本文整理汇总了C++中SequenceTree::get_sequences方法的典型用法代码示例。如果您正苦于以下问题:C++ SequenceTree::get_sequences方法的具体用法?C++ SequenceTree::get_sequences怎么用?C++ SequenceTree::get_sequences使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SequenceTree
的用法示例。
在下文中一共展示了SequenceTree::get_sequences方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
}
示例2: partition_from_branch
Partition partition_from_branch(const SequenceTree& T,int b)
{
dynamic_bitset<> group(T.n_leaves());
const dynamic_bitset<>& with_internal = T.partition(b);
for(int i=0;i<group.size();i++)
group[i] = with_internal[i];
return Partition(T.get_sequences(), ~group);
}
示例3: remap_T_indices
/// \brief Re-index the leaves of tree \a T so that the labels have the same ordering as in \a names.
///
/// \param T The leaf-labelled tree.
/// \param names The ordered leaf labels.
///
void remap_T_indices(SequenceTree& T,const vector<string>& names)
{
//----- Remap leaf indices for T onto A's leaf sequence indices -----//
try {
vector<int> mapping = compute_mapping(T.get_sequences(),names);
T.standardize(mapping);
}
catch(const bad_mapping<string>& b)
{
bad_mapping<string> b2(b.missing,b.from);
if (b.from == 0)
b2<<"Couldn't find leaf sequence \""<<b2.missing<<"\" in names.";
else
b2<<"Sequence '"<<b2.missing<<"' not found in the tree.";
throw b2;
}
}
示例4: delete_node
//FIXME T.seq(i) -> T.leafname(i)
//FIXME T.get_sequences -> T.leafnames()
void delete_node(SequenceTree& T,const std::string& name)
{
int index = find_index(T.get_sequences(),name);
nodeview n = T.prune_subtree(T.branch(index).reverse());
T.remove_node_from_branch(n);
}
示例5: myexception
Parameters::Parameters(const vector<alignment>& A, const SequenceTree& t,
const vector<polymorphic_cow_ptr<substitution::MultiModel> >& SMs,
const vector<int>& s_mapping,
const vector<int>& scale_mapping)
:SModels(SMs),
smodel_for_partition(s_mapping),
scale_for_partition(scale_mapping),
branch_prior_type(0),
smodel_full_tree(true),
T(t),
TC(star_tree(t.get_sequences())),
branch_HMM_type(t.n_branches(),0),
beta(2, 1.0),
updown(-1),
features(0)
{
constants.push_back(-1);
for(int i=0;i<n_scales;i++)
add_super_parameter("mu"+convertToString(i+1),1.0);
// check that smodel mapping has correct size.
if (smodel_for_partition.size() != A.size())
throw myexception()<<"There are "<<A.size()
<<" data partitions, but you mapped smodels onto "
<<smodel_for_partition.size();
// register the substitution models as sub-models
for(int i=0;i<SModels.size();i++) {
string name = "S" + convertToString(i+1);
add_submodel(name, *SModels[i]);
}
// NO indel model (in this constructor)
// check that we only mapping existing smodels to data partitions
for(int i=0;i<smodel_for_partition.size();i++) {
int m = smodel_for_partition[i];
if (m >= SModels.size())
throw myexception()<<"You can't use smodel "<<m+1<<" for data partition "<<i+1
<<" because there are only "<<SModels.size()<<" smodels.";
}
// load values from sub-models (smodels/imodel)
read();
// don't constrain any branch lengths
for(int b=0;b<TC->n_branches();b++)
TC->branch(b).set_length(-1);
// create data partitions and register as sub-models
for(int i=0;i<A.size();i++)
{
// compute name for data-partition
string name = string("part") + convertToString(i+1);
// get reference to smodel for data-partition
const substitution::MultiModel& SM = SModel(smodel_for_partition[i]);
// create data partition
data_partitions.push_back(cow_ptr<data_partition>(data_partition(name,A[i],*T,SM)));
// register data partition as sub-model
add_submodel(name,*data_partitions[i]);
}
}
示例6: next_tree
bool reader_t::next_tree(SequenceTree& T)
{
T.get_sequences() = leaf_names;
return next_tree(static_cast<Tree&>(T));
}