Search in sources :

Example 1 with PathwayData

use of cbit.vcell.client.desktop.biomodel.BioModelEditorPathwayCommonsPanel.PathwayData in project vcell by virtualcell.

the class BioModelEditorSabioPanel method treeSelectionChanged.

public void treeSelectionChanged() {
    System.out.println("treeSelectionChanged");
    final SBEntity kineticLaw = computeSelectedKineticLaw();
    if (kineticLaw == null) {
        return;
    }
    String kineticLawID = kineticLaw.getID();
    final String kls = new String("kineticLaw");
    if (!kineticLawID.contains(kls)) {
        return;
    }
    kineticLawID = kineticLawID.substring(kineticLawID.lastIndexOf(kls) + kls.length());
    command = "EntryID:" + kineticLawID;
    AsynchClientTask task1 = new AsynchClientTask("Importing Kinetic Laws", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        @Override
        public void run(final Hashtable<String, Object> hashTable) throws Exception {
            final URL url = new URL("http://sabiork.h-its.org/sabioRestWebServices/searchKineticLaws/biopax?q=" + command);
            // final URL url = new URL("http://sabiork.h-its.org/sabioRestWebServices/searchKineticLaws/biopax?q=EntryID:33107");
            System.out.println(url.toString());
            String ERROR_CODE_TAG = "error_code";
            Document jdomDocument = XmlUtil.getJDOMDocument(url, getClientTaskStatusSupport());
            Element rootElement = jdomDocument.getRootElement();
            String errorCode = rootElement.getChildText(ERROR_CODE_TAG);
            if (errorCode != null) {
                throw new RuntimeException("Failed to access " + url + " \n\nPlease try again.");
            }
            PathwayModel pathwayModel = PathwayIOUtil.extractPathwayFromJDOM(jdomDocument, new RDFXMLContext(), getClientTaskStatusSupport());
            PathwayData pathwayData = new PathwayData("Sabio Kinetic Laws", pathwayModel);
            hashTable.put("pathwayData", pathwayData);
        }
    };
    AsynchClientTask task2 = new AsynchClientTask("showing", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            PathwayData pathwayData = (PathwayData) hashTable.get("pathwayData");
            if (pathwayData != null) {
                setSelectedObjects(new Object[] { pathwayData });
            }
        }
    };
    ClientTaskDispatcher.dispatch(this, new Hashtable<String, Object>(), new AsynchClientTask[] { task1, task2 }, true, true, null);
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) RDFXMLContext(org.vcell.pathway.persistence.RDFXMLContext) Hashtable(java.util.Hashtable) Element(org.jdom.Element) PathwayData(cbit.vcell.client.desktop.biomodel.BioModelEditorPathwayCommonsPanel.PathwayData) Document(org.jdom.Document) PathwayModel(org.vcell.pathway.PathwayModel) SBEntity(org.vcell.pathway.sbpax.SBEntity) URL(java.net.URL) PathwayStringObject(cbit.vcell.client.desktop.biomodel.BioModelEditorPathwayCommonsPanel.PathwayStringObject)

Example 2 with PathwayData

use of cbit.vcell.client.desktop.biomodel.BioModelEditorPathwayCommonsPanel.PathwayData in project vcell by virtualcell.

the class BioModelEditorSabioPanel method populateKineticLawsTree.

public void populateKineticLawsTree() {
    // String category1 = (String)categoryList1.getSelectedItem();
    String category1 = "AnyRole";
    String category2 = (String) categoryList2.getSelectedItem();
    String entity1 = entityName1.getText();
    String entity2 = entityName2.getText();
    // http://sabiork.h-its.org/sabioRestWebServices/searchKineticLaws/biopax?q=%28Pathway:JAK-STAT%20AND%20CellularLocation:cytosol%29
    command = "";
    if (entity1.isEmpty() && entity2.isEmpty()) {
        DialogUtils.showWarningDialog(this, "No search criteria specified.");
        return;
    }
    if (!entity1.isEmpty() && entity2.isEmpty()) {
        command += category1 + ":" + entity1;
    } else if (entity1.isEmpty() && !entity2.isEmpty()) {
        command += category2 + ":" + entity2;
    } else {
        // both entities present
        command += "%28" + category1 + ":" + entity1 + "%20AND%20" + category2 + ":" + entity2 + "%29";
    }
    AsynchClientTask task1 = new AsynchClientTask("Importing Kinetic Laws", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        @Override
        public void run(final Hashtable<String, Object> hashTable) throws Exception {
            final URL url = new URL("http://sabiork.h-its.org/sabioRestWebServices/searchKineticLaws/biopax?q=" + command);
            System.out.println(url.toString());
            String ERROR_CODE_TAG = "error_code";
            Document jdomDocument = XmlUtil.getJDOMDocument(url, getClientTaskStatusSupport());
            Element rootElement = jdomDocument.getRootElement();
            String errorCode = rootElement.getChildText(ERROR_CODE_TAG);
            if (errorCode != null) {
                throw new RuntimeException("Failed to access " + url + " \n\nPlease try again.");
            }
            PathwayModel pathwayModel = PathwayIOUtil.extractPathwayFromJDOM(jdomDocument, new RDFXMLContext(), getClientTaskStatusSupport());
            PathwayData pathwayData = new PathwayData("Sabio Kinetic Laws", pathwayModel);
            hashTable.put("pathwayData", pathwayData);
        }
    };
    AsynchClientTask task2 = new AsynchClientTask("showing", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

        @Override
        public void run(Hashtable<String, Object> hashTable) throws Exception {
            PathwayData pathwayData = (PathwayData) hashTable.get("pathwayData");
            if (pathwayData != null) {
                responseTreeModel.addSearchResponse("text", pathwayData);
            }
        }
    };
    ClientTaskDispatcher.dispatch(this, new Hashtable<String, Object>(), new AsynchClientTask[] { task1, task2 }, true, true, null);
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) RDFXMLContext(org.vcell.pathway.persistence.RDFXMLContext) Hashtable(java.util.Hashtable) Element(org.jdom.Element) PathwayData(cbit.vcell.client.desktop.biomodel.BioModelEditorPathwayCommonsPanel.PathwayData) PathwayStringObject(cbit.vcell.client.desktop.biomodel.BioModelEditorPathwayCommonsPanel.PathwayStringObject) Document(org.jdom.Document) PathwayModel(org.vcell.pathway.PathwayModel) URL(java.net.URL)

