Search in sources :

Example 1 with KineticsDescription

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

the class KineticsTypeTemplatePanel method getKineticsTypeComboBox.

private javax.swing.JComboBox getKineticsTypeComboBox() {
    if (kineticsTypeComboBox == null) {
        try {
            kineticsTypeComboBox = new javax.swing.JComboBox();
            kineticsTypeComboBox.setName("JComboBox1");
            kineticsTypeComboBox.setRenderer(new DefaultListCellRenderer() {

                private static final String MU = "\u03BC";

                private static final String MICROMOLAR = MU + "M";

                private static final String SQUARED = "\u00B2";

                private static final String SQUAREMICRON = MU + "m" + SQUARED;

                public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
                    java.awt.Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
                    if (value instanceof KineticsDescription) {
                        KineticsDescription kineticsDescription = (KineticsDescription) value;
                        if (getKinetics() != null && getKinetics().getReactionStep() != null) {
                            if (getKinetics().getReactionStep().getStructure() instanceof Feature) {
                                if (kineticsDescription.equals(KineticsDescription.General)) {
                                    setText("General [" + MICROMOLAR + "/s]");
                                } else if (kineticsDescription.equals(KineticsDescription.MassAction)) {
                                    setText("Mass Action [" + MICROMOLAR + "/s] (recommended for stochastic application)");
                                } else if (kineticsDescription.equals(KineticsDescription.GeneralLumped)) {
                                    setText("General [molecules/s]");
                                } else if (kineticsDescription.equals(KineticsDescription.HMM_irreversible)) {
                                    setText("Henri-Michaelis-Menten (Irreversible) [" + MICROMOLAR + "/s]");
                                } else if (kineticsDescription.equals(KineticsDescription.HMM_reversible)) {
                                    setText("Henri-Michaelis-Menten (Reversible) [" + MICROMOLAR + "/s]");
                                } else {
                                    setText(kineticsDescription.getDescription());
                                }
                            } else if (getKinetics().getReactionStep().getStructure() instanceof Membrane) {
                                if (kineticsDescription.equals(KineticsDescription.General)) {
                                    setText("General [molecules/(" + SQUAREMICRON + " s)]");
                                } else if (kineticsDescription.equals(KineticsDescription.MassAction)) {
                                    setText("Mass Action [molecules/(" + SQUAREMICRON + " s)]");
                                } else if (kineticsDescription.equals(KineticsDescription.GeneralLumped)) {
                                    setText("General [molecules/s)]");
                                } else if (kineticsDescription.equals(KineticsDescription.HMM_irreversible)) {
                                    setText("Henri-Michaelis-Menten (Irreversible) [molecules/(" + SQUAREMICRON + " s)]");
                                } else if (kineticsDescription.equals(KineticsDescription.HMM_reversible)) {
                                    setText("Henri-Michaelis-Menten (Reversible) [molecules/(" + SQUAREMICRON + " s)]");
                                } else if (kineticsDescription.equals(KineticsDescription.Macroscopic_irreversible)) {
                                    setText("Macroscopic (Irreversible) [molecules/(" + SQUAREMICRON + " s)]");
                                } else if (kineticsDescription.equals(KineticsDescription.Microscopic_irreversible)) {
                                    setText("Microscopic (Irreversible) [molecules/(" + SQUAREMICRON + " s)]");
                                } else {
                                    setText(kineticsDescription.getDescription());
                                }
                            }
                        } else {
                            setText(kineticsDescription.getDescription());
                        }
                    }
                    return component;
                }
            });
        // user code begin {1}
        // user code end
        } catch (java.lang.Throwable ivjExc) {
            // user code begin {2}
            // user code end
            handleException(ivjExc);
        }
    }
    return kineticsTypeComboBox;
}
Also used : KineticsDescription(cbit.vcell.model.KineticsDescription) Feature(cbit.vcell.model.Feature) DefaultListCellRenderer(javax.swing.DefaultListCellRenderer) Membrane(cbit.vcell.model.Membrane) Component(java.awt.Component) JList(javax.swing.JList)

Example 2 with KineticsDescription

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

the class KineticsTypeTemplatePanel method initKineticChoices.

private void initKineticChoices() {
    KineticsDescription[] kineticTypes = reactionStep == null || reactionStep instanceof SimpleReaction ? Simple_Reaction_Kinetic_Types : Flux_Reaction_KineticTypes;
    javax.swing.DefaultComboBoxModel model = new DefaultComboBoxModel();
    for (int i = 0; i < kineticTypes.length; i++) {
        model.addElement(kineticTypes[i]);
    }
    getKineticsTypeComboBox().setModel(model);
    return;
}
Also used : SimpleReaction(cbit.vcell.model.SimpleReaction) KineticsDescription(cbit.vcell.model.KineticsDescription) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel)

Example 3 with KineticsDescription

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

the class ReactionPropertiesPanel method getKineticsTypeComboBox.

