yat  0.14.5pre
Classes | Public Member Functions | List of all members
theplu::yat::omic::Fasta Class Reference

wrapper class around struct faidx_t in libhts More...

#include <yat/omic/Fasta.h>

Classes

class  Sequence
 

Public Member Functions

 Fasta (const std::string &fn)
 
bool present (const std::string &name) const
 
std::string name (size_t i) const
 
int nseq (void) const
 
int sequence_length (const std::string &name) const
 
Sequence sequence (const std::string &chr) const
 
Sequence sequence (const std::string &chr, int beg, int end) const
 

Detailed Description

wrapper class around struct faidx_t in libhts

Class handling a fasta file. Class assumes the fasta file has an index file created by e.g. 'samtools faidx'.

Since
New in yat 0.14

Constructor & Destructor Documentation

theplu::yat::omic::Fasta::Fasta ( const std::string &  fn)

Tries to open index for fasta file fn. It is assumed that the index file is called fn + ".fai". If open fails, constructor tries to create an index file from fasta file fn (see fai_build in htslib). If that also fails, an exception is thrown.

Exceptions
utility::runtime_errorif open fails

Member Function Documentation

std::string theplu::yat::omic::Fasta::name ( size_t  i) const
Returns
name of sequence i
int theplu::yat::omic::Fasta::nseq ( void  ) const
Returns
number of sequences
bool theplu::yat::omic::Fasta::present ( const std::string &  name) const
Returns
true if there exist a sequence called name
Sequence theplu::yat::omic::Fasta::sequence ( const std::string &  chr) const
Returns
entire sequence from sequence chr
Sequence theplu::yat::omic::Fasta::sequence ( const std::string &  chr,
int  beg,
int  end 
) const
Parameters
chrsequence name
begbeginning position (0-based)
endend position (0-based)
Returns
sub-sequence of chr as indicated by beg and end
int theplu::yat::omic::Fasta::sequence_length ( const std::string &  name) const
Returns
length of sequence with name name
Exceptions
utility::runtime_errorif there is no sequence named name

The documentation for this class was generated from the following file:

Generated on Tue Sep 26 2017 02:33:30 for yat by  doxygen 1.8.5