pub fn consensus_boundary(&mut self, cns : &[u64], cns_es: &[String], orig: &[u64], debug: bool)
        -> (Vec<u64>, Vec<String>)
    {
        let x = &orig[..];
        let y = & cns[..];
        let score = |a: u64, b: u64| if a == b {1i32} else {-1i32};
        let mut regular_aligner = pairwise::Aligner::with_capacity(x.len(), y.len(), -1, -1, &score);
        let alignment = regular_aligner.semiglobal(x, y);
        if alignment.yend - alignment.ystart < 2 { return (Vec::new(), Vec::new()); }
        let adjusted_cns = cns   [alignment.ystart..alignment.yend].to_vec();
        let adjusted_es  = cns_es[alignment.ystart..(alignment.yend-1)].to_vec();
        if debug
        {
            println!("alignment: {:?} (score: {})",alignment.operations, alignment.score);
            println!("consensus    : {:?}",pretty_minvec(cns));
            println!("orig template: {:?}",pretty_minvec(orig));
            println!("adjusted cns : {:?}",pretty_minvec(&adjusted_cns));
        }

        // TODO comment that part if the warning below is never printed

        let mut y_rev = cns.to_owned();
        y_rev.reverse();
        let rev_alignment = regular_aligner.semiglobal(x, &y_rev);
        if false // debug
        {
            println!("bwd alignment: {:?} (score: {})",rev_alignment.operations, alignment.score);
        }
        if rev_alignment.score > alignment.score
        {
            println!("WARNING! (rev alignment POA consensus score {} higher than fwd alignment {})", rev_alignment.score, alignment.score);
        }

        (adjusted_cns, adjusted_es)
    }
/// gets template boundary in consensus
/// Perform Smith-Waterman on the consensus with the original template
/// to determine the boundary of the template on the consensus
gets template boundary in consensus
Perform Smith-Waterman on the consensus with the original template
to determine the boundary of the template on the consensus
gets template boundary in consensus Perform Smith - Waterman on the consensus with the original template to determine the boundary of the template on the consensus
pub fn consensus_boundary(&mut self, cns : &[u64], cns_es: &[String], orig: &[u64], debug: bool)
        -> (Vec<u64>, Vec<String>)
    {
        let x = &orig[..];
        let y = & cns[..];
        let score = |a: u64, b: u64| if a == b {1i32} else {-1i32};
        let mut regular_aligner = pairwise::Aligner::with_capacity(x.len(), y.len(), -1, -1, &score);
        let alignment = regular_aligner.semiglobal(x, y);
        if alignment.yend - alignment.ystart < 2 { return (Vec::new(), Vec::new()); }
        let adjusted_cns = cns   [alignment.ystart..alignment.yend].to_vec();
        let adjusted_es  = cns_es[alignment.ystart..(alignment.yend-1)].to_vec();
        if debug
        {
            println!("alignment: {:?} (score: {})",alignment.operations, alignment.score);
            println!("consensus    : {:?}",pretty_minvec(cns));
            println!("orig template: {:?}",pretty_minvec(orig));
            println!("adjusted cns : {:?}",pretty_minvec(&adjusted_cns));
        }
        // TODO comment that part if the warning below is never printed
        let mut y_rev = cns.to_owned();
        y_rev.reverse();
        let rev_alignment = regular_aligner.semiglobal(x, &y_rev);
        if false // debug
        {
            println!("bwd alignment: {:?} (score: {})",rev_alignment.operations, alignment.score);
        }
        if rev_alignment.score > alignment.score
        {
            println!("WARNING! (rev alignment POA consensus score {} higher than fwd alignment {})", rev_alignment.score, alignment.score);
        }
        (adjusted_cns, adjusted_es)
    }
pub fn consensus_boundary ( & mut self , cns : & [ u64 ] , cns_es : & [ String ] , orig : & [ u64 ] , debug : bool ) -> ( Vec < u64 > , Vec < String > ) { let x = & orig [ .. ] ; let y = & cns [ .. ] ; let score = | a : u64 , b : u64 | if a == b { 1i32 } else { - 1i32 } ; let mut regular_aligner = pairwise :: Aligner :: with_capacity ( x . len ( ) , y . len ( ) , - 1 , - 1 , & score ) ; let alignment = regular_aligner . semiglobal ( x , y ) ; if alignment . yend - alignment . ystart < 2 { return ( Vec :: new ( ) , Vec :: new ( ) ) ; } let adjusted_cns = cns [ alignment . ystart .. alignment . yend ] . to_vec ( ) ; let adjusted_es = cns_es [ alignment . ystart .. ( alignment . yend - 1 ) ] . to_vec ( ) ; if debug { println ! ( " " alignment operations alignment score ) ; println ! ( " " pretty_minvec ( cns ) ) ; println ! ( " " pretty_minvec ( orig ) ) ; println ! ( " " pretty_minvec ( adjusted_cns ) ) ; } // TODO comment that part if the warning below is never printed let mut y_rev = cns . to_owned ( ) ; y_rev . reverse ( ) ; let rev_alignment = regular_aligner . semiglobal ( x , & y_rev ) ; if false // debug { println ! ( " " rev_alignment operations alignment score ) ; } if rev_alignment . score > alignment . score { println ! ( " " rev_alignment score alignment score ) ; } ( adjusted_cns , adjusted_es ) }
gets template boundary in consensus
Perform Smith-Waterman on the consensus with the original template
to determine the boundary of the template on the consensus
gets template boundary in consensus Perform Smith - Waterman on the consensus with the original template to determine the boundary of the template on the consensus
&mut self
cns
&[u64]
cns_es
&[String]
orig
&[u64]
debug
bool
&mut self
cns
&[u64]
cns_es
&[String]
orig
&[u64]
debug
bool