Search in sources :

Example 1 with HMM_IRRKinetics

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

the class Xmlproducer method getXML.

/**
 * This method returns a XML representation of a Kinetics object type.
 * Creation date: (2/26/2001 7:31:43 PM)
 * @return Element
 * @param param cbit.vcell.model.Kinetics
 */
private Element getXML(Kinetics param) throws XmlParseException {
    String kineticsType = null;
    if (param instanceof GeneralKinetics) {
        // process a GeneralKinetics object
        kineticsType = XMLTags.KineticsTypeGeneralKinetics;
    } else if (param instanceof MassActionKinetics) {
        // Process a MassActionKinetics
        kineticsType = XMLTags.KineticsTypeMassAction;
    } else if (param instanceof NernstKinetics) {
        // Process a NernstKinetics
        kineticsType = XMLTags.KineticsTypeNernst;
    } else if (param instanceof GHKKinetics) {
        // Process a GHKKinetics
        kineticsType = XMLTags.KineticsTypeGHK;
    } else if (param instanceof GeneralCurrentKinetics) {
        // Process a GeneralCurrentKinetics
        kineticsType = XMLTags.KineticsTypeGeneralCurrentKinetics;
    } else if (param instanceof HMM_IRRKinetics) {
        // Process a HenriMichaelasMentenKinetics (irreversible)
        kineticsType = XMLTags.KineticsTypeHMM_Irr;
    } else if (param instanceof HMM_REVKinetics) {
        // Process a HenriMichaelasMentenKinetics (reversible)
        kineticsType = XMLTags.KineticsTypeHMM_Rev;
    } else if (param instanceof GeneralLumpedKinetics) {
        // Process a GeneralLumpedKinetics
        kineticsType = XMLTags.KineticsTypeGeneralLumped;
    } else if (param instanceof GeneralCurrentLumpedKinetics) {
        // Process a GeneralCurrentLumpedKinetics
        kineticsType = XMLTags.KineticsTypeGeneralCurrentLumped;
    } else if (param instanceof GeneralPermeabilityKinetics) {
        // Process a GeneralPermeabilityKinetics
        kineticsType = XMLTags.KineticsTypeGeneralPermeability;
    } else if (param instanceof Macroscopic_IRRKinetics) {
        // Process a Macroscopic_IRRKinetics
        kineticsType = XMLTags.KineticsTypeMacroscopic_Irr;
    } else if (param instanceof Microscopic_IRRKinetics) {
        // Process a Microscopic_IRRKinetics
        kineticsType = XMLTags.KineticsTypeMicroscopic_Irr;
    }
    Element kinetics = new Element(XMLTags.KineticsTag);
    // Add atributes
    kinetics.setAttribute(XMLTags.KineticsTypeAttrTag, kineticsType);
    // Add Kinetics Parameters
    Kinetics.KineticsParameter[] parameters = param.getKineticsParameters();
    for (int i = 0; i < parameters.length; i++) {
        Kinetics.KineticsParameter parm = parameters[i];
        Element tempparameter = new Element(XMLTags.ParameterTag);
        // Get parameter attributes
        tempparameter.setAttribute(XMLTags.NameAttrTag, mangle(parm.getName()));
        tempparameter.setAttribute(XMLTags.ParamRoleAttrTag, param.getDefaultParameterDesc(parm.getRole()));
        VCUnitDefinition unit = parm.getUnitDefinition();
        if (unit != null) {
            tempparameter.setAttribute(XMLTags.VCUnitDefinitionAttrTag, unit.getSymbol());
        }
        tempparameter.addContent(mangleExpression(parm.getExpression()));
        // Add the parameter to the general kinetics object
        kinetics.addContent(tempparameter);
    }
    return kinetics;
}
Also used : HMM_IRRKinetics(cbit.vcell.model.HMM_IRRKinetics) GHKKinetics(cbit.vcell.model.GHKKinetics) Element(org.jdom.Element) NernstKinetics(cbit.vcell.model.NernstKinetics) HMM_REVKinetics(cbit.vcell.model.HMM_REVKinetics) GeneralKinetics(cbit.vcell.model.GeneralKinetics) GeneralLumpedKinetics(cbit.vcell.model.GeneralLumpedKinetics) GeneralCurrentKinetics(cbit.vcell.model.GeneralCurrentKinetics) VCUnitDefinition(cbit.vcell.units.VCUnitDefinition) GeneralCurrentLumpedKinetics(cbit.vcell.model.GeneralCurrentLumpedKinetics) MassActionKinetics(cbit.vcell.model.MassActionKinetics) Macroscopic_IRRKinetics(cbit.vcell.model.Macroscopic_IRRKinetics) Macroscopic_IRRKinetics(cbit.vcell.model.Macroscopic_IRRKinetics) Kinetics(cbit.vcell.model.Kinetics) NernstKinetics(cbit.vcell.model.NernstKinetics) GeneralKinetics(cbit.vcell.model.GeneralKinetics) GeneralLumpedKinetics(cbit.vcell.model.GeneralLumpedKinetics) GeneralPermeabilityKinetics(cbit.vcell.model.GeneralPermeabilityKinetics) GHKKinetics(cbit.vcell.model.GHKKinetics) MassActionKinetics(cbit.vcell.model.MassActionKinetics) Microscopic_IRRKinetics(cbit.vcell.model.Microscopic_IRRKinetics) GeneralCurrentKinetics(cbit.vcell.model.GeneralCurrentKinetics) HMM_REVKinetics(cbit.vcell.model.HMM_REVKinetics) HMM_IRRKinetics(cbit.vcell.model.HMM_IRRKinetics) GeneralCurrentLumpedKinetics(cbit.vcell.model.GeneralCurrentLumpedKinetics) GeneralPermeabilityKinetics(cbit.vcell.model.GeneralPermeabilityKinetics) Microscopic_IRRKinetics(cbit.vcell.model.Microscopic_IRRKinetics)

