/// Translates all requested genes
///
/// NOTE: we handle translation errors as warnings, so we return a collection of `Results` as is, to handle elsewhere
Translates all requested genes
NOTE: we handle translation errors as warnings, so we return a collection of `Results` as is, to handle elsewhere
Translates all requested genes NOTE : we handle translation errors as warnings so we return a collection of ` Results ` as is to handle elsewhere
pub fn translate_genes(
  qry_seq: &[Nuc],
  ref_seq: &[Nuc],
  ref_peptides: &TranslationMap,
  gene_map: &GeneMap,
  gap_open_close_aa: &[i32],
  params: &AlignPairwiseParams,
) -> Result<IndexMap<String, Result<Translation, Report>>, Report> {
  let coord_map = CoordMap::new(ref_seq);
  gene_map
    .iter()
    .map(
      |(gene_name, gene)| -> Result<(String, Result<Translation, Report>), Report> {
        let ref_peptide = ref_peptides.get(&gene.gene_name).ok_or(make_internal_report!(
          "Reference peptide not found for gene {}",
          &gene.gene_name
        ))?;
        let res = translate_gene(
          qry_seq,
          ref_seq,
          gene,
          ref_peptide,
          gap_open_close_aa,
          &coord_map,
          params,
        );
        Ok((gene_name.clone(), res))
      },
    )
    .collect::<Result<IndexMap<String, Result<Translation, Report>>, Report>>()
}
pub fn translate_genes ( qry_seq : & [ Nuc ] , ref_seq : & [ Nuc ] , ref_peptides : & TranslationMap , gene_map : & GeneMap , gap_open_close_aa : & [ i32 ] , params : & AlignPairwiseParams , ) -> Result < IndexMap < String , Result < Translation , Report > > , Report > { let coord_map = CoordMap :: new ( ref_seq ) ; gene_map . iter ( ) . map ( | ( gene_name , gene ) | -> Result < ( String , Result < Translation , Report > ) , Report > { let ref_peptide = ref_peptides . get ( & gene . gene_name ) . ok_or ( make_internal_report ! ( " " gene gene_name ) ) ? ; let res = translate_gene ( qry_seq , ref_seq , gene , ref_peptide , gap_open_close_aa , & coord_map , params , ) ; Ok ( ( gene_name . clone ( ) , res ) ) } , ) . collect :: < Result < IndexMap < String , Result < Translation , Report > > , Report > > ( ) }
Translates all requested genes
NOTE: we handle translation errors as warnings, so we return a collection of `Results` as is, to handle elsewhere
Translates all requested genes NOTE : we handle translation errors as warnings so we return a collection of ` Results ` as is to handle elsewhere
qry_seq
&[Nuc]
ref_seq
&[Nuc]
ref_peptides
&TranslationMap
gene_map
&GeneMap
gap_open_close_aa
&[i32]
params
&AlignPairwiseParams