bpp-seq3  3.0.0
bpp::MaseTools Class Reference

Utilitary methods that deal with the Mase format. More...

#include <Bpp/Seq/Io/MaseTools.h>

Static Public Member Functions

static SiteSelection getSiteSet (const Comments &maseFileHeader, const std::string &setName)
 Get a site selection from a Mase+ header file. More...
 
static SequenceSelection getSequenceSet (const Comments &maseFileHeader, const std::string &setName)
 Get a sequence selection from a Mase+ header file. More...
 
template<class SiteType , class SequenceType >
static std::unique_ptr< TemplateVectorSiteContainer< SiteType, SequenceType > > getSelectedSites (const TemplateSiteContainerInterface< SiteType, SequenceType, std::string > &sequences, const std::string &setName)
 Create a new container corresponding to a site set given in the mase+ format. More...
 
template<class SequenceType , class HashType >
static std::unique_ptr< TemplateSequenceContainerInterface< SequenceType, HashType > > getSelectedSequences (const TemplateSequenceContainerInterface< SequenceType, HashType > &sequences, const std::string &setName)
 Create a new container corresponding to a site set given in the mase+ format. More...
 
static std::map< std::string, size_t > getAvailableSiteSelections (const Comments &maseHeader)
 Get a list of all available site selections. More...
 
static std::map< std::string, size_t > getAvailableSequenceSelections (const Comments &maseHeader)
 Get a list of all available sequences selections. More...
 
static size_t getPhase (const Comments &maseFileHeader, const std::string &setName)
 Get the phase of a given coding region from a mase+ header. More...
 

Detailed Description

Utilitary methods that deal with the Mase format.

This class particularly covers the Mase+ format, which allows site and sequence selection. Mase+ tags are in the header of the mase file, which is stored in the 'general comment' section of sequence containers. Most of the methods here hence work on the general comments associated to a container.

Definition at line 27 of file MaseTools.h.

Member Function Documentation

◆ getAvailableSequenceSelections()

map< string, size_t > MaseTools::getAvailableSequenceSelections ( const Comments maseHeader)
static

Get a list of all available sequences selections.

Parameters
maseHeaderComments as described in the Mase+ format specification.
Returns
A vector of selection names.

Definition at line 163 of file MaseTools.cpp.

References bpp::StringTokenizer::hasMoreToken(), and bpp::StringTokenizer::nextToken().

◆ getAvailableSiteSelections()

map< string, size_t > MaseTools::getAvailableSiteSelections ( const Comments maseHeader)
static

Get a list of all available site selections.

Parameters
maseHeaderComments as described in the Mase+ format specification.
Returns
A vector of selection names.

Definition at line 116 of file MaseTools.cpp.

References bpp::StringTokenizer::hasMoreToken(), and bpp::StringTokenizer::nextToken().

◆ getPhase()

size_t MaseTools::getPhase ( const Comments maseFileHeader,
const std::string &  setName 
)
static

Get the phase of a given coding region from a mase+ header.

Look for a /codon_start tag with a phase indice and a site selection with name setName.

Parameters
maseFileHeaderComments in Mase+ format.
setNamea cds site selection name.
Returns
1,2 or 3.
Exceptions
ExceptionIf no corresponding tag found in file.

Definition at line 189 of file MaseTools.cpp.

References bpp::StringTokenizer::hasMoreToken(), and bpp::StringTokenizer::nextToken().

◆ getSelectedSequences()

template<class SequenceType , class HashType >
static std::unique_ptr< TemplateSequenceContainerInterface<SequenceType, HashType> > bpp::MaseTools::getSelectedSequences ( const TemplateSequenceContainerInterface< SequenceType, HashType > &  sequences,
const std::string &  setName 
)
inlinestatic

Create a new container corresponding to a site set given in the mase+ format.

A new VectorSequenceContainer is created, whose destruction is up to the user. The container passed as argument must have 'general comments' in the mase+ format. This function calls the getSequenceSet() function on the comments and then calls for SiteContainerTools::getSelectedSequences() on the selection.

Parameters
sequencesThe container to get the sequence from.
setNameThe name of the set to retrieve.
Exceptions
IOExceptionIf the specified set is not found.

Definition at line 85 of file MaseTools.h.

References getSequenceSet().

◆ getSelectedSites()

template<class SiteType , class SequenceType >
static std::unique_ptr< TemplateVectorSiteContainer<SiteType, SequenceType> > bpp::MaseTools::getSelectedSites ( const TemplateSiteContainerInterface< SiteType, SequenceType, std::string > &  sequences,
const std::string &  setName 
)
inlinestatic

Create a new container corresponding to a site set given in the mase+ format.

A new VectorSiteContainer is created, whose destruction is up to the user. The container passed as argument must have 'general comments' in the mase+ format. This function calls the getSiteSet() function on the comments and then calls for SiteContainerTools::getSelectedSites() on the selection.

Parameters
sequencesThe container to get the sites from.
setNameThe name of the set to retrieve.
Exceptions
IOExceptionIf the specified set is not found.

Definition at line 62 of file MaseTools.h.

References bpp::Commentable::getComments(), and getSiteSet().

Referenced by bpp::SequenceApplicationTools::getProbabilisticSiteContainer(), and bpp::SequenceApplicationTools::getSiteContainer().

◆ getSequenceSet()

SequenceSelection MaseTools::getSequenceSet ( const Comments maseFileHeader,
const std::string &  setName 
)
static

Get a sequence selection from a Mase+ header file.

Parameters
maseFileHeaderThe header of the mase+ file as comments lines.
setNameThe name of the set to retrieve.
Exceptions
IOExceptionIf the specified set is not found.

Definition at line 69 of file MaseTools.cpp.

References bpp::StringTokenizer::hasMoreToken(), bpp::StringTokenizer::nextToken(), and bpp::StringTokenizer::unparseRemainingTokens().

Referenced by getSelectedSequences().

◆ getSiteSet()

SiteSelection MaseTools::getSiteSet ( const Comments maseFileHeader,
const std::string &  setName 
)
static

Get a site selection from a Mase+ header file.

Parameters
maseFileHeaderThe header of the mase+ file as comments lines.
setNameThe name of the set to retrieve.
Exceptions
IOExceptionIf the specified set is not found.

Definition at line 17 of file MaseTools.cpp.

References bpp::StringTokenizer::hasMoreToken(), bpp::StringTokenizer::nextToken(), and bpp::StringTokenizer::unparseRemainingTokens().

Referenced by getSelectedSites().


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