42 #include "../Alphabet/CodonAlphabet.h"
43 #include "../SymbolListTools.h"
63 for (
size_t i = 0; i < size; ++i)
74 const vector<string>& seqNames)
76 SequenceContainer* sc = createContainerOfSpecifiedSize(alphabet, seqNames.size());
89 for (
size_t i = 0; i < selection.size(); i++)
99 const std::vector<std::string>& selection,
103 for (
size_t i = 0; i < selection.size(); i++)
124 for (
size_t i = 0; i < names.size(); i++)
129 for (
size_t j = 0; j < selection.size() && !test; j++)
131 test = (selection[j] == i);
144 if (seqNames.size() <= 1)
147 for (
size_t i = 1; i < seqNames.size(); i++)
170 n +=
static_cast<double>(seq.
size());
176 n +=
static_cast<double>(seq.
size());
179 throw Exception(
"SequenceContainerTools::getFrequencies : unknown SequenceContainer type.");
182 if (pseudoCount != 0)
185 for (
int i = 0; i < static_cast<int>(pA->
getSize()); i++)
190 n += pseudoCount *
static_cast<double>(pA->
getSize());
195 i.second = i.second / n;
206 for (
size_t i = 0; i < seq.
size(); i++)
219 throw AlphabetException(
"SequenceContainerTools::getCodonPosition. Input sequences should be of type codon.");
224 vector<int> newseq(seq.
size());
225 for (
size_t i = 0; i < seq.
size(); i++)
The alphabet exception base class.
virtual unsigned int getSize() const =0
Get the number of resolved states in the alphabet (e.g. return 4 for DNA alphabet)....
A basic implementation of the Sequence interface.
const NucleicAlphabet *const getNucleicAlphabet() const
int getNPosition(int codon, size_t pos) const
Get the int code of the n-position of a word given its int description.
virtual size_t size() const =0
Get the number of elements in the list.
The OrderedSequenceContainer interface.
virtual const Sequence & getSequence(size_t sequenceIndex) const =0
Retrieve a sequence object from the container.
virtual std::shared_ptr< Sequence > removeSequence(size_t sequenceIndex)=0
Extract (and remove) a sequence from the container.
The ProbabilisticSequenceContainer interface.
virtual const ProbabilisticSequence & getSequence(const std::string &name) const =0
Retrieve a probabilistic sequence object from the container.
The probabilistic sequence interface.
The SequenceContainer interface.
virtual void addSequence(const Sequence &sequence, bool checkName)=0
Add a sequence to the container.
virtual const Sequence & getSequence(const std::string &name) const =0
Retrieve a sequence object from the container.
virtual void setSequenceNames(const std::vector< std::string > &names, bool checkNames)=0
Set all sequence names.
virtual const Alphabet * getAlphabet() const =0
Get container's alphabet.
virtual const Comments & getComments(const std::string &name) const =0
Get comments of a particular sequence.
virtual size_t getNumberOfSequences() const =0
Get the number of sequences in the container.
virtual std::vector< std::string > getSequenceNames() const =0
Get all the names of the sequences in the container.
virtual bool hasSequence(const std::string &name) const =0
Check if a sequence with a given name is present in the container.
The VectorSequenceContainer class.
virtual void addSequence(const Sequence &sequence, bool checkName=true)
Add a sequence at the end of the container.
std::string toString(T t)
This alphabet is used to deal NumericAlphabet.
std::vector< size_t > SequenceSelection