MDA
|
The base class for a SequenceSet. More...
#include <SequenceSet_basic.hpp>
Public Types | |
typedef SequenceType | value_type |
The sequence type used in the object. | |
Public Member Functions | |
Constructors & Destructors | |
SequenceSetBase () | |
Constructor. | |
SequenceSetBase (size_t value) | |
virtual | ~SequenceSetBase () |
Destructor. | |
Basic methods | |
const SequenceType * | seq (unsigned int index) const |
Returns a sequence. More... | |
size_t | n_seqs () const |
returns the number of sequences. More... | |
size_t | size () const |
returns the number of sequences. More... | |
size_t | length () const |
Returns the length of the sequence inside. More... | |
double | avg_size () const |
The average size of the sequence set. More... | |
bool | empty () const |
Returns true if no sequences are contained in this object. | |
std::string | file () const |
Returns the file the sequences were read from. | |
char | seq_type () const throw () |
Returns type. More... | |
void | seq_type (char seq_type_) throw () |
Sets the sequence type. More... | |
int | id () const throw () |
Returns the id of the set. More... | |
void | id (int val) |
Sets the id of the sequence set. More... | |
void | clear () |
Sets everything to 0. | |
Input & Output | |
virtual void | read (const std::string &seq_f, const std::vector< std::string > &seq_names, bool check=false, short format=-1) |
Extracts a subalignment from the sequence set. More... | |
virtual void | read (const std::string &seq_f, bool check=false, short format=-1) |
Reads a set of sequences. More... | |
virtual void | write (const std::string &seq_f, const std::string format) const |
Writes the sequences into a file. More... | |
void | add_seq (SequenceType *seq) |
Append a sequence to a set. More... | |
Manipulation methods | |
void | to_upper () |
Turns all characters to uppercase. | |
void | to_lower () |
Turns all characters to lowercase. | |
virtual void | delete_seqs (const std::map< std::string, bool > &names) |
Deletes sequences from the alignment. More... | |
virtual void | delete_seqs (std::vector< size_t > &indices) |
Deletes sequences from the alignment. More... | |
virtual void | keep_seqs (std::vector< size_t > &indices) |
Deletes sequences if they are not in the given list. More... | |
void | share (const SequenceSetBase< SequenceType, MemoryType > &set, size_t id) |
Shares a sequence between two sets. More... | |
void | transfer (SequenceSetBase< SequenceType, MemoryType > &set, size_t id) |
Transfer a sequence from one set to another. More... | |
void | transfer (SequenceSetBase< SequenceType, MemoryType > &set) |
Transfers all sequences from one set to another. More... | |
void | sort (std::string type) |
Sorts the sequences. More... | |
void | insert_gaps (const std::string &edit_string) |
Inserts gaps into each sequence. More... | |
Operators | |
SequenceType & | operator[] (unsigned int index) |
Operator to access the sequence. More... | |
const SequenceType & | operator[] (unsigned int index) const |
SequenceType & | operator[] (const std::string &seq_name) |
Access a function by name. More... | |
const SequenceType & | operator[] (const std::string &seq_name) const |
template<typename SeqType , typename MemType > | |
std::ostream & | operator<< (std::ostream &out, const SequenceSetBase< SeqType, MemType > &seqSet) |
The base class for a SequenceSet.
SequenceType | The type of Sequence to be stored inside (Sequence, ProteinSequence or DNASequence). |
MemoryType | The memory mode to use for the sequence set (Default or MemSafe). |
|
inline |
Append a sequence to a set.
seq | A pointer to the new sequence. |
double MDAT::SequenceSetBase< SequenceType, MemoryType >::avg_size | ( | ) | const |
The average size of the sequence set.
|
virtual |
Deletes sequences from the alignment.
names | The names of the sequences to delete |
|
virtual |
Deletes sequences from the alignment.
indices | The indices of the sequences to delete. |
|
inline |
Returns the id of the set.
|
inline |
Sets the id of the sequence set.
val | The id |
void MDAT::SequenceSetBase< SequenceType, MemoryType >::insert_gaps | ( | const std::string & | edit_string | ) |
Inserts gaps into each sequence.
edit_string | The matter of matches and gaps in reverse order |
|
virtual |
Deletes sequences if they are not in the given list.
indices | The indices of the sequences to keep. |
|
inline |
Returns the length of the sequence inside.
Returns the length of the first sequence or 0 if not existant.
|
inline |
returns the number of sequences.
|
inline |
Operator to access the sequence.
index | The sequence position to return. |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
virtual |
Extracts a subalignment from the sequence set.
Only sequences which are denoted in seq_names are extracted. Names in seq_names not occurring in the alignment are ignored. Columns consisting of gaps only are removed.
seq_f | The file of the sequences to read. |
seq_names | The names to read. |
format | The format of the alignment. (-1 enables automatic format detection) |
check | Checks if the sequence is a proper biological sequence |
|
inlinevirtual |
Reads a set of sequences.
This function can read unaligned sequences in FASTA format as well as aligned sequences in several formats.
seq_f | The file with the sequences to read. |
format | The format of the alignment. (-1 enables automatic format detection) |
check | Checks if the sequence is a proper biological sequence |
|
inline |
Returns a sequence.
index | Index of the sequence. |
|
inline |
Returns type.
|
inline |
Sets the sequence type.
seq_type_ | The sequence type. |
|
inline |
Shares a sequence between two sets.
set | The set to take the sequence from. |
id | The index of the sequence. |
|
inline |
returns the number of sequences.
void MDAT::SequenceSetBase< SequenceType, MemoryType >::sort | ( | std::string | type | ) |
Sorts the sequences.
type | "input" sorts the sequences by order of the input. "name" sorts by sequence name. "seq" sorts the sequences by alphabetical order. |
|
inline |
Transfer a sequence from one set to another.
set | The set to take the sequence from. |
id | The index of the sequence. |
|
inline |
Transfers all sequences from one set to another.
set | The set to take the sequence from. |
|
virtual |
Writes the sequences into a file.
This function supports the following formats: FASTA, MSF.
seq_f | The file to write the alignment to |
format | The format to use (fasta, clustalw, msf, phylip_i, phylip_s) |
|
friend |
Simple print of a SequenceSet in fasta format.
out[in|out] | The output stream. |
seqSet[in] | The sequence set |