pub fn find_link(&self, kmer: K, dir: Dir) -> Option<(usize, Dir, bool)> {
        // Only test self-consistent paths through
        // the edges
        // Avoids problems due to single kmer edges
        // (dir, next_side_incoming, rc)
        // (Dir::Left, Dir::Right, false) => true,
        // (Dir::Left, Dir::Left,  true) => true,
        // (Dir::Right, Dir::Left, false) => true,
        // (Dir::Right, Dir::Right, true) => true,

        let rc = kmer.rc();

        match dir {
            Dir::Left => {
                match self.search_kmer(kmer, Dir::Right) {
                    Some(idx) => return Some((idx, Dir::Right, false)),
                    _ => (),
                }

                if !self.base.stranded {
                    match self.search_kmer(rc, Dir::Left) {
                        Some(idx) => return Some((idx, Dir::Left, true)),
                        _ => (),
                    }
                }
            }

            Dir::Right => {
                match self.search_kmer(kmer, Dir::Left) {
                    Some(idx) => return Some((idx, Dir::Left, false)),
                    _ => (),
                }

                if !self.base.stranded {
                    match self.search_kmer(rc, Dir::Right) {
                        Some(idx) => return Some((idx, Dir::Right, true)),
                        _ => (),
                    }
                }
            }
        }

        return None;
    }
/// Find a link in the graph, possibly handling a RC switch.
Find a link in the graph, possibly handling a RC switch.
Find a link in the graph possibly handling a RC switch .
pub fn find_link(&self, kmer: K, dir: Dir) -> Option<(usize, Dir, bool)> {
        // Only test self-consistent paths through
        // the edges
        // Avoids problems due to single kmer edges
        // (dir, next_side_incoming, rc)
        // (Dir::Left, Dir::Right, false) => true,
        // (Dir::Left, Dir::Left,  true) => true,
        // (Dir::Right, Dir::Left, false) => true,
        // (Dir::Right, Dir::Right, true) => true,
        let rc = kmer.rc();
        match dir {
            Dir::Left => {
                match self.search_kmer(kmer, Dir::Right) {
                    Some(idx) => return Some((idx, Dir::Right, false)),
                    _ => (),
                }
                if !self.base.stranded {
                    match self.search_kmer(rc, Dir::Left) {
                        Some(idx) => return Some((idx, Dir::Left, true)),
                        _ => (),
                    }
                }
            }
            Dir::Right => {
                match self.search_kmer(kmer, Dir::Left) {
                    Some(idx) => return Some((idx, Dir::Left, false)),
                    _ => (),
                }
                if !self.base.stranded {
                    match self.search_kmer(rc, Dir::Right) {
                        Some(idx) => return Some((idx, Dir::Right, true)),
                        _ => (),
                    }
                }
            }
        }
        return None;
    }
pub fn find_link ( & self , kmer : K , dir : Dir ) -> Option < ( usize , Dir , bool ) > { // Only test self-consistent paths through // the edges // Avoids problems due to single kmer edges // (dir, next_side_incoming, rc) // (Dir::Left, Dir::Right, false) => true, // (Dir::Left, Dir::Left,  true) => true, // (Dir::Right, Dir::Left, false) => true, // (Dir::Right, Dir::Right, true) => true, let rc = kmer . rc ( ) ; match dir { Dir :: Left => { match self . search_kmer ( kmer , Dir :: Right ) { Some ( idx ) => return Some ( ( idx , Dir :: Right , false ) ) , _ => ( ) , } if ! self . base . stranded { match self . search_kmer ( rc , Dir :: Left ) { Some ( idx ) => return Some ( ( idx , Dir :: Left , true ) ) , _ => ( ) , } } } Dir :: Right => { match self . search_kmer ( kmer , Dir :: Left ) { Some ( idx ) => return Some ( ( idx , Dir :: Left , false ) ) , _ => ( ) , } if ! self . base . stranded { match self . search_kmer ( rc , Dir :: Right ) { Some ( idx ) => return Some ( ( idx , Dir :: Right , true ) ) , _ => ( ) , } } } } return None ; }
Find a link in the graph, possibly handling a RC switch.
Find a link in the graph possibly handling a RC switch .
&self
kmer
K
dir
Dir
&self
kmer
K
dir
Dir