Example 3 with PathwayData

use of cbit.vcell.client.desktop.biomodel.BioModelEditorPathwayCommonsPanel.PathwayData in project vcell by virtualcell.

the class BioModelEditor method setRightBottomPanelOnSelection.

@Override
protected void setRightBottomPanelOnSelection(Object[] selections) {
    if (selections == null) {
        return;
    }
    JComponent bottomComponent = rightBottomEmptyPanel;
    int destComponentIndex = DocumentEditorTabID.object_properties.ordinal();
    boolean bShowInDatabaseProperties = false;
    boolean bShowPathway = false;
    if (selections.length == 1) {
        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 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 || 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;
            }
        }
    }
    if (bShowPathway) {
        for (destComponentIndex = 0; destComponentIndex < rightBottomTabbedPane.getTabCount(); destComponentIndex++) {
            if (rightBottomTabbedPane.getComponentAt(destComponentIndex) == 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);
        rightBottomTabbedPane.setComponentAt(destComponentIndex, bottomComponent);
        rightSplitPane.repaint();
    }
    if (rightBottomTabbedPane.getSelectedComponent() != bottomComponent) {
        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) 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 PathwayData

use of cbit.vcell.client.desktop.biomodel.BioModelEditorPathwayCommonsPanel.PathwayData in project vcell by virtualcell.

the class BioModelEditorPathwayPanel method onSelectedObjectsChange.

@Override
protected void onSelectedObjectsChange(Object[] selectedObjects) {
    PathwayData pathwayData = null;
    if (selectedObjects != null && selectedObjects.length == 1 && selectedObjects[0] instanceof PathwayData) {
        pathwayData = (PathwayData) selectedObjects[0];
        setPathwayData(pathwayData);
    }
}
Also used : PathwayData(cbit.vcell.client.desktop.biomodel.BioModelEditorPathwayCommonsPanel.PathwayData)

Aggregations

PathwayData (cbit.vcell.client.desktop.biomodel.BioModelEditorPathwayCommonsPanel.PathwayData)4 PathwayStringObject (cbit.vcell.client.desktop.biomodel.BioModelEditorPathwayCommonsPanel.PathwayStringObject)2 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)2 URL (java.net.URL)2 Hashtable (java.util.Hashtable)2 Document (org.jdom.Document)2 Element (org.jdom.Element)2 PathwayModel (org.vcell.pathway.PathwayModel)2 RDFXMLContext (org.vcell.pathway.persistence.RDFXMLContext)2 BioModel (cbit.vcell.biomodel.BioModel)1 VCMetaData (cbit.vcell.biomodel.meta.VCMetaData)1 DocumentEditorTreeFolderClass (cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderClass)1 DocumentEditorTreeFolderNode (cbit.vcell.client.desktop.biomodel.DocumentEditorTreeModel.DocumentEditorTreeFolderNode)1 DataSymbol (cbit.vcell.data.DataSymbol)1 CSGObject (cbit.vcell.geometry.CSGObject)1 GeometryInfo (cbit.vcell.geometry.GeometryInfo)1 BioEvent (cbit.vcell.mapping.BioEvent)1 ReactionRuleSpec (cbit.vcell.mapping.ReactionRuleSpec)1 ReactionSpec (cbit.vcell.mapping.ReactionSpec)1 SimulationContext (cbit.vcell.mapping.SimulationContext)1