libsequence  1.9.5
Sequence::Seq Class Referenceabstract

Abstract interface to sequence objects. More...

#include <Sequence/Seq.hpp>

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

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

 Seq (void)
 
template<typename T >
 Seq (T &&name_, T &&seq_)
 
 Seq (const char *n, const char *s)
 
 Seq (const Seq &seq)=default
 
 Seq (Seq &&seq)=default
 
std::string GetName (void) const
 
std::string GetSeq (void) const
 
std::string substr (std::string::size_type beg, std::string::size_type len) const
 
std::string substr (std::string::size_type beg) const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
void Revcom (void)
 
void Subseq (const unsigned &, const unsigned &)
 
void Complement (void)
 
size_type length (void) const
 
size_type size (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
 
Seqoperator= (const Seq &rhs)=default
 
Seqoperator= (Seq &&rhs)=default
 
 operator std::string () const
 
const char * c_str (void) const
 
virtual std::istream & read (std::istream &s)=0
 
virtual std::ostream & print (std::ostream &s) const =0
 

Public Attributes

std::string name
 
std::string seq
 

Detailed Description

Abstract interface to sequence objects.

Abstract interface to sequence objects. A sequence consists of a name and a sequence, both of which are stored as C++ std::strings. Most of the rest of the member functions of this class are to make the behavior of Sequence::Seq more "std::string"-like.

Definition at line 46 of file Seq.hpp.

Member Typedef Documentation

◆ const_iterator

typedef std::string::const_iterator Sequence::Seq::const_iterator

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

Definition at line 83 of file Seq.hpp.

◆ iterator

typedef std::string::iterator Sequence::Seq::iterator

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

Definition at line 77 of file Seq.hpp.

Constructor & Destructor Documentation

◆ Seq()

Sequence::Seq::Seq ( void  )

creates an empty sequence

Definition at line 32 of file Seq.cc.

Member Function Documentation

◆ begin() [1/2]

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

Definition at line 189 of file Seq.cc.

◆ begin() [2/2]

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

Definition at line 207 of file Seq.cc.

◆ c_str()

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

Definition at line 243 of file Seq.cc.

◆ cbegin()

Seq::const_iterator Sequence::Seq::cbegin ( ) const
Returns
a const iterator to the beginning of the sequence

Definition at line 225 of file Seq.cc.

◆ cend()

Seq::const_iterator Sequence::Seq::cend ( ) const
Returns
a const iterator to the end of the sequence

Definition at line 234 of file Seq.cc.

◆ Complement()

void Sequence::Seq::Complement ( void  )

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 163 of file Seq.cc.

◆ end() [1/2]

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

Definition at line 198 of file Seq.cc.

◆ end() [2/2]

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

Definition at line 216 of file Seq.cc.

◆ GetName()

std::string Sequence::Seq::GetName ( void  ) const
Deprecated:
Access first directly

◆ GetSeq()

std::string Sequence::Seq::GetSeq ( void  ) const
Deprecated:
Access second directly

◆ IsGapped()

bool Sequence::Seq::IsGapped ( void  ) const

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

Definition at line 137 of file Seq.cc.

◆ length()

Seq::size_type Sequence::Seq::length ( void  ) const

Return the total length of the sequence in bytes

Examples:
codons.cc.

Definition at line 58 of file Seq.cc.

◆ operator std::string()

Sequence::Seq::operator std::string ( ) const

allows (implict) cast to std::string

Definition at line 117 of file Seq.cc.

◆ operator!=()

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

Definition at line 107 of file Seq.cc.

◆ operator==()

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

Definition at line 96 of file Seq.cc.

◆ operator[]() [1/2]

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

Return the i-th element of the sequence.

Note
range-checking is done by assert()

Definition at line 75 of file Seq.cc.

◆ operator[]() [2/2]

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

Return the i-th element of the sequence.

Note
range-checking is done by assert()

Definition at line 85 of file Seq.cc.

◆ print()

virtual std::ostream& Sequence::Seq::print ( std::ostream &  s) const
pure virtual

read an object of type Sequence::Seq from an istream

Implemented in Sequence::Fasta, and Sequence::fastq.

◆ read()

virtual std::istream& Sequence::Seq::read ( std::istream &  s)
pure virtual

read an object of type Sequence::Seq from an istream

Implemented in Sequence::Fasta, and Sequence::fastq.

◆ Revcom()

void Sequence::Seq::Revcom ( void  )

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 175 of file Seq.cc.

◆ size()

Seq::size_type Sequence::Seq::size ( void  ) const

Return the total length of the sequence in bytes

Definition at line 67 of file Seq.cc.

◆ Subseq()

void Sequence::Seq::Subseq ( const unsigned &  beg,
const unsigned &  length 
)
Parameters
begthe index along the sequence at which the substring begins
lengththe 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 147 of file Seq.cc.

◆ substr() [1/2]

std::string Sequence::Seq::substr ( std::string::size_type  beg,
std::string::size_type  len 
) const
Deprecated:
access .second.substr directly

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

Definition at line 40 of file Seq.cc.

◆ substr() [2/2]

std::string Sequence::Seq::substr ( std::string::size_type  beg) const
Deprecated:
access .second.substr directly

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

Definition at line 49 of file Seq.cc.

◆ UngappedLength()

Seq::size_type Sequence::Seq::UngappedLength ( void  ) const

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

Definition at line 126 of file Seq.cc.


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