esteinig / nanoq

Minimal but speedy quality control for nanopore reads in Rust :bear:
MIT License
118 stars 10 forks source link

Implement proper writing with bio:: #5

Closed esteinig closed 4 years ago

esteinig commented 4 years ago

Implement proper record writer instead of println!

mbhall88 commented 4 years ago

No need. When the next release of rust-bio comes out you can directly write a record without needing to parse out the components as I implemented fmt::Display for fastq recently. An example of using this https://github.com/rust-bio/rust-bio/blob/ed797d7e2b4621d146c48c03a09d6ccd56e25311/src/io/fastq.rs#L486-L497

esteinig commented 4 years ago

I saw your contribution and the test - it looks neat! For some reason I went for the bio::io::fastq::Writer and record.write_record but would like to compare speed.

By the way there was a huge difference using f32 floats for the quality computation instead of f64 which about halved the runtime :astonished:

esteinig commented 4 years ago

You can try it out now, I think it's pretty fast using the binary with cargo build --release

esteinig commented 4 years ago

Closing for now, will reopen on next release of rust-bio to compare speed of fmt::Display

mbhall88 commented 4 years ago

I think you're correct in using the fastq::Writer API. Using the Display trait with the write! macro directly is effectively doing the same thing. Using the API makes it much cleaner and likely more flexible to future changes.