Closed colindaven closed 3 years ago
It returns a byte slice. Use https://doc.rust-lang.org/std/str/fn.from_utf8.html if you want to print the actual string.
Excellent, thanks. For others:
while let Some(record) = reader.next() {
let seqrec = record.expect("invalid record");
// demultiplex
// get sequence
let sequenceBytes = seqrec.normalize(false);
let sequenceText = str::from_utf8(&sequenceBytes).unwrap();
println!("Seq: {} ", &sequenceText);
}
I'm writing a very simple demultiplexer (based on custom barcodes, first 8chars of the read) but am struggling to get the sequence out.
I've tried
yet only get numbers, not sequence (here FASTQ, ATGCN expected) out.
Results in
Seq: [71, 65, 84, 65, 84, 84, 67, 65, 65, 65, 84, 65, 65, 67, 67, 67, 84, 71, 65, 65, 65, 67, 65, 65, 65, 84, 71, 67, 84, 84, 65, 71, 71, 71, 65, 84, 84, 84, 84, 65, 84, 84, 71, 71, 84, 65, 84, 67, 65, 71, 71, 71, 84, 84, 65, 65, 84, 67, 71, 84, 71, 67, 67, 65, 65, 71, 65, 65, 65, 65, 71, 67, 71, 71, 67, 65, 84, 71, 71, 84, 67, 65, 65, 84, 65, 84, 65, 65, 67, 67, 65, 71]
The FASTQ looks ok
What am I missing? Thanks