Example 2 with HMM_IRRKinetics

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

the class SBPAXHMMIrrevLawBuilder method addKinetics.

public void addKinetics(KineticContext context) {
    try {
        ReactionStep reaction = context.getReaction();
        HMM_IRRKinetics kinetics = new HMM_IRRKinetics((SimpleReaction) reaction);
        NameScope modelScope = reaction.getModel().getNameScope();
        ModelParameter kMichaelis = context.getParameter(SBOList.MICHAELIS_CONST_FORW);
        if (kMichaelis != null) {
            KineticsParameter kmParameter = kinetics.getKmParameter();
            kmParameter.setExpression(new Expression(kMichaelis, modelScope));
            kmParameter.setUnitDefinition(kMichaelis.getUnitDefinition());
        }
        ModelParameter kcat = context.getParameter(SBOList.CATALYTIC_RATE_CONST_FORW);
        if (kcat != null && context.getCatalysts().size() == 1) {
            KineticsParameter vmaxParameter = kinetics.getVmaxParameter();
            Catalyst catalyst = context.getCatalysts().iterator().next();
            vmaxParameter.setExpression(Expression.mult(new Expression(kcat, modelScope), new Expression(catalyst.getSpeciesContext(), modelScope)));
        // vmaxParameter.setUnitDefinition(vMax.getUnitDefinition());
        } else {
            ModelParameter vMax = context.getParameter(SBOList.MAXIMAL_VELOCITY_FORW);
            if (vMax != null) {
                KineticsParameter vmaxParameter = kinetics.getVmaxParameter();
                vmaxParameter.setExpression(new Expression(vMax, modelScope));
                vmaxParameter.setUnitDefinition(vMax.getUnitDefinition());
            }
        }
    } catch (ExpressionException e) {
        e.printStackTrace();
    }
}
Also used : ModelParameter(cbit.vcell.model.Model.ModelParameter) KineticsParameter(cbit.vcell.model.Kinetics.KineticsParameter) NameScope(cbit.vcell.parser.NameScope) Expression(cbit.vcell.parser.Expression) HMM_IRRKinetics(cbit.vcell.model.HMM_IRRKinetics) ReactionStep(cbit.vcell.model.ReactionStep) Catalyst(cbit.vcell.model.Catalyst) ExpressionException(cbit.vcell.parser.ExpressionException)

Example 3 with HMM_IRRKinetics

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

