Ejemplo n.º 1
0
//Gets all the paths from a given node. 
int perfect_path_get_all_paths_from(dBNode * node, Orientation orientation,
									 PathArray * pa, int limit, dBGraph * db_graph)
{
	
	int found = 0;
	pathStep ps;
	ps.orientation = orientation;
	ps.node = node;
	ps.flags = 0;
    ps.path = NULL;
    Nucleotide n;
    for (n = 0; n < 4; n++) {
		ps.label = n;
		path_reset(pa->paths[n]);
        path_set_limit(limit,pa->paths[n] );		
		if (db_node_edge_exist_any_colour(node, n, orientation)) {
			perfect_path_get_path_from_step_with_callback_with_args(ps,
														  NULL, NULL,
														  &pp_copy_path,pa->paths[n], 
														  db_graph);
			
		}

    }
	
	return found;
}
Ejemplo n.º 2
0
/**
 * Returns all the paths up to certain length. All the paths come from the pathBuffer, you are responsible
 * of freeing them from the buffer with path_array_free_from_buffer after using the buffer. 
 */
PathArray * branches_get_all_paths_from(pathStep * first, int max_length, dBGraph * db_graph){
//    first->label = Cytosine;
    first->flags = 0;
    first->orientation = reverse;
    first->label = Undefined;
    PathArray * pa = path_array_new(4);// where is freeing the path array?
    Path * buff = path_get_buffer_path();
    path_set_limit(max_length, buff);
    
    WalkingFunctions wf;
    branches_get_funtions(&wf);
    
    
    void copy_path(Path * p){
        Path * tmp = path_get_buffer_path();
        path_copy(tmp, p);
        //path_to_fasta(p, stdout);
        path_array_add_path(tmp, pa);
    }