pub fn alignment(&self) -> Alignment {
        let debug = false;

        let mut ops: Vec<AlignmentOperation> = vec![];
    
        // Now backtrack through the matrix to construct an optimal path
        let mut i;
        let mut j;

        // semiglobal
        let cands: Vec<NodeIndex<usize>> = self.poa.graph.node_indices().filter(|x| self.poa.graph.neighbors_directed(*x, Outgoing).count() == 0).collect();
        //println!("Cands {:?}, len {}", cands, cands.len());
        let max_cand = cands.iter().map(|cand| ((cand.index() + 1, self.traceback.cols), self.traceback.matrix[cand.index()+1][self.traceback.cols].score)).max_by(|a, b| a.1.partial_cmp(&b.1).unwrap()).unwrap();
        let i_0 = (max_cand.0).0;
        let j_0 = (max_cand.0).1;

        i = i_0;
        j = j_0;
        if debug{print!("traceback: ");}
        while i > 0 && j > 0 {
            // push operation and edge corresponding to (one of the) optimal
            // routes
            ops.push(self.traceback.matrix[i][j].op.clone());
            match self.traceback.matrix[i][j].op {
                AlignmentOperation::Match(Some((p, _))) => {
                    i = p + 1;
                    j -= 1;
                    if debug{print!("M");}
                }
                AlignmentOperation::Del(Some((p, _))) => {
                    i = p + 1;
                    if debug{print!("-");}
                }
                AlignmentOperation::Ins(Some(p)) => {
                    i = p + 1;
                    j -= 1; 
                    if debug{print!("I");}
                }
                AlignmentOperation::Match(None) => {
                    if debug{print!("m");}
                    j -= 1; //?
                    break;
                }
                AlignmentOperation::Del(None) => {
                    if debug{print!("d");}
                    break; //semiglobal can end anywhere in the first column
                    //j -= 1;
                }
                AlignmentOperation::Ins(None) => {
                    if debug{print!("i");}
                    i -= 1;
                    j -= 1; //?
                }
            }
        }
        if debug{println!();}

        ops.reverse();

        if debug{println!("ystart: {}",j);}
        Alignment {
            score: self.traceback.matrix[i_0][j_0].score,
            ystart: j,
            operations: ops,
        }
    }
/// Return alignment of last added query against the graph.
Return alignment of last added query against the graph.
Return alignment of last added query against the graph .
pub fn alignment(&self) -> Alignment {
        let debug = false;
        let mut ops: Vec<AlignmentOperation> = vec![];
        // Now backtrack through the matrix to construct an optimal path
        let mut i;
        let mut j;
        // semiglobal
        let cands: Vec<NodeIndex<usize>> = self.poa.graph.node_indices().filter(|x| self.poa.graph.neighbors_directed(*x, Outgoing).count() == 0).collect();
        //println!("Cands {:?}, len {}", cands, cands.len());
        let max_cand = cands.iter().map(|cand| ((cand.index() + 1, self.traceback.cols), self.traceback.matrix[cand.index()+1][self.traceback.cols].score)).max_by(|a, b| a.1.partial_cmp(&b.1).unwrap()).unwrap();
        let i_0 = (max_cand.0).0;
        let j_0 = (max_cand.0).1;
        i = i_0;
        j = j_0;
        if debug{print!("traceback: ");}
        while i > 0 && j > 0 {
            // push operation and edge corresponding to (one of the) optimal
            // routes
            ops.push(self.traceback.matrix[i][j].op.clone());
            match self.traceback.matrix[i][j].op {
                AlignmentOperation::Match(Some((p, _))) => {
                    i = p + 1;
                    j -= 1;
                    if debug{print!("M");}
                }
                AlignmentOperation::Del(Some((p, _))) => {
                    i = p + 1;
                    if debug{print!("-");}
                }
                AlignmentOperation::Ins(Some(p)) => {
                    i = p + 1;
                    j -= 1; 
                    if debug{print!("I");}
                }
                AlignmentOperation::Match(None) => {
                    if debug{print!("m");}
                    j -= 1; //?
                    break;
                }
                AlignmentOperation::Del(None) => {
                    if debug{print!("d");}
                    break; //semiglobal can end anywhere in the first column
                    //j -= 1;
                }
                AlignmentOperation::Ins(None) => {
                    if debug{print!("i");}
                    i -= 1;
                    j -= 1; //?
                }
            }
        }
        if debug{println!();}
        ops.reverse();
        if debug{println!("ystart: {}",j);}
        Alignment {
            score: self.traceback.matrix[i_0][j_0].score,
            ystart: j,
            operations: ops,
        }
    }
pub fn alignment ( & self ) -> Alignment { let debug = false ; let mut ops : Vec < AlignmentOperation > = vec ! [ ] ; // Now backtrack through the matrix to construct an optimal path let mut i ; let mut j ; // semiglobal let cands : Vec < NodeIndex < usize > > = self . poa . graph . node_indices ( ) . filter ( | x | self . poa . graph . neighbors_directed ( * x , Outgoing ) . count ( ) == 0 ) . collect ( ) ; //println!("Cands {:?}, len {}", cands, cands.len()); let max_cand = cands . iter ( ) . map ( | cand | ( ( cand . index ( ) + 1 , self . traceback . cols ) , self . traceback . matrix [ cand . index ( ) + 1 ] [ self . traceback . cols ] . score ) ) . max_by ( | a , b | a . 1 . partial_cmp ( & b . 1 ) . unwrap ( ) ) . unwrap ( ) ; let i_0 = ( max_cand . 0 ) . 0 ; let j_0 = ( max_cand . 0 ) . 1 ; i = i_0 ; j = j_0 ; if debug { print ! ( " " ) ; } while i > 0 && j > 0 { // push operation and edge corresponding to (one of the) optimal // routes ops . push ( self . traceback . matrix [ i ] [ j ] . op . clone ( ) ) ; match self . traceback . matrix [ i ] [ j ] . op { AlignmentOperation :: Match ( Some ( ( p , _ ) ) ) => { i = p + 1 ; j -= 1 ; if debug { print ! ( " " ) ; } } AlignmentOperation :: Del ( Some ( ( p , _ ) ) ) => { i = p + 1 ; if debug { print ! ( " " ) ; } } AlignmentOperation :: Ins ( Some ( p ) ) => { i = p + 1 ; j -= 1 ; if debug { print ! ( " " ) ; } } AlignmentOperation :: Match ( None ) => { if debug { print ! ( " " ) ; } j -= 1 ; //? break ; } AlignmentOperation :: Del ( None ) => { if debug { print ! ( " " ) ; } break ; //semiglobal can end anywhere in the first column //j -= 1; } AlignmentOperation :: Ins ( None ) => { if debug { print ! ( " " ) ; } i -= 1 ; j -= 1 ; //? } } } if debug { println ! ( ) ; } ops . reverse ( ) ; if debug { println ! ( " " j ) ; } Alignment { score : self . traceback . matrix [ i_0 ] [ j_0 ] . score , ystart : j , operations : ops , } }
Return alignment of last added query against the graph.
Return alignment of last added query against the graph .
&self
&self