public ListSingleSelection<String> getTargetColumns(CyNetwork network) {
    CyTable selectedTable = network.getTable(CyNode.class, CyRootNetwork.SHARED_ATTRS);

    List<String> colNames = new ArrayList<String>();
    for (CyColumn col : selectedTable.getColumns()) {
      // Exclude SUID from the mapping key list
      if (col.getName().equalsIgnoreCase("SUID")) {
        continue;
      }
      colNames.add(col.getName());
    }

    ListSingleSelection<String> columns = new ListSingleSelection<String>(colNames);

    // columns.setSelectedValue("shared name"); this does not work, why
    return columns;
  }
Esempio n. 2
0
  protected final Set<CyNetwork> getNetworksByQuery(final String query, final String column) {
    final Set<CyNetwork> networks = networkManager.getNetworkSet();
    final Set<CyNetwork> matchedNetworks = new HashSet<>();

    for (final CyNetwork network : networks) {
      // First, check shared table
      CyTable table = network.getDefaultNetworkTable();
      if (table.getColumn(column) == null) {
        table = network.getTable(CyNetwork.class, CyNetwork.LOCAL_ATTRS);
      }
      // If column does not exists in the default table, check local one:
      if (table.getColumn(column) == null) {
        // Still not found?  Give up and continue.
        // TODO: should we check hidden tables, too?
        continue;
      }
      final Object rawQuery = MapperUtil.getRawValue(query, table.getColumn(column).getType());
      final Collection<CyRow> rows = table.getMatchingRows(column, rawQuery);
      if (rows.isEmpty() == false) {
        matchedNetworks.add(network);
      }
    }
    return matchedNetworks;
  }