CMAPLE 1.0.0
C++ MAximum Parsimonious Likelihood Estimation
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
cmaple::Alignment Class Reference

#include <alignment.h>

Public Types

enum  InputType {
  IN_FASTA , IN_PHYLIP , IN_MAPLE , IN_AUTO ,
  IN_UNKNOWN
}
 

Public Member Functions

 Alignment ()
 Default constructor.
 
 Alignment (std::istream &aln_stream, const std::string &ref_seq="", const InputType format=IN_AUTO, const cmaple::SeqRegion::SeqType seqtype=cmaple::SeqRegion::SEQ_AUTO)
 Constructor from a stream of an alignment in FASTA, PHYLIP, or MAPLE format.
 
 Alignment (const std::string &aln_filename, const std::string &ref_seq="", const InputType format=IN_AUTO, const cmaple::SeqRegion::SeqType seqtype=cmaple::SeqRegion::SEQ_AUTO)
 Constructor from an alignment file in FASTA, PHYLIP, or MAPLE format.
 
 ~Alignment ()
 Destructor.
 
void read (std::istream &aln_stream, const std::string &ref_seq="", const InputType format=IN_AUTO, const cmaple::SeqRegion::SeqType seqtype=cmaple::SeqRegion::SEQ_AUTO)
 Read an alignment from a stream in FASTA, PHYLIP, or MAPLE format.
 
void read (const std::string &aln_filename, const std::string &ref_seq="", const InputType format=IN_AUTO, const cmaple::SeqRegion::SeqType seqtype=cmaple::SeqRegion::SEQ_AUTO)
 Read an alignment from a file in FASTA, PHYLIP, or MAPLE format.
 
void write (std::ostream &aln_stream, const InputType &format=IN_MAPLE)
 Write the alignment to a stream in FASTA, PHYLIP, or MAPLE format.
 
void write (const std::string &aln_filename, const InputType &format=IN_MAPLE, const bool overwrite=false)
 Write the alignment to a file in FASTA, PHYLIP, or MAPLE format.
 

Detailed Description

Class presents the input alignment

Member Enumeration Documentation

◆ InputType

Alignment format

Enumerator
IN_FASTA 

FASTA format

IN_PHYLIP 

PHYLIP format

IN_MAPLE 

MAPLE format

IN_AUTO 

Auto detect

IN_UNKNOWN 

Unknown format

Constructor & Destructor Documentation

◆ Alignment() [1/2]

cmaple::Alignment::Alignment ( std::istream &  aln_stream,
const std::string &  ref_seq = "",
const InputType  format = IN_AUTO,
const cmaple::SeqRegion::SeqType  seqtype = cmaple::SeqRegion::SEQ_AUTO 
)

Constructor from a stream of an alignment in FASTA, PHYLIP, or MAPLE format.

Parameters
[in]aln_streamA stream of an alignment file
[in]ref_seqA reference sequence (optional). If not specified, it will be read from the alignment (in MAPLE format) or automatically generated from the alignment (in FASTA or PHYLIP format)
[in]formatFormat of the alignment (optional): IN_MAPLE, IN_FASTA, IN_PHYLIP, or IN_AUTO (auto detection)
[in]seqtypeData type of sequences (optional): SEQ_DNA (nucleotide data), SEQ_PROTEIN (amino acid data), or SEQ_AUTO (auto detection)
Exceptions
std::invalid_argumentif any of the following situations occur.
  • the alignment is empty or in an incorrect format
  • the sequences contain invalid states

◆ Alignment() [2/2]

cmaple::Alignment::Alignment ( const std::string &  aln_filename,
const std::string &  ref_seq = "",
const InputType  format = IN_AUTO,
const cmaple::SeqRegion::SeqType  seqtype = cmaple::SeqRegion::SEQ_AUTO 
)

Constructor from an alignment file in FASTA, PHYLIP, or MAPLE format.

