Class DuplicateSet

java.lang.Object
htsjdk.samtools.DuplicateSet

public class DuplicateSet extends Object
Stores a set of records that are duplicates of each other. The first records in the list of records is considered the representative of the duplicate, and typically does not have it's duplicate flag set. The records' duplicate flag will be set appropriately as records are added. This behavior can be turned off. At this time, this set does not track optical duplicates.
  • Constructor Details

    • DuplicateSet

      public DuplicateSet()
      Sets the duplicate flag by default
    • DuplicateSet

      public DuplicateSet(boolean setDuplicateFlag)
    • DuplicateSet

      public DuplicateSet(SAMRecordDuplicateComparator comparator)
    • DuplicateSet

      public DuplicateSet(boolean setDuplicateFlag, SAMRecordDuplicateComparator comparator)
  • Method Details

    • add

      public int add(SAMRecord record)
      Adds a record to the set and returns zero if either the set is empty, or it is a duplicate of the records already in the set. Otherwise, it does not add the record and returns non-zero.
      Parameters:
      record - the record to add.
      Returns:
      zero if the record belongs in this set, -1 in a previous set, or 1 in a subsequent set, according to the comparison order
    • getRecords

      public List<SAMRecord> getRecords(boolean sort)
      Gets the list of records from this set. Setting sort to false likely will not yield records in duplicate order within the set.
      Parameters:
      sort - true if we want the records in the duplicate set sorted by duplicate order, false if we do not care about the order.
    • getRecords

      public List<SAMRecord> getRecords()
      Gets the list of records from this set.
    • getRepresentative

      public SAMRecord getRepresentative()
      Gets the representative record according to the duplicate comparator.
    • size

      public int size()
      Returns the number of records in this set.
    • numDuplicates

      public int numDuplicates()
      Returns the number of duplicates in this set, including the representative record. Does not include records that are unmapped, secondary, or supplementary.
    • isEmpty

      public boolean isEmpty()
    • setDuplicateFlag

      public void setDuplicateFlag(boolean setDuplicateFlag)
      Controls if we should update the duplicate flag of the records in this set.