2 * 31mer/output_pregraph.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/>.
28 static int outvCounter
= 0;
30 //after this LINKFLAGFILTER in the Kmer is destroyed
31 static void output1vt ( kmer_t
* node1
, FILE * fp
)
38 if ( ! ( node1
->linear
) && ! ( node1
->deleted
) )
41 print_kmer ( fp
, node1
->seq
, ' ' );
43 if ( outvCounter
% 8 == 0 )
50 void output_vertex ( char * outfile
)
57 sprintf ( temp
, "%s.vertex", outfile
);
58 fp
= ckopen ( temp
, "w" );
60 for ( i
= 0; i
< thrd_num
; i
++ )
65 while ( set
->iter_ptr
< set
->size
)
67 if ( !is_kmer_entity_null ( set
->flags
, set
->iter_ptr
) )
69 node
= set
->array
+ set
->iter_ptr
;
70 output1vt ( node
, fp
);
78 fprintf ( stderr
, "%d vertex(es) output.\n", outvCounter
);
80 sprintf ( temp
, "%s.preGraphBasic", outfile
);
81 fp
= ckopen ( temp
, "w" );
82 fprintf ( fp
, "VERTEX %d K %d\n", outvCounter
, overlaplen
);
83 fprintf ( fp
, "\nEDGEs %d\n", num_ed
);
84 fprintf ( fp
, "\nMaxReadLen %d MinReadLen %d MaxNameLen %d\n", maxReadLen4all
, minReadLen
, maxNameLen
);
88 void output_1edge ( preEDGE
* edge
, gzFile
* fp
)
91 gzprintf ( fp
, ">length %d,", edge
->length
);
92 print_kmer_gz ( fp
, edge
->from_node
, ',' );
93 print_kmer_gz ( fp
, edge
->to_node
, ',' );
94 gzprintf ( fp
, "cvg %d, %d\n", edge
->cvg
, edge
->bal_edge
);
96 for ( i
= 0; i
< edge
->length
; i
++ )
98 gzprintf ( fp
, "%c", int2base ( ( int ) edge
->seq
[i
] ) );
100 if ( ( i
+ 1 ) % 100 == 0 )
102 gzprintf ( fp
, "\n" );
106 if ( edge
->length
% 100 != 0 )
108 gzprintf ( fp
, "\n" );