Exemplo n.º 1
0
  public static int getReadCoordinateForReferenceCoordinate(
      final int alignmentStart,
      final Cigar cigar,
      final int refCoord,
      final ClippingTail tail,
      final boolean allowGoalNotReached) {
    Pair<Integer, Boolean> result =
        getReadCoordinateForReferenceCoordinate(
            alignmentStart, cigar, refCoord, allowGoalNotReached);
    int readCoord = result.getFirst();

    // Corner case one: clipping the right tail and falls on deletion, move to the next
    // read coordinate. It is not a problem for the left tail because the default answer
    // from getReadCoordinateForReferenceCoordinate is to give the previous read coordinate.
    if (result.getSecond() && tail == ClippingTail.RIGHT_TAIL) readCoord++;

    // clipping the left tail and first base is insertion, go to the next read coordinate
    // with the same reference coordinate. Advance to the next cigar element, or to the
    // end of the read if there is no next element.
    Pair<Boolean, CigarElement> firstElementIsInsertion = readStartsWithInsertion(cigar);
    if (readCoord == 0 && tail == ClippingTail.LEFT_TAIL && firstElementIsInsertion.getFirst())
      readCoord =
          Math.min(firstElementIsInsertion.getSecond().getLength(), cigar.getReadLength() - 1);

    return readCoord;
  }
  @Test(dataProvider = "PrefixSuffixData")
  public void testPrefixSuffixVertices(
      final List<String> strings, int expectedPrefixLen, int expectedSuffixLen) {
    final List<SeqVertex> v = new ArrayList<>();
    for (final String s : strings) {
      v.add(new SeqVertex(s));
    }

    final String expectedPrefix = strings.get(0).substring(0, expectedPrefixLen);
    final String expectedSuffix =
        strings.get(0).substring(strings.get(0).length() - expectedSuffixLen);

    final Pair<SeqVertex, SeqVertex> result =
        SharedVertexSequenceSplitter.commonPrefixAndSuffixOfVertices(v);
    Assert.assertEquals(
        result.getFirst().getSequenceString(), expectedPrefix, "Failed suffix test");
    Assert.assertEquals(
        result.getSecond().getSequenceString(), expectedSuffix, "Failed suffix test");

    Assert.assertEquals(result.getFirst().isEmpty(), expectedPrefix.isEmpty());
    Assert.assertEquals(result.getSecond().isEmpty(), expectedSuffix.isEmpty());
  }
Exemplo n.º 3
0
 /**
  * General interval reduce routine called after all of the traversals are done
  *
  * @param results interval reduce results
  */
 public void onTraversalDone(List<Pair<GenomeLoc, ReduceType>> results) {
   for (Pair<GenomeLoc, ReduceType> result : results) {
     logger.info(String.format("[INTERVAL REDUCE RESULT] at %s ", result.getFirst()));
     this.onTraversalDone(result.getSecond());
   }
 }