ensembl-hive  2.7.0
Bio::EnsEMBL::Utils::Tree::Interval::Immutable Class Reference

Public Member Functions

public Bio::EnsEMBL::Utils::Tree::Interval::Immutable new ()
 
public Bio::EnsEMBL::Utils::Tree::Interval::Immutable::Node root ()
 
public An query ()
 
protected _query_point ()
 
protected _range_query_left ()
 
protected _range_query_right ()
 
public in_order_traversal ()
 
protected _in_order_traversal ()
 
protected _divide_intervals ()
 
protected _center ()
 
protected _center_sorted ()
 
public sort_by_begin ()
 
public uniq ()
 

Detailed Description

Synopsis

# define a set of intervals to be added to the tree
my $intervals = [ Bio::EnsEMBL::Utils::Interval->new(121626874, 122092717),
Bio::EnsEMBL::Utils::Interval->new(121637917, 121658918),
Bio::EnsEMBL::Utils::Interval->new(122096077, 124088369) ];
# initialise the tree with the above intervals
# point query
my $results = $tree->query(121779004);
if (scalar @$results) {
print "Intervals contain 121779004\n";
}
# same query, but use interval query
my $results = $tree->query(121779004, 121779004);
if (scalar @$results) {
print "Found containing interval: [", $result->[0]->start, ', ', $result->[0]->end, "\n";
}

Description

An implementation of an immutable interval tree. Immutable means the tree is
initialised with a fixed set of intervals at creation time. Intervals cannot
be added to or removed from the tree during its life cycle.

Implementation heavily inspired by https://github.com/tylerkahn/intervaltree-python

This implementation does not support Intervals having a start > end - i.e.
intervals spanning the origin of a circular chromosome.

Definition at line 47 of file Immutable.pm.

Member Function Documentation

◆ _center()

protected Bio::EnsEMBL::Utils::Tree::Interval::Immutable::_center ( )

Undocumented method

Code:
click to view

◆ _center_sorted()

protected Bio::EnsEMBL::Utils::Tree::Interval::Immutable::_center_sorted ( )

Undocumented method

Code:
click to view

◆ _divide_intervals()

protected Bio::EnsEMBL::Utils::Tree::Interval::Immutable::_divide_intervals ( )

Undocumented method

Code:
click to view

◆ _in_order_traversal()

protected Bio::EnsEMBL::Utils::Tree::Interval::Immutable::_in_order_traversal ( )

Undocumented method

Code:
click to view

◆ _query_point()

protected Bio::EnsEMBL::Utils::Tree::Interval::Immutable::_query_point ( )

Undocumented method

Code:
click to view

◆ _range_query_left()

protected Bio::EnsEMBL::Utils::Tree::Interval::Immutable::_range_query_left ( )

Undocumented method

Code:
click to view

◆ _range_query_right()

protected Bio::EnsEMBL::Utils::Tree::Interval::Immutable::_range_query_right ( )

Undocumented method

Code:
click to view

◆ in_order_traversal()

public Bio::EnsEMBL::Utils::Tree::Interval::Immutable::in_order_traversal ( )

Undocumented method

Code:
click to view

◆ new()

public Bio::EnsEMBL::Utils::Tree::Interval::Immutable Bio::EnsEMBL::Utils::Tree::Interval::Immutable::new ( )
  Arg [1]     : Arrayref of Bio::EnsEMBL::Utils::Interval instances
  Example     :
my $tree = Bio::EnsEMBL::Utils::Tree::Immutable([ $i1, $i2, $i3 ]);
  Description : Constructor. Creates a new immutable tree instance
  Returntype  : Bio::EnsEMBL::Utils::Tree::Interval::Immutable
  Exceptions  : none
  Caller      : general
 
Code:
click to view

◆ query()

public An Bio::EnsEMBL::Utils::Tree::Interval::Immutable::query ( )
  Arg [1]     : scalar, $start
                Where the query interval begins
  Arg [2]     : (optional) scalar, $end
                Where the query interval ends
  Example     :
my $results = $tree->query(121626874, 122092717);
  Description : Query the tree if its intervals overlap the interval whose start
                and end points are specified by the argument list.
                If end is not specified, it is assumed to be the same as start
                so effectively making a point query.
  Returntype  : An arrayref of Bio::EnsEMBL::Utils::Interval instances
  Exceptions  : none
  Caller      : general
 
Code:
click to view

◆ root()

public Bio::EnsEMBL::Utils::Tree::Interval::Immutable::Node Bio::EnsEMBL::Utils::Tree::Interval::Immutable::root ( )
  Arg []      : none
  Example     :
my $root = $tree->root();
  Description : Return the tree top node
  Returntype  : Bio::EnsEMBL::Utils::Tree::Interval::Immutable::Node
  Exceptions  : none
  Caller      : general
 
Code:
click to view

◆ sort_by_begin()

public Bio::EnsEMBL::Utils::Tree::Interval::Immutable::sort_by_begin ( )

Undocumented method

Code:
click to view

◆ uniq()

public Bio::EnsEMBL::Utils::Tree::Interval::Immutable::uniq ( )

Undocumented method

Code:
click to view

The documentation for this class was generated from the following file:
Bio::EnsEMBL::Utils::Interval
Definition: Interval.pm:41
map
public map()
Bio::EnsEMBL::Utils::Tree::Interval::Immutable::uniq
public uniq()
Bio::EnsEMBL::Utils::Tree::Interval::Immutable::_in_order_traversal
protected _in_order_traversal()
Bio::EnsEMBL::Utils::Tree::Interval::Immutable::_range_query_right
protected _range_query_right()
Bio::EnsEMBL::Utils::Tree::Interval::Immutable::_center
protected _center()
Bio::EnsEMBL::Utils::Tree::Interval::Immutable::in_order_traversal
public in_order_traversal()
Bio::EnsEMBL::Utils::Tree::Interval::Immutable::_query_point
protected _query_point()
Bio::EnsEMBL::Utils::Tree::Interval::Immutable::sort_by_begin
public sort_by_begin()
Bio::EnsEMBL::Utils::Tree::Interval::Immutable::Node
Definition: Node.pm:14
Bio::EnsEMBL::Utils::Tree::Interval::Immutable::query
public An query()
Bio::EnsEMBL::Utils::Tree::Interval::Immutable::root
public Bio::EnsEMBL::Utils::Tree::Interval::Immutable::Node root()
Bio::EnsEMBL::Utils::Interval::new
public Bio::EnsEMBL::Utils::Interval new()
Bio::EnsEMBL::Utils::Tree::Interval::Immutable::_divide_intervals
protected _divide_intervals()
Bio::EnsEMBL::Utils::Tree::Interval::Immutable
Definition: Node.pm:8
Bio::EnsEMBL::Utils::Tree::Interval::Immutable::Node::new
public Bio::EnsEMBL::Utils::Tree::Interval::Immutable::Node new()
Bio::EnsEMBL::Utils::Tree::Interval::Immutable::_range_query_left
protected _range_query_left()
Bio::EnsEMBL::Utils::Tree::Interval::Immutable::_center_sorted
protected _center_sorted()
Bio::EnsEMBL::Utils::Interval::is_point
public Boolean is_point()