本文整理汇总了C++中SequenceTree::parse方法的典型用法代码示例。如果您正苦于以下问题:C++ SequenceTree::parse方法的具体用法?C++ SequenceTree::parse怎么用?C++ SequenceTree::parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SequenceTree
的用法示例。
在下文中一共展示了SequenceTree::parse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
void NEXUS::initialize()
{
// Check #NEXUS
getline(*file,line);
if (line != "#NEXUS")
throw myexception()<<"NEXUS trees reader: File does not begin with '#NEXUS' and may not be a NEXUS file.";
// [ and ] do not break words
string word;
bool in_trees_block=false;
while(get_NEXUS_command(*file,line))
{
// cerr<<"line: "<<line<<endl;
int pos=0;
if (not get_word_NEXUS(word,pos,line)) continue;
// cerr<<"NEXUS: command = :"<<word<<":"<<" in_trees_block = "<<in_trees_block<<endl;
// Parse BEGIN TREES
if (uppercase(word) == "BEGIN") {
if (not get_word_NEXUS(word,pos,line)) continue;
if (uppercase(word) == "TREES")
in_trees_block = true;
}
if (not in_trees_block) continue;
// Parse TRANSLATE ...
if (uppercase(word) == "TRANSLATE") {
parse_translate_command(line.substr(pos,line.size()-pos));
// cerr<<"leaf names = "<<join(leaf_names,',')<<endl;
line.clear();
return;
}
else if (uppercase(word) == "TREE") {
try {
get_word_NEXUS(word,pos,line);
if (not (word == "="))
get_word_NEXUS(word,pos,line);
NEXUS_skip_ws(pos,line);
SequenceTree T;
string t = strip_NEXUS_comments(line.substr(pos,line.size()-pos));
T.parse(t);
leaf_names = T.get_sequences();
std::sort(leaf_names.begin(),leaf_names.end());
return;
}
catch (std::exception& e) {
cerr<<" Error! "<<e.what()<<endl;
cerr<<" Quitting read of tree file."<<endl;
file->setstate(std::ios::badbit);
}
}
}
}