Parameters
[in]aln_filenameName of an alignment file
[in]ref_seqA reference sequence (optional). If not specified, it will be read from the alignment (in MAPLE format) or automatically generated from the alignment (in FASTA or PHYLIP format)
[in]formatFormat of the alignment (optional): IN_MAPLE, IN_FASTA, IN_PHYLIP, or IN_AUTO (auto detection)
[in]seqtypeData type of sequences (optional): SEQ_DNA (nucleotide data), SEQ_PROTEIN (amino acid data), or SEQ_AUTO (auto detection)
Exceptions
std::invalid_argumentif any of the following situations occur.
  • the alignment is empty or in an incorrect format
  • the sequences contain invalid states
std::ios_base::failureif the alignment file is not found

Member Function Documentation

◆ read() [1/2]

void cmaple::Alignment::read ( std::istream &  aln_stream,
const std::string &  ref_seq = "",
const InputType  format = IN_AUTO,
const cmaple::SeqRegion::SeqType  seqtype = cmaple::SeqRegion::SEQ_AUTO 
)

Read an alignment from a stream in FASTA, PHYLIP, or MAPLE format.

Parameters
[in]aln_streamA stream of an alignment file
[in]ref_seqA reference sequence (optional). If not specified, it will be read from the alignment (in MAPLE format) or automatically generated from the alignment (in FASTA or PHYLIP format)
[in]formatFormat of the alignment (optional): IN_MAPLE, IN_FASTA, IN_PHYLIP, or IN_AUTO (auto detection)
[in]seqtypeData type of sequences (optional): SEQ_DNA (nucleotide data), SEQ_PROTEIN (amino acid data), or SEQ_AUTO (auto detection)
Exceptions
std::invalid_argumentif any of the following situations occur.
  • the alignment is empty or in an incorrect format
  • the sequences contain invalid states

◆ read() [2/2]

void cmaple::Alignment::read ( const std::string &  aln_filename,
const std::string &  ref_seq = "",
const InputType  format = IN_AUTO,
const cmaple::SeqRegion::SeqType  seqtype = cmaple::SeqRegion::SEQ_AUTO 
)

Read an alignment from a file in FASTA, PHYLIP, or MAPLE format.

Parameters
[in]aln_filenameName of an alignment file
[in]ref_seqA reference sequence (optional). If not specified, it will be read from the alignment (in MAPLE format) or automatically generated from the alignment (in FASTA or PHYLIP format)
[in]formatFormat of the alignment (optional): IN_MAPLE, IN_FASTA, IN_PHYLIP, or IN_AUTO (auto detection)
[in]seqtypeData type of sequences (optional): SEQ_DNA (nucleotide data), SEQ_PROTEIN (amino acid data), or SEQ_AUTO (auto detection)
Exceptions
std::invalid_argumentif any of the following situations occur.
  • the alignment is empty or in an incorrect format
  • the sequences contain invalid states
std::ios_base::failureif the alignment file is not found

◆ write() [1/2]

void cmaple::Alignment::write ( std::ostream &  aln_stream,
const InputType format = IN_MAPLE 
)

Write the alignment to a stream in FASTA, PHYLIP, or MAPLE format.

Parameters
[in]aln_streamA stream of the output alignment file
[in]formatFormat of the output alignment (optional): IN_MAPLE, IN_FASTA, or IN_PHYLIP
Exceptions
std::invalid_argumentif the format is unknown
std::logic_errorif the alignment is empty (i.e., nothing to write)

◆ write() [2/2]

void cmaple::Alignment::write ( const std::string &  aln_filename,
const InputType format = IN_MAPLE,
const bool  overwrite = false 
)

Write the alignment to a file in FASTA, PHYLIP, or MAPLE format.

Parameters
[in]aln_filenameName of the output alignment file
[in]formatFormat of the output alignment (optional): IN_MAPLE, IN_FASTA, or IN_PHYLIP
[in]overwriteTRUE to overwrite the existing output file (optional)
Exceptions
std::invalid_argumentif any of the following situations occur.
  • aln_filename is empty
  • format is unknown
std::logic_errorif the alignment is empty (i.e., nothing to write)
std::ios_base::failureif aln_filename already exists and overwrite = false

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