the class SBPAXKineticsExtractor method extractKineticsExactMatch.

public static boolean extractKineticsExactMatch(ReactionStep reaction, Process process) throws ExpressionException, PropertyVetoException {
    // we try a perfect match first based on the existence of a SBOTerm in the kinetic law
    if (process.getControl() == null) {
        // no control means no kinetic law - nothing more to do
        return true;
    }
    Control control = process.getControl();
    ArrayList<SBEntity> sbEntities = control.getSBSubEntity();
    for (SBEntity sbE : sbEntities) {
        // the only SBSubEntities allowed in a control are kinetic laws
        if (sbE.getID().contains("kineticLaw")) {
            // build list of the parameters of this kinetic law in sboParams
            // params of this kinetic law
            ArrayList<SBOParam> sboParams = new ArrayList<SBOParam>();
            ArrayList<SBEntity> subEntities = sbE.getSBSubEntity();
            for (SBEntity subEntity : subEntities) {
                if (subEntity instanceof SBMeasurable) {
                    SBMeasurable m = (SBMeasurable) subEntity;
                    if (!m.hasTerm()) {
                        // we don't know what to do with a measurable with no SBTerm
                        break;
                    }
                    String termName = m.extractSBOTermAsString();
                    SBOTerm sboT = SBOListEx.sboMap.get(termName);
                    System.out.println("    " + sboT.getIndex() + "  " + sboT.getName());
                    SBOParam sboParam = matchSBOParam(sboT);
                    if (m.hasNumber()) {
                        double number = m.getNumber().get(0);
                        sboParam.setNumber(number);
                    }
                    if (m.hasUnit()) {
                        String unit = m.extractSBOUnitAsString();
                        sboParam.setUnit(unit);
                    }
                    sboParams.add(sboParam);
                }
            }
            // find if a kinetic law type exists and if not guesstimate one based on parameters
            // simple rule: if we have a Km param it's MM, otherwise it's mass action
            ArrayList<SBVocabulary> sbTerms = sbE.getSBTerm();
            if (sbTerms.isEmpty()) {
                // return false;
                SBVocabulary sbTerm = new SBVocabulary();
                ArrayList<String> termNames = new ArrayList<String>();
                String id;
                SBOParam kMichaelis = extractMichaelisForwardParam(sboParams);
                if (kMichaelis == null) {
                    // mass action rate law
                    id = new String("SBO:0000012");
                } else {
                    // irreversible Henri-Michaelis-Menten rate law
                    id = new String("SBO:0000029");
                }
                // termNames.add(id);
                // sbTerm.setTerm(termNames);
                sbTerm.setID(id);
                sbTerms.add(sbTerm);
            }
            System.out.println(" kinetic law ID: " + sbTerms.get(0).getID());
            // identify the kinetic law type (mass action, michaelis menten, etc) and bring it in vCell
            for (SBVocabulary sbv : sbTerms) {
                // use for loop even though we only expect 1 SBTerm
                // SBVocabulary id, used to retrieve the kinetic law type
                String vocabularyID = sbv.getID();
                SBOTerm sboT = SBOUtil.getSBOTermFromVocabularyId(vocabularyID);
                System.out.println(vocabularyID + "   " + sboT.getName());
                SBOParam kForward;
                SBOParam kCat;
                SBOParam vM;
                SBOParam kReverse;
                SBOParam kMichaelis;
                Kinetics kinetics;
                MappedKinetics current = matchSBOKineticLaw(sboT);
                switch(current) {
                    case SBO_0000069:
                    case SBO_0000432:
                        // some kinetic laws unknown to vCell will fall through to this category
                        // honestly i don't know what to do with them
                        System.out.println("GeneralKinetics");
                        // TODO: what to do here?
                        return true;
                    case SBO_0000012:
                    case SBO_0000078:
                        System.out.println("MassActionKinetics - reversible");
                        kForward = extractKForwardParam(sboParams);
                        kReverse = extractKReverseParam(sboParams);
                        kinetics = new MassActionKinetics(reaction);
                        reaction.setKinetics(kinetics);
                        setKForwardParam(reaction, kForward, kinetics);
                        setKReverseParam(reaction, kReverse, kinetics);
                        return true;
                    case SBO_0000043:
                        System.out.println("MassActionKinetics - zeroth order irreversible, Kr <- 0  ");
                        kForward = extractKForwardParam(sboParams);
                        kinetics = new MassActionKinetics(reaction);
                        // TODO: what to do here?
                        return true;
                    case SBO_0000044:
                        System.out.println("MassActionKinetics - first order irreversible, Kr <- 0  ");
                        kForward = extractKForwardParam(sboParams);
                        kinetics = new MassActionKinetics(reaction);
                        reaction.setKinetics(kinetics);
                        setKForwardParam(reaction, kForward, kinetics);
                        return true;
                    case SBO_0000028:
                    case SBO_0000029:
                        System.out.println("HMM_IRRKinetics");
                        // TODO: make kCat global variable, set its number and unit in annotation
                        // TODO: make vM global variable, set its number and unit in annotation
                        // get the numbers, if present (may be null)
                        kMichaelis = extractMichaelisForwardParam(sboParams);
                        vM = extractVMForwardParam(sboParams, process);
                        kCat = extractKCatForwardParam(sboParams);
                        kinetics = new HMM_IRRKinetics((SimpleReaction) reaction);
                        try {
                            // TODO: create expression only if kCat != null, otherwise use vM directly (if != null) otherwise ???
                            kinetics.reading(true);
                            setVMForwardParamAsExpression(reaction, kCat, kinetics);
                        } finally {
                            kinetics.reading(false);
                        }
                        reaction.setKinetics(kinetics);
                        setMichaelisForwardParam(reaction, kMichaelis, kinetics);
                        return true;
                    case SBO_0000438:
                        System.out.println("HMMREVKinetics");
                        kinetics = new HMM_REVKinetics((SimpleReaction) reaction);
                        return true;
                    default:
                        // TODO: guessing happens above - if we have nothing by now we need to raise runtime exception
                        // change the code below !!!
                        System.out.println("Unable to match the SBOTerm with any compatible kinetic law.");
                        // found unmapped kinetic law, we'll try to guess a match
                        return false;
                }
            }
        }
    }
    // no SBTerm found so we cannot know for sure the kinetic law, we'll have to guess it
    return false;
}
Also used : SBVocabulary(org.vcell.pathway.sbpax.SBVocabulary) SimpleReaction(cbit.vcell.model.SimpleReaction) HMM_IRRKinetics(cbit.vcell.model.HMM_IRRKinetics) ArrayList(java.util.ArrayList) SBOTerm(org.vcell.pathway.sbo.SBOTerm) HMM_REVKinetics(cbit.vcell.model.HMM_REVKinetics) SBEntity(org.vcell.pathway.sbpax.SBEntity) SBOParam(org.vcell.pathway.sbo.SBOParam) SBMeasurable(org.vcell.pathway.sbpax.SBMeasurable) Control(org.vcell.pathway.Control) MassActionKinetics(cbit.vcell.model.MassActionKinetics) HMM_IRRKinetics(cbit.vcell.model.HMM_IRRKinetics) Kinetics(cbit.vcell.model.Kinetics) HMM_REVKinetics(cbit.vcell.model.HMM_REVKinetics) MassActionKinetics(cbit.vcell.model.MassActionKinetics)

