Search in sources :

Example 26 with Product

use of cbit.vcell.model.Product in project vcell by virtualcell.

the class Xmlproducer method getXML.

/**
 * This method returns a XML representation of a Flux Reaction object.
 * Creation date: (2/26/2001 12:30:13 PM)
 * @return Element
 * @param param cbit.vcell.model.FluxReaction
 */
private Element getXML(FluxReaction param) throws XmlParseException {
    Element fluxreaction = new Element(XMLTags.FluxStepTag);
    // get Attributes
    String versionName = (param.getName() != null) ? mangle(param.getName()) : "unnamed_fluxReaction";
    fluxreaction.setAttribute(XMLTags.NameAttrTag, versionName);
    fluxreaction.setAttribute(XMLTags.StructureAttrTag, mangle(param.getStructure().getName()));
    fluxreaction.setAttribute(XMLTags.ReversibleAttrTag, mangle(Boolean.valueOf(param.isReversible()).toString()));
    if (param.getPhysicsOptions() == FluxReaction.PHYSICS_ELECTRICAL_ONLY) {
        fluxreaction.setAttribute(XMLTags.FluxOptionAttrTag, XMLTags.FluxOptionElectricalOnly);
    } else if (param.getPhysicsOptions() == FluxReaction.PHYSICS_MOLECULAR_AND_ELECTRICAL) {
        fluxreaction.setAttribute(XMLTags.FluxOptionAttrTag, XMLTags.FluxOptionMolecularAndElectrical);
    } else if (param.getPhysicsOptions() == FluxReaction.PHYSICS_MOLECULAR_ONLY) {
        fluxreaction.setAttribute(XMLTags.FluxOptionAttrTag, XMLTags.FluxOptionMolecularOnly);
    }
    // If keyFlag is on print the Keyvalue
    if (param.getKey() != null && this.printKeysFlag) {
        fluxreaction.setAttribute(XMLTags.KeyValueAttrTag, param.getKey().toString());
    }
    // Add subelements: Reactants/Products/Catalysts
    // separate the order of the reactants, products, and modifiers.
    ReactionParticipant[] rpArray = param.getReactionParticipants();
    ArrayList<Element> products = new ArrayList<Element>();
    ArrayList<Element> modifiers = new ArrayList<Element>();
    for (int i = 0; i < rpArray.length; i++) {
        Element rp = getXML(rpArray[i]);
        if (rp != null) {
            if (rpArray[i] instanceof Reactant)
                fluxreaction.addContent(rp);
            else if (rpArray[i] instanceof Product)
                products.add(rp);
            else if (rpArray[i] instanceof Catalyst)
                modifiers.add(rp);
        }
    }
    for (int i = 0; i < products.size(); i++) fluxreaction.addContent((Element) products.get(i));
    for (int i = 0; i < modifiers.size(); i++) fluxreaction.addContent((Element) modifiers.get(i));
    // Add Kinetics
    fluxreaction.addContent(getXML(param.getKinetics()));
    return fluxreaction;
}
Also used : Element(org.jdom.Element) ArrayList(java.util.ArrayList) Product(cbit.vcell.model.Product) ReactionParticipant(cbit.vcell.model.ReactionParticipant) Reactant(cbit.vcell.model.Reactant) Catalyst(cbit.vcell.model.Catalyst)

Example 27 with Product

use of cbit.vcell.model.Product in project vcell by virtualcell.

the class ModelProcessEquation method computeEquationString.