private javax.swing.JComboBox getKineticsTypeComboBox() {
    if (kineticsTypeComboBox == null) {
        try {
            kineticsTypeComboBox = new javax.swing.JComboBox();
            kineticsTypeComboBox.setName("JComboBox1");
            kineticsTypeComboBox.setRenderer(new DefaultListCellRenderer() {

                private static final String MU = "\u03BC";

                private static final String MICROMOLAR = MU + "M";

                private static final String SQUARED = "\u00B2";

                private static final String SQUAREMICRON = MU + "m" + SQUARED;

                private static final String MICRON = MU + "m";

                public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
                    java.awt.Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
                    if (value instanceof KineticsDescription) {
                        KineticsDescription kineticsDescription = (KineticsDescription) value;
                        setText(kineticsDescription.getDescription());
                        if (reactionStep != null) {
                            if (reactionStep instanceof SimpleReaction) {
                                if (reactionStep.getStructure() instanceof Feature) {
                                    if (kineticsDescription.equals(KineticsDescription.General)) {
                                        setText("General [" + MICROMOLAR + "/s]");
                                    } else if (kineticsDescription.equals(KineticsDescription.MassAction)) {
                                        setText("Mass Action [" + MICROMOLAR + "/s] (recommended for stochastic application)");
                                    } else if (kineticsDescription.equals(KineticsDescription.GeneralLumped)) {
                                        setText("General [molecules/s]");
                                    } else if (kineticsDescription.equals(KineticsDescription.HMM_irreversible)) {
                                        setText("Henri-Michaelis-Menten (Irreversible) [" + MICROMOLAR + "/s]");
                                    } else if (kineticsDescription.equals(KineticsDescription.HMM_reversible)) {
                                        setText("Henri-Michaelis-Menten (Reversible) [" + MICROMOLAR + "/s]");
                                    } else {
                                        setText(kineticsDescription.getDescription());
                                    }
                                } else if (reactionStep.getStructure() instanceof Membrane) {
                                    if (kineticsDescription.equals(KineticsDescription.General)) {
                                        setText("General [molecules/(" + SQUAREMICRON + " s)]");
                                    } else if (kineticsDescription.equals(KineticsDescription.MassAction)) {
                                        setText("Mass Action [molecules/(" + SQUAREMICRON + " s)]");
                                    } else if (kineticsDescription.equals(KineticsDescription.GeneralLumped)) {
                                        setText("General [molecules/s)]");
                                    } else if (kineticsDescription.equals(KineticsDescription.HMM_irreversible)) {
                                        setText("Henri-Michaelis-Menten (Irreversible) [molecules/(" + SQUAREMICRON + " s)]");
                                    } else if (kineticsDescription.equals(KineticsDescription.HMM_reversible)) {
                                        setText("Henri-Michaelis-Menten (Reversible) [molecules/(" + SQUAREMICRON + " s)]");
                                    } else if (kineticsDescription.equals(KineticsDescription.Macroscopic_irreversible)) {
                                        setText("Macroscopic (Irreversible) [molecules/(" + SQUAREMICRON + " s)]");
                                    } else if (kineticsDescription.equals(KineticsDescription.Microscopic_irreversible)) {
                                        setText("Microscopic (Irreversible) [molecules/(" + SQUAREMICRON + " s)]");
                                    }
                                }
                            } else if (reactionStep instanceof FluxReaction) {
                                if (kineticsDescription.equals(KineticsDescription.General)) {
                                    setText("General Flux Density (" + MICROMOLAR + "-" + MICRON + "/s)");
                                } else if (kineticsDescription.equals(KineticsDescription.GeneralLumped)) {
                                    setText("General Flux (molecules/s)");
                                } else if (kineticsDescription.equals(KineticsDescription.GeneralCurrent)) {
                                    setText("General Current Density (pA/" + SQUAREMICRON + ")");
                                } else if (kineticsDescription.equals(KineticsDescription.GeneralCurrentLumped)) {
                                    setText("General Current (pA)");
                                } else if (kineticsDescription.equals(KineticsDescription.GHK)) {
                                    setText("Goldman-Hodgkin-Katz Current Density (pA/" + SQUAREMICRON + ") - permeability in " + MICRON + "/s");
                                } else if (kineticsDescription.equals(KineticsDescription.Nernst)) {
                                    setText("Nernst Current Density (pA/" + SQUAREMICRON + ") - conductance in nS/" + SQUAREMICRON);
                                } else if (kineticsDescription.equals(KineticsDescription.GeneralPermeability)) {
                                    setText("General Permeability (" + MICROMOLAR + "-" + MICRON + "/s) - permeability in " + MICRON + "/s");
                                }
                            }
                        }
                    }
                    return component;
                }
            });
        // user code begin {1}
        // user code end
        } catch (java.lang.Throwable ivjExc) {
            // user code begin {2}
            // user code end
            handleException(ivjExc);
        }
    }
    return kineticsTypeComboBox;
}
Also used : SimpleReaction(cbit.vcell.model.SimpleReaction) KineticsDescription(cbit.vcell.model.KineticsDescription) FluxReaction(cbit.vcell.model.FluxReaction) Feature(cbit.vcell.model.Feature) DefaultListCellRenderer(javax.swing.DefaultListCellRenderer) Membrane(cbit.vcell.model.Membrane) BioPaxObject(org.vcell.pathway.BioPaxObject) RelationshipObject(org.vcell.relationship.RelationshipObject) Component(java.awt.Component) JList(javax.swing.JList)

