(ArrayList<Kmer> kmers,
BloomFilterDeBruijnGraph graph,
int lookahead,
int maxIndelSize,
float maxCovGradient,
float covFPR,
float percentIdentity,
float minKmerCov)
| 3996 | } |
| 3997 | |
| 3998 | public static ArrayList<Kmer> correctErrorsSE(ArrayList<Kmer> kmers, |
| 3999 | BloomFilterDeBruijnGraph graph, |
| 4000 | int lookahead, |
| 4001 | int maxIndelSize, |
| 4002 | float maxCovGradient, |
| 4003 | float covFPR, |
| 4004 | float percentIdentity, |
| 4005 | float minKmerCov) { |
| 4006 | |
| 4007 | if (!kmers.isEmpty()) { |
| 4008 | int numKmers = kmers.size(); |
| 4009 | |
| 4010 | // sort coverage in ascending order |
| 4011 | float[] covs = new float[numKmers]; |
| 4012 | for (int i=0; i<numKmers; ++i) { |
| 4013 | covs[i] = kmers.get(i).count; |
| 4014 | } |
| 4015 | Arrays.sort(covs); |
| 4016 | |
| 4017 | boolean thresholdFound = false; |
| 4018 | |
| 4019 | int numFalsePositivesAllowed = (int) Math.round(numKmers * covFPR); |
| 4020 | int startIndex = numKmers - 1 - numFalsePositivesAllowed; |
| 4021 | |
| 4022 | float covThreshold = 0; |
| 4023 | |
| 4024 | if (startIndex >= 0) { |
| 4025 | covThreshold = covs[startIndex]; |
| 4026 | float c = -1; |
| 4027 | for (int i=startIndex-1; i>=0; --i) { |
| 4028 | c = covs[i]; |
| 4029 | if (covThreshold * maxCovGradient > c) { |
| 4030 | thresholdFound = true; |
| 4031 | break; |
| 4032 | } |
| 4033 | covThreshold = c; |
| 4034 | } |
| 4035 | } |
| 4036 | |
| 4037 | if (thresholdFound) { |
| 4038 | return correctErrorHelper(kmers, |
| 4039 | graph, |
| 4040 | lookahead, |
| 4041 | maxIndelSize, |
| 4042 | covThreshold, |
| 4043 | percentIdentity, |
| 4044 | minKmerCov); |
| 4045 | } |
| 4046 | } |
| 4047 | |
| 4048 | return null; |
| 4049 | } |
| 4050 | |
| 4051 | public static ReadPair correctErrorsPE(ArrayList<Kmer> leftKmers, |
| 4052 | ArrayList<Kmer> rightKmers, |
no test coverage detected