Skip to content

Commit 2e748e0

Browse files
authored
Refactor bin_id extraction logic
Refactor bin_id handling to strip file extensions.
1 parent 6afdb70 commit 2e748e0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/assess.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,14 @@ pub fn parse_bins_quality(
7676
error!("Skipping invalid record: {:?}", record);
7777
continue; // Skip records that do not have enough columns
7878
}
79-
let bin_id: String = record[0].to_string();
79+
// let bin_id: String = record[0].to_string();
80+
let mut bin_id: String = record[0].to_string();
81+
for ext in [".fasta", ".faa", ".fna", ".fa", ".fas", ".ffn"] {
82+
if let Some(stripped) = bin_id.strip_suffix(ext) {
83+
bin_id = stripped.to_string();
84+
break;
85+
}
86+
}
8087
let completeness: f64 = record[1].parse().unwrap_or(0.0);
8188
let contamination: f64 = record[2].parse().unwrap_or(0.0);
8289
bin_qualities.insert(bin_id,
@@ -124,4 +131,4 @@ pub fn check_high_quality_bin(
124131
return true;
125132
}
126133
false
127-
}
134+
}

0 commit comments

Comments
 (0)