Class IntervalTreeArray

  • All Implemented Interfaces:
    java.lang.Iterable<Marker>, Itree

    public class IntervalTreeArray
    extends java.lang.Object
    implements Itree
    Interval tree structure using arrays This is slightly faster than the new IntervalTree implementation
    Author:
    pcingola
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(Marker interval)
      Add an interval object to the interval tree's list
      void add​(Markers markers)
      Add all intervals to interval tree's list
      void build()
      Build the interval tree to reflect the list of intervals.
      protected int build​(Markers markers)
      Index intervals from 'start' to 'end' (index in 'markers')
      Markers getIntervals()  
      boolean isEmpty()  
      boolean isInSync()
      Is the tree 'in sync'? If false, the tree must be 'build()' before the next query
      java.util.Iterator<Marker> iterator()  
      void load​(java.lang.String fileName, Genome genome)
      Load intervals from file
      Markers query​(Interval marker)
      Query index to find all VCF entries intersecting 'marker' Store VCF entries in 'results'
      protected void query​(Interval marker, int idx, Markers results)
      Query index to find all VCF entries intersecting 'marker', starting from node 'idx' Store VCF entries in 'results'
      protected void queryIntersects​(Interval marker, int idx, Markers results)
      Query entries intersecting 'marker' at node 'idx'
      protected void reset()  
      void setDebug​(boolean debug)  
      void setVerbose​(boolean verbose)  
      int size()
      Size: number of entries in this tree
      Markers stab​(int point)
      Perform a stabbing query, returning the interval objects
      protected void stab​(int point, int idx, Markers results)  
      protected void stabIntersects​(int point, int idx, Markers results)
      Stab entries intersecting 'point' at node 'idx'
      java.lang.String toString()  
      java.lang.String toString​(int idx)  
      java.lang.String toStringAll()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

      • EMPTY_MARKER_ARRAY

        protected static final Marker[] EMPTY_MARKER_ARRAY
      • debug

        protected boolean debug
      • verbose

        protected boolean verbose
      • markers

        protected Markers markers
      • inSync

        protected boolean inSync
      • left

        protected int[] left
      • right

        protected int[] right
      • mid

        protected int[] mid
      • intersectMarkers

        protected Marker[][] intersectMarkers
      • lastIdx

        protected int lastIdx
    • Constructor Detail

      • IntervalTreeArray

        public IntervalTreeArray()
      • IntervalTreeArray

        public IntervalTreeArray​(Markers markers)
        Instantiate an interval tree with a list of intervals
    • Method Detail

      • add

        public void add​(Marker interval)
        Description copied from interface: Itree
        Add an interval object to the interval tree's list
        Specified by:
        add in interface Itree
      • add

        public void add​(Markers markers)
        Description copied from interface: Itree
        Add all intervals to interval tree's list
        Specified by:
        add in interface Itree
      • build

        public void build()
        Description copied from interface: Itree
        Build the interval tree to reflect the list of intervals. Must not run if this is currently in sync
        Specified by:
        build in interface Itree
      • build

        protected int build​(Markers markers)
        Index intervals from 'start' to 'end' (index in 'markers')
        Returns:
        Index of added item (-1 if no item was added)
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface Itree
      • isInSync

        public boolean isInSync()
        Description copied from interface: Itree
        Is the tree 'in sync'? If false, the tree must be 'build()' before the next query
        Specified by:
        isInSync in interface Itree
      • iterator

        public java.util.Iterator<Marker> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<Marker>
      • load

        public void load​(java.lang.String fileName,
                         Genome genome)
        Description copied from interface: Itree
        Load intervals from file
        Specified by:
        load in interface Itree
      • query

        public Markers query​(Interval marker)
        Query index to find all VCF entries intersecting 'marker' Store VCF entries in 'results'
        Specified by:
        query in interface Itree
        Returns:
        All intervals that intersect 'interval'
      • query

        protected void query​(Interval marker,
                             int idx,
                             Markers results)
        Query index to find all VCF entries intersecting 'marker', starting from node 'idx' Store VCF entries in 'results'
      • queryIntersects

        protected void queryIntersects​(Interval marker,
                                       int idx,
                                       Markers results)
        Query entries intersecting 'marker' at node 'idx'
      • reset

        protected void reset()
      • setDebug

        public void setDebug​(boolean debug)
      • setVerbose

        public void setVerbose​(boolean verbose)
      • size

        public int size()
        Description copied from interface: Itree
        Size: number of entries in this tree
        Specified by:
        size in interface Itree
      • stab

        public Markers stab​(int point)
        Description copied from interface: Itree
        Perform a stabbing query, returning the interval objects
        Specified by:
        stab in interface Itree
        Returns:
        All intervals intersecting 'point'
      • stab

        protected void stab​(int point,
                            int idx,
                            Markers results)
      • stabIntersects

        protected void stabIntersects​(int point,
                                      int idx,
                                      Markers results)
        Stab entries intersecting 'point' at node 'idx'
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toString

        public java.lang.String toString​(int idx)
      • toStringAll

        public java.lang.String toStringAll()