Skip to content

Commit

Permalink
fixing the term mininum quality to the more appropriate maximum base …
Browse files Browse the repository at this point in the history
…error rate
  • Loading branch information
jeffersonfparil committed Nov 13, 2023
1 parent 72ac003 commit 9d79e43
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/base/pileup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ impl Filter for PileupLine {
return Err(Error::new(ErrorKind::Other, "Phred score out of bounds."));
} else {
let q = f64::powf(10.0, -(self.read_qualities[i][j] as f64 - 33.0) / 10.0);
if q > filter_stats.min_quality {
if q > filter_stats.max_bases_error_rate {
self.read_codes[i][j] = 78; // convert to N
}
if filter_stats.remove_ns & (self.read_codes[i][j] == 78) {
Expand Down Expand Up @@ -538,7 +538,7 @@ mod tests {
let frequencies = *(pileup_line.to_frequencies().unwrap());
let filter_stats = FilterStats {
remove_ns: true,
min_quality: 0.005,
max_bases_error_rate: 0.005,
min_coverage: 1,
min_allele_frequency: 0.0,
max_missingness_rate: 0.0,
Expand Down
2 changes: 1 addition & 1 deletion src/base/structs_and_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub struct FileSyncPhen {
#[derive(Debug, Clone)]
pub struct FilterStats {
pub remove_ns: bool,
pub min_quality: f64,
pub max_bases_error_rate: f64,
pub min_coverage: u64,
pub min_allele_frequency: f64,
pub max_missingness_rate: f64,
Expand Down
4 changes: 2 additions & 2 deletions src/base/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,7 @@ mod tests {
let frequencies = *(counts.to_frequencies().unwrap());
let filter_stats = FilterStats {
remove_ns: true,
min_quality: 0.005,
max_bases_error_rate: 0.005,
min_coverage: 1,
min_allele_frequency: 0.005,
max_missingness_rate: 0.0,
Expand Down Expand Up @@ -1675,7 +1675,7 @@ mod tests {
// let phen = file_phen.lparse().unwrap();
// let filter_stats = FilterStats {
// remove_ns: true,
// min_quality: 0.005,
// max_bases_error_rate: 0.005,
// min_coverage: 0,
// min_allele_frequency: 0.0001,
// max_missingness_rate: 0.2,
Expand Down
4 changes: 2 additions & 2 deletions src/base/vcf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,15 +509,15 @@ mod tests {
);
let filter_stats_1 = FilterStats {
remove_ns: true,
min_quality: 0.005,
max_bases_error_rate: 0.005,
min_coverage: 1,
min_allele_frequency: 0.0,
max_missingness_rate: 0.0,
pool_sizes: vec![0.2; 10],
};
let filter_stats_2 = FilterStats {
remove_ns: true,
min_quality: 0.005,
max_bases_error_rate: 0.005,
min_coverage: 10,
min_allele_frequency: 0.0,
max_missingness_rate: 0.0,
Expand Down
2 changes: 1 addition & 1 deletion src/gp/cv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ mod tests {
let n_threads = 2;
let filter_stats = FilterStats {
remove_ns: true,
min_quality: 0.005,
max_bases_error_rate: 0.005,
min_coverage: 1,
min_allele_frequency: 0.005,
max_missingness_rate: 0.0,
Expand Down
2 changes: 1 addition & 1 deletion src/gwas/correlation_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ mod tests {
Array2::from_shape_vec((5, 2), vec![1, 9, 2, 8, 3, 7, 4, 6, 5, 5]).unwrap();
let filter_stats = FilterStats {
remove_ns: true,
min_quality: 0.005,
max_bases_error_rate: 0.005,
min_coverage: 1,
min_allele_frequency: 0.005,
max_missingness_rate: 0.0,
Expand Down
2 changes: 1 addition & 1 deletion src/gwas/gwalpha.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ mod tests {
.reversed_axes();
let filter_stats = FilterStats {
remove_ns: true,
min_quality: 0.005,
max_bases_error_rate: 0.005,
min_coverage: 1,
min_allele_frequency: 0.005,
max_missingness_rate: 0.0,
Expand Down
2 changes: 1 addition & 1 deletion src/gwas/ols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ mod tests {
// .unwrap();
// let filter_stats = FilterStats {
// remove_ns: true,
// min_quality: 0.005,
// max_bases_error_rate: 0.005,
// min_coverage: 1,
// min_allele_frequency: 0.005,
// pool_sizes: vec![20.0, 20.0, 20.0, 20.0, 20.0],
Expand Down
2 changes: 1 addition & 1 deletion src/imputation/adaptive_ld_knn_imputation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ mod tests {
let file_sync_phen = *(file_sync, file_phen).lparse().unwrap();
let filter_stats = FilterStats {
remove_ns: true,
min_quality: 0.005,
max_bases_error_rate: 0.005,
min_coverage: 1,
min_allele_frequency: 0.005,
max_missingness_rate: 0.0,
Expand Down
2 changes: 1 addition & 1 deletion src/imputation/filtering_missing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ mod tests {
////////////////////////////////////////////////////////////////////////////////////////////////////////
let filter_stats = FilterStats {
remove_ns: false,
min_quality: 1.0,
max_bases_error_rate: 1.0,
min_coverage: 0,
min_allele_frequency: 0.000001,
max_missingness_rate: 0.0,
Expand Down
2 changes: 1 addition & 1 deletion src/imputation/mean_imputation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ mod tests {
let file_sync_phen = *(file_sync, file_phen).lparse().unwrap();
let filter_stats = FilterStats {
remove_ns: true,
min_quality: 0.005,
max_bases_error_rate: 0.005,
min_coverage: 1,
min_allele_frequency: 0.005,
max_missingness_rate: 0.0,
Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ struct Args {
/// Output filename
#[clap(short, long, default_value = "")]
output: String,
/// Minimum base quality in terms of base calling error rate, i.e. lower values means higher quality
/// Maximum base sequencing error rate
#[clap(long, default_value_t = 0.01)]
min_quality: f64,
max_bases_error_rate: f64,
/// Minimum depth of coverage (loci with at least one pool below this threshold will be omitted)
#[clap(long, default_value_t = 1)]
min_coverage: u64,
Expand Down Expand Up @@ -186,7 +186,7 @@ fn main() {
let phen = file_phen.lparse().unwrap();
let filter_stats = base::FilterStats {
remove_ns: !args.keep_ns,
min_quality: args.min_quality,
max_bases_error_rate: args.max_bases_error_rate,
min_coverage: args.min_coverage,
min_allele_frequency: args.min_allele_frequency,
max_missingness_rate: args.max_missingness_rate,
Expand Down
2 changes: 1 addition & 1 deletion src/popgen/gudmc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ mod tests {
let file_sync_phen = *(file_sync, file_phen).lparse().unwrap();
let filter_stats = FilterStats {
remove_ns: false,
min_quality: 0.01,
max_bases_error_rate: 0.01,
min_coverage: 1,
min_allele_frequency: 0.001,
max_missingness_rate: 0.0,
Expand Down
2 changes: 1 addition & 1 deletion src/tables/chisq_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ mod tests {
};
let filter_stats = FilterStats {
remove_ns: true,
min_quality: 0.01,
max_bases_error_rate: 0.01,
min_coverage: 1,
min_allele_frequency: 0.005,
max_missingness_rate: 0.0,
Expand Down
2 changes: 1 addition & 1 deletion src/tables/fisher_exact_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ mod tests {
Array2::from_shape_vec((3, 2), vec![0, 3, 1, 5, 2, 6]).unwrap();
let filter_stats = FilterStats {
remove_ns: true,
min_quality: 0.005,
max_bases_error_rate: 0.005,
min_coverage: 1,
min_allele_frequency: 0.005,
max_missingness_rate: 0.0,
Expand Down

0 comments on commit 9d79e43

Please sign in to comment.