/// Makes the "alignment to reference" coordinate map: from alignment coordinates to reference coordinates.
/// Given a position of a letter in the aligned sequence, the "alignment to reference" coordinate map allows to
/// lookup the position of the corresponding letter in the reference sequence.
Makes the "alignment to reference" coordinate map: from alignment coordinates to reference coordinates.
Given a position of a letter in the aligned sequence, the "alignment to reference" coordinate map allows to
lookup the position of the corresponding letter in the reference sequence.
Makes the " alignment to reference " coordinate map : from alignment coordinates to reference coordinates . Given a position of a letter in the aligned sequence the " alignment to reference " coordinate map allows to lookup the position of the corresponding letter in the reference sequence .
fn make_aln_to_ref_map(ref_seq: &[Nuc]) -> Vec<usize> {
  let mut rev_coord_map = Vec::<usize>::with_capacity(ref_seq.len());
  let mut ref_pos = 0;
  for nuc in ref_seq {
    if nuc.is_gap() {
      if rev_coord_map.is_empty() {
        rev_coord_map.push(0);
      } else {
        let prev = *(rev_coord_map.last().unwrap());
        rev_coord_map.push(prev);
      }
    } else {
      rev_coord_map.push(ref_pos);
      ref_pos += 1;
    }
  }
  rev_coord_map.shrink_to_fit();
  rev_coord_map
}
fn make_aln_to_ref_map ( ref_seq : & [ Nuc ] ) -> Vec < usize > { let mut rev_coord_map = Vec :: < usize > :: with_capacity ( ref_seq . len ( ) ) ; let mut ref_pos = 0 ; for nuc in ref_seq { if nuc . is_gap ( ) { if rev_coord_map . is_empty ( ) { rev_coord_map . push ( 0 ) ; } else { let prev = * ( rev_coord_map . last ( ) . unwrap ( ) ) ; rev_coord_map . push ( prev ) ; } } else { rev_coord_map . push ( ref_pos ) ; ref_pos += 1 ; } } rev_coord_map . shrink_to_fit ( ) ; rev_coord_map }
Makes the "alignment to reference" coordinate map: from alignment coordinates to reference coordinates.
Makes the " alignment to reference " coordinate map : from alignment coordinates to reference coordinates .
ref_seq
&[Nuc]