use of cbit.vcell.dictionary.DBNonFormalUnboundSpecies in project vcell by virtualcell.
the class BiomodelVCMLModelInfoResource method createReactionDescription.
// Copied from DBReactionWizrdPanel and altered to display speciescontext names in ReactionStep text representation
public static ReactionDescription createReactionDescription(ReactionStep rxStep, KeyValue bmid, KeyValue structRef) {
ReactionType rxType = null;
if (rxStep instanceof FluxReaction) {
if (rxStep.isReversible()) {
rxType = ReactionType.REACTTYPE_FLUX_REVERSIBLE;
} else {
rxType = ReactionType.REACTTYPE_FLUX_IRREVERSIBLE;
}
} else {
if (rxStep.isReversible()) {
rxType = ReactionType.REACTTYPE_SIMPLE_REVERSIBLE;
} else {
rxType = ReactionType.REACTTYPE_SIMPLE_IRREVERSIBLE;
}
}
ReactionDescription dbfr = new ReactionDescription(rxStep.getName(), rxType, rxStep.getKey(), bmid, structRef);
//
ReactionParticipant[] rpArr = rxStep.getReactionParticipants();
for (int i = 0; i < rpArr.length; i += 1) {
DBNonFormalUnboundSpecies dbnfu = new DBNonFormalUnboundSpecies(rpArr[i].getSpeciesContext().getName());
char role;
if (rpArr[i] instanceof Reactant) {
role = ReactionDescription.RX_ELEMENT_REACTANT;
} else if (rpArr[i] instanceof Product) {
role = ReactionDescription.RX_ELEMENT_PRODUCT;
} else if (rpArr[i] instanceof Catalyst) {
role = ReactionDescription.RX_ELEMENT_CATALYST;
} else {
throw new RuntimeException("Unsupported ReationParticiapnt=" + rpArr[i].getClass().getName());
}
dbfr.addReactionElement(dbnfu, rpArr[i].getSpeciesContext().getName(), rpArr[i].getSpeciesContext().getStructure().getName(), rpArr[i].getStoichiometry(), role);
}
if (dbfr.isFluxReaction()) {
// make sure flux is in right direction
Structure outsideStruct = rxStep.getModel().getStructureTopology().getOutsideFeature((Membrane) rxStep.getStructure());
String defaultOutsideSCName = dbfr.getOrigSpeciesContextName(dbfr.getFluxIndexOutside());
for (int i = 0; i < rpArr.length; i += 1) {
if (rpArr[i].getSpeciesContext().getName().equals(defaultOutsideSCName)) {
if (!rpArr[i].getStructure().equals(outsideStruct)) {
dbfr.swapFluxSCNames();
}
break;
}
}
}
return dbfr;
}
use of cbit.vcell.dictionary.DBNonFormalUnboundSpecies in project vcell by virtualcell.
the class ReactStepTable method getUserReactionList.
/**
* Insert the method's description here.
* Creation date: (7/12/2003 2:59:27 PM)
* @return java.lang.String
* @param likeString java.lang.String
*/
public ReactionDescription[] getUserReactionList(java.sql.ResultSet rset) throws java.sql.SQLException {
java.util.Vector resultV = new java.util.Vector();
ReactionDescription[] result = null;
java.util.Vector rxidV = null;
//
java.math.BigDecimal rxid = null;
java.math.BigDecimal bmid = null;
ReactionDescription dbfr = null;
//
while (rset.next()) {
java.math.BigDecimal currRXID = rset.getBigDecimal(ReactStepTable.table.id.toString());
java.math.BigDecimal currBMID = rset.getBigDecimal(BMID_NAME);
if (rset.isFirst()) {
rxid = currRXID;
bmid = currBMID;
}
if (!rxid.equals(currRXID) || !bmid.equals(currBMID)) {
rxid = currRXID;
bmid = currBMID;
dbfr = null;
}
//
if (dbfr == null) {
ReactionType rxType = ReactionType.fromDatabaseName(rset.getString(ReactStepTable.table.reactType.toString()));
String rxName = rset.getString(ReactStepTable.table.name.toString());
java.math.BigDecimal currStructID = rset.getBigDecimal(ReactStepTable.table.structRef.toString());
dbfr = new ReactionDescription(rxName, rxType, new KeyValue(rxid), new KeyValue(bmid), new KeyValue(currStructID));
resultV.add(dbfr);
}
String name = rset.getString(SPECCONT_NAME);
DBNonFormalUnboundSpecies dbnfu = new DBNonFormalUnboundSpecies(name);
//
String partRole = rset.getString(ReactPartTable.table.role.toString());
char partRoleType;
if (partRole.equals("reactant")) {
partRoleType = ReactionDescription.RX_ELEMENT_REACTANT;
} else if (partRole.equals("flux")) {
partRoleType = ReactionDescription.RX_ELEMENT_FLUX;
} else if (partRole.equals("catalyst")) {
partRoleType = ReactionDescription.RX_ELEMENT_CATALYST;
} else if (partRole.equals("product")) {
partRoleType = ReactionDescription.RX_ELEMENT_PRODUCT;
} else {
throw new RuntimeException("Unknown role in UserList Query results");
}
//
int stoich = rset.getInt(ReactPartTable.table.stoich.toString());
dbfr.addReactionElement(dbnfu, stoich, partRoleType);
if (partRole.equals("flux")) {
dbfr.addReactionElement(new DBNonFormalUnboundSpecies(name), stoich, partRoleType);
}
}
//
if (resultV.size() > 0) {
result = new ReactionDescription[resultV.size()];
resultV.copyInto(result);
}
return result;
}
use of cbit.vcell.dictionary.DBNonFormalUnboundSpecies in project vcell by virtualcell.
the class DBReactionWizardPanel method createReactionDescription.
public static ReactionDescription createReactionDescription(ReactionStep rxStep, KeyValue bmid, KeyValue structRef) {
ReactionType rxType = null;
if (rxStep instanceof FluxReaction) {
if (rxStep.isReversible()) {
rxType = ReactionType.REACTTYPE_FLUX_REVERSIBLE;
} else {
rxType = ReactionType.REACTTYPE_FLUX_IRREVERSIBLE;
}
} else {
if (rxStep.isReversible()) {
rxType = ReactionType.REACTTYPE_SIMPLE_REVERSIBLE;
} else {
rxType = ReactionType.REACTTYPE_SIMPLE_IRREVERSIBLE;
}
}
ReactionDescription dbfr = new ReactionDescription(rxStep.getName(), rxType, rxStep.getKey(), bmid, structRef);
//
ReactionParticipant[] rpArr = rxStep.getReactionParticipants();
for (int i = 0; i < rpArr.length; i += 1) {
DBNonFormalUnboundSpecies dbnfu = new DBNonFormalUnboundSpecies(rpArr[i].getSpecies().getCommonName());
char role;
if (rpArr[i] instanceof Reactant) {
role = ReactionDescription.RX_ELEMENT_REACTANT;
} else if (rpArr[i] instanceof Product) {
role = ReactionDescription.RX_ELEMENT_PRODUCT;
} else if (rpArr[i] instanceof Catalyst) {
role = ReactionDescription.RX_ELEMENT_CATALYST;
} else {
throw new RuntimeException("Unsupported ReationParticiapnt=" + rpArr[i].getClass().getName());
}
dbfr.addReactionElement(dbnfu, rpArr[i].getSpeciesContext().getName(), rpArr[i].getSpeciesContext().getStructure().getName(), rpArr[i].getStoichiometry(), role);
}
if (dbfr.isFluxReaction()) {
// make sure flux is in right direction
Structure outsideStruct = rxStep.getModel().getStructureTopology().getOutsideFeature((Membrane) rxStep.getStructure());
String defaultOutsideSCName = dbfr.getOrigSpeciesContextName(dbfr.getFluxIndexOutside());
for (int i = 0; i < rpArr.length; i += 1) {
if (rpArr[i].getSpeciesContext().getName().equals(defaultOutsideSCName)) {
if (!rpArr[i].getStructure().equals(outsideStruct)) {
dbfr.swapFluxSCNames();
}
break;
}
}
}
return dbfr;
}
use of cbit.vcell.dictionary.DBNonFormalUnboundSpecies in project vcell by virtualcell.
the class EnzymeReactionTable method getReactions.
/**
* returns a Compound object from the ResultSet
* @return cbit.vcell.dictionary.Compound
* @param rset java.sql.ResultSet
*/
public ReactionDescription[] getReactions(java.sql.ResultSet rset) throws java.sql.SQLException {
Vector reactions = new Vector();
String currentReactionID = null;
String currentEnzymeFID = null;
ReactionDescription current_dbfr = null;
while (rset.next()) {
String reactionID = null;
String enzymeFID = null;
if (!rset.isAfterLast()) {
reactionID = rset.getString(EnzymeReactionTable.table.reactionId.toString());
enzymeFID = rset.getString(RXQ_ENZYMEFID_ALIAS);
}
if (!reactionID.equals(currentReactionID) || !org.vcell.util.Compare.isEqualOrNull(enzymeFID, currentEnzymeFID)) {
java.math.BigDecimal enzymeID = rset.getBigDecimal(RXQ_ENZYMEID_ALIAS);
if (enzymeID != null) {
String enzymeName = rset.getString(RXQ_ENZYMENAME_ALIAS);
current_dbfr = new ReactionDescription(reactionID);
current_dbfr.addReactionElement(new FormalEnzyme(new KeyValue(enzymeID), new EnzymeInfo(enzymeFID, new String[] { enzymeName }, null, null, null)), 0, ReactionDescription.RX_ELEMENT_CATALYST);
} else if (enzymeFID != null) {
current_dbfr = new ReactionDescription(reactionID);
current_dbfr.addReactionElement(new DBNonFormalUnboundSpecies(enzymeFID), /*FormalUnknown(enzymeFID,null)*/
0, ReactionDescription.RX_ELEMENT_CATALYST);
} else {
current_dbfr = new ReactionDescription(reactionID);
}
reactions.add(current_dbfr);
}
currentReactionID = reactionID;
currentEnzymeFID = enzymeFID;
//
FormalCompound formalCompound = new FormalCompound(new KeyValue(rset.getBigDecimal(RXQ_CMPNDID_ALIAS)), new CompoundInfo(rset.getString(CompoundTable.table.keggID.toString()), new String[] { rset.getString(RXQ_CMPDNDNAME_ALIAS) }, null, null, null));
current_dbfr.addReactionElement(formalCompound, rset.getInt(EnzymeReactionTable.table.stoich.toString()), rset.getString(EnzymeReactionTable.table.type.toString()).charAt(0));
}
ReactionDescription[] reactionsArr = null;
if (reactions.size() > 0) {
reactionsArr = new ReactionDescription[reactions.size()];
reactions.copyInto(reactionsArr);
}
return reactionsArr;
}
Aggregations