fn compress_graph(
        stranded: bool,
        compression: &S,
        mut old_graph: DebruijnGraph<K, D>,
        censor_nodes: Option<Vec<usize>>,
    ) -> DebruijnGraph<K, D> {
        let n_nodes = old_graph.len();
        let mut available_nodes = BitSet::with_capacity(n_nodes);
        for i in 0..n_nodes {
            available_nodes.insert(i);
        }

        match censor_nodes {
            Some(c) => {
                for censor in c {
                    available_nodes.remove(censor);
                }
            }
            None => (),
        }

        old_graph.fix_exts(Some(&available_nodes));

        let mut comp = CompressFromGraph {
            spec: compression,
            stranded: stranded,
            graph: &old_graph,
            available_nodes: available_nodes,
            d: PhantomData,
        };

        // FIXME -- clarify requirements around state of extensions
        let mut graph = BaseGraph::new(stranded);

        for node_counter in 0..n_nodes {
            if comp.available_nodes.contains(node_counter) {
                let (seq, exts, _, data) = comp.build_node(node_counter);
                graph.add(&seq, exts, data);
            }
        }

        // We will have some hanging exts due to
        let mut dbg = graph.finish();
        dbg.fix_exts(None);
        debug_assert!(dbg.is_compressed(compression) == None);
        dbg
    }
/// Simplify a compressed Debruijn graph by merging adjacent unbranched nodes, and optionally
/// censoring some nodes
Simplify a compressed Debruijn graph by merging adjacent unbranched nodes, and optionally
censoring some nodes
Simplify a compressed Debruijn graph by merging adjacent unbranched nodes and optionally censoring some nodes
fn compress_graph(
        stranded: bool,
        compression: &S,
        mut old_graph: DebruijnGraph<K, D>,
        censor_nodes: Option<Vec<usize>>,
    ) -> DebruijnGraph<K, D> {
        let n_nodes = old_graph.len();
        let mut available_nodes = BitSet::with_capacity(n_nodes);
        for i in 0..n_nodes {
            available_nodes.insert(i);
        }
        match censor_nodes {
            Some(c) => {
                for censor in c {
                    available_nodes.remove(censor);
                }
            }
            None => (),
        }
        old_graph.fix_exts(Some(&available_nodes));
        let mut comp = CompressFromGraph {
            spec: compression,
            stranded: stranded,
            graph: &old_graph,
            available_nodes: available_nodes,
            d: PhantomData,
        };
        // FIXME -- clarify requirements around state of extensions
        let mut graph = BaseGraph::new(stranded);
        for node_counter in 0..n_nodes {
            if comp.available_nodes.contains(node_counter) {
                let (seq, exts, _, data) = comp.build_node(node_counter);
                graph.add(&seq, exts, data);
            }
        }
        // We will have some hanging exts due to
        let mut dbg = graph.finish();
        dbg.fix_exts(None);
        debug_assert!(dbg.is_compressed(compression) == None);
        dbg
    }
fn compress_graph ( stranded : bool , compression : & S , mut old_graph : DebruijnGraph < K , D > , censor_nodes : Option < Vec < usize > > , ) -> DebruijnGraph < K , D > { let n_nodes = old_graph . len ( ) ; let mut available_nodes = BitSet :: with_capacity ( n_nodes ) ; for i in 0 .. n_nodes { available_nodes . insert ( i ) ; } match censor_nodes { Some ( c ) => { for censor in c { available_nodes . remove ( censor ) ; } } None => ( ) , } old_graph . fix_exts ( Some ( & available_nodes ) ) ; let mut comp = CompressFromGraph { spec : compression , stranded : stranded , graph : & old_graph , available_nodes : available_nodes , d : PhantomData , } ; // FIXME -- clarify requirements around state of extensions let mut graph = BaseGraph :: new ( stranded ) ; for node_counter in 0 .. n_nodes { if comp . available_nodes . contains ( node_counter ) { let ( seq , exts , _ , data ) = comp . build_node ( node_counter ) ; graph . add ( & seq , exts , data ) ; } } // We will have some hanging exts due to let mut dbg = graph . finish ( ) ; dbg . fix_exts ( None ) ; debug_assert ! ( dbg is_compressed ( compression ) None ) ; dbg }
Simplify a compressed Debruijn graph by merging adjacent unbranched nodes, and optionally
censoring some nodes
Simplify a compressed Debruijn graph by merging adjacent unbranched nodes and optionally censoring some nodes
stranded
bool
compression
&S
old_graph
DebruijnGraph<K, D>
censor_nodes
Option<Vec<usize>>
stranded
bool
compression
&S
old_graph
DebruijnGraph<K, D>
censor_nodes
Option<Vec<usize>>