Search in sources :

Example 11 with CyTable

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

the class BaseIntegrationTest method assertTablesEqual.

public void assertTablesEqual(CyTable expectedTable, CyTable actualTable, boolean edgeTable, Set<String> columnsToIgnore) {
    List<CyColumn> expectedColumns = new ArrayList<>(expectedTable.getColumns());
    // Remove columns to ignore
    expectedColumns = expectedColumns.stream().filter(c -> !columnsToIgnore.contains(c.getName())).filter(c -> !CyNetwork.SUID.equals(c.getName())).collect(Collectors.toList());
    // Test columns are the same
    for (CyColumn expectedColumn : expectedColumns) {
        String name = expectedColumn.getName();
        //			if(!CyNetwork.SUID.equals(name)) {
        CyColumn actualColumn = actualTable.getColumn(name);
        assertNotNull("Column '" + name + "' does not exist", actualColumn);
        assertEquals("Column '" + name + "' is wrong type", expectedColumn.getType(), actualColumn.getType());
    //			}
    }
    List<CyRow> expectedRows = expectedTable.getAllRows();
    List<CyRow> actualRows = actualTable.getAllRows();
    assertEquals("Tables are not the same size", expectedRows.size(), actualRows.size());
    if (edgeTable) {
        assertEdgeTableRowsEqual(expectedColumns, expectedRows, actualRows);
    } else {
        // node table or other table
        // need to sort both Lists 
        sort(expectedColumns, expectedRows);
        sort(expectedColumns, actualRows);
        for (int i = 0; i < expectedRows.size(); i++) {
            CyRow expectedRow = expectedRows.get(i);
            CyRow actualRow = actualRows.get(i);
            assertAttributesEqual(expectedColumns, expectedRow, actualRow);
        }
    }
}
Also used : PaxExam(org.ops4j.pax.exam.junit.PaxExam) Arrays(java.util.Arrays) RunWith(org.junit.runner.RunWith) HashMap(java.util.HashMap) TaskIterator(org.cytoscape.work.TaskIterator) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) CyRow(org.cytoscape.model.CyRow) CyNetwork(org.cytoscape.model.CyNetwork) Map(java.util.Map) CyColumn(org.cytoscape.model.CyColumn) CyTable(org.cytoscape.model.CyTable) ImmutableSet(com.google.common.collect.ImmutableSet) LoadNetworkFileTaskFactory(org.cytoscape.task.read.LoadNetworkFileTaskFactory) Assert.assertNotNull(org.junit.Assert.assertNotNull) Assert.assertTrue(org.junit.Assert.assertTrue) Set(java.util.Set) IOException(java.io.IOException) CyNetworkManager(org.cytoscape.model.CyNetworkManager) Collectors(java.util.stream.Collectors) File(java.io.File) List(java.util.List) CyRootNetwork(org.cytoscape.model.subnetwork.CyRootNetwork) Comparator(java.util.Comparator) Collections(java.util.Collections) Assert.assertEquals(org.junit.Assert.assertEquals) ArrayList(java.util.ArrayList) CyColumn(org.cytoscape.model.CyColumn) CyRow(org.cytoscape.model.CyRow)

Example 12 with CyTable

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

the class CreateDiseaseSignatureNetworkTask method createNodeColumns.

/**
	 * Create Node attribute table with post analysis parameters not in the main EM table
	 */
private CyTable createNodeColumns(CyNetwork network, String name, String prefix) {
    CyTable table = network.getDefaultNodeTable();
    Columns.NODE_ENR_GENES.createColumnIfAbsent(table, prefix, null);
    Columns.NODE_GS_SIZE.createColumnIfAbsent(table, prefix, null);
    return table;
}
Also used : CyTable(org.cytoscape.model.CyTable)

Example 13 with CyTable

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

the class CreateDiseaseSignatureNetworkTask method createEdgeColumns.

// create the edge attribue table
private CyTable createEdgeColumns(CyNetwork network, String name, String prefix) {
    CyTable table = network.getDefaultEdgeTable();
    //check to see if column exists.  If it doesn't then create it
    Columns.EDGE_HYPERGEOM_PVALUE.createColumnIfAbsent(table, prefix, null);
    Columns.EDGE_HYPERGEOM_U.createColumnIfAbsent(table, prefix, null);
    Columns.EDGE_HYPERGEOM_N.createColumnIfAbsent(table, prefix, null);
    Columns.EDGE_HYPERGEOM_K.createColumnIfAbsent(table, prefix, null);
    Columns.EDGE_HYPERGEOM_M.createColumnIfAbsent(table, prefix, null);
    Columns.EDGE_HYPERGEOM_CUTOFF.createColumnIfAbsent(table, prefix, null);
    Columns.EDGE_MANN_WHIT_TWOSIDED_PVALUE.createColumnIfAbsent(table, prefix, null);
    Columns.EDGE_MANN_WHIT_GREATER_PVALUE.createColumnIfAbsent(table, prefix, null);
    Columns.EDGE_MANN_WHIT_LESS_PVALUE.createColumnIfAbsent(table, prefix, null);
    Columns.EDGE_MANN_WHIT_CUTOFF.createColumnIfAbsent(table, prefix, null);
    Columns.EDGE_CUTOFF_TYPE.createColumnIfAbsent(table, prefix, null);
    Columns.EDGE_SIG_DATASET.createColumnIfAbsent(table, prefix, null);
    return table;
}
Also used : CyTable(org.cytoscape.model.CyTable)

Example 14 with CyTable

use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.

the class GroupUtils method getPosition.

public static Dimension getPosition(CyNetwork net, CyGroup group, Long suid, Class tableClass) {
    CyTable table = group.getGroupNetwork().getTable(tableClass, CyNetwork.HIDDEN_ATTRS);
    CyRow row = table.getRow(suid);
    int index = getNetworkIndex(row, net);
    Dimension d = getDimension(row, index);
    return d;
}
Also used : CyTable(org.cytoscape.model.CyTable) Dimension(java.awt.Dimension) CyRow(org.cytoscape.model.CyRow)

Example 15 with CyTable

use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.

the class RowListTunableHandler method processArg.

public Object processArg(String arg) throws Exception {
    RowList bi = (RowList) getValue();
    CyTable table = bi.getTable();
    List<CyRow> value = stringHandler.getRowList(table, arg);
    bi.setValue(value);
    return bi;
}
Also used : RowList(org.cytoscape.command.util.RowList) CyTable(org.cytoscape.model.CyTable) 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