modified: makefile
[GalaxyCodeBases.git] / BGI / SOAPdenovo2 / standardPregraph / output_scaffold.c
blobada94863cd788f984b795a51d1db4f5824e679fc
1 /*
2 * output_scaffold.c
4 * Copyright (c) 2008-2012 BGI-Shenzhen <soap at genomics dot org dot cn>.
6 * This file is part of SOAPdenovo.
8 * SOAPdenovo is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
13 * SOAPdenovo is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with SOAPdenovo. If not, see <http://www.gnu.org/licenses/>.
23 #include "stdinc.h"
24 #include "newhash.h"
25 #include "kmerhash.h"
26 #include "extfunc.h"
27 #include "extvab.h"
29 void output_contig_graph ( char * outfile )
31 char name[256];
32 FILE * fp;
33 unsigned int i;
34 sprintf ( name, "%s.contig.gvz", outfile );
35 fp = ckopen ( name, "w" );
36 fprintf ( fp, "digraph G{\n" );
37 fprintf ( fp, "\tsize=\"512,512\";\n" );
39 for ( i = num_ctg; i > 0; i-- )
41 fprintf ( fp, "\tV%d -> V%d[label =\"%d(%d)\"];\n", contig_array[i].from_vt, contig_array[i].to_vt, i, contig_array[i].length );
44 fprintf ( fp, "}\n" );
45 fclose ( fp );
47 void output_scaf ( char * outfile )
49 char name[256];
50 FILE * fp;
51 unsigned int i;
52 CONNECT * connect;
53 boolean flag;
54 sprintf ( name, "%s.scaffold.gvz", outfile );
55 fp = ckopen ( name, "w" );
56 fprintf ( fp, "digraph G{\n" );
57 fprintf ( fp, "\tsize=\"512,512\";\n" );
59 for ( i = num_ctg; i > 0; i-- )
61 //if(contig_array[i].mask||!contig_array[i].downwardConnect)
62 if ( !contig_array[i].downwardConnect )
64 continue;
67 connect = contig_array[i].downwardConnect;
69 while ( connect )
71 //if(connect->mask||connect->deleted){
72 if ( connect->deleted )
74 connect = connect->next;
75 continue;
78 if ( connect->prevInScaf || connect->nextInScaf )
80 flag = 1;
82 else
84 flag = 0;
87 if ( !connect->mask )
88 fprintf ( fp, "\tC%d_%d -> C%d_%d [label = \"%d(%d_%d)\"];\n", i, contig_array[i].length, connect->contigID, contig_array[connect->contigID].length,
89 connect->gapLen, flag, connect->weight );
90 else
91 fprintf ( fp, "\tC%d_%d -> C%d_%d [label = \"%d(%d_%d)\", color = red];\n", i, contig_array[i].length, connect->contigID, contig_array[connect->contigID].length,
92 connect->gapLen, flag, connect->weight );
94 connect = connect->next;
98 fprintf ( fp, "}\n" );
99 fclose ( fp );