Search in sources :

Example 1 with ReactionRuleSpec

use of cbit.vcell.mapping.ReactionRuleSpec in project vcell by virtualcell.

the class ReactionRuleSpecPropertiesPanel method onSelectedObjectsChange.

@Override
protected void onSelectedObjectsChange(Object[] selectedObjects) {
    ReactionRuleSpec reactionRuleSpec = null;
    if (selectedObjects != null && selectedObjects.length == 1 && selectedObjects[0] instanceof ReactionRuleSpec) {
        reactionRuleSpec = (ReactionRuleSpec) selectedObjects[0];
    }
    setReactionRule(reactionRuleSpec);
}
Also used : ReactionRuleSpec(cbit.vcell.mapping.ReactionRuleSpec)

Example 2 with ReactionRuleSpec

use of cbit.vcell.mapping.ReactionRuleSpec in project vcell by virtualcell.

the class ModelProcessSpecsTableModel method setSimulationContext.

/**
 * Sets the simulationContext property (cbit.vcell.mapping.SimulationContext) value.
 * @param simulationContext The new value for the property.
 * @see #getSimulationContext
 */
public void setSimulationContext(SimulationContext simulationContext) {
    SimulationContext oldValue = fieldSimulationContext;
    if (oldValue != null) {
        oldValue.removePropertyChangeListener(this);
        ReactionContext reactionContext = oldValue.getReactionContext();
        reactionContext.removePropertyChangeListener(this);
        ReactionSpec[] oldReactionSpecs = reactionContext.getReactionSpecs();
        for (int i = 0; i < oldReactionSpecs.length; i++) {
            oldReactionSpecs[i].getReactionStep().removePropertyChangeListener(this);
            oldReactionSpecs[i].removePropertyChangeListener(this);
        }
        ReactionRuleSpec[] oldReactionRuleSpecs = reactionContext.getReactionRuleSpecs();
        for (int i = 0; i < oldReactionRuleSpecs.length; i++) {
            oldReactionRuleSpecs[i].getReactionRule().removePropertyChangeListener(this);
            oldReactionRuleSpecs[i].removePropertyChangeListener(this);
        }
    }
    fieldSimulationContext = simulationContext;
    refreshColumns();
    if (simulationContext != null) {
        simulationContext.addPropertyChangeListener(this);
        ReactionContext reactionContext = fieldSimulationContext.getReactionContext();
        reactionContext.addPropertyChangeListener(this);
        ReactionSpec[] newReactionSpecs = reactionContext.getReactionSpecs();
        for (int i = 0; i < newReactionSpecs.length; i++) {
            newReactionSpecs[i].getReactionStep().addPropertyChangeListener(this);
            newReactionSpecs[i].addPropertyChangeListener(this);
        }
        ReactionRuleSpec[] newReactionRuleSpecs = reactionContext.getReactionRuleSpecs();
        for (int i = 0; i < newReactionRuleSpecs.length; i++) {
            newReactionRuleSpecs[i].getReactionRule().addPropertyChangeListener(this);
            newReactionRuleSpecs[i].addPropertyChangeListener(this);
        }
    }
    firePropertyChange("simulationContext", oldValue, simulationContext);
}
Also used : ReactionSpec(cbit.vcell.mapping.ReactionSpec) ReactionRuleSpec(cbit.vcell.mapping.ReactionRuleSpec) ReactionContext(cbit.vcell.mapping.ReactionContext) SimulationContext(cbit.vcell.mapping.SimulationContext)

Example 3 with ReactionRuleSpec

use of cbit.vcell.mapping.ReactionRuleSpec in project vcell by virtualcell.

the class BioModelEditor method setRightBottomPanelOnSelection.

