@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)
| 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; |
no test coverage detected