Class QueryInterval

java.lang.Object
htsjdk.samtools.QueryInterval
All Implemented Interfaces:
Comparable<QueryInterval>

public class QueryInterval extends Object implements Comparable<QueryInterval>
Interval relative to a reference, for querying a BAM file.
  • Field Details

    • referenceIndex

      public final int referenceIndex
      Index of reference sequence, based on the sequence dictionary of the BAM file being queried.
    • start

      public final int start
      1-based, inclusive
    • end

      public final int end
      1-based, inclusive. If <= 0, implies that the interval goes to the end of the reference sequence
  • Constructor Details

    • QueryInterval

      public QueryInterval(int referenceIndex, int start, int end)
  • Method Details

    • compareTo

      public int compareTo(QueryInterval other)
      Specified by:
      compareTo in interface Comparable<QueryInterval>
    • endsAtStartOf

      public boolean endsAtStartOf(QueryInterval other)
      Returns:
      true if both are on same reference, and other starts exactly before this ends.
    • overlaps

      public boolean overlaps(QueryInterval other)
      Returns:
      true if both are on same reference, and the overlap.
    • toString

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

      public static QueryInterval[] optimizeIntervals(QueryInterval[] inputIntervals)
      Parameters:
      inputIntervals - WARNING: This list is modified (sorted) by this method.
      Returns:
      Ordered list of intervals in which abutting and overlapping intervals are merged.
    • assertIntervalsOptimized

      public static void assertIntervalsOptimized(QueryInterval[] intervals)
      Throws:
      IllegalArgumentException - if the intervals are not optimized
      See Also:
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object