@Override
protected void setRightBottomPanelOnSelection(Object[] selections) {
    if (selections == null) {
        return;
    }
    // TODO: here
    JComponent bottomComponent = rightBottomEmptyPanel;
    JComponent annotationComponent = rightBottomEmptyAnnotationsPanel;
    // properties panel
    int destComponentIndex = DocumentEditorTabID.object_properties.ordinal();
    // annotations panel
    int annComponentIndex = DocumentEditorTabID.annotations.ordinal();
    boolean bShowInDatabaseProperties = false;
    boolean bShowPathway = false;
    if (selections.length == 1) {
        annotationComponent = getAnnotationsPanel();
        Object singleSelection = selections[0];
        if (singleSelection instanceof ReactionStep) {
            bottomComponent = getReactionPropertiesPanel();
        } else if (singleSelection instanceof ReactionRule) {
            bottomComponent = getReactionRulePropertiesPanel();
        } else if (singleSelection instanceof SpeciesContext) {
            bottomComponent = getSpeciesPropertiesPanel();
        } else if (singleSelection instanceof MolecularType) {
            bottomComponent = getMolecularTypePropertiesPanel();
        } else if (singleSelection instanceof RbmObservable) {
            bottomComponent = getObservablePropertiesPanel();
        } else if (singleSelection instanceof Structure) {
            bottomComponent = getStructurePropertiesPanel();
            getStructurePropertiesPanel().setModel(bioModel.getModel());
        } else if (singleSelection instanceof Parameter) {
            bottomComponent = getParameterPropertiesPanel();
        } else if (singleSelection instanceof SimulationContext) {
            bottomComponent = getApplicationPropertiesPanel();
        } else if (singleSelection instanceof ParameterEstimationTask) {
            bottomComponent = parameterEstimationTaskPropertiesPanel;
        } else if (singleSelection instanceof Product || singleSelection instanceof Reactant) {
            bottomComponent = getReactionParticipantPropertiesPanel();
        } else if (singleSelection instanceof BioModelNode.PublicationInfoNode) {
            bShowInDatabaseProperties = true;
            bottomComponent = bioModelMetaDataPanel;
        } else if (singleSelection instanceof BioModelInfo) {
            bShowInDatabaseProperties = true;
            bottomComponent = bioModelMetaDataPanel;
        } else if (singleSelection instanceof MathModelInfo) {
            bShowInDatabaseProperties = true;
            bottomComponent = mathModelMetaDataPanel;
        } else if (singleSelection instanceof GeometryInfo) {
            bShowInDatabaseProperties = true;
            bottomComponent = geometryMetaDataPanel;
        } else if (singleSelection instanceof SpeciesContextSpec) {
            bottomComponent = getSpeciesContextSpecPanel();
        } else if (singleSelection instanceof ReactionSpec) {
            bottomComponent = getKineticsTypeTemplatePanel();
        } else if (singleSelection instanceof ReactionRuleSpec) {
            // 
            bottomComponent = getReactionRuleSpecPropertiesPanel();
        } else if (singleSelection instanceof BioModelsNetModelInfo) {
            bShowInDatabaseProperties = true;
            bottomComponent = getBioModelsNetPropertiesPanel();
        } else if (singleSelection instanceof Simulation) {
            bottomComponent = getSimulationSummaryPanel();
        } else if (singleSelection instanceof DataSymbol) {
            bottomComponent = getDataSymbolsSpecPanel();
        } else if (singleSelection instanceof BioEvent) {
            bottomComponent = getEventPanel();
        } else if (singleSelection instanceof SpatialObject) {
            bottomComponent = getSpatialObjectPropertyPanel();
        } else if (singleSelection instanceof SpatialProcess) {
            bottomComponent = getSpatialProcessPropertyPanel();
        } else if (singleSelection instanceof BioPaxObject) {
            bottomComponent = bioPaxObjectPropertiesPanel;
        } else if (singleSelection instanceof BioModel) {
            // only contains Notes, is displayed in the Object Properties Panel
            bottomComponent = bioModelEditorAnnotationPanel;
        } else if (singleSelection instanceof VCMetaData) {
            bottomComponent = bioModelEditorAnnotationPanel;
        } else if (singleSelection instanceof PathwayData) {
            bShowPathway = true;
            bottomComponent = getBioModelEditorPathwayPanel();
        } else if (singleSelection instanceof Model) {
        } else if (singleSelection instanceof RuleParticipantSignature) {
            bottomComponent = getReactionRuleParticipantSignaturePropertiesPanel();
        } else if (singleSelection instanceof CSGObject) {
            bottomComponent = csgObjectPropertiesPanel;
            csgObjectPropertiesPanel.setSimulationContext(getSelectedSimulationContext());
        } else if (singleSelection instanceof DocumentEditorTreeFolderNode) {
            DocumentEditorTreeFolderClass folderClass = ((DocumentEditorTreeFolderNode) singleSelection).getFolderClass();
            if ((folderClass == DocumentEditorTreeFolderClass.REACTIONS_NODE) && !(singleSelection instanceof ReactionRule)) {
                bottomComponent = getReactionPropertiesPanel();
            } else if ((folderClass == DocumentEditorTreeFolderClass.REACTIONS_NODE) && (singleSelection instanceof ReactionRule)) {
                bottomComponent = getReactionRulePropertiesPanel();
            } else if (folderClass == DocumentEditorTreeFolderClass.STRUCTURES_NODE) {
                bottomComponent = getStructurePropertiesPanel();
            } else if (folderClass == DocumentEditorTreeFolderClass.SPECIES_NODE) {
                bottomComponent = getSpeciesPropertiesPanel();
            } else if (folderClass == DocumentEditorTreeFolderClass.MOLECULAR_TYPES_NODE) {
                bottomComponent = getMolecularTypePropertiesPanel();
            } else if (folderClass == DocumentEditorTreeFolderClass.OBSERVABLES_NODE) {
                bottomComponent = getObservablePropertiesPanel();
            } else if (folderClass == DocumentEditorTreeFolderClass.APPLICATIONS_NODE) {
                bottomComponent = getApplicationsPropertiesPanel();
                getApplicationsPropertiesPanel().setBioModel(bioModel);
            } else if (folderClass == DocumentEditorTreeFolderClass.PARAMETER_ESTIMATION_NODE) {
                bottomComponent = parameterEstimationTaskPropertiesPanel;
            }
        } else if (singleSelection instanceof SelectionManager.AnnotationNavigator) {
            Object entity = ((SelectionManager.AnnotationNavigator) singleSelection).getEntity();
            if (entity instanceof ReactionStep) {
                bottomComponent = getReactionPropertiesPanel();
            } else if (entity instanceof SpeciesContext) {
                bottomComponent = getSpeciesPropertiesPanel();
            } else if (entity instanceof Structure) {
                // Observables. MolecularType, Structures
                bottomComponent = getStructurePropertiesPanel();
            } else if (entity instanceof MolecularType) {
                bottomComponent = getMolecularTypePropertiesPanel();
            } else if (entity instanceof RbmObservable) {
                bottomComponent = getObservablePropertiesPanel();
            } else {
                bottomComponent = bioModelEditorAnnotationPanel;
            }
        }
    }
    if (bShowPathway) {
        int numTabs = rightBottomTabbedPane.getTabCount();
        for (destComponentIndex = 0; destComponentIndex < numTabs; destComponentIndex++) {
            Component current = rightBottomTabbedPane.getComponentAt(destComponentIndex);
            if (current == bottomComponent) {
                break;
            }
        }
        String tabTitle = "Pathway Preview";
        if (rightBottomTabbedPane.getTabCount() == destComponentIndex) {
            rightBottomTabbedPane.addTab(tabTitle, new TabCloseIcon(), bottomComponent);
        }
    } else if (bShowInDatabaseProperties) {
        for (destComponentIndex = 0; destComponentIndex < rightBottomTabbedPane.getTabCount(); destComponentIndex++) {
            Component c = rightBottomTabbedPane.getComponentAt(destComponentIndex);
            if (c == bioModelMetaDataPanel || c == mathModelMetaDataPanel || c == geometryMetaDataPanel || c == getBioModelsNetPropertiesPanel()) {
                break;
            }
        }
        if (rightBottomTabbedPane.getTabCount() == destComponentIndex) {
            rightBottomTabbedPane.addTab(DATABASE_PROPERTIES_TAB_TITLE, new TabCloseIcon(), bottomComponent);
        }
    }
    if (rightBottomTabbedPane.getComponentAt(destComponentIndex) != bottomComponent) {
        bottomComponent.setBorder(GuiConstants.TAB_PANEL_BORDER);
        annotationComponent.setBorder(GuiConstants.TAB_PANEL_BORDER);
        rightBottomTabbedPane.setComponentAt(destComponentIndex, bottomComponent);
        rightBottomTabbedPane.setComponentAt(annComponentIndex, annotationComponent);
        rightSplitPane.repaint();
    }
    Component selectedComponent = rightBottomTabbedPane.getSelectedComponent();
    if (selections.length == 1 && selections[0] instanceof BioModel && bottomComponent instanceof BioModelEditorAnnotationPanel) {
        // if the biomodel name is selected in the upper left tree, we select the Annotations tab
        rightBottomTabbedPane.setSelectedComponent(annotationComponent);
    } else if (selections.length == 1 && selections[0] instanceof SelectionManager.AnnotationNavigator && selections[0] instanceof SelectionManager.AnnotationNavigator) {
        // we want to navigate to the AnnotationPanel
        rightBottomTabbedPane.setSelectedComponent(annotationComponent);
    // } else if(selections.length == 1 && selections[0] instanceof SelectionManager.AnnotationNavigator && bottomComponent instanceof BioModelEditorAnnotationPanel) {
    // // we want to navigate to the AnnotationPanel (old way)
    // rightBottomTabbedPane.setSelectedComponent(annotationComponent);
    } else if (selectedComponent != bottomComponent) /* && rightBottomTabbedPane.getSelectedComponent() != annotationComponent */
    {
        rightBottomTabbedPane.setSelectedComponent(bottomComponent);
    }
}
Also used : RuleParticipantSignature(cbit.vcell.model.RuleParticipantSignature) BioPaxObject(org.vcell.pathway.BioPaxObject) Product(cbit.vcell.model.Product) PathwayData(cbit.vcell.client.desktop.biomodel.BioModelEditorPathwayCommonsPanel.PathwayData) SpeciesContext(cbit.vcell.model.SpeciesContext) SpeciesContextSpec(cbit.vcell.mapping.SpeciesContextSpec) Reactant(cbit.vcell.model.Reactant) SpatialObject(cbit.vcell.mapping.spatial.SpatialObject) VCMetaData(cbit.vcell.biomodel.meta.VCMetaData) SpatialProcess(cbit.vcell.mapping.spatial.processes.SpatialProcess) GeometryInfo(cbit.vcell.geometry.GeometryInfo) Structure(cbit.vcell.model.Structure) CSGObject(cbit.vcell.geometry.CSGObject) Component(java.awt.Component) JComponent(javax.swing.JComponent) PublicationInfoNode(cbit.vcell.desktop.BioModelNode.PublicationInfoNode) ReactionRule(cbit.vcell.model.ReactionRule) ReactionSpec(cbit.vcell.mapping.ReactionSpec) ReactionRuleSpec(cbit.vcell.mapping.ReactionRuleSpec) RbmObservable(cbit.vcell.model.RbmObservable) JComponent(javax.swing.JComponent) BioModelInfo(org.vcell.util.document.BioModelInfo) DocumentEditorTreeFolderNode(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderNode) MathModelInfo(org.vcell.util.document.MathModelInfo) SimulationContext(cbit.vcell.mapping.SimulationContext) DocumentEditorTreeFolderClass(cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderClass) MolecularType(org.vcell.model.rbm.MolecularType) ParameterEstimationTask(cbit.vcell.modelopt.ParameterEstimationTask) DataSymbol(cbit.vcell.data.DataSymbol) Simulation(cbit.vcell.solver.Simulation) ReactionStep(cbit.vcell.model.ReactionStep) BioModel(cbit.vcell.biomodel.BioModel) Model(cbit.vcell.model.Model) ListSelectionModel(javax.swing.ListSelectionModel) BioModel(cbit.vcell.biomodel.BioModel) Parameter(cbit.vcell.model.Parameter) BioPaxObject(org.vcell.pathway.BioPaxObject) SpatialObject(cbit.vcell.mapping.spatial.SpatialObject) CSGObject(cbit.vcell.geometry.CSGObject) BioEvent(cbit.vcell.mapping.BioEvent)

