Search in sources :

Example 6 with ReactionDescription

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

the class DictionaryDbDriver method getDictionaryReactions.

/**
 * Insert the method's description here.
 * Creation date: (4/18/2003 10:23:37 AM)
 */
public ReactionDescription[] getDictionaryReactions(Connection con, ReactionQuerySpec reactionQuerySpec) throws SQLException {
    String sql = EnzymeReactionTable.table.getSQLReactionQuery(reactionQuerySpec);
    ReactionDescription[] dictionaryReactions = null;
    Statement stmt = con.createStatement();
    try {
        ResultSet rset = stmt.executeQuery(sql);
        dictionaryReactions = EnzymeReactionTable.table.getReactions(rset);
    } finally {
        // Release resources include resultset
        stmt.close();
    }
    // 
    return dictionaryReactions;
}
Also used : Statement(java.sql.Statement) ResultSet(java.sql.ResultSet) ReactionDescription(cbit.vcell.model.ReactionDescription)

Example 7 with ReactionDescription

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

the class DBReactionWizardPanel method configureRXParameterList.

/**
 * Comment
 */
private void configureRXParameterList(javax.swing.event.ListSelectionEvent listSelectionEvent) {
    // 
    final javax.swing.DefaultListModel pndlm = (javax.swing.DefaultListModel) getParameterNamesJList().getModel();
    // 
    if (lastReactionSelection == null || !lastReactionSelection.equals(getReactionsJList().getSelectedValue())) {
        lastReactionSelection = getReactionsJList().getSelectedValue();
        setReactionStep(null);
        setReactionDescription(null);
        // 
        pndlm.removeAllElements();
        javax.swing.DefaultListModel pvdlm = (javax.swing.DefaultListModel) getParameterValuesJList().getModel();
        pvdlm.removeAllElements();
        // 
        if (getReactionsJList().getSelectedValue() instanceof String) {
            // User Reactions
            Vector<String> rxIDV = mapRXStringtoRXIDs.get(getReactionsJList().getSelectedValue());
            // String[] rxIDArr = (String[])rxIDV.toArray(new String[rxIDV.size()]);
            final KeyValue[] rxKeys = new KeyValue[rxIDV.size()];
            for (int i = 0; i < rxKeys.length; i++) {
                rxKeys[i] = new KeyValue(rxIDV.elementAt(i));
            }
            AsynchClientTask task1 = new AsynchClientTask("getting user reaction step infos", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

                public void run(Hashtable<String, Object> hashTable) throws Exception {
                    ReactionStepInfo[] reactionStepInfos = getDocumentManager().getUserReactionStepInfos(rxKeys);
                    hashTable.put("reactionStepInfos", reactionStepInfos);
                }
            };
            AsynchClientTask task2 = new AsynchClientTask("getting user reaction step infos", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

                public void run(Hashtable<String, Object> hashTable) {
                    ReactionStepInfo[] reactionStepInfos = (ReactionStepInfo[]) hashTable.get("reactionStepInfos");
                    for (int i = 0; reactionStepInfos != null && i < reactionStepInfos.length; i++) {
                        String descriptiveText = reactionStepInfos[i].getOwner().getName() + " - " + "  " + reactionStepInfos[i].getBioModelName() + "  " + "(" + reactionStepInfos[i].getReactionName() + ")" + " " + reactionStepInfos[i].getBioModelVersionDate();
                        pndlm.addElement(new MapStringToObject(descriptiveText, /*reactionStepInfos[i].getDescriptiveText()*/
                        reactionStepInfos[i]));
                    }
                }
            };
            Hashtable<String, Object> hash = new Hashtable<String, Object>();
            AsynchClientTask[] taskArray = new AsynchClientTask[] { task1, task2 };
            ClientTaskDispatcher.dispatch(this, hash, taskArray);
        } else {
            // Dictionary ReactionDescription
            ReactionDescription dbfr = (ReactionDescription) getReactionsJList().getSelectedValue();
            setupRX(dbfr);
        }
    }
// if(pndlm.size() == 0){
// //Skip parameters if there are none
// ((java.awt.CardLayout)getCardLayoutJPanel().getLayout()).next(getCardLayoutJPanel());
// }
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) KeyValue(org.vcell.util.document.KeyValue) Hashtable(java.util.Hashtable) ReactionStepInfo(cbit.vcell.model.ReactionStepInfo) ReactionDescription(cbit.vcell.model.ReactionDescription)

Example 8 with ReactionDescription

use of cbit.vcell.model.ReactionDescription 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;
}
Also used : FormalEnzyme(cbit.vcell.dictionary.FormalEnzyme) KeyValue(org.vcell.util.document.KeyValue) EnzymeInfo(cbit.vcell.dictionary.EnzymeInfo) CompoundInfo(cbit.vcell.dictionary.CompoundInfo) ReactionDescription(cbit.vcell.model.ReactionDescription) DBNonFormalUnboundSpecies(cbit.vcell.dictionary.DBNonFormalUnboundSpecies) Vector(java.util.Vector) FormalCompound(cbit.vcell.dictionary.FormalCompound)

Example 9 with ReactionDescription

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

the class DictionaryDbDriver method getUserReactionDescriptions.

/**
 * Insert the method's description here.
 * Creation date: (4/18/2003 10:23:37 AM)
 */
public ReactionDescription[] getUserReactionDescriptions(Connection con, User user, ReactionQuerySpec reactionQuerySpec) throws SQLException {
    String sql = ReactStepTable.table.getSQLUserReactionListQuery(reactionQuerySpec, user, dbSyntax);
    ReactionDescription[] rxArr = null;
    Statement stmt = con.createStatement();
    try {
        ResultSet rset = stmt.executeQuery(sql);
        rxArr = ReactStepTable.table.getUserReactionList(rset);
    } finally {
        // Release resources include resultset
        stmt.close();
    }
    // 
    return rxArr;
}
Also used : Statement(java.sql.Statement) ResultSet(java.sql.ResultSet) ReactionDescription(cbit.vcell.model.ReactionDescription)

Aggregations

ReactionDescription (cbit.vcell.model.ReactionDescription)9 KeyValue (org.vcell.util.document.KeyValue)4 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)3 DBNonFormalUnboundSpecies (cbit.vcell.dictionary.DBNonFormalUnboundSpecies)3 Hashtable (java.util.Hashtable)3 DocumentManager (cbit.vcell.clientdb.DocumentManager)2 ReactionType (cbit.vcell.model.ReactionDescription.ReactionType)2 ResultSet (java.sql.ResultSet)2 Statement (java.sql.Statement)2 Vector (java.util.Vector)2 JList (javax.swing.JList)2 DataAccessException (org.vcell.util.DataAccessException)2 CompoundInfo (cbit.vcell.dictionary.CompoundInfo)1 EnzymeInfo (cbit.vcell.dictionary.EnzymeInfo)1 FormalCompound (cbit.vcell.dictionary.FormalCompound)1 FormalEnzyme (cbit.vcell.dictionary.FormalEnzyme)1 Catalyst (cbit.vcell.model.Catalyst)1 FluxReaction (cbit.vcell.model.FluxReaction)1 Membrane (cbit.vcell.model.Membrane)1 Product (cbit.vcell.model.Product)1