Ejemplo n.º 1
0
  /**
   * Returns the reference index in the given header of the read's contig, or {@link
   * SAMRecord#NO_ALIGNMENT_REFERENCE_INDEX} if the read is unmapped.
   *
   * @param read read whose reference index to look up
   * @param header SAM header defining contig indices
   * @return the reference index in the given header of the read's contig, or {@link
   *     SAMRecord#NO_ALIGNMENT_REFERENCE_INDEX} if the read is unmapped.
   */
  public static int getReferenceIndex(final GATKRead read, final SAMFileHeader header) {
    if (read.isUnmapped()) {
      return SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX;
    }

    return header.getSequenceIndex(read.getContig());
  }