/// Finds contiguous ranges (segments) consisting of a given amino acid in the sequence.
Finds contiguous ranges (segments) consisting of a given amino acid in the sequence.
Finds contiguous ranges ( segments ) consisting of a given amino acid in the sequence .
pub fn find_aa_letter_ranges(translations: &[Translation], letter: Aa) -> Vec<GeneAaRange> {
  translations
    .iter()
    .filter_map(|Translation { gene_name, seq, .. }| {
      let ranges = find_letter_ranges_by(seq, |candidate| candidate == letter);
      let length = ranges.iter().map(LetterRange::len).sum();
      (length > 0).then(|| GeneAaRange {
        gene_name: gene_name.clone(),
        letter,
        ranges,
        length,
      })
    })
    .collect()
}
pub fn find_aa_letter_ranges ( translations : & [ Translation ] , letter : Aa ) -> Vec < GeneAaRange > { translations . iter ( ) . filter_map ( | Translation { gene_name , seq , .. } | { let ranges = find_letter_ranges_by ( seq , | candidate | candidate == letter ) ; let length = ranges . iter ( ) . map ( LetterRange :: len ) . sum ( ) ; ( length > 0 ) . then ( | | GeneAaRange { gene_name : gene_name . clone ( ) , letter , ranges , length , } ) } ) . collect ( ) }
Finds contiguous ranges (segments) consisting of a given amino acid in the sequence.
Finds contiguous ranges ( segments ) consisting of a given amino acid in the sequence .
translations
&[Translation]
letter
Aa