rsomics-fastq-utils 0.1.0

FASTQ utility toolkit — lightweight subcommands for counting, filtering, converting, and inspecting FASTQ files
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::path::Path;

use rsomics_common::Result;
use rsomics_seqio::open_fastq;

pub fn count(input: &Path) -> Result<u64> {
    if std::fs::metadata(input).is_ok_and(|m| m.len() == 0) {
        return Ok(0);
    }
    let mut reader = open_fastq(input)?;
    let mut n: u64 = 0;
    for result in reader.by_ref() {
        result?;
        n += 1;
    }
    Ok(n)
}