Sequence::Fasta Class Reference
[Classes for sequence I/O]

FASTA sequence stream. More...

#include <Sequence/Fasta.hpp>

Inheritance diagram for Sequence::Fasta:
Sequence::Seq

List of all members.

Public Types

typedef std::string::iterator iterator
typedef std::string::const_iterator const_iterator
typedef std::string::reference reference
typedef
std::string::const_reference 
const_reference
typedef std::string::size_type size_type

Public Member Functions

 Fasta ()
 Fasta (const std::string &name, const std::string &seq)
 Fasta (const char *name, const char *seq)
 Fasta (const Seq &s)
 ~Fasta ()
std::istream & read (std::istream &s) throw (Sequence::badFormat,std::exception)
std::ostream & print (std::ostream &s) const
std::string GetName (void) const
std::string GetSeq (void) const
std::string substr (unsigned beg, unsigned len) const
std::string substr (unsigned beg) const
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
void Revcom (void)
void Subseq (unsigned, unsigned)
void Complement (void)
size_type length (void) const
size_type UngappedLength (void) const
bool IsGapped (void) const
reference operator[] (const size_type &i)
const_reference operator[] (const size_type &i) const
bool operator== (const Seq &rhs) const
bool operator!= (const Seq &rhs) const
 operator std::string () const
const char * c_str (void) const

Detailed Description

FASTA sequence stream.

Publicly derived from Sequence::Seq, this class defines how to read and print sequences in FASTA format, which looks like:
>sequence name 1
ATGATGATCAGATAGACATAGCAGATACATGT
>sequence name 2
ATGTTGGTTTTTTTTTAGAGATGTTTATAGGT
ETC...

Examples:

baseComp.cc, codons.cc, and valid_dna.cc.

Definition at line 49 of file Fasta.hpp.


Member Typedef Documentation

typedef std::string::const_iterator Sequence::Seq::const_iterator [inherited]

Const iterator to sequence elements. Iterators access the data, not the seuquence name. Value type de-references to char

Definition at line 72 of file Seq.hpp.

typedef std::string::iterator Sequence::Seq::iterator [inherited]

Iterator to sequence elements. Iterators access the data, not the seuquence name. Value type de-references to char

Definition at line 66 of file Seq.hpp.


Constructor & Destructor Documentation

Sequence::Fasta::Fasta (  )  [inline]

Generic constructor

Definition at line 53 of file Fasta.hpp.

Sequence::Fasta::Fasta ( const std::string &  name,
const std::string &  seq 
)

constructor for const std::string

Definition at line 31 of file Fasta.cc.

Sequence::Fasta::Fasta ( const char *  name,
const char *  seq 
)

constructor for const char *

Definition at line 37 of file Fasta.cc.

Sequence::Fasta::Fasta ( const Seq seq  ) 

copy constructor

Definition at line 43 of file Fasta.cc.

Sequence::Fasta::~Fasta (  )  [inline]

placeholder for vtable

Definition at line 57 of file Fasta.hpp.


Member Function Documentation

Seq::const_iterator Sequence::Seq::begin (  )  const [inherited]
Returns:
a const iterator to the beginning of the sequence

Definition at line 209 of file Seq.cc.

Seq::iterator Sequence::Seq::begin (  )  [inherited]
Returns:
an iterator to the beginning of the sequence
Examples:
valid_dna.cc.

Definition at line 193 of file Seq.cc.

const char * Sequence::Seq::c_str ( void   )  const [inherited]
Returns:
the the C-style string representing the sequence as a cont char *

Definition at line 225 of file Seq.cc.

void Sequence::Seq::Complement ( void   )  [inherited]

Complement the Sequence

Note:
This modifies the data in the object by changing the std::string--if you want to keep the original sequence, you need to make a copy of the object first.

Definition at line 169 of file Seq.cc.

Seq::const_iterator Sequence::Seq::end (  )  const [inherited]
Returns:
a const iterator to the end of the sequence

Definition at line 217 of file Seq.cc.