Example 4 with KineticsDescription

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

the class ReactionPropertiesPanel method initKineticChoices.

private void initKineticChoices() {
    KineticsDescription[] kineticTypes = reactionStep == null || reactionStep instanceof SimpleReaction ? Simple_Reaction_Kinetic_Types : Flux_Reaction_KineticTypes;
    javax.swing.DefaultComboBoxModel model = new DefaultComboBoxModel();
    for (int i = 0; i < kineticTypes.length; i++) {
        if (!(kineticTypes[i].equals(KineticsDescription.Macroscopic_irreversible) || kineticTypes[i].equals(KineticsDescription.Microscopic_irreversible))) {
            model.addElement(kineticTypes[i]);
        } else // macroscopic/microscopic irreversible
        {
            // reactions on membrane in a 3D geometry
            if (reactionStep != null && reactionStep.getStructure() != null && reactionStep.getStructure() instanceof Membrane) {
                // check if reactants are all on membrane and calculate sum of reactants' stoichiometry
                ReactionParticipant[] rps = reactionStep.getReactionParticipants();
                int order = 0;
                boolean bAllMembraneReactants = true;
                for (ReactionParticipant rp : rps) {
                    if (rp instanceof Reactant) {
                        if (!(rp.getStructure() instanceof Membrane)) {
                            bAllMembraneReactants = false;
                            break;
                        }
                        order += rp.getStoichiometry();
                    }
                }
                // add only if 2nd order membrane reaction
                if (order == 2 && bAllMembraneReactants && !reactionStep.hasCatalyst()) {
                    model.addElement(kineticTypes[i]);
                }
            }
        }
    }
    getKineticsTypeComboBox().setModel(model);
    return;
}
Also used : SimpleReaction(cbit.vcell.model.SimpleReaction) KineticsDescription(cbit.vcell.model.KineticsDescription) Membrane(cbit.vcell.model.Membrane) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) ReactionParticipant(cbit.vcell.model.ReactionParticipant) Reactant(cbit.vcell.model.Reactant)

Example 5 with KineticsDescription

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

the class ReactionPropertiesPanel method updateKineticChoice.

private void updateKineticChoice() {
    KineticsDescription newKineticChoice = (KineticsDescription) getKineticsTypeComboBox().getSelectedItem();
    // 
    if (reactionStep == null || reactionStep.getKinetics().getKineticsDescription().equals(newKineticChoice)) {
        return;
    }
    boolean bFoundKineticType = false;
    KineticsDescription[] kineticTypes = reactionStep instanceof SimpleReaction ? Simple_Reaction_Kinetic_Types : Flux_Reaction_KineticTypes;
    for (int i = 0; i < kineticTypes.length; i++) {
        if (kineticTypes[i].equals(newKineticChoice)) {
            bFoundKineticType = true;
            break;
        }
    }
    if (!bFoundKineticType) {
        return;
    }
    try {
        reactionStep.setKinetics(newKineticChoice.createKinetics(reactionStep));
    } catch (Exception exc) {
        handleException(exc);
    }
}
Also used : SimpleReaction(cbit.vcell.model.SimpleReaction) KineticsDescription(cbit.vcell.model.KineticsDescription) PropertyVetoException(java.beans.PropertyVetoException)

Aggregations

KineticsDescription (cbit.vcell.model.KineticsDescription)6 SimpleReaction (cbit.vcell.model.SimpleReaction)5 Membrane (cbit.vcell.model.Membrane)4 Feature (cbit.vcell.model.Feature)2 FluxReaction (cbit.vcell.model.FluxReaction)2 Component (java.awt.Component)2 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)2 DefaultListCellRenderer (javax.swing.DefaultListCellRenderer)2 JList (javax.swing.JList)2 Kinetics (cbit.vcell.model.Kinetics)1 KineticsParameter (cbit.vcell.model.Kinetics.KineticsParameter)1 Reactant (cbit.vcell.model.Reactant)1 ReactionParticipant (cbit.vcell.model.ReactionParticipant)1 ReactionStep (cbit.vcell.model.ReactionStep)1 PropertyVetoException (java.beans.PropertyVetoException)1 BioPaxObject (org.vcell.pathway.BioPaxObject)1 RelationshipObject (org.vcell.relationship.RelationshipObject)1 DataAccessException (org.vcell.util.DataAccessException)1 KeyValue (org.vcell.util.document.KeyValue)1