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

Method getPredecessorsRanked

src/rnabloom/util/GraphUtils.java:5569–5618  ·  view source on GitHub ↗
(Kmer source, BloomFilterDeBruijnGraph graph, int lookahead, float covThreshold)

Source from the content-addressed store, hash-verified

5567 }
5568
5569 private static LinkedList<Kmer> getPredecessorsRanked(Kmer source, BloomFilterDeBruijnGraph graph, int lookahead, float covThreshold) {
5570 LinkedList<Kmer> results = new LinkedList<>();
5571 ArrayDeque<Kmer> neighbors = source.getPredecessors(graph.getK(), graph.getMaxNumHash(), graph);
5572 if (neighbors.isEmpty()) {
5573 return results;
5574 }
5575 else if (neighbors.size() == 1) {
5576 results.add(neighbors.peek());
5577 return results;
5578 }
5579
5580 LinkedList<Float> values = new LinkedList<>();
5581
5582 ListIterator<Kmer> resultsItr;
5583 ListIterator<Float> valuesItr;
5584
5585 for (Kmer n : neighbors) {
5586 if (n.count >= covThreshold) {
5587 float c = getMaxMedianCoverageLeft(graph, n, lookahead);
5588
5589 if (results.isEmpty()) {
5590 results.add(n);
5591 values.add(c);
5592 }
5593 else {
5594 resultsItr = results.listIterator();
5595 valuesItr = values.listIterator();
5596
5597 float val;
5598 while (valuesItr.hasNext()) {
5599 resultsItr.next();
5600 val = valuesItr.next();
5601
5602 if (c > val) {
5603 if (valuesItr.hasPrevious()) {
5604 resultsItr.previous();
5605 valuesItr.previous();
5606 }
5607
5608 resultsItr.add(n);
5609 valuesItr.add(c);
5610 break;
5611 }
5612 }
5613 }
5614 }
5615 }
5616
5617 return results;
5618 }
5619
5620 private static LinkedList<Kmer> getSuccessorsRanked(Kmer source, BloomFilterDeBruijnGraph graph, int lookahead) {
5621 LinkedList<Kmer> results = new LinkedList<>();

Callers

nothing calls this directly

Calls 8

getMaxNumHashMethod · 0.80
addMethod · 0.65
hasNextMethod · 0.65
nextMethod · 0.65
getPredecessorsMethod · 0.45
getKMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected