epivizquindex package¶
Submodules¶
epivizquindex.EpivizQuindex module¶
epivizquindex.QuadTree module¶
-
class
epivizquindex.QuadTree.
Index
(bbox=None, x=None, y=None, width=None, height=None, max_items=50, max_depth=30, disk=None, first_run=False)[source]¶ Bases:
epivizquindex.QuadTree._QuadTree
The wrapper of the root quad tree node, which represents a spatial index.
-
from_disk
(f_path)[source]¶ Constructs a quadtree index from a precomputed file and store it in the current node. Parameters: - f_path: a string containing the path to the precomputed index.
-
insert
(item, bbox)[source]¶ Inserts an item into the quadtree along with its bounding box. Parameters: - item: The item to insert into the index, which will be returned by the intersection method - bbox: The spatial bounding box tuple of the item, with four members (xmin,ymin,xmax,ymax)
-
intersect
(bbox, in_memory=False, debug=False)[source]¶ Intersects an input boundingbox rectangle with all of the items contained in the quadtree. Parameters: - bbox: A spatial bounding box tuple with four members (xmin,ymin,xmax,ymax) - in_memory (optional): A flag for using in_memory search with respect to file based search. - debug (optional): A flag that allows extra output when debugging. Returns: - A list of inserted items whose bounding boxes intersect with the input bbox.
-
-
epivizquindex.QuadTree.
box_contains
(box1, box2)[source]¶ Determin whether the box 1 contains box 2.
Parameters: - box1 (tuple): bottom left, top right coordinate of a bounding box. - box2 (tuple): bottom left, top right coordinate of a bounding box.
Returns: - box_contains (bool): whether the box 1 contains box 2.
-
epivizquindex.QuadTree.
box_intersect
(box1, box2)[source]¶ Determin whether the two bounding box intersect.
Parameters: - box1 (tuple): bottom left, top right coordinate of a bounding box. - box2 (tuple): bottom left, top right coordinate of a bounding box.
Returns: - box_intersect (bool): Whether the two bounding box intersect.
epivizquindex.sample module¶
epivizquindex.utils module¶
-
epivizquindex.utils.
get_genome
(t)[source]¶ Get the range of chromosomes of the given type. Currently these are read from hgdownload.cse.ucsc.edu.
Parameters: - t (str): type of gene.
Returns: - genome (dict): Dictionary of the range of the chromosome for the given type.
-
epivizquindex.utils.
hcoords
(x, chromLength, dims=2)[source]¶ Returns hilbert space coordinate of the input query.
Parameters: - x (int): A integer representing the query location in a chromosome. - chromLength (int): The total length of the chromosome. - dims (int): dimension of the hilbert space, by default we use 2d hilbert space.
Returns: - x (int): x coordinate in hilbert space. - y (int): y coordinate in hilbert space. - hlevel (int): level of the hilbert space.
-
epivizquindex.utils.
range2bbox
(hlevel, query, dims=2, margin=0)[source]¶ Convert the input query chromosome range to query bounding box in hilbert space.
Parameters: - hlevel (int): level of the hilbert space, calculated by the size of the chromosome. - query (dict): dictionary of a query range, with “start” and “end” representing the query range in a chromosome. - dims (int): dimension of the hilbert space, by default we use 2d hilbert space. - margin (int): margin of the query box in hilbert space.
Returns: - bbox (tuple): 4 integers representing the lower left and top right coordinate. The order is lower left x, y, then top right x, y.