Example 4 with HMM_IRRKinetics

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

the class XmlReader method getKinetics.

/**
 * This method returns a Kinetics object from a XML Element based on the value of the kinetics type attribute.
 * Creation date: (3/19/2001 4:42:04 PM)
 * @return cbit.vcell.model.Kinetics
 * @param param org.jdom.Element
 */
private Kinetics getKinetics(Element param, ReactionStep reaction, Model model) throws XmlParseException {
    VariableHash varHash = new VariableHash();
    addResevedSymbols(varHash, model);
    String type = param.getAttributeValue(XMLTags.KineticsTypeAttrTag);
    Kinetics newKinetics = null;
    try {
        if (type.equalsIgnoreCase(XMLTags.KineticsTypeGeneralKinetics)) {
            // create a general kinetics
            newKinetics = new GeneralKinetics(reaction);
        } else if (type.equalsIgnoreCase(XMLTags.KineticsTypeGeneralCurrentKinetics)) {
            // Create GeneralCurrentKinetics
            newKinetics = new GeneralCurrentKinetics(reaction);
        } else if (type.equalsIgnoreCase(XMLTags.KineticsTypeMassAction) && reaction instanceof SimpleReaction) {
            // create a Mass Action kinetics
            newKinetics = new MassActionKinetics((SimpleReaction) reaction);
        } else if (type.equalsIgnoreCase(XMLTags.KineticsTypeNernst) && reaction instanceof FluxReaction) {
            // create NernstKinetics
            newKinetics = new NernstKinetics((FluxReaction) reaction);
        } else if (type.equalsIgnoreCase(XMLTags.KineticsTypeGHK) && reaction instanceof FluxReaction) {
            // create GHKKinetics
            newKinetics = new GHKKinetics((FluxReaction) reaction);
        } else if (type.equalsIgnoreCase(XMLTags.KineticsTypeHMM_Irr) && reaction instanceof SimpleReaction) {
            // create HMM_IrrKinetics
            newKinetics = new HMM_IRRKinetics((SimpleReaction) reaction);
        } else if (type.equalsIgnoreCase(XMLTags.KineticsTypeHMM_Rev) && reaction instanceof SimpleReaction) {
            // create HMM_RevKinetics
            newKinetics = new HMM_REVKinetics((SimpleReaction) reaction);
        } else if (type.equalsIgnoreCase(XMLTags.KineticsTypeGeneralTotal_oldname)) {
            // create GeneralTotalKinetics
            newKinetics = new GeneralLumpedKinetics(reaction);
        } else if (type.equalsIgnoreCase(XMLTags.KineticsTypeGeneralLumped)) {
            // create GeneralLumpedKinetics
            newKinetics = new GeneralLumpedKinetics(reaction);
        } else if (type.equalsIgnoreCase(XMLTags.KineticsTypeGeneralCurrentLumped)) {
            // create GeneralCurrentLumpedKinetics
            newKinetics = new GeneralCurrentLumpedKinetics(reaction);
        } else if (type.equalsIgnoreCase(XMLTags.KineticsTypeGeneralPermeability) && reaction instanceof FluxReaction) {
            // create GeneralPermeabilityKinetics
            newKinetics = new GeneralPermeabilityKinetics((FluxReaction) reaction);
        } else if (type.equalsIgnoreCase(XMLTags.KineticsTypeMacroscopic_Irr) && reaction instanceof SimpleReaction) {
            // create Macroscopic_IRRKinetics
            newKinetics = new Macroscopic_IRRKinetics((SimpleReaction) reaction);
        } else if (type.equalsIgnoreCase(XMLTags.KineticsTypeMicroscopic_Irr) && reaction instanceof SimpleReaction) {
            // create Microscopic_IRRKinetics
            newKinetics = new Microscopic_IRRKinetics((SimpleReaction) reaction);
        } else {
            throw new XmlParseException("Unknown kinetics type: " + type);
        }
    } catch (ExpressionException e) {
        e.printStackTrace();
        throw new XmlParseException("Error creating the kinetics for reaction: " + reaction.getName(), e);
    }
    try {
        // transaction begin flag ... yeah, this is a hack
        newKinetics.reading(true);
        // Read all of the parameters
        List<Element> list = param.getChildren(XMLTags.ParameterTag, vcNamespace);
        // add constants that may be used in kinetics.
        // VariableHash varHash = getVariablesHash();
        ArrayList<String> reserved = new ArrayList<String>();
        ReservedSymbol[] reservedSymbols = reaction.getModel().getReservedSymbols();
        for (ReservedSymbol rs : reservedSymbols) {
            reserved.add(rs.getName());
        }
        try {
            if (reaction.getStructure() instanceof Membrane) {
                Membrane membrane = (Membrane) reaction.getStructure();
                varHash.addVariable(new Constant(membrane.getMembraneVoltage().getName(), new Expression(0.0)));
                reserved.add(membrane.getMembraneVoltage().getName());
            }
            // 
            // add Reactants, Products, and Catalysts (ReactionParticipants)
            // 
            ReactionParticipant[] rp = reaction.getReactionParticipants();
            for (int i = 0; i < rp.length; i++) {
                varHash.addVariable(new Constant(rp[i].getName(), new Expression(0.0)));
            }
        } catch (MathException e) {
            e.printStackTrace(System.out);
            throw new XmlParseException("error reordering parameters according to dependencies: ", e);
        }
        // 
        for (Element xmlParam : list) {
            String paramName = unMangle(xmlParam.getAttributeValue(XMLTags.NameAttrTag));
            String role = xmlParam.getAttributeValue(XMLTags.ParamRoleAttrTag);
            String paramExpStr = xmlParam.getText();
            Expression paramExp = unMangleExpression(paramExpStr);
            try {
                if (varHash.getVariable(paramName) == null) {
                    varHash.addVariable(new Function(paramName, paramExp, null));
                } else {
                    if (reserved.contains(paramName)) {
                        varHash.removeVariable(paramName);
                        varHash.addVariable(new Function(paramName, paramExp, null));
                    }
                }
            } catch (MathException e) {
                e.printStackTrace(System.out);
                throw new XmlParseException("error reordering parameters according to dependencies: ", e);
            }
            Kinetics.KineticsParameter tempParam = null;
            if (!role.equals(XMLTags.ParamRoleUserDefinedTag)) {
                tempParam = newKinetics.getKineticsParameterFromRole(Kinetics.getParamRoleFromDefaultDesc(role));
            } else {
                continue;
            }
            // hack for bringing in General Total kinetics without breaking.
            if (tempParam == null && newKinetics instanceof GeneralLumpedKinetics) {
                if (role.equals(Kinetics.GTK_AssumedCompartmentSize_oldname) || role.equals(Kinetics.GTK_ReactionRate_oldname) || role.equals(Kinetics.GTK_CurrentDensity_oldname)) {
                    continue;
                } else if (role.equals(VCMODL.TotalRate_oldname)) {
                    tempParam = newKinetics.getKineticsParameterFromRole(Kinetics.ROLE_LumpedReactionRate);
                }
            }
            // hack from bringing in chargeValence parameters without breaking
            if (tempParam == null && Kinetics.getParamRoleFromDefaultDesc(role) == Kinetics.ROLE_ChargeValence) {
                tempParam = newKinetics.getChargeValenceParameter();
            }
            if (tempParam == null) {
                throw new XmlParseException("parameter with role '" + role + "' not found in kinetics type '" + type + "'");
            }
            // 
            if (!tempParam.getName().equals(paramName)) {
                Kinetics.KineticsParameter multNameParam = newKinetics.getKineticsParameter(paramName);
                int n = 0;
                while (multNameParam != null) {
                    String tempName = paramName + "_" + n++;
                    newKinetics.renameParameter(paramName, tempName);
                    multNameParam = newKinetics.getKineticsParameter(tempName);
                }
                newKinetics.renameParameter(tempParam.getName(), paramName);
            }
        }
        // 
        // create unresolved parameters for all unresolved symbols
        // 
        String unresolvedSymbol = varHash.getFirstUnresolvedSymbol();
        while (unresolvedSymbol != null) {
            try {
                // will turn into an UnresolvedParameter.
                varHash.addVariable(new Function(unresolvedSymbol, new Expression(0.0), null));
            } catch (MathException e) {
                e.printStackTrace(System.out);
                throw new XmlParseException(e);
            }
            newKinetics.addUnresolvedParameter(unresolvedSymbol);
            unresolvedSymbol = varHash.getFirstUnresolvedSymbol();
        }
        Variable[] sortedVariables = varHash.getTopologicallyReorderedVariables();
        ModelUnitSystem modelUnitSystem = reaction.getModel().getUnitSystem();
        for (int i = sortedVariables.length - 1; i >= 0; i--) {
            if (sortedVariables[i] instanceof Function) {
                Function paramFunction = (Function) sortedVariables[i];
                Element xmlParam = null;
                for (int j = 0; j < list.size(); j++) {
                    Element tempParam = (Element) list.get(j);
                    if (paramFunction.getName().equals(unMangle(tempParam.getAttributeValue(XMLTags.NameAttrTag)))) {
                        xmlParam = tempParam;
                        break;
                    }
                }
                if (xmlParam == null) {
                    // must have been an unresolved parameter
                    continue;
                }
                String symbol = xmlParam.getAttributeValue(XMLTags.VCUnitDefinitionAttrTag);
                VCUnitDefinition unit = null;
                if (symbol != null) {
                    unit = modelUnitSystem.getInstance(symbol);
                }
                Kinetics.KineticsParameter tempParam = newKinetics.getKineticsParameter(paramFunction.getName());
                if (tempParam == null) {
                    newKinetics.addUserDefinedKineticsParameter(paramFunction.getName(), paramFunction.getExpression(), unit);
                } else {
                    newKinetics.setParameterValue(tempParam, paramFunction.getExpression());
                    tempParam.setUnitDefinition(unit);
                }
            }
        }
    } catch (java.beans.PropertyVetoException e) {
        e.printStackTrace(System.out);
        throw new XmlParseException("Exception while setting parameters for Reaction : " + reaction.getName(), e);
    } catch (ExpressionException e) {
        e.printStackTrace(System.out);
        throw new XmlParseException("Exception while settings parameters for Reaction : " + reaction.getName(), e);
    } finally {
        newKinetics.reading(false);
    }
    return newKinetics;
}
Also used : FilamentVariable(cbit.vcell.math.FilamentVariable) OutsideVariable(cbit.vcell.math.OutsideVariable) StochVolVariable(cbit.vcell.math.StochVolVariable) RandomVariable(cbit.vcell.math.RandomVariable) VolumeRandomVariable(cbit.vcell.math.VolumeRandomVariable) VolumeParticleVariable(cbit.vcell.math.VolumeParticleVariable) VolumeRegionVariable(cbit.vcell.math.VolumeRegionVariable) InsideVariable(cbit.vcell.math.InsideVariable) VolVariable(cbit.vcell.math.VolVariable) MembraneRegionVariable(cbit.vcell.math.MembraneRegionVariable) PointVariable(cbit.vcell.math.PointVariable) MembraneRandomVariable(cbit.vcell.math.MembraneRandomVariable) MembraneParticleVariable(cbit.vcell.math.MembraneParticleVariable) ParticleVariable(cbit.vcell.math.ParticleVariable) MemVariable(cbit.vcell.math.MemVariable) FilamentRegionVariable(cbit.vcell.math.FilamentRegionVariable) Variable(cbit.vcell.math.Variable) KineticsParameter(cbit.vcell.model.Kinetics.KineticsParameter) VariableHash(cbit.vcell.math.VariableHash) HMM_IRRKinetics(cbit.vcell.model.HMM_IRRKinetics) MacroscopicRateConstant(cbit.vcell.math.MacroscopicRateConstant) Constant(cbit.vcell.math.Constant) Element(org.jdom.Element) ReservedSymbol(cbit.vcell.model.Model.ReservedSymbol) NernstKinetics(cbit.vcell.model.NernstKinetics) ArrayList(java.util.ArrayList) FluxReaction(cbit.vcell.model.FluxReaction) GeneralKinetics(cbit.vcell.model.GeneralKinetics) GeneralLumpedKinetics(cbit.vcell.model.GeneralLumpedKinetics) ExpressionException(cbit.vcell.parser.ExpressionException) PropertyVetoException(java.beans.PropertyVetoException) GeneralCurrentKinetics(cbit.vcell.model.GeneralCurrentKinetics) AnnotatedFunction(cbit.vcell.solver.AnnotatedFunction) Function(cbit.vcell.math.Function) GeneralCurrentLumpedKinetics(cbit.vcell.model.GeneralCurrentLumpedKinetics) Membrane(cbit.vcell.model.Membrane) Macroscopic_IRRKinetics(cbit.vcell.model.Macroscopic_IRRKinetics) GeneralPermeabilityKinetics(cbit.vcell.model.GeneralPermeabilityKinetics) ModelUnitSystem(cbit.vcell.model.ModelUnitSystem) SimpleReaction(cbit.vcell.model.SimpleReaction) GHKKinetics(cbit.vcell.model.GHKKinetics) HMM_REVKinetics(cbit.vcell.model.HMM_REVKinetics) VCUnitDefinition(cbit.vcell.units.VCUnitDefinition) Expression(cbit.vcell.parser.Expression) MathException(cbit.vcell.math.MathException) MassActionKinetics(cbit.vcell.model.MassActionKinetics) Macroscopic_IRRKinetics(cbit.vcell.model.Macroscopic_IRRKinetics) Kinetics(cbit.vcell.model.Kinetics) NernstKinetics(cbit.vcell.model.NernstKinetics) GeneralKinetics(cbit.vcell.model.GeneralKinetics) GeneralLumpedKinetics(cbit.vcell.model.GeneralLumpedKinetics) GeneralPermeabilityKinetics(cbit.vcell.model.GeneralPermeabilityKinetics) GHKKinetics(cbit.vcell.model.GHKKinetics) MassActionKinetics(cbit.vcell.model.MassActionKinetics) Microscopic_IRRKinetics(cbit.vcell.model.Microscopic_IRRKinetics) GeneralCurrentKinetics(cbit.vcell.model.GeneralCurrentKinetics) HMM_REVKinetics(cbit.vcell.model.HMM_REVKinetics) HMM_IRRKinetics(cbit.vcell.model.HMM_IRRKinetics) GeneralCurrentLumpedKinetics(cbit.vcell.model.GeneralCurrentLumpedKinetics) Microscopic_IRRKinetics(cbit.vcell.model.Microscopic_IRRKinetics) ReactionParticipant(cbit.vcell.model.ReactionParticipant)

