[][src]Struct bio::data_structures::annot_map::AnnotMap

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

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.

Methods

impl<R, T> AnnotMap<R, T> where
    R: Eq + Hash
[src]

pub fn new() -> Self[src]

Creates a new, empty AnnotMap.

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

pub fn insert_at<L>(&mut self, data: T, location: &L) where
    R: Eq + Hash + Clone,
    L: Loc<RefID = R>, 
[src]

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);

Important traits for AnnotMapIterator<'a, R, T>
pub fn find<'a, L>(&'a self, location: &'a L) -> AnnotMapIterator<'a, R, T> where
    L: Loc<RefID = R>, 
[src]

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"]);

impl<R, T> AnnotMap<R, T> where
    R: Eq + Hash + Clone,
    T: Loc<RefID = R>, 
[src]

pub fn insert_loc(&mut self, data: T)[src]

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

impl<R: Clone, T: Clone> Clone for AnnotMap<R, T> where
    R: Hash + Eq
[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<R: Debug, T: Debug> Debug for AnnotMap<R, T> where
    R: Hash + Eq
[src]

Auto Trait Implementations

impl<R, T> Sync for AnnotMap<R, T> where
    R: Sync,
    T: Sync

impl<R, T> Unpin for AnnotMap<R, T> where
    R: Unpin,
    T: Unpin

impl<R, T> Send for AnnotMap<R, T> where
    R: Send,
    T: Send

impl<R, T> UnwindSafe for AnnotMap<R, T> where
    R: RefUnwindSafe + UnwindSafe,
    T: RefUnwindSafe + UnwindSafe

impl<R, T> RefUnwindSafe for AnnotMap<R, T> where
    R: RefUnwindSafe,
    T: RefUnwindSafe

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]