// `nbuf` and `sbuf` are temporary variables used by this function static void _call_bubble(BubbleCaller *caller, const char *flank5p, const char *flank3p, const char **alleles, size_t num_alleles, dBNodeBuffer *nbuf, StrBuf *sbuf) { const dBGraph *graph = caller->db_graph; const size_t kmer_size = graph->kmer_size; dBNode node5p = db_graph_find_str(graph, flank5p+strlen(flank5p)-kmer_size); dBNode node3p = db_graph_find_str(graph, flank3p); TASSERT(node5p.key != HASH_NOT_FOUND); TASSERT(node3p.key != HASH_NOT_FOUND); Edges edges5p = db_node_get_edges_union(graph, node5p.key); Edges edges3p = db_node_get_edges_union(graph, node3p.key); TASSERT(edges_get_outdegree(edges5p, node5p.orient) > 1); TASSERT(edges_get_indegree(edges3p, node3p.orient) > 1); find_bubbles(caller, node5p); GCacheUnitig *snode3p; Orientation snorient3p; GCacheStepPtrBuf *stepbuf; // Get 3p flank and orientation snode3p = graph_cache_find_unitig(&caller->cache, node3p); TASSERT(snode3p != NULL); snorient3p = gc_unitig_get_orient(&caller->cache, snode3p, node3p); find_bubbles_ending_with(caller, snode3p); stepbuf = (snorient3p == FORWARD ? &caller->spp_forward : &caller->spp_reverse); _check_alleles(&caller->cache, stepbuf, alleles, num_alleles, nbuf, sbuf); }
static void write_bubbles_to_file(BubbleCaller *caller) { // Loop over supernodes checking if they are 3p flanks size_t snode_count = graph_cache_num_snodes(&caller->cache); GCacheSnode *snode; size_t i; for(i = 0; i < snode_count; i++) { snode = graph_cache_snode(&caller->cache, i); find_bubbles_ending_with(caller, snode); if(caller->spp_forward.len > 1) print_bubble(caller, caller->spp_forward.b, caller->spp_forward.len); if(caller->spp_reverse.len > 1) print_bubble(caller, caller->spp_reverse.b, caller->spp_reverse.len); } }