Struct faimm::Fai [−][src]
pub struct Fai { /* fields omitted */ }
The object that stores the parsed fasta index file. You can use it to map chromosome names to indexes and lookup offsets for chr-start:end coordinates
Methods
impl Fai
[src]
impl Fai
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self>
[src]
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self>
Open a fasta index file from path P
.
pub fn offset(
&self,
tid: usize,
start: usize,
stop: usize
) -> Result<(usize, usize)>
[src]
pub fn offset(
&self,
tid: usize,
start: usize,
stop: usize
) -> Result<(usize, usize)>
Calculate the slice coordinates (byte offsets).
tid is the index of the chromosome (lookup with Fai::tid
if necessary.
start, end: zero based coordinates of the requested range.
Returns an tuple (start, end) if successful. io::Error
otherwise.
pub fn offset_tid(&self, tid: usize) -> Result<(usize, usize)>
[src]
pub fn offset_tid(&self, tid: usize) -> Result<(usize, usize)>
Calculate the slice coordinates (byte offsets).
tid is the index of the chromosome (lookup with Fai::tid
if necessary.
Returns an tuple (start, end) if successful. io::Error
otherwise.
pub fn tid(&self, name: &str) -> Option<usize>
[src]
pub fn tid(&self, name: &str) -> Option<usize>
Return the index of the chromosome by name in the fasta index.
Returns the position of chr name
if succesful, None otherwise.
pub fn size(&self, tid: usize) -> Result<usize>
[src]
pub fn size(&self, tid: usize) -> Result<usize>
Return the index of a chromosome in the fasta index.
Returns the size in bases as usize.
pub fn name(&self, tid: usize) -> Result<&String>
[src]
pub fn name(&self, tid: usize) -> Result<&String>
Return the name of the chromomsome at index tid
pub fn names(&self) -> Vec<&str>
[src]
pub fn names(&self) -> Vec<&str>
Return the names of the chromosomes from the fasta index in the same order as in the
.fai
. You can use Fai::tid
to map it back to an index.
Returns a Vec<&str>
with the chromosome names.
Trait Implementations
impl Debug for Fai
[src]
impl Debug for Fai
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for Fai
[src]
impl Clone for Fai