use of org.vcell.pathway.PhysicalEntity in project vcell by virtualcell.
the class PathwayMapping method generateSpeciesPattern.
private SpeciesPattern generateSpeciesPattern(BioModel bioModel, PhysicalEntity bioPaxObject, boolean addSubunits) {
SpeciesPattern sp = new SpeciesPattern();
if (bioPaxObject instanceof Complex) {
Complex c = (Complex) bioPaxObject;
for (PhysicalEntity pc : c.getComponents()) {
MolecularType mt = createMolecularTypeFromBioPaxObject(bioModel, pc, addSubunits);
MolecularTypePattern mtp = new MolecularTypePattern(mt);
sp.addMolecularTypePattern(mtp);
}
return sp;
} else {
// else if(!(bioPaxObject instanceof Complex))
MolecularType mt = createMolecularTypeFromBioPaxObject(bioModel, bioPaxObject, addSubunits);
MolecularTypePattern mtp = new MolecularTypePattern(mt);
sp.addMolecularTypePattern(mtp);
return sp;
}
// return null;
}
use of org.vcell.pathway.PhysicalEntity 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)));
}
}
}
}
Aggregations