private void computeEquationString() {
    if (modelProcess instanceof ReactionStep) {
        ReactionStep reactionStep = (ReactionStep) modelProcess;
        ReactionParticipant[] reactantParticipants = reactionStep.getReactionParticipants();
        ArrayList<ReactionParticipant> reactantList = new ArrayList<ReactionParticipant>();
        ArrayList<ReactionParticipant> productList = new ArrayList<ReactionParticipant>();
        // if (reactionStep instanceof SimpleReaction) {
        for (ReactionParticipant rp : reactantParticipants) {
            if (rp instanceof Reactant) {
                reactantList.add(rp);
            } else if (rp instanceof Product) {
                productList.add(rp);
            }
        }
        // } else {
        // Membrane membrane = (Membrane) ((FluxReaction)reactionStep).getStructure();
        // StructureTopology structTopology = reactionStep.getModel().getStructureTopology();
        // for (ReactionParticipant rp : reactantParticipants) {
        // if (rp instanceof Flux) {
        // Flux flux = (Flux)rp;
        // Feature scf = (Feature) flux.getSpeciesContext().getStructure();
        // if (structTopology.getInsideFeature(membrane) == scf) {
        // productList.add(rp);
        // } else {
        // reactantList.add(rp);
        // }
        // }
        // }
        // }
        StringBuffer sb = new StringBuffer();
        for (ReactionParticipant r : reactantList) {
            if (sb.length() > 0) {
                sb.append(" + ");
            }
            int stoichiometry = r.getStoichiometry();
            sb.append((stoichiometry > 1 ? stoichiometry : "") + r.getName());
        }
        equationleftHand = sb.toString();
        sb = new StringBuffer();
        for (ReactionParticipant p : productList) {
            if (sb.length() > 0) {
                sb.append(" + ");
            }
            int stoichiometry = p.getStoichiometry();
            sb.append((stoichiometry > 1 ? stoichiometry : "") + p.getName());
        }
        equationRightHand = sb.toString();
        equationString = equationleftHand + " " + REACTION_GOESTO + " " + equationRightHand;
    } else if (modelProcess instanceof ReactionRule) {
        ReactionRule reactionRuleEmbedded = (ReactionRule) modelProcess;
        equationString = RbmUtils.toBnglStringShort(reactionRuleEmbedded, CompartmentMode.hide);
    }
}
Also used : ReactionRule(cbit.vcell.model.ReactionRule) ReactionStep(cbit.vcell.model.ReactionStep) ArrayList(java.util.ArrayList) Product(cbit.vcell.model.Product) ReactionParticipant(cbit.vcell.model.ReactionParticipant) Reactant(cbit.vcell.model.Reactant)

Example 28 with Product

use of cbit.vcell.model.Product in project vcell by virtualcell.

the class PathwayMapping method parseReaction.

