Class AbstractLocusInfo<E extends AbstractRecordAndOffset>

java.lang.Object
htsjdk.samtools.util.AbstractLocusInfo<E>
All Implemented Interfaces:
Locatable, Locus
Direct Known Subclasses:
SamLocusIterator.LocusInfo

public class AbstractLocusInfo<E extends AbstractRecordAndOffset> extends Object implements Locus, Locatable
The unit of iteration for AbstractLocusIterator. Holds information about the locus (the SAMSequenceRecord and 1-based position on the reference), plus list of AbstractRecordAndOffset objects, If RecordAndOffset class is used, one object represents one aligned read that overlaps the locus. If TypedRecordAndOffset class is used, one object represents one aligned read, that starts or ends at the locus.
  • Constructor Details

    • AbstractLocusInfo

      public AbstractLocusInfo(SAMSequenceRecord referenceSequence, int position)
      Parameters:
      referenceSequence - reference sequence to which the reads are aligned
      position - position in the sequence to which the reads are aligned
  • Method Details

    • add

      public void add(E recordAndOffset)
      Accumulates info for one read aligned to the locus. Method doesn't check, that recordAndOffset is really aligned to current reference position, so it must have valid reference sequence and position or further processing can go wrong.
      Parameters:
      recordAndOffset - object to add to current locus
    • getSequenceIndex

      public int getSequenceIndex()
      Specified by:
      getSequenceIndex in interface Locus
      Returns:
      the index of reference sequence
    • getPosition

      public int getPosition()
      Specified by:
      getPosition in interface Locus
      Returns:
      1-based reference position
    • getRecordAndPositions

      @Deprecated public List<E> getRecordAndPositions()
      Deprecated.
      since name of the method can be confusing, new implementation should be used getRecordAndOffsets()
      Returns:
      unmodifiable list of aligned to the reference position recordsAndOffsets
    • getRecordAndOffsets

      public List<E> getRecordAndOffsets()
      Returns:
      unmodifiable list of aligned to the reference position recordsAndOffsets
    • getSequenceName

      public String getSequenceName()
      Returns:
      the name of reference sequence
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getSequenceLength

      public int getSequenceLength()
      Returns:
      the length of reference sequence
    • size

      public int size()
      Returns:
      the number of records overlapping the position
    • isEmpty

      public boolean isEmpty()
      Returns:
      true if RecordAndOffset list is empty;
    • getContig

      public String getContig()
      Description copied from interface: Locatable
      Gets the contig name for the contig this is mapped to. May return null if there is no unique mapping.
      Specified by:
      getContig in interface Locatable
      Returns:
      name of the contig this is mapped to, potentially null
    • getStart

      public int getStart()
      Specified by:
      getStart in interface Locatable
      Returns:
      1-based start position, undefined if getContig() == null
    • getEnd

      public int getEnd()
      Specified by:
      getEnd in interface Locatable
      Returns:
      1-based closed-ended position, undefined if getContig() == null