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

Method getMaxCoveragePath

src/rnabloom/util/GraphUtils.java:1591–1675  ·  view source on GitHub ↗

@param graph @param left @param right @param bound @param lookahead @param minKmerCov @return

(BloomFilterDeBruijnGraph graph, Kmer left, Kmer right, int bound, int lookahead, float minKmerCov)

Source from the content-addressed store, hash-verified

1589 * @return
1590 */
1591 public static ArrayDeque<Kmer> getMaxCoveragePath(BloomFilterDeBruijnGraph graph, Kmer left, Kmer right, int bound, int lookahead, float minKmerCov) {
1592
1593 int k = graph.getK();
1594 int numHash = graph.getMaxNumHash();
1595
1596 HashSet<Kmer> leftPathKmers = new HashSet<>(bound);
1597
1598 /* greedy extend right */
1599 ArrayDeque<Kmer> leftPath = new ArrayDeque<>(bound);
1600 Kmer best;
1601
1602 best = left;
1603
1604 for (int depth=0; depth < bound; ++depth) {
1605 best = best.getMaxCovSuccessor(k, numHash, graph, minKmerCov);
1606 if (best == null) {
1607 break;
1608 }
1609 else {
1610 if (best.equals(right)) {
1611 return leftPath;
1612 }
1613 else {
1614 if (leftPathKmers.contains(best)) {
1615 break;
1616 }
1617 else {
1618 leftPathKmers.add(best);
1619 leftPath.add(best);
1620 }
1621 }
1622 }
1623 }
1624
1625 HashSet<Kmer> rightPathKmers = new HashSet<>(bound);
1626
1627 /* not connected, search from right */
1628 ArrayDeque<Kmer> rightPath = new ArrayDeque<>(bound);
1629 best = right;
1630 for (int depth=0; depth < bound; ++depth) {
1631 best = best.getMaxCovPredecessor(k, numHash, graph, minKmerCov);
1632
1633 if (best == null) {
1634 break;
1635 }
1636 else {
1637 if (best.equals(left)) {
1638 return rightPath;
1639 }
1640 else {
1641 if (rightPathKmers.contains(best)) {
1642 return null;
1643 }
1644 else if (leftPathKmers.contains(best)) {
1645 /* right path intersects the left path */
1646
1647 if (isLowComplexityShort(best.toString())) {
1648 return null;

Callers 7

representedMethod · 0.95
correctErrorHelper2Method · 0.95
correctInternalErrorsMethod · 0.95
correctErrorHelperMethod · 0.95
connectMethod · 0.95
isChimeraMethod · 0.95
isTemplateSwitch2Method · 0.95

Calls 15

getMaxCovSuccessorMethod · 0.95
equalsMethod · 0.95
getMaxCovPredecessorMethod · 0.95
toStringMethod · 0.95
getSuccessorsMethod · 0.95
greedyExtendRightOnceMethod · 0.95
getPredecessorsMethod · 0.95
greedyExtendLeftOnceMethod · 0.95
getMaxNumHashMethod · 0.80
containsMethod · 0.80
isLowComplexityShortMethod · 0.80
addMethod · 0.65

Tested by

no test coverage detected