pub fn find_private_aa_mutations(
  node: &AuspiceTreeNode,
  aa_substitutions: &[AaSub],
  aa_deletions: &[AaDel],
  aa_unknowns: &[GeneAaRange],
  ref_peptides: &TranslationMap,
  gene_map: &GeneMap,
) -> BTreeMap<String, PrivateAaMutations> {
  gene_map
    .iter()
    .filter_map(|(gene, _)| match node.tmp.aa_mutations.get(gene) {
      //node.tmp contains mutations accumulated from root
      None => None,
      Some(node_mut_map) => {
        let ref_peptide = ref_peptides
          .get(gene)
          .ok_or(make_internal_report!("Reference peptide not found for gene '{gene}'"))
          .unwrap();

        let aa_substitutions = aa_substitutions.iter().filter(|sub| &sub.gene == gene).collect_vec();
        let aa_deletions = aa_deletions.iter().filter(|del| &del.gene == gene).collect_vec();
        let aa_unknowns = aa_unknowns.iter().filter(|unk| &unk.gene_name == gene).collect_vec();

        let private_aa_mutations = find_private_aa_mutations_for_one_gene(
          node_mut_map,
          &aa_substitutions,
          &aa_deletions,
          &aa_unknowns,
          &ref_peptide.seq,
        );

        Some((gene.clone(), private_aa_mutations))
      }
    })
    .collect()
}
/// Finds private aminoacid mutations.
///
/// For a simpler version with explanation see the sister function for nucleotide mutations
Finds private aminoacid mutations.
For a simpler version with explanation see the sister function for nucleotide mutations
Finds private aminoacid mutations . For a simpler version with explanation see the sister function for nucleotide mutations
pub fn find_private_aa_mutations(
  node: &AuspiceTreeNode,
  aa_substitutions: &[AaSub],
  aa_deletions: &[AaDel],
  aa_unknowns: &[GeneAaRange],
  ref_peptides: &TranslationMap,
  gene_map: &GeneMap,
) -> BTreeMap<String, PrivateAaMutations> {
  gene_map
    .iter()
    .filter_map(|(gene, _)| match node.tmp.aa_mutations.get(gene) {
      //node.tmp contains mutations accumulated from root
      None => None,
      Some(node_mut_map) => {
        let ref_peptide = ref_peptides
          .get(gene)
          .ok_or(make_internal_report!("Reference peptide not found for gene '{gene}'"))
          .unwrap();
        let aa_substitutions = aa_substitutions.iter().filter(|sub| &sub.gene == gene).collect_vec();
        let aa_deletions = aa_deletions.iter().filter(|del| &del.gene == gene).collect_vec();
        let aa_unknowns = aa_unknowns.iter().filter(|unk| &unk.gene_name == gene).collect_vec();
        let private_aa_mutations = find_private_aa_mutations_for_one_gene(
          node_mut_map,
          &aa_substitutions,
          &aa_deletions,
          &aa_unknowns,
          &ref_peptide.seq,
        );
        Some((gene.clone(), private_aa_mutations))
      }
    })
    .collect()
}
pub fn find_private_aa_mutations ( node : & AuspiceTreeNode , aa_substitutions : & [ AaSub ] , aa_deletions : & [ AaDel ] , aa_unknowns : & [ GeneAaRange ] , ref_peptides : & TranslationMap , gene_map : & GeneMap , ) -> BTreeMap < String , PrivateAaMutations > { gene_map . iter ( ) . filter_map ( | ( gene , _ ) | match node . tmp . aa_mutations . get ( gene ) { //node.tmp contains mutations accumulated from root None => None , Some ( node_mut_map ) => { let ref_peptide = ref_peptides . get ( gene ) . ok_or ( make_internal_report ! ( " " ) ) . unwrap ( ) ; let aa_substitutions = aa_substitutions . iter ( ) . filter ( | sub | & sub . gene == gene ) . collect_vec ( ) ; let aa_deletions = aa_deletions . iter ( ) . filter ( | del | & del . gene == gene ) . collect_vec ( ) ; let aa_unknowns = aa_unknowns . iter ( ) . filter ( | unk | & unk . gene_name == gene ) . collect_vec ( ) ; let private_aa_mutations = find_private_aa_mutations_for_one_gene ( node_mut_map , & aa_substitutions , & aa_deletions , & aa_unknowns , & ref_peptide . seq , ) ; Some ( ( gene . clone ( ) , private_aa_mutations ) ) } } ) . collect ( ) }
Finds private aminoacid mutations.
Finds private aminoacid mutations .
node
&AuspiceTreeNode
aa_substitutions
&[AaSub]
aa_deletions
&[AaDel]
aa_unknowns
&[GeneAaRange]
ref_peptides
&TranslationMap
gene_map
&GeneMap
node
&AuspiceTreeNode
aa_substitutions
&[AaSub]
aa_deletions
&[AaDel]
aa_unknowns
&[GeneAaRange]
ref_peptides
&TranslationMap
gene_map
&GeneMap