Skip to content

Commit

Permalink
feat: Improve gene search for vcf-report (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
fxwiegand authored Dec 6, 2021
1 parent c7ec01e commit cbeaff5
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/bcf/report/oncoprint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1215,15 +1215,11 @@ fn make_prefixes(
rows_per_page: usize,
) -> HashMap<String, Vec<(&String, usize)>> {
let mut prefix_map = HashMap::new();
let prefix_len = 3;
for (i, partial_table) in genes.chunks(rows_per_page).enumerate() {
let page = i + 1;
for gene in partial_table {
if gene.len() >= prefix_len {
let prefix = gene.chars().take(prefix_len).collect::<String>();
let entry = prefix_map.entry(prefix).or_insert_with(Vec::new);
entry.push((gene.to_owned(), page));
}
let entry = prefix_map.entry(gene.to_string()).or_insert_with(Vec::new);
entry.push((gene.to_owned(), page));
}
}
prefix_map
Expand Down

0 comments on commit cbeaff5

Please sign in to comment.