示例#1
0
  public String getPairOrientation() {
    // LOG.info("getPairOrientation");
    String pairOrientation = "";
    if (EntryFlagHelper.isPaired(entry)
        && !EntryFlagHelper.isMateUnmapped(entry)
        && entry.getTargetIndex() == entry.getPairAlignmentLink().getTargetIndex()) {

      char s1 = EntryFlagHelper.isReadReverseStrand(entry) ? 'R' : 'F';
      char s2 = EntryFlagHelper.isMateReverseStrand(entry) ? 'R' : 'F';
      char o1 = ' ';
      char o2 = ' ';
      char[] tmp = new char[4];
      if (EntryFlagHelper.isFirstInPair(entry)) {
        o1 = '1';
        o2 = '2';
      } else if (EntryFlagHelper.isSecondInPair(entry)) {
        o1 = '2';
        o2 = '1';
      }
      if (getInferredInsertSize() > 0) {
        tmp[0] = s1;
        tmp[1] = o1;
        tmp[2] = s2;
        tmp[3] = o2;

      } else {
        tmp[2] = s1;
        tmp[3] = o1;
        tmp[0] = s2;
        tmp[1] = o2;
      }
      pairOrientation = new String(tmp);
    }
    return pairOrientation;
  }
示例#2
0
  /**
   * Returns the mate for a paired-end read. Please note that this method will return an unmapped
   * mate for any single end read as well. Do check if the read is paired before calling getMate().
   *
   * @return The mate, or a constant unmapped mate (for single end reads, or paired end where the
   *     mate is not found).
   */
  public ReadMate getMate() {
    if (entry.hasPairAlignmentLink()) {
      Alignments.RelatedAlignmentEntry link = entry.getPairAlignmentLink();
      String mateChr = getChromosome(link.getTargetIndex());
      int mateStart = link.getPosition();
      boolean mateNegativeStrand = EntryFlagHelper.isMateReverseStrand(entry);

      boolean isReadUnmappedFlag = EntryFlagHelper.isReadUnmapped(entry);
      final ReadMate mate =
          new ReadMate(mateChr, mateStart, mateNegativeStrand, isReadUnmappedFlag);
      return mate;
    } else {
      return unmappedMate;
    }
  }