private ReactionParticipant[] parseReaction(ReactionStep reactionStep, BioModel bioModel, RelationshipObject relationshipObject) throws ExpressionException, PropertyVetoException {
    if (reactionStep == null || bioModel == null || bioModel.getRelationshipModel() == null) {
        return null;
    }
    // create the reaction equation string
    String leftHand = getParticipantsString(((Conversion) relationshipObject.getBioPaxObject()).getLeft());
    String rightHand = getParticipantsString(((Conversion) relationshipObject.getBioPaxObject()).getRight());
    StringTokenizer st = new StringTokenizer(leftHand, "+");
    HashMap<String, SpeciesContext> speciesContextMap = new HashMap<String, SpeciesContext>();
    ArrayList<ReactionParticipant> rplist = new ArrayList<ReactionParticipant>();
    // create and add reaction participants to list for left-hand side of equation
    Model model = bioModel.getModel();
    Structure structure = reactionStep.getStructure();
    while (st.hasMoreElements()) {
        String nextToken = st.nextToken().trim();
        if (nextToken.length() == 0) {
            continue;
        }
        int stoichiIndex = 0;
        while (true) {
            if (Character.isDigit(nextToken.charAt(stoichiIndex))) {
                stoichiIndex++;
            } else {
                break;
            }
        }
        int stoichi = 1;
        String tmp = nextToken.substring(0, stoichiIndex);
        if (tmp.length() > 0) {
            stoichi = Integer.parseInt(tmp);
        }
        String var = nextToken.substring(stoichiIndex).trim();
        // get speciesContext object based on its name
        // if the speciesContext is not existed, create a new one
        SpeciesContext sc = model.getSpeciesContext(var);
        if (sc == null) {
            sc = speciesContextMap.get(var);
            if (sc == null) {
                // get species object based on its name
                // if the species is not existed, create a new one
                Species species = model.getSpecies(var);
                if (species == null) {
                    species = new Species(var, null);
                }
                sc = new SpeciesContext(species, structure);
                sc.setName(var);
                speciesContextMap.put(var, sc);
            }
        }
        // add the existed speciesContext objects or new speciesContext objects to reaction participant list
        if (reactionStep instanceof SimpleReaction || reactionStep instanceof FluxReaction) {
            rplist.add(new Reactant(null, (SimpleReaction) reactionStep, sc, stoichi));
        }
    }
    // create and add reaction participants to list for right-hand side of equation
    st = new StringTokenizer(rightHand, "+");
    while (st.hasMoreElements()) {
        String nextToken = st.nextToken().trim();
        if (nextToken.length() == 0) {
            continue;
        }
        int stoichiIndex = 0;
        while (true) {
            if (Character.isDigit(nextToken.charAt(stoichiIndex))) {
                stoichiIndex++;
            } else {
                break;
            }
        }
        int stoichi = 1;
        String tmp = nextToken.substring(0, stoichiIndex);
        if (tmp.length() > 0) {
            stoichi = Integer.parseInt(tmp);
        }
        String var = nextToken.substring(stoichiIndex);
        SpeciesContext sc = model.getSpeciesContext(var);
        if (sc == null) {
            sc = speciesContextMap.get(var);
            if (sc == null) {
                Species species = model.getSpecies(var);
                if (species == null) {
                    species = new Species(var, null);
                }
                sc = new SpeciesContext(species, structure);
                sc.setName(var);
                speciesContextMap.put(var, sc);
            }
        }
        if (reactionStep instanceof SimpleReaction || reactionStep instanceof FluxReaction) {
            rplist.add(new Product(null, (SimpleReaction) reactionStep, sc, stoichi));
        }
    }
    return rplist.toArray(new ReactionParticipant[0]);
}
Also used : SimpleReaction(cbit.vcell.model.SimpleReaction) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Product(cbit.vcell.model.Product) FluxReaction(cbit.vcell.model.FluxReaction) SpeciesContext(cbit.vcell.model.SpeciesContext) Reactant(cbit.vcell.model.Reactant) StringTokenizer(java.util.StringTokenizer) BioModel(cbit.vcell.biomodel.BioModel) Model(cbit.vcell.model.Model) Structure(cbit.vcell.model.Structure) ReactionParticipant(cbit.vcell.model.ReactionParticipant) Species(cbit.vcell.model.Species)

Example 29 with Product

use of cbit.vcell.model.Product in project vcell by virtualcell.

the class PathwayMapping method createReactionStep.

/*
	 * for reaction:
	 * 1. annotate the selected vcell object using linked pathway conversion
	 * 2. add non-existing speciesContexts from linked pathway conversion
	 * 3. add links between relative vcell objects and pathway objects
	 * Questions:
	 * - how to deal with the case that the reaction is existing in the model?
	 * 		+ add it in no matter what? 
	 * 				(this is the version we have now: 
	 * 					add the duplicated reactions in without name changing, 
	 * 				 	all duplicated reactions share the same participant objects)
	 *      + just modify the existing one?
	 */
