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)));
}
}
}
}
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();
}
}
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())));
}
}
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;
}
Aggregations