bpp-popgen3
3.0.0
|
Utilitary function to manipulate PolymorphismSequenceContainer. More...
#include <Bpp/PopGen/PolymorphismSequenceContainerTools.h>
Public Member Functions | |
virtual | ~PolymorphismSequenceContainerTools () |
Static Public Member Functions | |
static std::unique_ptr< PolymorphismSequenceContainer > | read (const std::string &path, std::shared_ptr< const Alphabet > alpha) |
Read a Mase+ file and return a PolymorphismSequenceContainer. Toggle Sequence when selection tag begin with OUTGROUP (see Polymorphix) More... | |
static std::unique_ptr< PolymorphismSequenceContainer > | extractIngroup (const PolymorphismSequenceContainer &psc) |
Extract ingroup sequences from a PolymorphismSequenceContainer and create a new one. More... | |
static std::unique_ptr< PolymorphismSequenceContainer > | extractOutgroup (const PolymorphismSequenceContainer &psc) |
Extract outgroup sequences from a PolymorphismSequenceContainer and create a new one. More... | |
static std::unique_ptr< PolymorphismSequenceContainer > | extractGroup (const PolymorphismSequenceContainer &psc, size_t groupId) |
Extract a special group from the PolymorphismSequenceContainer. More... | |
static std::unique_ptr< PolymorphismSequenceContainer > | getSelectedSequences (const PolymorphismSequenceContainer &psc, const SequenceSelection &ss) |
Extract selected sequences. More... | |
static std::unique_ptr< PolymorphismSequenceContainer > | sample (const PolymorphismSequenceContainer &psc, size_t n, bool replace=true) |
Get a random set of sequences. More... | |
static std::unique_ptr< PolymorphismSequenceContainer > | getSitesWithoutGaps (const PolymorphismSequenceContainer &psc) |
Retrieves sites without gaps from PolymorphismSequenceContainer. More... | |
static size_t | getNumberOfNonGapSites (const PolymorphismSequenceContainer &psc, bool ingroup) |
Return number of sites without gaps in a PolymorphismSequenceContainer. More... | |
static size_t | getNumberOfCompleteSites (const PolymorphismSequenceContainer &psc, bool ingroup) |
Return number of completely resolved sites in a PolymorphismSequenceContainer. More... | |
static std::unique_ptr< PolymorphismSequenceContainer > | getCompleteSites (const PolymorphismSequenceContainer &psc) |
Retrieves complete sites from a PolymorphismSequenceContainer. More... | |
static std::unique_ptr< PolymorphismSequenceContainer > | excludeFlankingGap (const PolymorphismSequenceContainer &psc) |
exclude flanking sites with gap but keep gap sites within the alignment More... | |
static std::unique_ptr< PolymorphismSequenceContainer > | getSelectedSites (const PolymorphismSequenceContainer &psc, const std::string &setName, bool phase) |
Get a PolymorphismSequenceContainer corresponding to a site selection annotated in the mase comments. More... | |
static std::unique_ptr< PolymorphismSequenceContainer > | getNonCodingSites (const PolymorphismSequenceContainer &psc, const std::string &setName) |
Retrieve non-coding sites defined in the mase file header. More... | |
static std::unique_ptr< PolymorphismSequenceContainer > | getOnePosition (const PolymorphismSequenceContainer &psc, const std::string &setName, size_t pos) |
Retrieve sites at one codon position (1,2,3) More... | |
static std::unique_ptr< PolymorphismSequenceContainer > | getIntrons (const PolymorphismSequenceContainer &psc, const std::string &setName, const GeneticCode &gCode) |
Retrieve intron sites. More... | |
static std::unique_ptr< PolymorphismSequenceContainer > | get5Prime (const PolymorphismSequenceContainer &psc, const std::string &setName) |
Retrieve 5' sites. More... | |
static std::unique_ptr< PolymorphismSequenceContainer > | get3Prime (const PolymorphismSequenceContainer &psc, const std::string &setName, const GeneticCode &gCode) |
Retrieve 3' sites. More... | |
static std::string | getIngroupSpeciesName (const PolymorphismSequenceContainer &psc) |
Get the species name of the ingroup. More... | |
static std::unique_ptr< PolymorphismSequenceContainer > | getSynonymousSites (const PolymorphismSequenceContainer &psc, const GeneticCode &gCode) |
Retrieve synonymous codon sites. More... | |
static std::unique_ptr< PolymorphismSequenceContainer > | getNonSynonymousSites (const PolymorphismSequenceContainer &psc, const GeneticCode &gCode) |
Retrieve non-synonymous codon sites. More... | |
Utilitary function to manipulate PolymorphismSequenceContainer.
Definition at line 38 of file PolymorphismSequenceContainerTools.h.
|
virtual |
Definition at line 12 of file PolymorphismSequenceContainerTools.cpp.
|
static |
exclude flanking sites with gap but keep gap sites within the alignment
psc | a PolymorphismSequenceContainer reference |
Definition at line 257 of file PolymorphismSequenceContainerTools.cpp.
References bpp::SiteTools::hasGap().
|
static |
Extract a special group from the PolymorphismSequenceContainer.
psc | a PolymorphismSequenceContainer reference. |
groupId | the group identifier as an size_t. |
GroupNotFoundException | if group_id is not found. |
Definition at line 89 of file PolymorphismSequenceContainerTools.cpp.
References bpp::PolymorphismSequenceContainer::getGroupId(), and bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSequences().
|
static |
Extract ingroup sequences from a PolymorphismSequenceContainer and create a new one.
psc | a PolymorphismSequenceContainer reference |
Exception | if there is no ingroup sequence |
Definition at line 43 of file PolymorphismSequenceContainerTools.cpp.
References bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSequences(), and bpp::PolymorphismSequenceContainer::isIngroupMember().
|
static |
Extract outgroup sequences from a PolymorphismSequenceContainer and create a new one.
psc | a PolymorphismSequenceContainer reference |
Exception | if there is no outgroup sequence |
Definition at line 66 of file PolymorphismSequenceContainerTools.cpp.
References bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSequences(), and bpp::PolymorphismSequenceContainer::isIngroupMember().
|
static |
Retrieve 3' sites.
psc | a PolymorphismSequenceContainer |
setName | name of the CDS site selection |
gCode | The genetic code to use |
Definition at line 464 of file PolymorphismSequenceContainerTools.cpp.
References bpp::GeneticCode::codonAlphabet(), bpp::CodonAlphabet::getCodon(), bpp::TemplateVectorSiteContainer< class, class >::getComments(), bpp::PolymorphismSequenceContainer::getGroupId(), bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSequences(), bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSites(), bpp::SiteContainerTools::getSelectedSites(), bpp::MaseTools::getSiteSet(), bpp::PolymorphismSequenceContainer::isIngroupMember(), bpp::GeneticCode::isStop(), and bpp::TemplateVectorSiteContainer< class, class >::site().
|
static |
Retrieve 5' sites.
psc | a PolymorphismSequenceContainer |
setName | name of the CDS site selection |
Definition at line 425 of file PolymorphismSequenceContainerTools.cpp.
References bpp::TemplateVectorSiteContainer< class, class >::getComments(), bpp::PolymorphismSequenceContainer::getGroupId(), bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSequences(), bpp::MaseTools::getPhase(), bpp::SiteContainerTools::getSelectedSites(), bpp::MaseTools::getSiteSet(), bpp::PolymorphismSequenceContainer::isIngroupMember(), and bpp::TemplateVectorSiteContainer< class, class >::site().
|
static |
Retrieves complete sites from a PolymorphismSequenceContainer.
psc | a PolymorphismSequenceContainer reference |
Definition at line 228 of file PolymorphismSequenceContainerTools.cpp.
References bpp::TemplateVectorSiteContainer< class, class >::getAlphabet(), bpp::PolymorphismSequenceContainer::getGroupId(), bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSequences(), bpp::PolymorphismSequenceContainer::getSequenceCount(), bpp::TemplateVectorSiteContainer< class, class >::getSequenceNames(), bpp::CompleteTemplateSiteContainerIterator< class, class, class >::hasMoreSites(), bpp::PolymorphismSequenceContainer::isIngroupMember(), and bpp::CompleteTemplateSiteContainerIterator< class, class, class >::nextSite().
|
static |
Get the species name of the ingroup.
psc | a PolymorphismSequenceContainer. |
Definition at line 503 of file PolymorphismSequenceContainerTools.cpp.
References bpp::MaseTools::getAvailableSequenceSelections(), bpp::TemplateVectorSiteContainer< class, class >::getComments(), and bpp::StringTokenizer::getToken().
|
static |
Retrieve intron sites.
Same as getNonCodgingSites but exclude 5' and 3' flanking regions if there are
psc | a PolymorphismSequenceContainer |
setName | name of the CDS site selection |
gCode | The genetic code to use |
Definition at line 378 of file PolymorphismSequenceContainerTools.cpp.
References bpp::GeneticCode::codonAlphabet(), bpp::CodonAlphabet::getCodon(), bpp::TemplateVectorSiteContainer< class, class >::getComments(), bpp::PolymorphismSequenceContainer::getGroupId(), bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSequences(), bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSites(), bpp::MaseTools::getPhase(), bpp::SiteContainerTools::getSelectedSites(), bpp::MaseTools::getSiteSet(), bpp::PolymorphismSequenceContainer::isIngroupMember(), bpp::GeneticCode::isStop(), and bpp::TemplateVectorSiteContainer< class, class >::site().
|
static |
Retrieve non-coding sites defined in the mase file header.
Be careful: to use before excluding gap
psc | a PolymorphismSequenceContainer reference |
setName | name of the CDS site selection |
Definition at line 306 of file PolymorphismSequenceContainerTools.cpp.
References bpp::TemplateVectorSiteContainer< class, class >::getComments(), bpp::PolymorphismSequenceContainer::getGroupId(), bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSequences(), bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSites(), bpp::SiteContainerTools::getSelectedSites(), bpp::MaseTools::getSiteSet(), and bpp::PolymorphismSequenceContainer::isIngroupMember().
|
static |
Retrieve non-synonymous codon sites.
psc | a PolymorphismSequenceContainer. |
gCode | The genetic code to use |
Definition at line 555 of file PolymorphismSequenceContainerTools.cpp.
References bpp::TemplateVectorSiteContainer< class, class >::getAlphabet(), bpp::PolymorphismSequenceContainer::getGroupId(), bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSequences(), bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSites(), bpp::PolymorphismSequenceContainer::getSequenceCount(), bpp::TemplateVectorSiteContainer< class, class >::getSequenceNames(), bpp::PolymorphismSequenceContainer::isIngroupMember(), bpp::CodonSiteTools::isSynonymousPolymorphic(), and bpp::TemplateVectorSiteContainer< class, class >::site().
|
static |
Return number of completely resolved sites in a PolymorphismSequenceContainer.
psc | a PolymorphismSequenceContainer reference |
ingroup | a boolean set to true if you want to take only ingroup sequences into account |
Exception | if there is no ingroup sequence |
Definition at line 206 of file PolymorphismSequenceContainerTools.cpp.
References count(), bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSites(), and bpp::SiteTools::isComplete().
|
static |
Return number of sites without gaps in a PolymorphismSequenceContainer.
psc | a PolymorphismSequenceContainer reference |
ingroup | a boolean set to true if you want to take only ingroup sequences into account |
Exception | if there is no ingroup sequence |
Definition at line 184 of file PolymorphismSequenceContainerTools.cpp.
References count(), bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSites(), and bpp::SiteTools::hasGap().
|
static |
Retrieve sites at one codon position (1,2,3)
Be careful: to use before excluding gap Be careful: if there is no phase information, the method catch an exception and set the phase to 1 This allows to use this method for PolymorphismSequenceContainer generated by getSelectedSequence
psc | a PolymorphismSequenceContainer reference |
setName | name of the CDS site selection |
pos | position index. |
Definition at line 335 of file PolymorphismSequenceContainerTools.cpp.
References bpp::TemplateVectorSiteContainer< class, class >::getComments(), bpp::PolymorphismSequenceContainer::getGroupId(), bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSequences(), bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSites(), bpp::MaseTools::getPhase(), bpp::SiteContainerTools::getSelectedSites(), and bpp::PolymorphismSequenceContainer::isIngroupMember().
|
static |
Extract selected sequences.
psc | a PolymorphismSequenceContainer reference. |
ss | a sequence selection. |
Definition at line 113 of file PolymorphismSequenceContainerTools.cpp.
References bpp::TemplateVectorSiteContainer< class, class >::getAlphabet(), bpp::TemplateVectorSiteContainer< class, class >::getComments(), bpp::PolymorphismSequenceContainer::getGroupId(), bpp::PolymorphismSequenceContainer::getSequenceCount(), bpp::PolymorphismSequenceContainer::isIngroupMember(), and bpp::TemplateVectorSiteContainer< class, class >::sequence().
Referenced by sample().
|
static |
Get a PolymorphismSequenceContainer corresponding to a site selection annotated in the mase comments.
Warning: in the new PolymorphismSequenceContainer the mase comments are lost Information about cds positions and start codon is no more available
psc | a PolymorphismSequenceContainer. |
setName | The name of the set to retrieve. |
phase | a boolean set to true if you want to take the phase into account during the extraction. It removes the useless sites. |
Definition at line 275 of file PolymorphismSequenceContainerTools.cpp.
References bpp::TemplateVectorSiteContainer< class, class >::getComments(), bpp::PolymorphismSequenceContainer::getGroupId(), bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSequences(), bpp::MaseTools::getPhase(), bpp::MaseTools::getSelectedSites(), and bpp::PolymorphismSequenceContainer::isIngroupMember().
|
static |
Retrieves sites without gaps from PolymorphismSequenceContainer.
psc | a PolymorphismSequenceContainer reference |
Definition at line 155 of file PolymorphismSequenceContainerTools.cpp.
References bpp::TemplateVectorSiteContainer< class, class >::getAlphabet(), bpp::PolymorphismSequenceContainer::getGroupId(), bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSequences(), bpp::PolymorphismSequenceContainer::getSequenceCount(), bpp::TemplateVectorSiteContainer< class, class >::getSequenceNames(), bpp::NoGapTemplateSiteContainerIterator< class, class, class >::hasMoreSites(), bpp::PolymorphismSequenceContainer::isIngroupMember(), and bpp::NoGapTemplateSiteContainerIterator< class, class, class >::nextSite().
|
static |
Retrieve synonymous codon sites.
psc | a PolymorphismSequenceContainer. |
gCode | The genetic code to use |
Definition at line 525 of file PolymorphismSequenceContainerTools.cpp.
References bpp::TemplateVectorSiteContainer< class, class >::getAlphabet(), bpp::PolymorphismSequenceContainer::getGroupId(), bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSequences(), bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSites(), bpp::PolymorphismSequenceContainer::getSequenceCount(), bpp::TemplateVectorSiteContainer< class, class >::getSequenceNames(), bpp::PolymorphismSequenceContainer::isIngroupMember(), bpp::CodonSiteTools::isSynonymousPolymorphic(), and bpp::TemplateVectorSiteContainer< class, class >::site().
|
static |
Read a Mase+ file and return a PolymorphismSequenceContainer. Toggle Sequence when selection tag begin with OUTGROUP (see Polymorphix)
Exception | if the file is not in the specified format |
Definition at line 16 of file PolymorphismSequenceContainerTools.cpp.
References bpp::MaseTools::getAvailableSequenceSelections(), bpp::MaseTools::getSequenceSet(), and bpp::Mase::readSequences().
|
static |
Get a random set of sequences.
psc | a PolymorphismSequenceContainer reference |
n | the number of sequence to get |
replace | a boolean flag true for sampling with replacement |
Definition at line 136 of file PolymorphismSequenceContainerTools.cpp.
References bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSequences(), bpp::RandomTools::getSample(), and getSelectedSequences().