Search in sources :

Example 16 with Catalyst

use of cbit.vcell.model.Catalyst 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 17 with Catalyst

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

the class SBPAXHMMRevLawBuilder method addKinetics.

public void addKinetics(KineticContext context) {
    try {
        ReactionStep reaction = context.getReaction();
        HMM_REVKinetics kinetics = new HMM_REVKinetics((SimpleReaction) reaction);
        NameScope modelScope = reaction.getModel().getNameScope();
        ModelParameter kMichaelisFwd = context.getParameter(SBOList.MICHAELIS_CONST_FORW);
        if (kMichaelisFwd != null) {
            KineticsParameter kmfParameter = kinetics.getKmFwdParameter();
            kmfParameter.setExpression(new Expression(kMichaelisFwd, modelScope));
            kmfParameter.setUnitDefinition(kMichaelisFwd.getUnitDefinition());
        }
        ModelParameter kcatf = context.getParameter(SBOList.CATALYTIC_RATE_CONST_FORW);
        if (kcatf != null && context.getCatalysts().size() == 1) {
            KineticsParameter vmaxfParameter = kinetics.getVmaxFwdParameter();
            Catalyst catalyst = context.getCatalysts().iterator().next();
            vmaxfParameter.setExpression(Expression.mult(new Expression(kcatf, modelScope), new Expression(catalyst.getSpeciesContext(), modelScope)));
        // vmaxParameter.setUnitDefinition(vMax.getUnitDefinition());
        } else {
            ModelParameter vMaxf = context.getParameter(SBOList.MAXIMAL_VELOCITY_FORW);
            if (vMaxf != null) {
                KineticsParameter vmaxfParameter = kinetics.getVmaxFwdParameter();
                vmaxfParameter.setExpression(new Expression(vMaxf, modelScope));
                vmaxfParameter.setUnitDefinition(vMaxf.getUnitDefinition());
            }
        }
        ModelParameter kMichaelisRev = context.getParameter(SBOList.MICHAELIS_CONST_REV);
        if (kMichaelisRev != null) {
            KineticsParameter kmrParameter = kinetics.getKmRevParameter();
            kmrParameter.setExpression(new Expression(kMichaelisRev, modelScope));
            kmrParameter.setUnitDefinition(kMichaelisRev.getUnitDefinition());
        }
        ModelParameter kcatr = context.getParameter(SBOList.CATALYTIC_RATE_CONST_FORW);
        if (kcatr != null && context.getCatalysts().size() == 1) {
            KineticsParameter vmaxrParameter = kinetics.getVmaxRevParameter();
            Catalyst catalyst = context.getCatalysts().iterator().next();
            vmaxrParameter.setExpression(Expression.mult(new Expression(kcatr, modelScope), new Expression(catalyst.getSpeciesContext(), modelScope)));
        // vmaxParameter.setUnitDefinition(vMax.getUnitDefinition());
        } else {
            ModelParameter vMaxr = context.getParameter(SBOList.MAXIMAL_VELOCITY_REV);
            if (vMaxr != null) {
                KineticsParameter vmaxrParameter = kinetics.getVmaxRevParameter();
                vmaxrParameter.setExpression(new Expression(vMaxr, modelScope));
                vmaxrParameter.setUnitDefinition(vMaxr.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) ReactionStep(cbit.vcell.model.ReactionStep) HMM_REVKinetics(cbit.vcell.model.HMM_REVKinetics) Catalyst(cbit.vcell.model.Catalyst) ExpressionException(cbit.vcell.parser.ExpressionException)

Example 18 with Catalyst

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

the class SBPAXKineticsExtractor method setVMForwardParamAsExpression.

private static void setVMForwardParamAsExpression(ReactionStep reaction, SBOParam kCat, Kinetics kinetics) throws ExpressionException, PropertyVetoException {
    if (kCat != null) {
        KineticsParameter Vmax = ((HMM_IRRKinetics) kinetics).getVmaxParameter();
        String unitF = SBOParam.formatUnit(kCat.getUnit());
        VCUnitDefinition kCatUnit = reaction.getModel().getUnitSystem().getInstance(unitF);
        Double numberKCat = 0.0;
        if (kCat.hasNumber()) {
            numberKCat = kCat.getNumber();
        }
        Expression KCatExpression = new Expression(numberKCat);
        KineticsParameter Kcat = kinetics.addUserDefinedKineticsParameter("Kcat", KCatExpression, kCatUnit);
        String enzymeName = "";
        ReactionParticipant[] participants = reaction.getReactionParticipants();
        for (int i = 0; i < participants.length; i++) {
            ReactionParticipant rp = participants[i];
            if (rp instanceof Catalyst) {
                enzymeName = rp.getName();
            }
        }
        SpeciesContext enzyme = reaction.getModel().getSpeciesContext(enzymeName);
        Vmax.setExpression(Expression.mult(new Expression(Kcat, reaction.getNameScope()), new Expression(enzyme, reaction.getNameScope())));
    }
}
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) SpeciesContext(cbit.vcell.model.SpeciesContext) ReactionParticipant(cbit.vcell.model.ReactionParticipant) Catalyst(cbit.vcell.model.Catalyst)

Example 19 with Catalyst

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

the class ReactPartTable method getReactionParticipant.

/**
 * This method was created in VisualAge.
 * @return cbit.vcell.model.ReactionParticipant
 * @param rset java.sql.ResultSet
 */
public ReactionParticipant getReactionParticipant(KeyValue rpKey, java.sql.ResultSet rset) throws java.sql.SQLException, DataAccessException {
    ReactionParticipant rp = null;
    KeyValue key = rpKey;
    String role = rset.getString(ReactPartTable.table.role.toString());
    int stoichiometry = rset.getInt(ReactPartTable.table.stoich.toString());
    if (role.equals(ROLE_CATALYST)) {
        rp = new Catalyst(key, null, null);
    } else if (role.equals(ROLE_PRODUCT)) {
        rp = new Product(key, null, null, stoichiometry);
    } else if (role.equals(ROLE_REACTANT)) {
        rp = new Reactant(key, null, null, stoichiometry);
    } else if (role.equals(ROLE_FLUX)) {
        rp = new FluxReaction.Flux(key, null, null);
    } else {
        throw new DataAccessException("unexpected value of " + ReactPartTable.table.role.toString() + "'" + role + "'");
    }
    rp.setStoichiometry(stoichiometry);
    return rp;
}
Also used : KeyValue(org.vcell.util.document.KeyValue) Product(cbit.vcell.model.Product) ReactionParticipant(cbit.vcell.model.ReactionParticipant) Reactant(cbit.vcell.model.Reactant) Catalyst(cbit.vcell.model.Catalyst) DataAccessException(org.vcell.util.DataAccessException)

Aggregations

Catalyst (cbit.vcell.model.Catalyst)19 ReactionParticipant (cbit.vcell.model.ReactionParticipant)14 Product (cbit.vcell.model.Product)10 Reactant (cbit.vcell.model.Reactant)10 ReactionStep (cbit.vcell.model.ReactionStep)9 FluxReaction (cbit.vcell.model.FluxReaction)7 SimpleReaction (cbit.vcell.model.SimpleReaction)7 SpeciesContext (cbit.vcell.model.SpeciesContext)7 Expression (cbit.vcell.parser.Expression)6 KineticsParameter (cbit.vcell.model.Kinetics.KineticsParameter)5 Structure (cbit.vcell.model.Structure)5 Shape (cbit.gui.graph.Shape)4 Feature (cbit.vcell.model.Feature)4 Membrane (cbit.vcell.model.Membrane)4 ExpressionException (cbit.vcell.parser.ExpressionException)4 Point (java.awt.Point)4 ArrayList (java.util.ArrayList)4 ModelParameter (cbit.vcell.model.Model.ModelParameter)3 VCUnitDefinition (cbit.vcell.units.VCUnitDefinition)3 UserCancelException (org.vcell.util.UserCancelException)3