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/>.
27 void removeMinorTips ( struct hashtable2
* ht
, int K_size
, int cut_len_tip
, int & tip_c
);
28 void kmer2edges ( hashtable2
* ht
, int K_size
, char * outfile
);
29 void convert ( char * sparse_edge_file
, int K_size
, char * output_prefix
);
30 void RemovingWeakNodesAndEdges2 ( hashtable2
* ht
, int K_size
, int NodeCovTh
, int EdgeCovTh
, size_t * bucket_cnt
, size_t * edge_cnt
);
34 struct bucket2
* node
;
35 bool is_left
; // change it to a byte later
36 struct edge_node
* edge
;
37 struct stacked_node2
* next
;
40 typedef struct preedge2
42 struct stacked_node2
* from_node
;
43 struct stacked_node2
* to_node
;
46 unsigned short bal_edge
: 2;
51 // below is static methods
52 //remove minor tips ...
53 //void removeMinorTips(struct hashtable2 *ht,int K_size,int cut_len_tip,int &tip_c);
54 static void mask1in1out ( hashtable2
* ht
);
55 static int clipTipFromNode ( hashtable2
* ht
, int K_size
, bucket2
* node
, int cut_len_tip
);
56 static int count_left_edge_num ( bucket2
* bkt
);
57 static int count_right_edge_num ( bucket2
* bkt
);
59 static void dislink ( hashtable2
* ht
, int K_size
, stacked_node2
* from_node
);
60 static bucket2
* lastKmer ( hashtable2
* ht
, int K_size
, bucket2
* node
, edge_node
* edge
, int is_left
, int & smaller
);
61 //static bucket2* search_kmer(hashtable2 *ht,uint64_t* t_kmer, int Kmer_arr_sz); old
62 static bucket2
* search_kmer ( hashtable2
* ht
, kmer_t2
* t_kmer
);
64 static void removeEdge ( bucket2
* node
, edge_node
* edge
, int is_left
);
65 static void stat_edge_num ( hashtable2
* ht
);
66 static void stat_edge_cvg_len ( hashtable2
* ht
);
67 static bool isSmaller2 ( uint64_t * kmer
, int K_size
);
70 //void kmer2edges(hashtable2* ht,int K_size,char *outfile);
71 static void make_edge ( hashtable2
* ht
, int K_size
, FILE * fp
);
72 static int startEdgeFromNode ( hashtable2
* ht
, int K_size
, bucket2
* node
, FILE * fp
);
73 static void stringBeads ( hashtable2
* ht
, int K_size
, list
<stacked_node2
*> &stack
, stacked_node2
* from_node
, edge_node
* from_edge
, int * node_c
);
75 static void process_1stack ( hashtable2
* ht
, int K_size
, list
<stacked_node2
*> &stack
, FILE * fp
, vector
<preEDGE2
> &loops_edges
);
77 //static void get_kmer(const char * seq,int len, int K_size,int pos,uint64_t *kmer,int arr_sz );
78 static void output_1edge ( preEDGE2
* long_edge
, int K_size
, FILE * fp
);
79 static string
stack2string ( hashtable2
* ht
, int K_size
, list
<stacked_node2
*> & stack
);
80 static bool check_palindrome ( string
& str
);
81 static string
revCompSeq ( const string
& str
);
83 //convert the edge fomat ...
84 //void convert(char * sparse_edge_file,int K_size, char * output_prefix);
85 static void convert_kmer ( uint64_t * sparse_kmer
, int K_size
, int arr_sz
);
86 static uint64_t * fastReverseComp ( uint64_t * seq_arr
, int seq_size
, int arr_sz
);