use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.
the class ImportTableDataTask method getResults.
@Override
public Object getResults(Class requestedType) {
if (requestedType.equals(List.class))
return mappedTables;
if (requestedType.equals(String.class)) {
String str = "Mapped to tables:\n";
for (CyTable table : mappedTables) {
str += " " + table.toString() + "\n";
}
return str;
}
if (requestedType.equals(JSONResult.class)) {
CyJSONUtil cyJSONUtil = serviceRegistrar.getService(CyJSONUtil.class);
JSONResult res = () -> {
if (mappedTables.isEmpty())
return "{}";
return "{\"mappedTables\":" + cyJSONUtil.cyIdentifiablesToJson(mappedTables) + "}";
};
return res;
}
return null;
}
use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.
the class ImportTableDataTask method addTable.
private void addTable() {
final CyTableManager tableMgr = serviceRegistrar.getService(CyTableManager.class);
if (byReader) {
if (this.reader != null && this.reader.getTables() != null) {
for (CyTable table : reader.getTables()) {
if (!newTableName.isEmpty())
table.setTitle(newTableName);
tableMgr.addTable(table);
}
} else {
if (reader == null)
logger.warn("reader is null.");
else
logger.warn("No tables in reader.");
}
} else {
if (tableMgr.getTable(globalTable.getSUID()) != null) {
tableMgr.deleteTable(globalTable.getSUID());
globalTable.setPublic(true);
}
if (!newTableName.isEmpty())
globalTable.setTitle(newTableName);
tableMgr.addTable(globalTable);
mappedTables.add(globalTable);
}
}
use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.
the class JoinTablesTask method applyMapping.
private void applyMapping(CyTable targetTable) {
if (byReader) {
if (reader.getTables() != null && reader.getTables().length > 0) {
for (CyTable sourceTable : reader.getTables()) {
copyColumns(sourceTable, targetTable);
copyRows(sourceTable, targetTable);
}
}
} else {
copyColumns(globalTable, targetTable);
copyRows(globalTable, targetTable);
}
}
use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.
the class ListColumnsTask method run.
@Override
public void run(final TaskMonitor taskMonitor) {
CyTable requestedTable = table.getTable();
if (requestedTable == null) {
taskMonitor.showMessage(TaskMonitor.Level.ERROR, "Unable to find table '" + table.getTableString() + "'");
return;
}
columns = new ArrayList<CyColumn>(requestedTable.getColumns());
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Columns for table " + getTableDescription(requestedTable) + ":");
for (CyColumn column : columns) taskMonitor.showMessage(TaskMonitor.Level.INFO, " " + column.toString());
}
use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.
the class ListEdgeAttributesTask method run.
@Override
public void run(final TaskMonitor taskMonitor) {
if (network == null)
network = appMgr.getCurrentNetwork();
CyTable networkTable = getNetworkTable(network, CyEdge.class, namespace);
columnList = networkTable.getColumns();
taskMonitor.showMessage(TaskMonitor.Level.INFO, " Edge columns for network " + DataUtils.getNetworkName(network) + ":");
for (CyColumn column : columnList) {
if (column.getType().equals(List.class))
taskMonitor.showMessage(TaskMonitor.Level.INFO, " " + column.getName() + ": " + DataUtils.getType(column.getListElementType()) + " list");
else
taskMonitor.showMessage(TaskMonitor.Level.INFO, " " + column.getName() + ": " + DataUtils.getType(column.getType()));
}
}
Aggregations