MCPcopy Create free account
hub / github.com/BirolLab/RNA-Bloom / correctErrorsPE

Method correctErrorsPE

src/rnabloom/util/GraphUtils.java:4051–4182  ·  view source on GitHub ↗
(ArrayList<Kmer> leftKmers, 
                                            ArrayList<Kmer> rightKmers, 
                                            BloomFilterDeBruijnGraph graph, 
                                            int lookahead,
                                            int maxIndelSize, 
                                            float maxCovGradient, 
                                            float covFPR,
                                            int errorCorrectionIterations,
                                            float minCovThreshold,
                                            float percentIdentity,
                                            float minKmerCov)

Source from the content-addressed store, hash-verified

4049 }
4050
4051 public static ReadPair correctErrorsPE(ArrayList<Kmer> leftKmers,
4052 ArrayList<Kmer> rightKmers,
4053 BloomFilterDeBruijnGraph graph,
4054 int lookahead,
4055 int maxIndelSize,
4056 float maxCovGradient,
4057 float covFPR,
4058 int errorCorrectionIterations,
4059 float minCovThreshold,
4060 float percentIdentity,
4061 float minKmerCov) {
4062
4063 boolean leftCorrected = false;
4064 boolean rightCorrected = false;
4065
4066 for (int round=0; round<errorCorrectionIterations; ++round) {
4067
4068 int numLeftKmers = leftKmers.size();
4069 int numRightKmers = rightKmers.size();
4070
4071 int numFalsePositivesAllowed = (int) Math.round(Math.max(numLeftKmers, numRightKmers) * covFPR);
4072
4073 // sort coverage of left kmers in ascending order
4074 float[] covs = new float[numLeftKmers];
4075 for (int i=0; i<numLeftKmers; ++i) {
4076 covs[i] = leftKmers.get(i).count;
4077 }
4078 Arrays.sort(covs);
4079
4080// float leftMedianCoverage = covs[numLeftKmers/2];
4081
4082 // find cov threshold in left kmers
4083 boolean leftThresholdFound = false;
4084 int startIndex = numLeftKmers - 1;
4085 if (startIndex > numFalsePositivesAllowed) {
4086 startIndex -= numFalsePositivesAllowed;
4087 }
4088 float leftCovThreshold = covs[startIndex];
4089 float c;
4090 for (int i=startIndex-1; i>=0; --i) {
4091 c = covs[i];
4092 if (leftCovThreshold * maxCovGradient >= c) {
4093 leftThresholdFound = true;
4094 break;
4095 }
4096 leftCovThreshold = c;
4097 }
4098
4099 // sort coverage of right kmers in ascending order
4100 covs = new float[numRightKmers];
4101 for (int i=0; i<numRightKmers; ++i) {
4102 covs[i] = rightKmers.get(i).count;
4103 }
4104 Arrays.sort(covs);
4105
4106// float rightMedianCov = covs[numRightKmers/2];
4107//
4108// if (Math.max(leftMedianCoverage, rightMedianCov) < medCovThreshold) {

Callers 1

runMethod · 0.80

Calls 3

correctErrorHelperMethod · 0.95
getMethod · 0.65
sizeMethod · 0.45

Tested by

no test coverage detected