Exemplo n.º 1
0
/*----------------------------------------------------------------------------------------------------------------------
|	Called by the NxsReader object when a block named `blockName' is entered. Allows program to notify user of 
|	progress in parsing the NEXUS file. Also gives program the opportunity to ask user if it is ok to purge data 
|	currently contained in this block. If user is asked whether existing data should be deleted, and the answer comes 
|	back no, then then return false, otherwise return true. Overrides pure virtual function in class NxsReader. 
*/
bool GarliReader::EnteringBlock(
  NxsString blockName)	/* the name of the block just entered */
	{
	message = "Reading ";
	message += blockName;
	message += " block...";
	PrintMessage(false);

	//3/25/08 if we already found a Garli block with a model (e.g. in the dataset file)
	//we should crap out, since we don't know which one the user meant to use
	//this is a change from previous behavior, in which I wanted the second to just override the first.
	if(blockName.Equals("GARLI") && FoundModelString())
		throw ErrorException("Multiple GARLI blocks found (possibly in multiple files).\n\tRemove or comment out all but one.");

	return true;
	}
Exemplo n.º 2
0
/*----------------------------------------------------------------------------------------------------------------------
|	Called by the NxsReader object when exiting a block named `blockName'. Allows program to notify user of progress 
|	in parsing the NEXUS file. Virtual function that overrides the pure virtual function in the base class NxsReader.
*/
void GarliReader::ExitingBlock(
  NxsString blockName)	/* the name of the block just exited */
	{
	//message to indicate that we sucessfully read whatever block this was
	string mess;
	if(blockName.Equals("CHARACTERS")){
		switch (static_cast<NxsCharactersBlock *>(currBlock)->GetDataType()){
			case NxsCharactersBlock::dna:
				mess = " found dna data...";
				break;
			case NxsCharactersBlock::rna:
				mess = " found rna data...";
				break;
			case NxsCharactersBlock::protein:
				mess = " found protein data...";
				break;
			case NxsCharactersBlock::standard:
				mess = " found standard data...";
				break;
			case NxsCharactersBlock::nucleotide:
				mess = " found nucleotide data...";
				break;
			case NxsCharactersBlock::continuous:
				mess = " found continuous data...";
				break;
			case NxsCharactersBlock::codon:
				mess = " unsupported codon datatype found" ;
				break;
			case NxsCharactersBlock::mixed:
				mess = " unsupported mixed datatype found" ;
				
			}
		}

	mess += " successful";
	outman.UserMessage(mess);
	}