示例#1
0
  /**
   * Creates an "empty" read with the provided read's read group and mate information, but empty
   * (not-null) fields: - Cigar String - Read Bases - Base Qualities
   *
   * <p>Use this method if you want to create a new empty read based on another read
   *
   * @param read a read to copy fields from
   * @return a read with no bases but safe for the GATK
   */
  public static GATKRead emptyRead(final GATKRead read) {
    final GATKRead emptyRead = read.copy();

    emptyRead.setCigar("");
    emptyRead.setBases(new byte[0]);
    emptyRead.setBaseQualities(new byte[0]);

    emptyRead.clearAttributes();
    String readGroup = read.getReadGroup();
    if (readGroup != null) {
      emptyRead.setAttribute(SAMTag.RG.name(), readGroup);
    }

    return emptyRead;
  }
示例#2
0
 /**
  * Returns a {@link SAMReadGroupRecord} object corresponding to the provided read's read group.
  *
  * @param read read whose read group to retrieve
  * @param header SAM header containing read groups
  * @return a {@link SAMReadGroupRecord} object corresponding to the provided read's read group, or
  *     null if the read has no read group
  */
 public static SAMReadGroupRecord getSAMReadGroupRecord(
     final GATKRead read, final SAMFileHeader header) {
   final String readGroupName = read.getReadGroup();
   return readGroupName != null ? header.getReadGroup(readGroupName) : null;
 }