NxsCharactersBlock Class Reference

This class handles reading and storage for the NEXUS block CHARACTERS. More...

#include <nxscharactersblock.h>

List of all members.

Public Types

enum  DataTypesEnum { ,
  dna, rna, nucleotide, protein,
  codon, continuous, mixed

Public Member Functions

 NxsCharactersBlock (NxsTaxaBlockAPI *tb, NxsAssumptionsBlockAPI *ab)
void SetSupportMixedDatatype (bool v)
bool AugmentedSymbolsToMixed ()
void SetConvertAugmentedToMixed (bool v)
void SetAllowAugmentingOfSequenceSymbols (bool v)
bool GetAllowAugmentingOfSequenceSymbols () const
std::map< DataTypesEnum,
NxsUnsignedSet > 
GetDatatypeMapForMixedType () const
DataTypesEnum GetDataType () const
bool TaxonIndHasData (const unsigned ind) const
unsigned GetNCharTotal () const
DataTypesEnum GetOriginalDataType () const
unsigned GetNumActiveChar () NCL_COULD_BE_CONST
const NxsUnsignedSet & GetExcludedIndexSet () const
bool IsActiveChar (unsigned j) const
unsigned ApplyExset (NxsUnsignedSet &exset)
unsigned ApplyIncludeset (NxsUnsignedSet &inset)
void ExcludeCharacter (unsigned i)
void IncludeCharacter (unsigned i)
NxsString GetCharLabel (unsigned i) const
bool HasCharLabels () const
GapModeEnum GetGapModeSetting () const
const char * GetSymbols () NCL_COULD_BE_CONST
unsigned GetNumStates (unsigned i, unsigned j) NCL_COULD_BE_CONST
char GetState (unsigned i, unsigned j, unsigned k=0) const
const NxsTransformationManagerGetNxsTransformationManagerRef () const
bool IsGapState (unsigned taxInd, unsigned charInd) NCL_COULD_BE_CONST
bool IsMissingState (unsigned i, unsigned j) NCL_COULD_BE_CONST
bool IsPolymorphic (unsigned i, unsigned j) NCL_COULD_BE_CONST
const NxsDiscreteStateRow & GetDiscreteMatrixRow (unsigned taxonIndex) const
std::vector< const
NxsDiscreteDatatypeMapper * > 
GetAllDatatypeMappers () const
std::vector< double > GetContinuousValues (unsigned taxIndex, unsigned charIndex, const std::string key) NCL_COULD_BE_CONST
std::vector< std::string > GetItems () const
StatesFormatEnum GetStatesFormat () const
void SetGapModeSetting (GapModeEnum m)
NxsDiscreteStateCell GetInternalRepresentation (unsigned i, unsigned j, unsigned k=0) NCL_COULD_BE_CONST
virtual unsigned GetMaxObsNumStates (bool countMissingStates=true, bool onlyActiveChars=false) NCL_COULD_BE_CONST
virtual unsigned GetNumObsStates (unsigned columnIndex, bool countMissingStates=true) NCL_COULD_BE_CONST
std::set< NxsDiscreteStateCell > GetObsStates (unsigned columnIndex, bool countMissingStates=true) const
double GetSimpleContinuousValue (unsigned i, unsigned j) NCL_COULD_BE_CONST
NxsString GetStateLabel (unsigned charIndex, unsigned charStateIndex) const
bool WasRestrictionDataype () const
const char * GetDatatypeName () const
char GetGapSymbol () const
void SetGapSymbol (char)
char GetMatchcharSymbol () NCL_COULD_BE_CONST
char GetMissingSymbol () const
virtual unsigned CharLabelToNumber (NxsString s) NCL_COULD_BE_CONST
virtual unsigned CharLabelToNumber (const std::string &s) const
unsigned GetIndicesForLabel (const std::string &label, NxsUnsignedSet *inds) const
unsigned GetNumIncludedChars () const
unsigned GetNumEliminated () NCL_COULD_BE_CONST
unsigned GetNChar () const
unsigned GetNumChar () const
NxsString GetStateLabel (unsigned charIndex, unsigned charStateIndex)
NxsString GetTaxonLabel (unsigned i) const
bool IsEliminated (unsigned charIndex) NCL_COULD_BE_CONST
bool IsExcluded (unsigned j) const
bool IsExcluded (unsigned j)
virtual unsigned TaxonLabelToNumber (NxsString s) const
virtual bool AddNewCodonPosPartition (const std::string &label, const NxsPartition &inds, bool isDefault)
bool AddNewIndexSet (const std::string &label, const NxsUnsignedSet &inds)
bool AddNewExSet (const std::string &label, const NxsUnsignedSet &inds)
bool AddNewPartition (const std::string &label, const NxsPartition &inds)
void Consume (NxsCharactersBlock &other)
std::set< NxsDiscreteStateCell > GetNamedStateSetOfColumn (const unsigned colIndex) const
std::set< NxsDiscreteStateCell > GetMaximalStateSetOfColumn (const unsigned colIndex) const
virtual void Report (std::ostream &out) NCL_COULD_BE_CONST
void ShowStateLabels (std::ostream &out, unsigned i, unsigned c, unsigned first_taxon) const
void WriteAsNexus (std::ostream &out) const
virtual void DebugShowMatrix (std::ostream &out, bool use_matchchar, const char *marginText=NULL) const
virtual void WriteLinkCommand (std::ostream &out) const
bool IsInterleave () NCL_COULD_BE_CONST
bool IsLabels () NCL_COULD_BE_CONST
bool IsRespectCase () const
bool IsTokens () NCL_COULD_BE_CONST
bool IsTranspose () NCL_COULD_BE_CONST
virtual VecBlockPtr GetImpliedBlocks ()
unsigned GetNumEquates () NCL_COULD_BE_CONST
unsigned GetNumUserEquates () const
unsigned GetNumMatrixCols () NCL_COULD_BE_CONST
unsigned GetNumMatrixRows () NCL_COULD_BE_CONST
virtual void Reset ()
void SetNexus (NxsReader *nxsptr)
virtual void HandleLinkCommand (NxsToken &token)
virtual std::string GetDefaultCodonPosPartitionName () const

Static Public Member Functions

static void CodonPosPartitionToPosList (const NxsPartition &codonPos, std::list< int > *charIndices)
static NxsCharactersBlockNewProteinCharactersBlock (const NxsCharactersBlock *codonBlock, bool mapPartialAmbigToUnknown, bool gapToUnknown, const std::vector< NxsDiscreteStateCell > &aaIndices)

Protected Member Functions

bool IsInSymbols (char ch) NCL_COULD_BE_CONST
void ShowStates (std::ostream &out, unsigned i, unsigned j) NCL_COULD_BE_CONST
void HandleCharlabels (NxsToken &token)
void HandleCharstatelabels (NxsToken &token)
void HandleDimensions (NxsToken &token, NxsString newtaxaLabel, NxsString ntaxLabel, NxsString ncharLabel)
void HandleEliminate (NxsToken &token)
virtual void HandleFormat (NxsToken &token)
virtual void HandleMatrix (NxsToken &token)
bool HandleNextTokenState (NxsToken &token, unsigned taxNum, unsigned charNum, NxsDiscreteStateRow &row, NxsDiscreteDatatypeMapper &, const NxsDiscreteStateRow *firstTaxonRow, const NxsString &nameStr)
void HandleStatelabels (NxsToken &token)
virtual void HandleStdMatrix (NxsToken &token)
virtual void HandleTransposedMatrix (NxsToken &token)
virtual void Read (NxsToken &token)
void ResetSymbols ()
void WriteStates (NxsDiscreteDatum &d, char *s, unsigned slen) NCL_COULD_BE_CONST

Detailed Description

This class handles reading and storage for the NEXUS block CHARACTERS.

It overrides the member functions Read and Reset, which are abstract virtual functions in the base class NxsBlock.

{"ActiveChar" is equivalent to "IncludedChar". }

Important change in starting in version 2.1: The ELIMINATE command is now dealt with as if it were an automatic exclude statment. Previous versions of NCL were more in keeping with the NEXUS specification, in that NCL did not store eliminate characters. This resulted in a confusing situation in which the Characters block maintained an original index for a character and a current index. Some public functions of NxsCharactersBlock took arguments that needed the original character index, while the vast majority of methods interpretted a character index as the current index of a character. ELIMINATE commands are *very* rare in modern NEXUS files (Mesquite does not even recognize the command), thus the increased complexity of the API that was caused by not storing ELIMINATED character was deemed a counterproductive. In NCL 2.1 (and later), the characters block stores every character, and the user of NCL can query the NxsCharactersBlock about whether a character has been excluded or not (you can also ask for the set of eliminated chararcters). Optimizations for avoiding excluded characters are no longer the responsibility of NxsCharactersBlock.

Thus, a normal loop through all characters in the data matrix should look something like this: > for(unsigned j = 0; j < nchar; j++) { if (IsExcluded(j)) continue; }

Below is a table showing the correspondence between the elements of a CHARACTERS block in a NEXUS file and the variables and member functions of the NxsCharactersBlock class that can be used to access each piece of information stored. Items in parenthesis should be viewed as "see also" items. > NEXUS Command Data Member Command Atribute Member Functions --------------------------------------------------------------------- DIMENSIONS NEWTAXA newtaxa

NCHAR nChar GetNChar

FORMAT DATATYPE datatype GetDataType

RESPECTCASE respectingCase IsRespectCase

MISSING missing GetMissingSymbol

GAP gap GetGapSymbol

SYMBOLS symbols GetSymbols

EQUATE userEquates GetEquateKey GetEquateValue GetNumEquates

MATCHCHAR matchchar GetMatchcharSymbol

(NO)LABELS labels IsLabels

TRANSPOSE transposing IsTranspose

INTERLEAVE interleaving IsInterleave

ITEMS GetItems


(NO)TOKENS tokens IsTokens

ELIMINATE eliminated GetNumEliminated IsExcluded MATRIX matrix GetState GetInternalRepresentation GetNumStates GetNumMatrixRows GetNumMatrixCols IsPolymorphic >

Definition at line 470 of file nxscharactersblock.h.

The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations Enumerator Friends
Generated on Mon Mar 29 16:37:12 2010 for NCL by  doxygen 1.6.3