Skip to content

Commit

Permalink
Clean up some of the filter logging messages
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlees committed Oct 16, 2023
1 parent 8840bcc commit deb514e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/generic_modes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ pub fn weed<IntT: for<'a> UInt<'a>>(
}

let filter_threshold = f64::floor(ska_array.nsamples() as f64 * min_freq) as usize;
if filter_threshold > 0 || *filter != FilterType::NoFilter || ambig_mask {
if filter_threshold > 0 || *filter != FilterType::NoFilter || ambig_mask || ignore_const_gaps {
log::info!("Applying filters: threshold={filter_threshold} constant_site_filter={filter} ambig_mask={ambig_mask} no_gap_only_sites={ignore_const_gaps}");
let update_kmers = true;
ska_array.filter(
Expand Down
5 changes: 4 additions & 1 deletion src/merge_ska_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ where

/// Load a split k-mer array from a `.skf` file.
pub fn load(filename: &str) -> Result<Self, Box<dyn Error>> {
log::info!("Loading skf file");
let ska_file = BufReader::new(File::open(filename)?);
let decompress_reader = snap::read::FrameDecoder::new(ska_file);
let ska_obj: Self = ciborium::de::from_reader(decompress_reader)?;
Expand Down Expand Up @@ -251,6 +250,10 @@ where
ignore_const_gaps: bool,
update_kmers: bool,
) -> i32 {
if ignore_const_gaps && matches!(filter, FilterType::NoAmbig | FilterType::NoFilter) {
log::warn!("--no-gap-only-sites can only be applied when filtering constant bases")
}

let total = self.names.len();
let mut filtered_variants = Array2::zeros((0, total));
let mut filtered_counts = Vec::new();
Expand Down
1 change: 1 addition & 0 deletions tests/align.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ fn filters() {
.arg(sandbox.file_string("merge_k9.skf", TestDir::Input))
.arg("--filter")
.arg("no-filter")
.arg("--no-gap-only-sites") // adding with no filter produces a warning
.arg("-v")
.output()
.unwrap()
Expand Down

0 comments on commit deb514e

Please sign in to comment.