本文整理汇总了C++中KineticLaw::getNumParameters方法的典型用法代码示例。如果您正苦于以下问题:C++ KineticLaw::getNumParameters方法的具体用法?C++ KineticLaw::getNumParameters怎么用?C++ KineticLaw::getNumParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KineticLaw
的用法示例。
在下文中一共展示了KineticLaw::getNumParameters方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkReactions
void checkReactions(Model* model, set<string>& components, set<string>& tests, const map<string, vector<double> >& results, int type)
{
if (model->getNumReactions() > 0) {
components.insert("Reaction");
for (unsigned int r=0; r<model->getNumReactions(); r++) {
Reaction* rxn = model->getReaction(r);
if (rxn->isSetFast() && rxn->getFast()) {
tests.insert("FastReaction");
}
if (rxn->isSetReversible() && rxn->getReversible()) {
if (type!=1) {
tests.insert("ReversibleReaction [?]");
}
}
ListOfSpeciesReferences* reactants = rxn->getListOfReactants();
checkSpeciesRefs(model, reactants, components, tests, results);
ListOfSpeciesReferences* products = rxn->getListOfProducts();
checkSpeciesRefs(model, products, components, tests, results);
if (rxn->isSetKineticLaw()) {
KineticLaw* kl = rxn->getKineticLaw();
if (kl->getNumParameters() > 0) {
tests.insert("LocalParameters");
}
if (kl->isSetMath() == false) {
tests.insert("NoMathML");
}
}
}
}
}
示例2: getReaction
void
Model::convertParametersToLocals(unsigned int level, unsigned int version)
{
for (unsigned int i = 0; i < getNumReactions(); i++)
{
Reaction *r = getReaction(i);
if (r->isSetKineticLaw())
{
KineticLaw *kl = r->getKineticLaw();
for (unsigned int j = 0; j < kl->getNumParameters(); j++)
{
LocalParameter *lp = new LocalParameter(level, version);
(*lp) = *(kl->getParameter(j));
kl->addLocalParameter(lp);
}
}
}
}
示例3: Model
END_TEST
START_TEST ( test_KineticLaw_Parameter_parent_create_model )
{
Model *m = new Model(2, 4);
Reaction *r = m->createReaction();
KineticLaw* kl = m->createKineticLaw();
Parameter * p = m->createKineticLawParameter();
fail_unless(kl->getNumParameters() == 1);
ListOfParameters *lop = kl->getListOfParameters();
fail_unless(r == kl->getParentSBMLObject());
fail_unless(kl == lop->getParentSBMLObject());
fail_unless(lop == p->getParentSBMLObject());
fail_unless(lop == kl->getParameter(0)->getParentSBMLObject());
delete kl;
}
示例4: printNotes
int
main (int argc, char* argv[])
{
if (argc != 2)
{
cout << endl << "Usage: printNotes filename" << endl << endl;
return 1;
}
unsigned int i,j;
const char* filename = argv[1];
SBMLDocument* document;
SBMLReader reader;
document = reader.readSBML(filename);
unsigned int errors = document->getNumErrors();
cout << endl;
cout << "filename: " << filename << endl;
cout << endl;
if(errors > 0)
{
document->printErrors(cerr);
delete document;
return errors;
}
/* Model */
Model* m = document->getModel();
printNotes(m);
for(i=0; i < m->getNumReactions(); i++)
{
Reaction* re = m->getReaction(i);
printNotes(re);
/* SpeciesReference (Reacatant) */
for(j=0; j < re->getNumReactants(); j++)
{
SpeciesReference* rt = re->getReactant(j);
if (rt->isSetNotes()) cout << " ";
printNotes(rt, (rt->isSetSpecies() ? rt->getSpecies() : std::string("")) );
}
/* SpeciesReference (Product) */
for(j=0; j < re->getNumProducts(); j++)
{
SpeciesReference* rt = re->getProduct(j);
if (rt->isSetNotes()) cout << " ";
printNotes(rt, (rt->isSetSpecies() ? rt->getSpecies() : std::string("")) );
}
/* ModifierSpeciesReference (Modifier) */
for(j=0; j < re->getNumModifiers(); j++)
{
ModifierSpeciesReference* md = re->getModifier(j);
if (md->isSetNotes()) cout << " ";
printNotes(md, (md->isSetSpecies() ? md->getSpecies() : std::string("")) );
}
/* Kineticlaw */
if(re->isSetKineticLaw())
{
KineticLaw* kl = re->getKineticLaw();
if (kl->isSetNotes()) cout << " ";
printNotes(kl);
/* Parameter */
for(j=0; j < kl->getNumParameters(); j++)
{
Parameter* pa = kl->getParameter(j);
if (pa->isSetNotes()) cout << " ";
printNotes(pa);
}
}
}
/* Species */
for(i=0; i < m->getNumSpecies(); i++)
{
Species* sp = m->getSpecies(i);
printNotes(sp);
}
/* Compartment */
for(i=0; i < m->getNumCompartments(); i++)
{
Compartment* sp = m->getCompartment(i);
//.........这里部分代码省略.........
示例5: load_sbml
/**
* Load a gene network from an SBML file. Overrides Structure.load(). Format must
* be equal GeneNetwork.SBML. Note, the SBML file must be in the exact same format
* as the SBML files produced by writeSBML(). In particular, we assume that reactions are listed
* *ordered* as we do in writeSBML().
* @param filename URL to the file describing the network to load
* @param format File format (GML, DOT, etc.)
* @throws IOException
*/
void GeneNetwork::load_sbml(const char *filename) {
SBMLDocument* document;
SBMLReader reader;
document = reader.readSBML(filename);
unsigned int errors = document->getNumErrors();
if (errors > 0) {
std::cerr << "Failed to open file " << filename << std::endl;
exit(1);
}
Model *m = document->getModel();
// -----------------------------------------
// Set the network size and create the genes
// do not count the species _void_
int size = m->getNumSpecies() - 1;
ListOfSpecies *species = m->getListOfSpecies();
for (int g=0; g < size; g++) {
if (species->get(g)->getId() != "_void_") {
//HillGene hg = new HillGene(this);
//hg.setLabel(species.get(g).getId());
HillGene *n = new HillGene(species->get(g)->getId());
//n.setLabel(species->get(g)->getId());
nodes_.push_back(*n);
delete n;
}
}
x_ = Vec_DP(nodes_.size());
x_ = 0;
y_ = Vec_DP(nodes_.size());
y_ = 0;
//vector<string> parameterNames; // the names of the parameters
//vector<double> parameterValues; // the values of the parameters
std::map<std::string, double> params;
std::vector<std::string> inputNodes; // the indexes of the inputs
HillGene src, tgt;
Parameter *param;
// 2 loops for one gene: both synthesis and degradation reactions
// (we assume that reactions are listed *ordered* as we do in writeSBML())
//int counter = 0;
for (unsigned int i=0; i < m->getNumReactions(); i++) {
Reaction *re = m->getReaction(i);
std::string id = re->getId();
std::stringstream ss;
ss << i;
//::logging::log::emit<Debug>() << id.c_str() <<
// ::logging::log::endl;
tgt = nodes_.at(getIndexOfNode(getGeneReactantId(id)));
//tgt->setLabel(getGeneReactantId(*re));
//SpeciesReference *rt = re->getReactant(0);
//Node *tgt = new HillGene();
//tgt->setLabel(rt->getSpecies());
//ListOfSpeciesReferences *modifiers = re->getListOfModifiers();
for (unsigned int j=0; j < re->getNumModifiers(); j++) {
ModifierSpeciesReference *md = re->getModifier(j);
src = nodes_.at(getIndexOfNode(md->getSpecies()));
inputNodes.push_back(src.getLabel());
// set output genes
std::vector<std::string> outputs = src.getOutputGenes();
outputs.push_back(tgt.getLabel());
src.setOutputGenes(outputs);
// The edge type is unknown for now, it is initialized later
Edge *e = new Edge(&src, &tgt, "+-");
edges_.push_back(*e);
//delete src;
delete e;
}
KineticLaw *kl = re->getKineticLaw();
for(unsigned int j=0; j < kl->getNumParameters(); j++) {
param = kl->getParameter(j);
params[param->getId()] = param->getValue();
//char buf[256];
//sprintf(buf, "%s\t%f", param->getId().c_str(), param->getValue());
//::logging::log::emit<Info>() << buf << ::logging::log::endl;
}
//::logging::log::emit<Info>() << ::logging::log::dec << params.size() <<
// ::logging::log::endl;
//.........这里部分代码省略.........