Search in sources :

Example 1 with CyTable

use of org.cytoscape.model.CyTable in project EnrichmentMapApp by BaderLab.

the class CreateEMNetworkTask method createEdgeColumns.

private CyTable createEdgeColumns(CyNetwork network) {
    CyTable table = network.getDefaultEdgeTable();
    Columns.EDGE_SIMILARITY_COEFF.createColumn(table, prefix, null);
    Columns.EDGE_OVERLAP_SIZE.createColumn(table, prefix, null);
    Columns.EDGE_DATASET.createColumn(table, prefix, null);
    Columns.EDGE_OVERLAP_GENES.createColumn(table, prefix, null);
    map.getParams().addSimilarityCutoffColumnName(Columns.EDGE_SIMILARITY_COEFF.with(prefix, null));
    return table;
}
Also used : CyTable(org.cytoscape.model.CyTable)

Example 2 with CyTable

use of org.cytoscape.model.CyTable in project EnrichmentMapApp by BaderLab.

the class CreateEMNetworkTask method createNodeColumns.

private CyTable createNodeColumns(CyNetwork network) {
    CyTable table = network.getDefaultNodeTable();
    // !
    Columns.NODE_NAME.createColumn(table, prefix, null);
    // !
    Columns.NODE_GS_DESCR.createColumn(table, prefix, null);
    // !
    Columns.NODE_GS_TYPE.createColumn(table, prefix, null);
    // !
    Columns.NODE_FORMATTED_NAME.createColumn(table, prefix, null);
    // Union of geneset genes across all datasets // !
    Columns.NODE_GENES.createColumn(table, prefix, null);
    // Size of the union // !
    Columns.NODE_GS_SIZE.createColumn(table, prefix, null);
    EMCreationParameters params = map.getParams();
    for (String datasetName : map.getDataSetNames()) {
        Columns.NODE_PVALUE.createColumn(table, prefix, datasetName);
        Columns.NODE_FDR_QVALUE.createColumn(table, prefix, datasetName);
        Columns.NODE_FWER_QVALUE.createColumn(table, prefix, datasetName);
        // MKTODO only create these if method is GSEA?
        Columns.NODE_ES.createColumn(table, prefix, datasetName);
        Columns.NODE_NES.createColumn(table, prefix, datasetName);
        Columns.NODE_COLOURING.createColumn(table, prefix, datasetName);
        params.addPValueColumnName(Columns.NODE_PVALUE.with(prefix, datasetName));
        params.addQValueColumnName(Columns.NODE_FDR_QVALUE.with(prefix, datasetName));
    }
    return table;
}
Also used : CyTable(org.cytoscape.model.CyTable) EMCreationParameters(org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters)

Example 3 with CyTable

use of org.cytoscape.model.CyTable in project EnrichmentMapApp by BaderLab.

the class WidthFunction method createColumns.

private void createColumns(CyNetwork network, String prefix) {
    CyTable networkTable = network.getDefaultNetworkTable();
    NETWORK_EDGE_WIDTH_PARAMETERS_COLUMN.createColumnIfAbsent(networkTable, null, null);
    CyTable edgeTable = network.getDefaultEdgeTable();
    EDGE_WIDTH_FORMULA_COLUMN.createColumnIfAbsent(edgeTable, prefix, null);
}
Also used : CyTable(org.cytoscape.model.CyTable)

Example 4 with CyTable

use of org.cytoscape.model.CyTable in project EnrichmentMapApp by BaderLab.

the class AbstractChart method getLabelsFromColumn.

@SuppressWarnings("unchecked")
public List<String> getLabelsFromColumn(final CyNetwork network, final CyIdentifiable model, final CyColumnIdentifier columnId) {
    final List<String> labels = new ArrayList<>();
    final CyRow row = network.getRow(model);
    if (row != null && columnId != null) {
        final CyTable table = row.getTable();
        final CyColumn column = table.getColumn(columnId.getColumnName());
        if (column != null && column.getType() == List.class) {
            final Class<?> type = column.getListElementType();
            final List<?> values = row.getList(columnId.getColumnName(), type);
            if (type == String.class) {
                labels.addAll((List<String>) values);
            } else {
                for (Object obj : values) labels.add(obj.toString());
            }
        }
    }
    return labels;
}
Also used : CyTable(org.cytoscape.model.CyTable) ArrayList(java.util.ArrayList) CyColumn(org.cytoscape.model.CyColumn) ArrayList(java.util.ArrayList) List(java.util.List) CyRow(org.cytoscape.model.CyRow)

Example 5 with CyTable

use of org.cytoscape.model.CyTable in project EnrichmentMapApp by BaderLab.

the class AbstractChart method getSingleValueColumnNames.

/**
	 * @return The names of the data columns or an empty list if any of the data columns is of type List.
	 */
protected List<String> getSingleValueColumnNames(final CyNetwork network, final CyIdentifiable model) {
    final List<String> names = new ArrayList<>();
    final CyRow row = network.getRow(model);
    if (row == null)
        return names;
    final List<CyColumnIdentifier> dataColumns = getList(DATA_COLUMNS, CyColumnIdentifier.class);
    final CyTable table = row.getTable();
    boolean invalid = false;
    for (final CyColumnIdentifier colId : dataColumns) {
        final CyColumn column = table.getColumn(colId.getColumnName());
        if (column == null || column.getType() == List.class) {
            // Not a single value column!
            invalid = true;
            break;
        }
        names.add(colId.getColumnName());
    }
    if (invalid)
        names.clear();
    return names;
}
Also used : CyTable(org.cytoscape.model.CyTable) ArrayList(java.util.ArrayList) CyColumn(org.cytoscape.model.CyColumn) ArrayList(java.util.ArrayList) List(java.util.List) CyColumnIdentifier(org.cytoscape.view.presentation.property.values.CyColumnIdentifier) CyRow(org.cytoscape.model.CyRow)

Aggregations

CyTable (org.cytoscape.model.CyTable)282 CyNetwork (org.cytoscape.model.CyNetwork)79 CyRow (org.cytoscape.model.CyRow)73 CyColumn (org.cytoscape.model.CyColumn)71 ArrayList (java.util.ArrayList)55 CyNode (org.cytoscape.model.CyNode)43 CyEdge (org.cytoscape.model.CyEdge)35 Test (org.junit.Test)29 List (java.util.List)26 HashMap (java.util.HashMap)24 CyApplicationManager (org.cytoscape.application.CyApplicationManager)19 HashSet (java.util.HashSet)18 CyIdentifiable (org.cytoscape.model.CyIdentifiable)14 CyNetworkView (org.cytoscape.view.model.CyNetworkView)14 CyNetworkTableManager (org.cytoscape.model.CyNetworkTableManager)13 RowSetRecord (org.cytoscape.model.events.RowSetRecord)11 CyRootNetwork (org.cytoscape.model.subnetwork.CyRootNetwork)11 CySubNetwork (org.cytoscape.model.subnetwork.CySubNetwork)11 CyEventHelper (org.cytoscape.event.CyEventHelper)10 CyTableManager (org.cytoscape.model.CyTableManager)10