Example #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;
  }