Skip to content

Commit

Permalink
Revert "Revert "Handle wrapped fastq files (rust-bio#255)" (rust-bio#260
Browse files Browse the repository at this point in the history
)"

This reverts commit 8a97498.
  • Loading branch information
johanneskoester authored and TianyiShi2001 committed Sep 3, 2020
1 parent 4ad78c9 commit cc55701
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions src/io/fastq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,14 @@
//! ```
//! use std::io;
//! use bio::io::fastq;
//! use bio::io::fastq::FastqRead;
//!
//! let mut reader = fastq::Reader::new(io::stdin());
//! let mut writer = fastq::Writer::new(io::stdout());
//! let mut record = fastq::Record::new();
//!
//! while let Ok(()) = reader.read(&mut record) {
//! if record.is_empty() {
//! let check = record.check();
//! break;
//! }
//!
//! let mut sum_qual = record.qual().iter().sum::<u8>() as f64;
//!
//! if (sum_qual / record.seq().len() as f64 - 33.0) > 30.0 {
//! writer.write_record(&record);
//! let reader = fastq::Reader::new(io::stdin());
//! let records = reader.records().map(|r| r.unwrap());
//! for record in records {
//! let check = record.check();
//! if check.is_err() {
//! panic!("I got a rubbish record!")
//! }
//! // your record is ok - do something with it...
//! }
//! ```

Expand Down Expand Up @@ -190,8 +181,8 @@ where
/// # Example
///
/// ```rust
/// use bio::io::fastq::{Reader, FastqRead};
/// use bio::io::fastq::Record;
/// use bio::io::fastq::{FastqRead, Reader};
/// const FASTQ_FILE: &'static [u8] = b"@id desc
/// AAAA
/// +
Expand Down Expand Up @@ -339,6 +330,7 @@ impl Record {
/// record = Record::with_attrs("id_str", Some("desc"), b"ATGCGGG", b"QQQQQQQ");
/// assert!(record.check().is_ok());
/// ```
///
pub fn check(&self) -> Result<(), &str> {
if self.id().is_empty() {
return Err("Expecting id for FastQ record.");
Expand Down

0 comments on commit cc55701

Please sign in to comment.