示例#1
0
static pathStep *get_next_step(pathStep * current_step, pathStep * next_step, pathStep * reverse_step, dBGraph * db_graph)
{
    pathStep *step = db_graph_get_next_step(current_step, next_step, reverse_step, db_graph);

    assert(step != NULL);
    
    step->label = Undefined;
    Nucleotide n;
   
    // TODO: If this works, then there's possibly a bug to fix for the multi-colour situation
    if (next_step->node == NULL) {
        next_step->label = Undefined;
        return next_step;
    }
 
    if (db_node_has_precisely_one_edge_all_colours(next_step->node, next_step->orientation, &n)) {
        next_step->label = n;
    }

    if (!db_node_has_precisely_one_edge_all_colours(next_step->node, opposite_orientation(next_step->orientation), &n)) {
        next_step->label = Undefined;
    }	

    return next_step;
}
示例#2
0
/*----------------------------------------------------------------------*
 * Function:                                                            *
 * Purpose:                                                             *
 * Params:                                                              *
 * Returns:                                                             *
 *----------------------------------------------------------------------*/
Nucleotide coverage_walk_get_best_label(dBNode* node, Orientation orientation, dBGraph* db_graph)
{
    Nucleotide label = Undefined;
    int highest_coverage = 0;
    
    //void check_edge(Nucleotide nucleotide) {
    Nucleotide nucleotide;
    for (nucleotide = Adenine; nucleotide < Undefined; nucleotide++) {
        
        //if (debugme) log_printf("  Trying nucleotide %c\n", binary_nucleotide_to_char(nucleotide));
        if (db_node_edge_exist_any_colour(node, nucleotide, orientation)) {
            pathStep step, reverse_step, next_step;            
            int coverage;
            
            step.node = node;
            step.label = nucleotide;
            step.orientation = orientation;            
            db_graph_get_next_step(&step, &next_step, &reverse_step, db_graph);
            coverage = element_get_coverage_all_colours(next_step.node);
            
            //if (debugme) log_printf("  Coverage %i\n", coverage);
            if (coverage > highest_coverage) {
                label = nucleotide;
                highest_coverage = coverage;
            }
        }
    }
    
   // nucleotide_iterator(&check_edge);    
    
	return label;
}
示例#3
0
/*----------------------------------------------------------------------*
 * Function:                                                            *
 * Purpose:                                                             *
 * Params:                                                              *
 * Returns:                                                             *
 *----------------------------------------------------------------------*/
static pathStep *coverage_walk_get_next_step(pathStep * current_step, pathStep * next_step, pathStep * reverse_step, dBGraph * db_graph)
{
	db_graph_get_next_step(current_step, next_step, reverse_step, db_graph);
    
    assert(next_step != NULL);
    
    next_step->label = Undefined;

    if (db_node_edges_count_all_colours(next_step->node, next_step->orientation) >= 1) {
        next_step->label = coverage_walk_get_best_label(next_step->node, next_step->orientation, db_graph);
    } else {
        //char seq[1024];
        //binary_kmer_to_seq(&(next_step->node->kmer), db_graph->kmer_size, seq);
        //log_printf("  No edge at %s orientation %s\n", seq, next_step->orientation == forward ? "Fwd":"Rev");
    }
	
	return next_step;
}
示例#4
0
static pathStep *get_next_step(pathStep * current_step, pathStep * next_step,
							   pathStep * reverse_step, dBGraph * db_graph)
{
    
	pathStep *step = db_graph_get_next_step(current_step, next_step, reverse_step, db_graph);
    
    assert(step != NULL);
    if (step->node != NULL) {
		step->label = Undefined;
		Nucleotide n;
		if (db_node_has_precisely_one_edge_all_colours
		    (next_step->node, next_step->orientation, &n)) {
			 next_step->label = n;
		}else{
            next_step->label = path_step_get_unvisited_edge_all_colours(next_step);
        }
        
	}
	
	return next_step;
}