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/>.
29 void output_contig_graph ( char * outfile
)
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" );
47 void output_scaf ( char * outfile
)
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
)
67 connect
= contig_array
[i
].downwardConnect
;
71 //if(connect->mask||connect->deleted){
72 if ( connect
->deleted
)
74 connect
= connect
->next
;
78 if ( connect
->prevInScaf
|| connect
->nextInScaf
)
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
);
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" );