Egglib 2.1.11
C++ library reference manual
Static Public Member Functions | Protected Member Functions | Static Protected Attributes | List of all members
Convert Class Reference

Performs conversion between sequence holder types. More...

#include <Convert.hpp>

Static Public Member Functions

static Align align (DataMatrix &dataMatrix, unsigned int length=0, Random *random=NULL, bool randomizePositions=false, bool randomizeNonVaryingStates=false, bool randomizeAlleles=false, bool enforceLength=false, std::string mapping="ACGT", char unknown='?', char nonVaryingState='A')
 DataMatrix to Align conversion. More...
 
static bpp::AlignedSequenceContainer egglib2bpp (Align &align, unsigned int alphabetID, unsigned int outgroupFlag, unsigned int offset=0)
 Converts an alignment to the equivalent Bio++ type. More...
 

Protected Member Functions

 Convert ()
 This class cannot be instantiated. More...
 
 Convert (const Convert &source)
 This class cannot be instantiated. More...
 
Convertoperator= (const Convert &source)
 This class cannot be instantiated. More...
 
virtual ~Convert ()
 This class cannot be instantiated. More...
 

Static Protected Attributes

static bpp::DNA dnaAlphabet
 
static bpp::RNA rnaAlphabet
 
static bpp::ProteicAlphabet proteicAlphabet
 
static bpp::CodonAlphabet CodonAlphabet
 

Detailed Description

Performs conversion between sequence holder types.

Static methods of this class allows conversion between sequence holder types implying parametrizable modifications.

Constructor & Destructor Documentation

Convert ( )
inlineprotected

This class cannot be instantiated.

Convert ( const Convert source)
inlineprotected

This class cannot be instantiated.

virtual ~Convert ( )
inlineprotectedvirtual

This class cannot be instantiated.

Member Function Documentation

Align align ( DataMatrix dataMatrix,
unsigned int  length = 0,
Random random = NULL,
bool  randomizePositions = false,
bool  randomizeNonVaryingStates = false,
bool  randomizeAlleles = false,
bool  enforceLength = false,
std::string  mapping = "ACGT",
char  unknown = '?',
char  nonVaryingState = 'A' 
)
static

DataMatrix to Align conversion.

By defaut, this method generates an Align instance containing only the polymorphic sites. The integers of the DataMatrix will be converted as follow: 0 to A, 1 to C, 2 to G and 3 to T. This behaviour can be largely modified using options.

Parameters
dataMatrixDataMatrix instance.
lengthlength of the desired alignment. Non-varying stretches of data will be introduced to reach the specified length. By default the positions of segregating sites will be determined from the positions given by the DataMatrix object. Those positions are expressed in a continuous range, and will be discretized. Mutations falling on the same site will be moved of one position left or right (always preserving the order of mutation sites). If positions are all zero (the default of the DataMatrix class) and if length is larger than the number of segregating sites, then all segregating sites will cluster on the left-hand side of the alignment.
randomthe address to a Random object allowing to draw random numbers (for randomizing positions and/or non-varying states). If an address is provided but no random numbers are required, it is ignored. If no address if provided and random numbers are required, a Random instance is built internally.
randomizePositionsif true, the positions specified in the DataMatrix objects are ignored and the positions of mutations are drawn randomly along the interval (only if the specified length is larger than the number of segregating sites). If randomizePositions and false and positions are not
enforceLengthspecify whether a EggRuntimeError should be thrown when the number of polymorphic sites is larger than the specified length. If false (the default) and in cases where the specified length is too short to harbor all polymorphic sites, the alignment length will be increased as needed.
randomizeNonVaryingStatesif true, the stretches of conserved positions (between segregating sites) will be randomly drawn from the current symbol mapping. Otherwise, the symbol given by fixed will be used.
randomizeAllelesif true, alleles will be drawn randomly from the mapped characters. Note that if a genotype value is larger than the size of the mapping, it will be replaced by the character given by unknown, without randomization. In other words, with the mapping "ACGT", alleles 0, 1, 2 and 3 will be randomly assigned to these four characters, but larger and negative alleles will be assigned to the unknown character.
mappinga string given the character to assign to different character values read from the DataMatrix. If the read value is 0, the first character of the string will used, the the value is 1, the second character will be used, and so on. If the integer read is out of range (in particular, for any negative value), then the character given by unknown will be used. An empty string will always lead to alignments containing only the character given by unknown. The string "01" is suitable for binary data.
unknownthe character to use if an integer genotype value is not mapped in the mapping string (that is, if the mapping string is too short).
nonVaryingStatecharacter to use for conserved stretches of data. It doesn't have to be included in the mapping. If randomizeNonVaryingState is true, this argument is ignored.
Returns
The resulting Align object.
bpp::AlignedSequenceContainer egglib2bpp ( Align align,
unsigned int  alphabetID,
unsigned int  outgroupFlag,
unsigned int  offset = 0 
)
static

Converts an alignment to the equivalent Bio++ type.

During conversion, name information is lost (arbitrary names are generated in order toprevent duplicate names). The object is attached to an alphabet matching the passed integer. The names are bare rank integers (starting at the value giving by offset).

Parameters
alignthe source alignment object.
alphabetIDan integer indicating which alphabet to use:
  • 1 for DNA
  • 2 for RNA
  • 3 for proteins
  • 4 for codons
Other values will result in an exception.
outgroupFlagan integer indicating whether to include outgroup sequences:
  • 0 use all sequences
  • 1 use only sequences without 999 label (ingroup)
  • 2 use only sequences with 999 label (outgroup)
Other values will result in an exception.
offsetenter an integer to shift the names of the resulting alignment (useful to merge alignment and ensure that names are not duplicated).
Returns
A Bio++ alignment.
Convert& operator= ( const Convert source)
inlineprotected

This class cannot be instantiated.


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

Hosted by 
Get EggLib at SourceForge.net. Fast, secure and Free Open Source software downloads