MCPcopy Create free account
hub / github.com/BirolLab/abyss / findOverlap

Function findOverlap

Overlap/Overlap.cpp:151–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151static unsigned findOverlap(const Graph& g,
152 const ContigNode& t_id,
153 const ContigNode& h_id,
154 bool& mask)
155{
156 mask = false;
157 string t = sequence(t_id);
158 string h = sequence(h_id);
159 unsigned len = min(t.length(), h.length());
160 vector<unsigned> overlaps;
161 overlaps.reserve(len);
162 for (unsigned overlap = len; overlap >= 1; overlap--) {
163 if (t.substr(t.length()-overlap, overlap)
164 == h.substr(0, overlap))
165 overlaps.push_back(overlap);
166 }
167
168 if (opt::verbose > 0) {
169 cout << get(vertex_name, g, t_id)
170 << '\t' << get(vertex_name, g, h_id);
171 for (vector<unsigned>::const_iterator i = overlaps.begin();
172 i != overlaps.end(); ++i)
173 cout << '\t' << *i;
174 cout << '\n';
175 }
176
177 if (overlaps.empty()) {
178 stats.none++;
179 return 0;
180 }
181
182 if (overlaps[0] < opt::minimum_overlap) {
183 stats.tooshort++;
184 return 0;
185 }
186
187 if (overlaps.size() >= 3
188 && overlaps[0]-overlaps[1] == overlaps[1]-overlaps[2]) {
189 // Homopolymer run or motif.
190 if (overlaps[0]-overlaps[1] == 1)
191 stats.homopolymer++;
192 else
193 stats.motif++;
194 mask = true;
195 }
196
197 return overlaps[0];
198}
199
200static FastaRecord newContig(const Graph& g,
201 const ContigNode& t, const ContigNode& v,

Callers 2

checkEdgeForOverlapFunction · 0.70
mainFunction · 0.70

Calls 15

allowedErrorFunction · 0.85
idMethod · 0.80
sequenceFunction · 0.70
OverlapClass · 0.70
getFunction · 0.50
out_degreeFunction · 0.50
in_degreeFunction · 0.50
edgeFunction · 0.50
add_edgeFunction · 0.50
lengthMethod · 0.45
push_backMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected