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

Method breakWithFragPairedKmers

src/rnabloom/util/GraphUtils.java:4312–4374  ·  view source on GitHub ↗
(ArrayList<Kmer> kmers, BloomFilterDeBruijnGraph graph, int numPairsRequired)

Source from the content-addressed store, hash-verified

4310 }
4311
4312 public static ArrayDeque<int[]> breakWithFragPairedKmers(ArrayList<Kmer> kmers, BloomFilterDeBruijnGraph graph, int numPairsRequired) {
4313 int interlockDistance = 0;
4314
4315 ArrayDeque<int[]> segments = new ArrayDeque<>();
4316
4317 int d = graph.getFragPairedKmerDistance();
4318 int lastIndex = kmers.size() - 1 - d;
4319
4320 int start = -1;
4321 int end = -1;
4322
4323 if (numPairsRequired == 1) {
4324 for (int i=0; i<=lastIndex; ++i) {
4325 if (graph.lookupFragmentKmerPair(kmers.get(i), kmers.get(i+d))) {
4326 if (start < 0) {
4327 start = i;
4328 }
4329
4330 end = i+d;
4331 }
4332 else if (start >= 0 && i >= end-interlockDistance) {
4333 segments.add(new int[]{start, end+1});
4334
4335 start = -1;
4336 end = -1;
4337 }
4338 }
4339
4340 if (start >= 0) {
4341 segments.add(new int[]{start, end+1});
4342 }
4343 }
4344 else {
4345 int numPreviousKmerPairs = 0;
4346 for (int i=0; i<=lastIndex; ++i) {
4347 if (graph.lookupFragmentKmerPair(kmers.get(i), kmers.get(i+d))) {
4348 if (++numPreviousKmerPairs >= numPairsRequired) {
4349 if (start < 0) {
4350 start = i-numPairsRequired+1;
4351 }
4352
4353 end = i+d;
4354 }
4355 }
4356 else {
4357 if (start >= 0 && i >= end-interlockDistance) {
4358 segments.add(new int[]{start, end+1});
4359
4360 start = -1;
4361 end = -1;
4362 }
4363
4364 numPreviousKmerPairs = 0;
4365 }
4366 }
4367
4368 if (start >= 0) {
4369 segments.add(new int[]{start, end+1});

Callers 2

runMethod · 0.80

Calls 5

getMethod · 0.65
addMethod · 0.65
sizeMethod · 0.45

Tested by

no test coverage detected