bio-0.5: A bioinformatics library

Bio.Location.LocMap

Contents

Description

Efficient lookup of sequence positions and locations in a large map of target locations. For example, target locations might represent a collection of genes annotated on a chromosome. The LocMap would efficiently find which gene(s) overlapped a sequence position on that chromosome.

Target locations are assigned to one or more zones based on bounds. Query locations are then tested only against the target locations in the relevant zones.

Synopsis

Constructing location lookup maps

data LocMap a Source

Data structure allowing efficient lookup of target sequence locations that overlap a query location. Target locations can be paired with an arbitrary object.

Instances

fromList :: Offset -> [(Loc, a)] -> LocMap aSource

Create a LocMap from an association list of target locations.

Searching for target locations

lookupWithin :: Pos -> LocMap a -> [(Loc, a)]Source

Find the (possibly empty) list of target locations and associated objects that contain a sequence position, in the sense of isWithin

lookupOverlaps :: Loc -> LocMap a -> [(Loc, a)]Source

Find the (possibly empty) list of target locations and associated objects that overlap a sequence location, in the sense of overlaps

Modifying location lookup maps

delete :: Eq a => (Loc, a) -> LocMap a -> LocMap aSource

Remove a target location and object association from the map, if it is present. If it is present multiple times, only the first occurrence will be deleted.

deleteBy :: ((Loc, a) -> Bool) -> LocMap a -> LocMap aSource

Generalized version of delete that removes the first target location / object association that satisfies a predicate function.

insert :: Loc -> a -> LocMap a -> LocMap aSource

Insert a new target association into a target location map.

Utilities