pub struct AnnotMap<R, T>where
    R: Hash + Eq,
{ /* private fields */ }
Expand description

Efficient container for querying annotations, using HashMap and IntervalTree.

The container is parameterized over the type of the reference sequence names R (which is often a String) and the type of the contained objects T.

The container finds annotations that overlap a specific query location. Overlaps are identified without regard for strandedness and without regard for e.g. spliced-out introns within the annotation or the query.

Thus, the overlapping annotations identified by querying a AnnotMap may need further filtering.

Implementations

Creates a new, empty AnnotMap.

extern crate bio;
use bio::data_structures::annot_map::AnnotMap;
let mut genes: AnnotMap<String,String> = AnnotMap::new();

Inserts an object into the container at a specified location.

Arguments

data is the data item to be inserted into the annotation map

location is the location associated with the data item.

extern crate bio_types;
extern crate bio;
use bio_types::strand::ReqStrand;
use bio_types::annot::contig::Contig;
use bio::data_structures::annot_map::AnnotMap;
let mut genes: AnnotMap<String,String> = AnnotMap::new();
let tma22 = Contig::new("chrX".to_owned(), 461829, 462426 - 461829, ReqStrand::Forward);
genes.insert_at("TMA22".to_owned(), &tma22);
let tma19 = Contig::new("chrXI".to_owned(), 334412, (334916 - 334412), ReqStrand::Reverse);
genes.insert_at("TMA19".to_owned(), &tma19);

Creates an Iterator that will visit all entries that overlap a query location.

Arguments

location is the annotation location to be searched for overlapping data items.

extern crate bio_types;
extern crate bio;
use bio_types::strand::ReqStrand;
use bio_types::annot::contig::Contig;
use bio::data_structures::annot_map::AnnotMap;
let mut genes: AnnotMap<String,String> = AnnotMap::new();
let tma22 = Contig::new("chrX".to_owned(), 461829, 462426 - 461829, ReqStrand::Forward);
genes.insert_at("TMA22".to_owned(), &tma22);
let tma19 = Contig::new("chrXI".to_owned(), 334412, (334916 - 334412), ReqStrand::Reverse);
genes.insert_at("TMA19".to_owned(), &tma19);
let query = Contig::new("chrX".to_owned(), 462400, 100, ReqStrand::Forward);
let hits: Vec<&String> = genes.find(&query).map(|e| e.data()).collect();
assert_eq!(hits, vec!["TMA22"]);
let query = Contig::new("chrXI".to_owned(), 334400, 100, ReqStrand::Forward);
let hits: Vec<&String> = genes.find(&query).map(|e| e.data()).collect();
assert_eq!(hits, vec!["TMA19"]);

Inserts an object with the Loc trait into the container at its location.

Argument

data is the data to be inserted based on its location.

Equivalent to inserting data at data.contig().

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.