Example 5 with HMM_IRRKinetics

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

the class SBPAXKineticsExtractor method setVMForwardParam.

private static void setVMForwardParam(ReactionStep reaction, SBOParam kVMForward, Kinetics kinetics) throws ExpressionException, PropertyVetoException {
    if (kVMForward != null) {
        KineticsParameter fwdParam = ((HMM_IRRKinetics) kinetics).getVmaxParameter();
        kinetics.setParameterValue(fwdParam, new Expression(kVMForward.getNumber()));
        String unitF = SBOParam.formatUnit(kVMForward.getUnit());
        VCUnitDefinition fwdUnit = reaction.getModel().getUnitSystem().getInstance(unitF);
        fwdParam.setUnitDefinition(fwdUnit);
    }
}
Also used : VCUnitDefinition(cbit.vcell.units.VCUnitDefinition) KineticsParameter(cbit.vcell.model.Kinetics.KineticsParameter) Expression(cbit.vcell.parser.Expression) HMM_IRRKinetics(cbit.vcell.model.HMM_IRRKinetics)

Aggregations

HMM_IRRKinetics (cbit.vcell.model.HMM_IRRKinetics)7 KineticsParameter (cbit.vcell.model.Kinetics.KineticsParameter)5 Expression (cbit.vcell.parser.Expression)5 VCUnitDefinition (cbit.vcell.units.VCUnitDefinition)5 HMM_REVKinetics (cbit.vcell.model.HMM_REVKinetics)3 Kinetics (cbit.vcell.model.Kinetics)3 MassActionKinetics (cbit.vcell.model.MassActionKinetics)3 Catalyst (cbit.vcell.model.Catalyst)2 GHKKinetics (cbit.vcell.model.GHKKinetics)2 GeneralCurrentKinetics (cbit.vcell.model.GeneralCurrentKinetics)2 GeneralCurrentLumpedKinetics (cbit.vcell.model.GeneralCurrentLumpedKinetics)2 GeneralKinetics (cbit.vcell.model.GeneralKinetics)2 GeneralLumpedKinetics (cbit.vcell.model.GeneralLumpedKinetics)2 GeneralPermeabilityKinetics (cbit.vcell.model.GeneralPermeabilityKinetics)2 Macroscopic_IRRKinetics (cbit.vcell.model.Macroscopic_IRRKinetics)2 ReactionParticipant (cbit.vcell.model.ReactionParticipant)2 Constant (cbit.vcell.math.Constant)1 FilamentRegionVariable (cbit.vcell.math.FilamentRegionVariable)1 FilamentVariable (cbit.vcell.math.FilamentVariable)1 Function (cbit.vcell.math.Function)1