// If `pickup_new_runs` is true we pick up runs starting at this supernode static inline bool gcrawler_stop_at_ref_covg(const GraphCache *cache, const GCacheStep *step, BreakpointCaller *caller, KOccurRunBuffer *koruns, KOccurRunBuffer *koruns_ended, bool pickup_new_runs) { GCacheSnode *snode = graph_cache_snode(cache, step->supernode); GCachePath *path = graph_cache_path(cache, step->pathid); const dBNode *nodes = graph_cache_first_node(cache, snode); bool forward = (step->orient == FORWARD); // Use index of last step as qoffset size_t qoffset = path->num_steps-1; // Kmer occurance runs are added to koruns_3p_ended only if they end and are // longer than the mininum length in kmers (caller->min_ref_nkmers) kograph_filter_extend(caller->kograph, nodes, snode->num_nodes, forward, caller->min_ref_nkmers, qoffset, koruns, koruns_ended, pickup_new_runs); size_t i, min_run_qoffset = SIZE_MAX, min_ended_run_qoffset = SIZE_MAX; for(i = 0; i < koruns->len; i++) min_run_qoffset = MIN2(min_run_qoffset, koruns->data[i].qoffset); // Stop if all our earliest runs have finished for(i = 0; i < koruns_ended->len; i++) { min_ended_run_qoffset = MIN2(min_ended_run_qoffset, koruns_ended->data[i].qoffset); } // Continue if... return min_run_qoffset <= min_ended_run_qoffset; }
static inline void walk_supernode_end(const GraphCache *cache, const GCacheSnode *snode, Orientation snorient, GraphWalker *wlk) { // Only need to traverse the first and last nodes of a supernode const dBNode *first = graph_cache_first_node(cache, snode); const dBNode *last = graph_cache_last_node(cache, snode); dBNode lastnode; size_t num_nodes = last - first + 1; if(num_nodes > 1) { lastnode = (snorient == FORWARD ? *last : db_node_reverse(*first)); graph_walker_jump_along_snode(wlk, lastnode, num_nodes); } }
void graph_crawler_reset_rpt_walker(RepeatWalker *rptwlk, const GraphCache *cache, uint32_t pathid) { rpt_walker_fast_clear(rptwlk, NULL, 0); const GCachePath *path = graph_cache_path(cache, pathid); const GCacheStep *step = graph_cache_step(cache, path->first_step), *endstep; const GCacheSnode *snode; const dBNode *node0, *node1; // Loop over supernodes in the path for(endstep = step + path->num_steps; step < endstep; step++) { // We don't care about orientation here snode = graph_cache_snode(cache, step->supernode); node0 = graph_cache_first_node(cache, snode); node1 = graph_cache_last_node(cache, snode); rpt_walker_fast_clear_single_node(rptwlk, *node0); rpt_walker_fast_clear_single_node(rptwlk, *node1); } }