//static void SBMLUtils::collectIds(Model* pModel, std::map<std::string, const SBase*>& ids, std::map<std::string, const SBase*>& metaIds) { if (pModel != NULL) { // the model itself SBase* pSBase = NULL; std::string id; if (pModel->isSetId()) { id = pModel->getId(); if (ids.find(id) == ids.end()) { ids.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str()); } } if (pModel->isSetMetaId()) { id = pModel->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } // ListOfFunctionDefinitions pSBase = pModel->getListOfFunctionDefinitions(); if (pSBase != NULL) { if (pSBase->isSetId()) { id = pSBase->getId(); if (ids.find(id) == ids.end()) { ids.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str()); } } if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } // all FunctionDefinitions unsigned int i, iMax = pModel->getListOfFunctionDefinitions()->size(); for (i = 0; i < iMax; ++i) { pSBase = pModel->getListOfFunctionDefinitions()->get(i); if (pSBase->isSetId()) { id = pSBase->getId(); if (ids.find(id) == ids.end()) { ids.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str()); } } if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } } } // ListOfUnitDefinition pSBase = pModel->getListOfUnitDefinitions(); if (pSBase != NULL) { if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } // all UnitDefinitions // for each UnitDefinition: ListOfUnits, each Unit in ListOfUnits unsigned int i, iMax = pModel->getListOfUnitDefinitions()->size(); for (i = 0; i < iMax; ++i) { /* UnitDefinitions have their ids in a different namespace so we only consider meta ids. */ UnitDefinition* pUDef = pModel->getUnitDefinition(i); assert(pUDef != NULL); if (pUDef->isSetMetaId()) { id = pUDef->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pUDef)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } ListOf* pList = pUDef->getListOfUnits(); if (pList != NULL) { if (pList->isSetMetaId()) { id = pList->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pList)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } unsigned j, jMax = pList->size(); for (j = 0; j < jMax; ++j) { pSBase = pList->get(j); assert(pSBase != NULL); if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } } } } } // ListOfCompartmentTypes pSBase = pModel->getListOfCompartmentTypes(); if (pSBase != NULL) { if (pSBase->isSetId()) { id = pSBase->getId(); if (ids.find(id) == ids.end()) { ids.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str()); } } if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } // each compartment type unsigned int i, iMax = pModel->getListOfCompartmentTypes()->size(); for (i = 0; i < iMax; ++i) { pSBase = pModel->getCompartmentType(i); assert(pSBase != NULL); if (pSBase->isSetId()) { id = pSBase->getId(); if (ids.find(id) == ids.end()) { ids.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str()); } } if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } } } // ListOfSpeciesTypes pSBase = pModel->getListOfSpeciesTypes(); if (pSBase != NULL) { if (pSBase->isSetId()) { id = pSBase->getId(); if (ids.find(id) == ids.end()) { ids.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str()); } } if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } // each species type unsigned int i, iMax = pModel->getListOfSpeciesTypes()->size(); for (i = 0; i < iMax; ++i) { pSBase = pModel->getSpeciesType(i); assert(pSBase != NULL); if (pSBase->isSetId()) { id = pSBase->getId(); if (ids.find(id) == ids.end()) { ids.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str()); } } if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } } } // ListOfCompartments pSBase = pModel->getListOfCompartments(); if (pSBase != NULL) { if (pSBase->isSetId()) { id = pSBase->getId(); if (ids.find(id) == ids.end()) { ids.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str()); } } if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } // all compartments unsigned int i, iMax = pModel->getListOfCompartments()->size(); for (i = 0; i < iMax; ++i) { pSBase = pModel->getCompartment(i); assert(pSBase != NULL); if (pSBase->isSetId()) { id = pSBase->getId(); if (ids.find(id) == ids.end()) { ids.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str()); } } if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } } } // ListOfSpecies pSBase = pModel->getListOfSpecies(); if (pSBase != NULL) { if (pSBase->isSetId()) { id = pSBase->getId(); if (ids.find(id) == ids.end()) { ids.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str()); } } if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } // all species unsigned int i, iMax = pModel->getListOfSpecies()->size(); for (i = 0; i < iMax; ++i) { pSBase = pModel->getSpecies(i); assert(pSBase != NULL); if (pSBase->isSetId()) { id = pSBase->getId(); if (ids.find(id) == ids.end()) { ids.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str()); } } if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } } } // ListOfParameters pSBase = pModel->getListOfParameters(); if (pSBase != NULL) { if (pSBase->isSetId()) { id = pSBase->getId(); if (ids.find(id) == ids.end()) { ids.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str()); } } if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } // each parameter unsigned int i, iMax = pModel->getListOfParameters()->size(); for (i = 0; i < iMax; ++i) { pSBase = pModel->getParameter(i); assert(pSBase != NULL); if (pSBase->isSetId()) { id = pSBase->getId(); if (ids.find(id) == ids.end()) { ids.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str()); } } if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } } } // ListOfInitialAssignments pSBase = pModel->getListOfInitialAssignments(); if (pSBase != NULL) { if (pSBase->isSetId()) { id = pSBase->getId(); if (ids.find(id) == ids.end()) { ids.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str()); } } if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } // each initial assignment unsigned int i, iMax = pModel->getListOfInitialAssignments()->size(); for (i = 0; i < iMax; ++i) { pSBase = pModel->getInitialAssignment(i); assert(pSBase != NULL); // initial assignments have no ids if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } } } // ListOfRules pSBase = pModel->getListOfRules(); if (pSBase != NULL) { if (pSBase->isSetId()) { id = pSBase->getId(); if (ids.find(id) == ids.end()) { ids.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str()); } } if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } // each rule unsigned int i, iMax = pModel->getListOfRules()->size(); for (i = 0; i < iMax; ++i) { pSBase = pModel->getRule(i); assert(pSBase != NULL); // rules don't have ids if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } } } // ListOfConstraints pSBase = pModel->getListOfConstraints(); if (pSBase != NULL) { if (pSBase->isSetId()) { id = pSBase->getId(); if (ids.find(id) == ids.end()) { ids.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str()); } } if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } // each constraint unsigned int i, iMax = pModel->getListOfConstraints()->size(); for (i = 0; i < iMax; ++i) { pSBase = pModel->getConstraint(i); assert(pSBase != NULL); // constraints don't have ids if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } } } // ListOfReactions pSBase = pModel->getListOfReactions(); if (pSBase != NULL) { if (pSBase->isSetId()) { id = pSBase->getId(); if (ids.find(id) == ids.end()) { ids.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str()); } } if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } // all reactions unsigned int i, iMax = pModel->getListOfReactions()->size(); for (i = 0; i < iMax; ++i) { Reaction* pReaction = pModel->getReaction(i); assert(pReaction != NULL); if (pReaction->isSetId()) { id = pReaction->getId(); if (ids.find(id) == ids.end()) { ids.insert(std::pair<const std::string, const SBase*>(id, pReaction)); } else { CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str()); } } if (pReaction->isSetMetaId()) { id = pReaction->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pReaction)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } // for each reaction: ListOfSubstrates, each substrate, ListOfProducts, each // Product, ListOfModifieres, each modifier, KineticLaw, ListOfparameters, // each parameter if (pReaction->getListOfReactants() != NULL) { pSBase = pReaction->getListOfReactants(); if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } unsigned int j, jMax = pReaction->getListOfReactants()->size(); for (j = 0; j < jMax; ++j) { pSBase = pReaction->getReactant(j); assert(pSBase != NULL); // since L2V2 species references can have ids if (pSBase->isSetId()) { id = pSBase->getId(); if (ids.find(id) == ids.end()) { ids.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str()); } } if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } } } if (pReaction->getListOfProducts() != NULL) { pSBase = pReaction->getListOfProducts(); if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } unsigned int j, jMax = pReaction->getListOfProducts()->size(); for (j = 0; j < jMax; ++j) { pSBase = pReaction->getProduct(j); assert(pSBase != NULL); // since L2V2 species references can have ids if (pSBase->isSetId()) { id = pSBase->getId(); if (ids.find(id) == ids.end()) { ids.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str()); } } if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } } } if (pReaction->getListOfModifiers() != NULL) { pSBase = pReaction->getListOfModifiers(); if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } unsigned int j, jMax = pReaction->getListOfModifiers()->size(); for (j = 0; j < jMax; ++j) { pSBase = pReaction->getModifier(j); assert(pSBase != NULL); // since L2V2 species references can have ids if (pSBase->isSetId()) { id = pSBase->getId(); if (ids.find(id) == ids.end()) { ids.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str()); } } if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } } } KineticLaw* pKLaw = pReaction->getKineticLaw(); if (pKLaw != NULL) { if (pKLaw->isSetMetaId()) { id = pKLaw->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pKLaw)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } pSBase = pKLaw->getListOfParameters(); if (pSBase != NULL) { if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } unsigned int j, jMax = pKLaw->getListOfParameters()->size(); for (j = 0; j < jMax; ++j) { pSBase = pKLaw->getParameter(j); assert(pSBase != NULL); // local parameters have their ids in a // different namespace if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } } } } } } // ListOfEvents pSBase = pModel->getListOfEvents(); if (pSBase != NULL) { if (pSBase->isSetId()) { id = pSBase->getId(); if (ids.find(id) == ids.end()) { ids.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str()); } } if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pModel)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } // each event unsigned int i, iMax = pModel->getListOfEvents()->size(); for (i = 0; i < iMax; ++i) { Event* pEvent = pModel->getEvent(i); assert(pEvent != NULL); if (pEvent->isSetId()) { id = pEvent->getId(); if (ids.find(id) == ids.end()) { ids.insert(std::pair<const std::string, const SBase*>(id, pEvent)); } else { CCopasiMessage(CCopasiMessage::EXCEPTION, MCSBML + 68, id.c_str()); } } if (pEvent->isSetMetaId()) { id = pEvent->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pEvent)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } // in each event Trigger,Delay,ListOfEventAssignments, each event assignment if (pEvent->isSetTrigger()) { pSBase = pEvent->getTrigger(); assert(pSBase != NULL); if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } } if (pEvent->isSetDelay()) { pSBase = pEvent->getDelay(); assert(pSBase != NULL); if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } } if (pEvent->getListOfEventAssignments() != NULL) { pSBase = pEvent->getListOfEventAssignments(); if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } unsigned int j, jMax = pEvent->getListOfEventAssignments()->size(); for (j = 0; j < jMax; ++j) { pSBase = pEvent->getEventAssignment(j); assert(pSBase != NULL); if (pSBase->isSetMetaId()) { id = pSBase->getMetaId(); if (metaIds.find(id) == metaIds.end()) { metaIds.insert(std::pair<const std::string, const SBase*>(id, pSBase)); } else { CCopasiMessage(CCopasiMessage::WARNING, MCSBML + 67, id.c_str()); } } } } } } } }
void CompIdBase::checkId (const Reaction& x) { if (x.isSetId()) doCheckId(x.getId(), x); }
void SbmlReader::createReaction(const map< string, Id > &molSidcmptMIdMap ) { Reaction* reac; map< string,double > rctMap; map< string,double >::iterator rctMap_iter; map< string,double >prdMap; map< string,double >::iterator prdMap_iter; map< string,EnzymeInfo >enzInfoMap; for ( unsigned int r = 0; r < model_->getNumReactions(); r++ ) { Id reaction_; reac = model_->getReaction( r ); noOfsub_ = 0; noOfprd_ = 0; std:: string id; //=reac->getId(); if ( reac->isSetId() ) id = reac->getId(); std::string name; if ( reac->isSetName() ) { name = reac->getName(); name = nameString(name); } if (name.empty()) { if (id.empty()) assert("Reaction id and name is empty"); else name = id; } string grpname = getAnnotation( reac,enzInfoMap ); if ( (grpname != "") && (enzInfoMap[grpname].stage == 3) ) { setupEnzymaticReaction( enzInfoMap[grpname],grpname ,molSidcmptMIdMap,name); } //if (grpname != "") // { //cout << "\n enz matic reaction " << enzInfoMap[grpname].stage; //setupEnzymaticReaction( enzInfoMap[grpname],grpname ,molSidcmptMIdMap); //} else if ( grpname == "" ) { if (reac->getNumModifiers() > 0) setupMMEnzymeReaction( reac,id,name ,molSidcmptMIdMap); else { bool rev=reac->getReversible(); bool fast=reac->getFast(); if ( fast ) { cout<<"warning: for now fast attribute is not handled"<<endl; errorFlag_ = true; } int numRcts = reac->getNumReactants(); int numPdts = reac->getNumProducts(); if ( numRcts == 0 && numPdts != 0 ) { cout << "Reaction with zero Substrate is not possible but exist in this model"; const SpeciesReference* pdt = reac->getProduct( 0 ); std::string spName = pdt->getSpecies(); Id parent = molSidcmptMIdMap.find( spName )->second; //gives compartment of spName cout << " \n \t ################################# Sub = 0 and prd != 0 need to the reac ############### "; const SpeciesReference* rect=reac->getReactant(0); std::string sp=rect->getSpecies(); Id comptRef = molSidcmptMIdMap.find(sp)->second; //gives compartment of sp Id meshEntry = Neutral::child( comptRef.eref(), "mesh" ); Shell* shell = reinterpret_cast< Shell* >( Id().eref().data() ); reaction_ = shell->doCreate("Reac", meshEntry, name, 1); //shell->doAddMsg( "Single", meshEntry, "remeshReacs", reaction_, "remesh"); //Get Substrate addSubPrd(reac,reaction_,"prd"); } //if numRcts == 0 else { const SpeciesReference* rect=reac->getReactant(0); std::string sp=rect->getSpecies(); Id comptRef = molSidcmptMIdMap.find(sp)->second; //gives compartment of sp Id meshEntry = Neutral::child( comptRef.eref(), "mesh" ); Shell* shell = reinterpret_cast< Shell* >( Id().eref().data() ); reaction_ = shell->doCreate("Reac", comptRef, name, 1); //shell->doAddMsg( "Single", meshEntry, "remeshReacs", reaction_, "remesh"); //Get Substrate addSubPrd(reac,reaction_,"sub"); //Get Product addSubPrd(reac,reaction_,"prd"); } if ( reac->isSetKineticLaw() ) { KineticLaw * klaw=reac->getKineticLaw(); //vector< double > rate = getKLaw( klaw,rev ); vector< double > rate; rate.clear(); getKLaw( klaw,rev,rate ); if ( errorFlag_ ) return; else if ( !errorFlag_ ) { //cout << " Reaction name " << name << " kf " << rate[0] << " kb " << rate[1]<<endl; Field < double > :: set( reaction_, "Kf", rate[0] ); Field < double > :: set( reaction_, "Kb", rate[1] ); /*if (numRcts > 1) rate[0] = rate[0]*pow(1e3,1.0); cout << "Reaction " << id << " " << name << " " << rate[0] << " " << rate[1]<<endl; Field < double > :: set( reaction_, "Kf", rate[0] ); Field < double > :: set( reaction_, "Kb", rate[1] ); */ } } //issetKineticLaw } //else } // else grpname == "" }//for unsigned } //reaction