Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplified proportion reads computation #75

Merged
merged 2 commits into from
May 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions src/ska_dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,22 +104,10 @@ where
qual: &QualOpts,
proportion_reads: Option<f64>,
) {
// Going though the file once to count the number of reads
let mut reader =
parse_fastx_file(filename).unwrap_or_else(|_| panic!("Invalid path/file: {filename}"));

let mut step: usize = 1;

if proportion_reads.is_some() {
let mut nb_reads_total = 0;
while let Some(_record) = reader.next() {
nb_reads_total += 1;
}

let mut nb_reads = nb_reads_total;
nb_reads = (nb_reads as f64 * proportion_reads.unwrap()) as usize;

step = (nb_reads_total as f64 / nb_reads as f64).round() as usize;
step = (1.0 / proportion_reads.unwrap()).round() as usize;
}

let mut reader =
Expand Down
Loading