Example 4 with ReactionRuleSpec

use of cbit.vcell.mapping.ReactionRuleSpec in project vcell by virtualcell.

the class RbmNetworkGenerator method writeReactions.

public static void writeReactions(PrintWriter writer, RbmModelContainer rbmModelContainer, SimulationContext sc, boolean applyApplicationFilters, CompartmentMode compartmentMode) {
    writer.println(BEGIN_REACTIONS);
    List<ReactionRule> reactionList = rbmModelContainer.getReactionRuleList();
    for (ReactionRule rr : reactionList) {
        if (applyApplicationFilters && sc != null) {
            ReactionRuleSpec rrs = sc.getReactionContext().getReactionRuleSpec(rr);
            if (rrs != null && rrs.isExcluded()) {
                // we skip those rules which are disabled (excluded)
                continue;
            }
        }
        writer.println(RbmUtils.toBnglStringLong(rr, compartmentMode));
    }
    writer.println(END_REACTIONS);
    writer.println();
}
Also used : ReactionRule(cbit.vcell.model.ReactionRule) ReactionRuleSpec(cbit.vcell.mapping.ReactionRuleSpec)

Example 5 with ReactionRuleSpec

use of cbit.vcell.mapping.ReactionRuleSpec in project vcell by virtualcell.

the class RbmNetworkGenerator method writeReactions_internal.

