(final ArrayList<Kmer> kmers,
final BloomFilterDeBruijnGraph graph,
final int lookahead,
final int maxIndelSize,
final float covThreshold,
final float percentIdentity)
| 2194 | } |
| 2195 | |
| 2196 | private static ArrayList<Kmer> correctErrorHelper2(final ArrayList<Kmer> kmers, |
| 2197 | final BloomFilterDeBruijnGraph graph, |
| 2198 | final int lookahead, |
| 2199 | final int maxIndelSize, |
| 2200 | final float covThreshold, |
| 2201 | final float percentIdentity) { |
| 2202 | |
| 2203 | /**@TODO Need to be debugged*/ |
| 2204 | |
| 2205 | final int numKmers = kmers.size(); |
| 2206 | final int k = graph.getK(); |
| 2207 | final int numHash = graph.getMaxNumHash(); |
| 2208 | final int snvBubbleLength = k; |
| 2209 | final int minIslandSize = 3; |
| 2210 | |
| 2211 | ArrayList<Kmer> kmers2 = new ArrayList<>(numKmers + maxIndelSize); |
| 2212 | |
| 2213 | boolean corrected = false; |
| 2214 | |
| 2215 | int start = -1; // left edge of kmer island |
| 2216 | int end = -1; // right edge of kmer island |
| 2217 | |
| 2218 | for (int i=0; i<numKmers; ++i) { |
| 2219 | if (start < 0) { |
| 2220 | // the left edge of kmer island has not been defined yet |
| 2221 | boolean enoughKmers = true; |
| 2222 | for (int j=i; j<i+minIslandSize; ++j) { |
| 2223 | if (kmers.get(j).count < covThreshold) { |
| 2224 | enoughKmers = false; |
| 2225 | break; |
| 2226 | } |
| 2227 | } |
| 2228 | |
| 2229 | if (enoughKmers) { |
| 2230 | start = i; |
| 2231 | |
| 2232 | // attempt to correct bad kmers to the left of island |
| 2233 | |
| 2234 | if (end < 0) { |
| 2235 | if (start > 0) { |
| 2236 | // correct left edge |
| 2237 | |
| 2238 | ArrayDeque<Kmer> leftVars = kmers.get(start-1).getLeftVariants(k, numHash, graph); |
| 2239 | |
| 2240 | if (leftVars.isEmpty()) { |
| 2241 | // no branches found |
| 2242 | for (int j=0; j<start; ++j) { |
| 2243 | kmers2.add(kmers.get(j)); |
| 2244 | } |
| 2245 | } |
| 2246 | else if (start >= lookahead) { |
| 2247 | // calculate median cov of edge kmers |
| 2248 | float[] tipCovs = new float[start]; |
| 2249 | for (int j=0; j<start; ++j) { |
| 2250 | tipCovs[j] = kmers.get(j).count; |
| 2251 | } |
| 2252 | float tipMedCov = getMedian(tipCovs); |
| 2253 |
nothing calls this directly
no test coverage detected