private void createReactionStep(BioModel bioModel, Process process, ReactionStep reactionStep, RelationshipObject relationshipObject, ArrayList<ConversionTableRow> participants, boolean addSubunits) throws Exception {
    if (reactionStep == null || bioModel == null || bioModel.getRelationshipModel() == null || participants.size() < 1) {
        return;
    }
    ArrayList<ReactionParticipant> rplist = new ArrayList<ReactionParticipant>();
    // create and add reaction participants to list
    for (ConversionTableRow ctr : participants) {
        if (ctr.getBioPaxObject() instanceof Conversion)
            continue;
        int stoich = ctr.stoich().intValue();
        String safeId = getSafetyName(ctr.id());
        // get speciesContext object based on its name
        // if the speciesContext is not existed, create a new one
        createSpeciesContextFromTableRow(bioModel, (PhysicalEntity) ctr.getBioPaxObject(), ctr.stoich(), ctr.id(), ctr.location(), addSubunits);
        // add the existed speciesContext objects or new speciesContext objects to reaction participant list
        if (ctr.participantType().equals("Reactant")) {
            if (reactionStep instanceof SimpleReaction || reactionStep instanceof FluxReaction) {
                rplist.add(new Reactant(null, reactionStep, bioModel.getModel().getSpeciesContext(safeId), stoich));
            }
        } else if (ctr.participantType().equals("Product")) {
            if (reactionStep instanceof SimpleReaction || reactionStep instanceof FluxReaction) {
                rplist.add(new Product(null, reactionStep, bioModel.getModel().getSpeciesContext(safeId), stoich));
            }
        }
    // we do not add catalysts
    }
    ReactionParticipant[] rpArray = rplist.toArray(new ReactionParticipant[0]);
    reactionStep.setReactionParticipants(rpArray);
    // add Controls to the reaction
    Set<PhysicalEntity> controllers = process.getControllers();
    for (ConversionTableRow ctr : participants) {
        if (controllers.contains(ctr.getBioPaxObject())) {
            if (ctr.participantType().equals("Catalyst")) {
                String safeId = getSafetyName(ctr.id());
                /* 
					 * using addCatalyst() to create catalyst in reaction: 
					 * this function cannot allow an object to be catalyst and (reactant/product) in the same reaction
					 */
                // reactionStep.addCatalyst(bioModel.getModel().getSpeciesContext(safeId));
                /* However, in pathway interaction object, an physicalEntity can be catalyst and (reactant/product) in the same reaction
					 * So we just call create catalyst for the reaction no matter what rolls the object is playing in the reaction
					 * Switch back to the addCatalyst() function when it is necessary, but exceptions make be reported for some reactions
					 */
                reactionStep.addReactionParticipant(new Catalyst(null, reactionStep, bioModel.getModel().getSpeciesContext(safeId)));
            } else if (ctr.participantType().equals("Control")) {
                String safeId = getSafetyName(ctr.id());
                // reactionStep.addCatalyst(bioModel.getModel().getSpeciesContext(safeId));
                reactionStep.addReactionParticipant(new Catalyst(null, reactionStep, bioModel.getModel().getSpeciesContext(safeId)));
            }
        }
    }
}
Also used : SimpleReaction(cbit.vcell.model.SimpleReaction) ArrayList(java.util.ArrayList) Product(cbit.vcell.model.Product) FluxReaction(cbit.vcell.model.FluxReaction) Conversion(org.vcell.pathway.Conversion) Reactant(cbit.vcell.model.Reactant) PhysicalEntity(org.vcell.pathway.PhysicalEntity) ReactionParticipant(cbit.vcell.model.ReactionParticipant) Catalyst(cbit.vcell.model.Catalyst)

Example 30 with Product

use of cbit.vcell.model.Product in project vcell by virtualcell.

the class SBMLImporter method addReactionParticipants.

/**
 * addReactionParticipant : Adds reactants and products and modifiers to a
 * reaction. Input args are the sbml reaction, vc reaction This method was
 * created mainly to handle reactions where there are reactants and/or
 * products that appear multiple times in a reaction. Virtual Cell now
 * allows the import of such reactions.
 */
