void perfect_path_base_callback(Path * p) { pathStep p1, p2; path_get_last_step(&p1, p); path_get_step_at_index(0, &p2, p); //Remove the repeated node in a cycle if (path_is_cycle(p)) { if (path_step_equals (&p1, &p2)) { p1.label = Undefined; path_remove_last(p); path_add_node(&p1, p); } } int n_fwd = db_node_edges_count_all_colours(p2.node, p2.orientation); int n_rev = db_node_edges_count_all_colours(p2.node, opposite_orientation(p2.orientation)); int n_fwd_f = db_node_edges_count_all_colours(p1.node, p1.orientation); int n_rev_f = db_node_edges_count_all_colours(p1.node, opposite_orientation(p1.orientation)); if (n_fwd == 0) { path_add_stop_reason(FIRST, PATH_FLAG_STOP_BLUNT_END, p); } if (n_fwd > 1) { path_add_stop_reason(FIRST, PATH_FLAG_DIVERGING_PATHS, p); } if (n_rev > 1) { path_add_stop_reason(FIRST, PATH_FLAG_CONVERGING_PATHS, p); } if(n_rev > 1 && n_fwd_f > 1 ){ path_add_stop_reason(FIRST, PATH_FLAG_IS_DOUBLE_Y,p); } if(n_rev_f > 1){ path_add_stop_reason(LAST, PATH_FLAG_CONVERGING_PATHS, p); } if(n_fwd_f > 1){ path_add_stop_reason(LAST, PATH_FLAG_DIVERGING_PATHS, p); } }
static boolean clean_path(Path * p, dBGraph * db_graph){ if(path_is_empty(p)){ return false; } boolean clean = true; pathStep last; path_get_last_step(&last, p); if(path_step_has_unvisited_edge_all_colours(&last)){ Nucleotide n = path_step_get_unvisited_edge_all_colours(&last); path_modfy_last_label(n, p); clean = false; } return clean; }