Seq::iterator Sequence::Seq::end (  )  [inherited]
Returns:
an iterator to the end of the sequence
Examples:
valid_dna.cc.

Definition at line 201 of file Seq.cc.

std::string Sequence::Seq::GetName ( void   )  const [inherited]

Return the sequence name

Examples:
baseComp.cc.

Definition at line 45 of file Seq.cc.

std::string Sequence::Seq::GetSeq ( void   )  const [inherited]

Return the sequence itself

Definition at line 53 of file Seq.cc.

bool Sequence::Seq::IsGapped ( void   )  const [inherited]

Returns 1 if the sequence contaings the gap character '-', 0 otherwise

Definition at line 145 of file Seq.cc.

Seq::size_type Sequence::Seq::length ( void   )  const [inherited]

Return the total length of the sequence

Examples:
codons.cc.

Definition at line 77 of file Seq.cc.

Sequence::Seq::operator std::string (  )  const [inherited]

allows (implict) cast to std::string

Definition at line 127 of file Seq.cc.

bool Sequence::Seq::operator!= ( const Seq rhs  )  const [inherited]
Returns:
false if the sequences contain the same data, true otherwise.
Note:
only the sequences (i.e. this->second and rhs.second) are compared

Definition at line 117 of file Seq.cc.

bool Sequence::Seq::operator== ( const Seq rhs  )  const [inherited]
Returns:
true if the sequences contain the same data, false otherwise.
Note:
only the sequences (i.e. this->second and rhs.second) are compared

Definition at line 107 of file Seq.cc.

Seq::const_reference Sequence::Seq::operator[] ( const size_type &  i  )  const [inherited]

Return the i-th element of the sequence.

Note:
range-checking is done by assert()

Definition at line 97 of file Seq.cc.

Seq::reference Sequence::Seq::operator[] ( const size_type &  i  )  [inherited]

Return the i-th element of the sequence.

Note:
range-checking is done by assert()

Definition at line 86 of file Seq.cc.

std::ostream & Sequence::Fasta::print ( std::ostream &  s  )  const [virtual]
Parameters:
stream a std::ostream write the sequence in FASTA format to stream

Implements Sequence::Seq.

Definition at line 99 of file Fasta.cc.

std::istream & Sequence::Fasta::read ( std::istream &  s  )  throw (Sequence::badFormat,std::exception) [virtual]
Exceptions:
Sequence::SeqException if memory can't be allocated. (This is because the data are temporarily read into char *, because that was found to be faster).
Sequence::badFormat if the input stream is not in FASTA format

Implements Sequence::Seq.

Definition at line 47 of file Fasta.cc.

void Sequence::Seq::Revcom ( void   )  [inherited]

Reverse and complement the sequence.

Note:
This function modifies the data in the object by changing the std::string--if you want to keep the original sequence, you need to make a copy of the object first.
Returns:
*this

Definition at line 180 of file Seq.cc.

void Sequence::Seq::Subseq ( unsigned  beg,
unsigned  length 
) [inherited]
Parameters:
beg the index along the sequence at which the substring begins
length the length of the subseq Acts via std::string.substr(). Note that this modifies the data in the object by changing thestd::string--if you want to keep the original sequence, you need to make a copy of the object first.
Note:
range-checking done by assert()

Definition at line 154 of file Seq.cc.

std::string Sequence::Seq::substr ( unsigned  beg  )  const [inherited]

Mimics the standardstd::string member function of the same name.

Definition at line 69 of file Seq.cc.

std::string Sequence::Seq::substr ( unsigned  beg,
unsigned  len 
) const [inherited]

Mimics the std::string member function of the same name.

Definition at line 61 of file Seq.cc.

Seq::size_type Sequence::Seq::UngappedLength ( void   )  const [inherited]

Return length of sequence, excluding the gap character '-'

Definition at line 136 of file Seq.cc.


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

Generated on Mon Jul 12 15:22:03 2010 for libsequence by  doxygen 1.6.1