private void addReactionParticipants(org.sbml.jsbml.Reaction sbmlRxn, ReactionStep vcRxn) throws Exception {
    Model vcModel = vcBioModel.getSimulationContext(0).getModel();
    // if (!(vcRxn instanceof FluxReaction)) {
    if (true) {
        // reactants in sbmlRxn
        HashMap<String, Integer> sbmlReactantsHash = new HashMap<String, Integer>();
        for (int j = 0; j < (int) sbmlRxn.getNumReactants(); j++) {
            SpeciesReference spRef = sbmlRxn.getReactant(j);
            String sbmlReactantSpId = spRef.getSpecies();
            if (sbmlModel.getSpecies(sbmlReactantSpId) != null) {
                // check
                // if
                // spRef
                // is in
                // sbml
                // model
                // If stoichiometry of speciesRef is not an integer, it is
                // not handled in the VCell at this time; no point going
                // further
                double stoichiometry = 0.0;
                if (level < 3) {
                    // for SBML models < L3, default
                    // stoichiometry is 1, if field is not
                    // set.
                    // default value of stoichiometry,
                    stoichiometry = 1.0;
                    // if not set.
                    if (spRef.isSetStoichiometry()) {
                        stoichiometry = spRef.getStoichiometry();
                        if (((int) stoichiometry != stoichiometry) || spRef.isSetStoichiometryMath()) {
                            throw new SBMLImportException("Non-integer stoichiometry ('" + stoichiometry + "' for reactant '" + sbmlReactantSpId + "' in reaction '" + sbmlRxn.getId() + "') or stoichiometryMath not handled in VCell at this time.", Category.NON_INTEGER_STOICH);
                        // logger.sendMessage(VCLogger.Priority.HighPriority,
                        // VCLogger.ErrorType.ReactionError,
                        // "Non-integer stoichiometry or stoichiometryMath not handled in VCell at this time.");
                        }
                    }
                } else {
                    if (spRef.isSetStoichiometry()) {
                        stoichiometry = spRef.getStoichiometry();
                        if (((int) stoichiometry != stoichiometry) || spRef.isSetStoichiometryMath()) {
                            throw new SBMLImportException("Non-integer stoichiometry ('" + stoichiometry + "' for reactant '" + sbmlReactantSpId + "' in reaction '" + sbmlRxn.getId() + "') or stoichiometryMath not handled in VCell at this time.", Category.NON_INTEGER_STOICH);
                        // logger.sendMessage(VCLogger.Priority.HighPriority,
                        // VCLogger.ErrorType.ReactionError,
                        // "Non-integer stoichiometry or stoichiometryMath not handled in VCell at this time.");
                        // logger.sendMessage(VCLogger.Priority.HighPriority,
                        // VCLogger.ErrorType.ReactionError,
                        // "Non-integer stoichiometry or stoichiometryMath not handled in VCell at this time.");
                        }
                    } else {
                        throw new SBMLImportException("This is a SBML level 3 model, stoichiometry is not set for the reactant '" + sbmlReactantSpId + "' and no default value can be assumed.");
                    // logger.sendMessage(VCLogger.Priority.HighPriority,
                    // VCLogger.ErrorType.ReactionError,
                    // "This is a SBML level 3 model, stoichiometry is not set for the reactant '"
                    // + spRef.getSpecies() +
                    // "' and no default value can be assumed.");
                    }
                }
                if (sbmlReactantsHash.get(sbmlReactantSpId) == null) {
                    // if sbmlReactantSpId is NOT in sbmlReactantsHash, add
                    // it with its stoichiometry
                    sbmlReactantsHash.put(sbmlReactantSpId, Integer.valueOf((int) stoichiometry));
                } else {
                    // if sbmlReactantSpId IS in sbmlReactantsHash, update
                    // its stoichiometry value to (existing-from-hash +
                    // stoichiometry) and put it back in hash
                    int intStoich = sbmlReactantsHash.get(sbmlReactantSpId).intValue();
                    intStoich += (int) stoichiometry;
                    sbmlReactantsHash.put(sbmlReactantSpId, Integer.valueOf(intStoich));
                }
            } else {
                // spRef is not in model, throw exception
                throw new SBMLImportException("Reactant '" + sbmlReactantSpId + "' in reaction '" + sbmlRxn.getId() + "' not found as species in SBML model.");
            }
        // end - if (spRef is species in model)
        }
        // sbmlReactionParticipantsHash as reactants to vcRxn
        for (Entry<String, Integer> es : sbmlReactantsHash.entrySet()) {
            SpeciesContext speciesContext = vcModel.getSpeciesContext(es.getKey());
            int stoich = es.getValue();
            vcRxn.addReactant(speciesContext, stoich);
        }
        /*
			Iterator<String> sbmlReactantsIter = sbmlReactantsHash.keySet()
					.iterator();
			while (sbmlReactantsIter.hasNext()) {
				String sbmlReactantStr = sbmlReactantsIter.next();
				SpeciesContext speciesContext = vcModel
						.getSpeciesContext(sbmlReactantStr);
				int stoich = sbmlReactantsHash.get(sbmlReactantStr).intValue();
				((SimpleReaction) vcRxn).addReactant(speciesContext, stoich);
			}
			*/
        // products in sbmlRxn
        HashMap<String, Integer> sbmlProductsHash = new HashMap<String, Integer>();
        for (int j = 0; j < (int) sbmlRxn.getNumProducts(); j++) {
            SpeciesReference spRef = sbmlRxn.getProduct(j);
            String sbmlProductSpId = spRef.getSpecies();
            if (sbmlModel.getSpecies(sbmlProductSpId) != null) {
                /* check if spRef is in sbml model
					If stoichiometry of speciesRef is not an integer, it is
					not handled in the VCell at this time; no point going
					further */
                double stoichiometry = 0.0;
                if (level < 3) {
                    // for sBML models < L3, default
                    // stoichiometry is 1, if field is not
                    // set.
                    // default value of stoichiometry,
                    stoichiometry = 1.0;
                    // if not set.
                    if (spRef.isSetStoichiometry()) {
                        stoichiometry = spRef.getStoichiometry();
                        if (((int) stoichiometry != stoichiometry) || spRef.isSetStoichiometryMath()) {
                            throw new SBMLImportException("Non-integer stoichiometry ('" + stoichiometry + "' for product '" + sbmlProductSpId + "' in reaction '" + sbmlRxn.getId() + "') or stoichiometryMath not handled in VCell at this time.", Category.NON_INTEGER_STOICH);
                        // logger.sendMessage(VCLogger.Priority.HighPriority,
                        // VCLogger.ErrorType.ReactionError,
                        // "Non-integer stoichiometry or stoichiometryMath not handled in VCell at this time.");
                        }
                    }
                } else {
                    if (spRef.isSetStoichiometry()) {
                        stoichiometry = spRef.getStoichiometry();
                        if (((int) stoichiometry != stoichiometry) || spRef.isSetStoichiometryMath()) {
                            throw new SBMLImportException("Non-integer stoichiometry ('" + stoichiometry + "' for product '" + sbmlProductSpId + "' in reaction '" + sbmlRxn.getId() + "') or stoichiometryMath not handled in VCell at this time.", Category.NON_INTEGER_STOICH);
                        // logger.sendMessage(VCLogger.Priority.HighPriority,
                        // VCLogger.ErrorType.ReactionError,
                        // "Non-integer stoichiometry or stoichiometryMath not handled in VCell at this time.");
                        }
                    } else {
                        throw new SBMLImportException("This is a SBML level 3 model, stoichiometry is not set for the product '" + sbmlProductSpId + "' and no default value can be assumed.");
                    // logger.sendMessage(VCLogger.Priority.HighPriority,
                    // VCLogger.ErrorType.ReactionError,
                    // "This is a SBML level 3 model, stoichiometry is not set for the product '"
                    // + spRef.getSpecies() +
                    // "' and no default value can be assumed.");
                    }
                }
                if (sbmlProductsHash.get(sbmlProductSpId) == null) {
                    // if sbmlProductSpId is NOT in sbmlProductsHash, add it
                    // with its stoichiometry
                    sbmlProductsHash.put(sbmlProductSpId, Integer.valueOf((int) stoichiometry));
                } else {
                    // if sbmlProductSpId IS in sbmlProductsHash, update its
                    // stoichiometry value to (existing-value-from-hash +
                    // stoichiometry) and put it back in hash
                    int intStoich = sbmlProductsHash.get(sbmlProductSpId).intValue();
                    intStoich += (int) stoichiometry;
                    sbmlProductsHash.put(sbmlProductSpId, Integer.valueOf(intStoich));
                }
            } else {
                // spRef is not in model, throw exception
                throw new SBMLImportException("Product '" + sbmlProductSpId + "' in reaction '" + sbmlRxn.getId() + "' not found as species in SBML model.");
            }
        // end - if (spRef is species in model)
        }
        // as products to vcRxn
        for (Entry<String, Integer> es : sbmlProductsHash.entrySet()) {
            SpeciesContext speciesContext = vcModel.getSpeciesContext(es.getKey());
            int stoich = es.getValue();
            vcRxn.addProduct(speciesContext, stoich);
        }
    /*
			Iterator<String> sbmlProductsIter = sbmlProductsHash.keySet()
					.iterator();
			while (sbmlProductsIter.hasNext()) {
				String sbmlProductStr = sbmlProductsIter.next();
				SpeciesContext speciesContext = vcModel
						.getSpeciesContext(sbmlProductStr);
				int stoich = sbmlProductsHash.get(sbmlProductStr).intValue();
				((SimpleReaction) vcRxn).addProduct(speciesContext, stoich);
			}
			*/
    // proxy.addProducts(sbmlProductsHash);
    }
    // modifiers
    for (int j = 0; j < (int) sbmlRxn.getNumModifiers(); j++) {
        ModifierSpeciesReference spRef = sbmlRxn.getModifier(j);
        String sbmlSpId = spRef.getSpecies();
        if (sbmlModel.getSpecies(sbmlSpId) != null) {
            // check if this modifier species is preesent in vcRxn (could
            // have been added as reactamt/product/catalyst).
            // If alreay a catalyst in vcRxn, do nothing
            ArrayList<ReactionParticipant> vcRxnParticipants = getVCReactionParticipantsFromSymbol(vcRxn, sbmlSpId);
            SpeciesContext speciesContext = vcModel.getSpeciesContext(sbmlSpId);
            if (vcRxnParticipants == null || vcRxnParticipants.size() == 0) {
                // If not in reactionParticipantList of vcRxn, add as
                // catalyst.
                vcRxn.addCatalyst(speciesContext);
            } else {
                for (ReactionParticipant rp : vcRxnParticipants) {
                    if (rp instanceof Reactant || rp instanceof Product) {
                        // If already a reactant or product in vcRxn, add
                        // warning to localIssuesList, don't do anything
                        localIssueList.add(new Issue(speciesContext, issueContext, IssueCategory.SBMLImport_Reaction, "Species " + speciesContext.getName() + " was already added as a reactant and/or product to " + vcRxn.getName() + "; Cannot add it as a catalyst also.", Issue.SEVERITY_INFO));
                        break;
                    }
                }
            }
        } else {
            // spRef is not in model, throw exception
            throw new SBMLImportException("Modifier '" + sbmlSpId + "' in reaction '" + sbmlRxn.getId() + "' not found as species in SBML model.");
        }
    // end - if (spRef is species in model)
    }
// end - for modifiers
}
Also used : Issue(org.vcell.util.Issue) HashMap(java.util.HashMap) Product(cbit.vcell.model.Product) SpeciesContext(cbit.vcell.model.SpeciesContext) Reactant(cbit.vcell.model.Reactant) InteriorPoint(org.sbml.jsbml.ext.spatial.InteriorPoint) SpeciesReference(org.sbml.jsbml.SpeciesReference) ModifierSpeciesReference(org.sbml.jsbml.ModifierSpeciesReference) Model(cbit.vcell.model.Model) BioModel(cbit.vcell.biomodel.BioModel) ModifierSpeciesReference(org.sbml.jsbml.ModifierSpeciesReference) ReactionParticipant(cbit.vcell.model.ReactionParticipant)

Aggregations

Product (cbit.vcell.model.Product)31 Reactant (cbit.vcell.model.Reactant)30 ReactionParticipant (cbit.vcell.model.ReactionParticipant)26 ReactionStep (cbit.vcell.model.ReactionStep)22 SpeciesContext (cbit.vcell.model.SpeciesContext)19 SimpleReaction (cbit.vcell.model.SimpleReaction)12 ArrayList (java.util.ArrayList)12 Model (cbit.vcell.model.Model)11 Structure (cbit.vcell.model.Structure)11 Catalyst (cbit.vcell.model.Catalyst)10 FluxReaction (cbit.vcell.model.FluxReaction)10 Expression (cbit.vcell.parser.Expression)10 Kinetics (cbit.vcell.model.Kinetics)8 KineticsParameter (cbit.vcell.model.Kinetics.KineticsParameter)8 ReactionRule (cbit.vcell.model.ReactionRule)8 HashMap (java.util.HashMap)8 LumpedKinetics (cbit.vcell.model.LumpedKinetics)6 ModelParameter (cbit.vcell.model.Model.ModelParameter)5 ExpressionException (cbit.vcell.parser.ExpressionException)5 BioModel (cbit.vcell.biomodel.BioModel)4