private static void writeReactions_internal(PrintWriter writer, SimulationContext sc, CompartmentMode compartmentMode) {
    writer.println(BEGIN_REACTIONS);
    for (ReactionRuleSpec rrSpec : sc.getReactionContext().getReactionRuleSpecs()) {
        if (rrSpec.isExcluded()) {
            // we skip those rules which are disabled (excluded)
            continue;
        }
        writer.println(RbmUtils.toBnglStringLong_internal(rrSpec.getReactionRule(), compartmentMode));
    }
    writer.println(END_REACTIONS);
    writer.println();
}
Also used : ReactionRuleSpec(cbit.vcell.mapping.ReactionRuleSpec)

Aggregations

ReactionRuleSpec (cbit.vcell.mapping.ReactionRuleSpec)13 Element (org.jdom.Element)6 ReactionSpec (cbit.vcell.mapping.ReactionSpec)5 BioEvent (cbit.vcell.mapping.BioEvent)4 SpatialObject (cbit.vcell.mapping.spatial.SpatialObject)4 SpatialProcess (cbit.vcell.mapping.spatial.processes.SpatialProcess)4 ReactionRule (cbit.vcell.model.ReactionRule)4 AssignmentRule (cbit.vcell.mapping.AssignmentRule)3 RateRule (cbit.vcell.mapping.RateRule)3 SimulationContext (cbit.vcell.mapping.SimulationContext)3 SimulationContextParameter (cbit.vcell.mapping.SimulationContext.SimulationContextParameter)3 SpeciesContextSpec (cbit.vcell.mapping.SpeciesContextSpec)3 NetworkConstraints (org.vcell.model.rbm.NetworkConstraints)3 BioModel (cbit.vcell.biomodel.BioModel)2 DataSymbol (cbit.vcell.data.DataSymbol)2 ParameterEstimationTask (cbit.vcell.modelopt.ParameterEstimationTask)2 ImageException (cbit.image.ImageException)1 VCMetaData (cbit.vcell.biomodel.meta.VCMetaData)1 PathwayData (cbit.vcell.client.desktop.biomodel.BioModelEditorPathwayCommonsPanel.PathwayData)1 DocumentEditorTreeFolderClass (cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderClass)1