bpp-popgen3  3.0.0
bpp::PolymorphismSequenceContainerTools Class Reference

Utilitary function to manipulate PolymorphismSequenceContainer. More...

#include <Bpp/PopGen/PolymorphismSequenceContainerTools.h>

Public Member Functions

virtual ~PolymorphismSequenceContainerTools ()
 

Static Public Member Functions

static std::unique_ptr< PolymorphismSequenceContainerread (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< PolymorphismSequenceContainerextractIngroup (const PolymorphismSequenceContainer &psc)
 Extract ingroup sequences from a PolymorphismSequenceContainer and create a new one. More...
 
static std::unique_ptr< PolymorphismSequenceContainerextractOutgroup (const PolymorphismSequenceContainer &psc)
 Extract outgroup sequences from a PolymorphismSequenceContainer and create a new one. More...
 
static std::unique_ptr< PolymorphismSequenceContainerextractGroup (const PolymorphismSequenceContainer &psc, size_t groupId)
 Extract a special group from the PolymorphismSequenceContainer. More...
 
static std::unique_ptr< PolymorphismSequenceContainergetSelectedSequences (const PolymorphismSequenceContainer &psc, const SequenceSelection &ss)
 Extract selected sequences. More...
 
static std::unique_ptr< PolymorphismSequenceContainersample (const PolymorphismSequenceContainer &psc, size_t n, bool replace=true)
 Get a random set of sequences. More...
 
static std::unique_ptr< PolymorphismSequenceContainergetSitesWithoutGaps (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< PolymorphismSequenceContainergetCompleteSites (const PolymorphismSequenceContainer &psc)
 Retrieves complete sites from a PolymorphismSequenceContainer. More...
 
static std::unique_ptr< PolymorphismSequenceContainerexcludeFlankingGap (const PolymorphismSequenceContainer &psc)
 exclude flanking sites with gap but keep gap sites within the alignment More...
 
static std::unique_ptr< PolymorphismSequenceContainergetSelectedSites (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< PolymorphismSequenceContainergetNonCodingSites (const PolymorphismSequenceContainer &psc, const std::string &setName)
 Retrieve non-coding sites defined in the mase file header. More...
 
static std::unique_ptr< PolymorphismSequenceContainergetOnePosition (const PolymorphismSequenceContainer &psc, const std::string &setName, size_t pos)
 Retrieve sites at one codon position (1,2,3) More...
 
static std::unique_ptr< PolymorphismSequenceContainergetIntrons (const PolymorphismSequenceContainer &psc, const std::string &setName, const GeneticCode &gCode)
 Retrieve intron sites. More...
 
static std::unique_ptr< PolymorphismSequenceContainerget5Prime (const PolymorphismSequenceContainer &psc, const std::string &setName)
 Retrieve 5' sites. More...
 
static std::unique_ptr< PolymorphismSequenceContainerget3Prime (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< PolymorphismSequenceContainergetSynonymousSites (const PolymorphismSequenceContainer &psc, const GeneticCode &gCode)
 Retrieve synonymous codon sites. More...
 
static std::unique_ptr< PolymorphismSequenceContainergetNonSynonymousSites (const PolymorphismSequenceContainer &psc, const GeneticCode &gCode)
 Retrieve non-synonymous codon sites. More...
 

Detailed Description

Utilitary function to manipulate PolymorphismSequenceContainer.

Author
Sylvain Gaillard

Definition at line 38 of file PolymorphismSequenceContainerTools.h.

Constructor & Destructor Documentation

◆ ~PolymorphismSequenceContainerTools()

PolymorphismSequenceContainerTools::~PolymorphismSequenceContainerTools ( )
virtual

Definition at line 12 of file PolymorphismSequenceContainerTools.cpp.

Member Function Documentation

◆ excludeFlankingGap()

unique_ptr< PolymorphismSequenceContainer > PolymorphismSequenceContainerTools::excludeFlankingGap ( const PolymorphismSequenceContainer psc)
static

exclude flanking sites with gap but keep gap sites within the alignment

Parameters
psca PolymorphismSequenceContainer reference

Definition at line 257 of file PolymorphismSequenceContainerTools.cpp.

References bpp::SiteTools::hasGap().

◆ extractGroup()

unique_ptr< PolymorphismSequenceContainer > PolymorphismSequenceContainerTools::extractGroup ( const PolymorphismSequenceContainer psc,
size_t  groupId 
)
static

Extract a special group from the PolymorphismSequenceContainer.

Parameters
psca PolymorphismSequenceContainer reference.
groupIdthe group identifier as an size_t.
Exceptions
GroupNotFoundExceptionif group_id is not found.

Definition at line 89 of file PolymorphismSequenceContainerTools.cpp.

References bpp::PolymorphismSequenceContainer::getGroupId(), and bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSequences().

◆ extractIngroup()

unique_ptr< PolymorphismSequenceContainer > PolymorphismSequenceContainerTools::extractIngroup ( const PolymorphismSequenceContainer psc)
static

Extract ingroup sequences from a PolymorphismSequenceContainer and create a new one.

Parameters
psca PolymorphismSequenceContainer reference
Exceptions
Exceptionif there is no ingroup sequence

Definition at line 43 of file PolymorphismSequenceContainerTools.cpp.

References bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSequences(), and bpp::PolymorphismSequenceContainer::isIngroupMember().

◆ extractOutgroup()

unique_ptr< PolymorphismSequenceContainer > PolymorphismSequenceContainerTools::extractOutgroup ( const PolymorphismSequenceContainer psc)
static

Extract outgroup sequences from a PolymorphismSequenceContainer and create a new one.

Parameters
psca PolymorphismSequenceContainer reference
Exceptions
Exceptionif there is no outgroup sequence

Definition at line 66 of file PolymorphismSequenceContainerTools.cpp.

References bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSequences(), and bpp::PolymorphismSequenceContainer::isIngroupMember().

◆ get3Prime()

◆ get5Prime()

◆ getCompleteSites()

◆ getIngroupSpeciesName()

string PolymorphismSequenceContainerTools::getIngroupSpeciesName ( const PolymorphismSequenceContainer psc)
static

◆ getIntrons()

◆ getNonCodingSites()

unique_ptr< PolymorphismSequenceContainer > PolymorphismSequenceContainerTools::getNonCodingSites ( const PolymorphismSequenceContainer psc,
const std::string &  setName 
)
static

◆ getNonSynonymousSites()

◆ getNumberOfCompleteSites()

size_t PolymorphismSequenceContainerTools::getNumberOfCompleteSites ( const PolymorphismSequenceContainer psc,
bool  ingroup 
)
static

Return number of completely resolved sites in a PolymorphismSequenceContainer.

Parameters
psca PolymorphismSequenceContainer reference
ingroupa boolean set to true if you want to take only ingroup sequences into account
Exceptions
Exceptionif there is no ingroup sequence

Definition at line 206 of file PolymorphismSequenceContainerTools.cpp.

References count(), bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSites(), and bpp::SiteTools::isComplete().

◆ getNumberOfNonGapSites()

size_t PolymorphismSequenceContainerTools::getNumberOfNonGapSites ( const PolymorphismSequenceContainer psc,
bool  ingroup 
)
static

Return number of sites without gaps in a PolymorphismSequenceContainer.

Parameters
psca PolymorphismSequenceContainer reference
ingroupa boolean set to true if you want to take only ingroup sequences into account
Exceptions
Exceptionif there is no ingroup sequence

Definition at line 184 of file PolymorphismSequenceContainerTools.cpp.

References count(), bpp::TemplateVectorSiteContainer< class, class >::getNumberOfSites(), and bpp::SiteTools::hasGap().

◆ getOnePosition()

unique_ptr< PolymorphismSequenceContainer > PolymorphismSequenceContainerTools::getOnePosition ( const PolymorphismSequenceContainer psc,
const std::string &  setName,
size_t  pos 
)
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

Parameters
psca PolymorphismSequenceContainer reference
setNamename of the CDS site selection
posposition 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().

◆ getSelectedSequences()

◆ getSelectedSites()

unique_ptr< PolymorphismSequenceContainer > PolymorphismSequenceContainerTools::getSelectedSites ( const PolymorphismSequenceContainer psc,
const std::string &  setName,
bool  phase 
)
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

Parameters
psca PolymorphismSequenceContainer.
setNameThe name of the set to retrieve.
phasea 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().

◆ getSitesWithoutGaps()

◆ getSynonymousSites()

◆ read()

unique_ptr< PolymorphismSequenceContainer > PolymorphismSequenceContainerTools::read ( const std::string &  path,
std::shared_ptr< const Alphabet alpha 
)
static

Read a Mase+ file and return a PolymorphismSequenceContainer. Toggle Sequence when selection tag begin with OUTGROUP (see Polymorphix)

Parameters
pathPath to the Mase+ file
alphaSequence Alphabet
Exceptions
Exceptionif 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().

◆ sample()

unique_ptr< PolymorphismSequenceContainer > PolymorphismSequenceContainerTools::sample ( const PolymorphismSequenceContainer psc,
size_t  n,
bool  replace = true 
)
static

Get a random set of sequences.

Parameters
psca PolymorphismSequenceContainer reference
nthe number of sequence to get
replacea 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().


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