Skip to content

Commit

Permalink
Merge pull request #75 from bacpop/Adding_max_frequence_reads_parameter
Browse files Browse the repository at this point in the history
Simplified proportion reads computation
  • Loading branch information
johnlees authored May 28, 2024
2 parents e849f71 + 12f9703 commit 3a881c6
Showing 1 changed file with 1 addition and 13 deletions.
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

0 comments on commit 3a881c6

Please sign in to comment.