Skip to content

Commit

Permalink
Simplify fastq bufreader use
Browse files Browse the repository at this point in the history
  • Loading branch information
GarrettNg authored and nvictus committed Dec 14, 2023
1 parent 0a4f49b commit add4e00
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions oxbow/src/fastq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,27 @@ use arrow::{error::ArrowError, record_batch::RecordBatch};
use noodles::fastq;
use std::{
fs::File,
io::{self, BufReader, Read, Seek},
io::{self, BufReader, Read},
str,
sync::Arc,
};

use crate::batch_builder::{write_ipc, BatchBuilder};

pub struct FastqReader<R> {
reader: fastq::Reader<BufReader<R>>,
reader: fastq::Reader<R>,
}

impl FastqReader<BufReader<File>> {
pub fn new_from_path(path: &str) -> io::Result<Self> {
let reader = File::open(path)
.map(BufReader::new)
.map(BufReader::new)
.map(fastq::Reader::new)?;
Ok(Self { reader })
}
}

impl<R: Read + Seek> FastqReader<R> {
impl<R: Read> FastqReader<BufReader<R>> {
pub fn new(read: R) -> io::Result<Self> {
let reader = fastq::Reader::new(BufReader::new(read));
Ok(Self { reader })
Expand Down

0 comments on commit add4e00

Please sign in to comment.