コード例 #1
0
  private void applySelectionToNetwork() {
    CyNetwork network = Cytoscape.getCurrentNetwork();
    network.unselectAllNodes();
    network.unselectAllEdges();

    Set<String> selection = new HashSet<String>();
    for (int i : currentTable.getSelectedRows()) {
      selection.add(currentTable.getValueAt(i, 0).toString());
    }

    NetworkData networkData =
        MetScapePlugin.getPluginData().getNetworkData(Networks.getUUID(network));
    if (networkData == null) return;
    NetworkType networkType = networkData.getNetworkType();

    if (networkType == NetworkType.CREG) applySelectionToCREGNetwork(network, selection);
    else if (networkType == NetworkType.COMPOUND_REACTION)
      applySelectionToCRNetwork(network, selection);
    else if (networkType == NetworkType.COMPOUND_GENE)
      applySelectionToCGNetwork(network, selection);
    else if (networkType == NetworkType.COMPOUND)
      applySelectionToCompoundNetwork(network, selection);

    CyNetworkView view = Cytoscape.getNetworkView(network.getIdentifier());
    if (view != null && initialized) view.redrawGraph(true, true);
    else if (!initialized) initialized = true;
  }
コード例 #2
0
  private void refreshPathwayListForCurrentNetwork() {
    Set<String> selectedPathwaySet = new HashSet<String>();
    for (int i : currentTable.getSelectedRows())
      selectedPathwaySet.add(currentTable.getValueAt(i, 0).toString());
    currentModel.setRowCount(0);

    SortedSet<String> pathwaySet;
    CyNetwork network = Cytoscape.getCurrentNetwork();
    NetworkData networkData =
        MetScapePlugin.getPluginData().getNetworkData(Networks.getUUID(network));
    NetworkType networkType = null;
    if (networkData != null) networkType = networkData.getNetworkType();

    if (networkType == NetworkType.COMPOUND_REACTION
        || networkType == NetworkType.CREG) { // for C-R and C-R-E-G
      pathwaySet = getPathwaySetFromReactionNodes(network);
    } else if (networkType == NetworkType.COMPOUND) {
      pathwaySet = getPathwaySetFromReactionEdges(network);
    } else if (networkType == NetworkType.COMPOUND_GENE) {
      pathwaySet = getPathwaySetFromEnzymeReactionEdges(network);
    } else {
      pathwaySet = new TreeSet<String>();
    }
    for (String pathway : pathwaySet) {
      currentModel.addRow(new Object[] {pathway});
      if (selectedPathwaySet.contains(pathway))
        currentTable.addRowSelectionInterval(
            currentTable.getRowCount() - 1, currentTable.getRowCount() - 1);
    }
    applySelectionToNetwork();
  }