Skip to content

Commit 4d76277

Browse files
committed
Added namespace to the CyNetwork tables columns.
1 parent 0a03cdb commit 4d76277

File tree

5 files changed

+75
-58
lines changed

5 files changed

+75
-58
lines changed

src/main/java/dk/ku/cpr/OmicsVisualizer/internal/model/OVConnection.java

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -231,14 +231,14 @@ public void updateVisualization() {
231231

232232
for(CyNetwork net : this.rootNetwork.getSubNetworkList()) {
233233
CyTable networkTable = net.getDefaultNetworkTable();
234-
if(networkTable.getColumn(OVShared.CYNETWORKTABLE_INNERVIZCOL) == null) {
235-
networkTable.createColumn(OVShared.CYNETWORKTABLE_INNERVIZCOL, String.class, false);
234+
if(networkTable.getColumn(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_INNERVIZCOL) == null) {
235+
networkTable.createColumn(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_INNERVIZCOL, String.class, false);
236236
}
237-
if(networkTable.getColumn(OVShared.CYNETWORKTABLE_OUTERVIZCOL) == null) {
238-
networkTable.createColumn(OVShared.CYNETWORKTABLE_OUTERVIZCOL, String.class, false);
237+
if(networkTable.getColumn(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_OUTERVIZCOL) == null) {
238+
networkTable.createColumn(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_OUTERVIZCOL, String.class, false);
239239
}
240-
networkTable.getRow(net.getSUID()).set(OVShared.CYNETWORKTABLE_INNERVIZCOL, savedInnerViz);
241-
networkTable.getRow(net.getSUID()).set(OVShared.CYNETWORKTABLE_OUTERVIZCOL, savedOuterViz);
240+
networkTable.getRow(net.getSUID()).set(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_INNERVIZCOL, savedInnerViz);
241+
networkTable.getRow(net.getSUID()).set(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_OUTERVIZCOL, savedOuterViz);
242242
}
243243
}
244244

@@ -262,8 +262,8 @@ public int updateLinks() {
262262
return 0; // TODO message?
263263
}
264264

265-
if(nodeTable.getColumn(OVShared.CYNODETABLE_CONNECTEDCOUNT) == null) {
266-
nodeTable.createColumn(OVShared.CYNODETABLE_CONNECTEDCOUNT, Integer.class, false);
265+
if(nodeTable.getColumn(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNODETABLE_CONNECTEDCOUNT) == null) {
266+
nodeTable.createColumn(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNODETABLE_CONNECTEDCOUNT, Integer.class, false);
267267
}
268268

269269
for(CyRow netRow : nodeTable.getAllRows()) {
@@ -292,18 +292,18 @@ public int updateLinks() {
292292
}
293293

294294
// We store the number of connected rows to the node in the Node Table so that users can use it in a Cytoscape style
295-
netRow.set(OVShared.CYNODETABLE_CONNECTEDCOUNT, nodeConnectedRows);
295+
netRow.set(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNODETABLE_CONNECTEDCOUNT, nodeConnectedRows);
296296
}
297297

298298
// SECOND STEP:
299299
// Make the link in the network tables
300300
//
301301
for(CyNetwork net : this.rootNetwork.getSubNetworkList()) {
302302
CyTable networkTable = net.getDefaultNetworkTable();
303-
if(networkTable.getColumn(OVShared.CYNETWORKTABLE_OVCOL) == null) {
304-
networkTable.createColumn(OVShared.CYNETWORKTABLE_OVCOL, String.class, false);
303+
if(networkTable.getColumn(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_OVCOL) == null) {
304+
networkTable.createColumn(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_OVCOL, String.class, false);
305305
}
306-
networkTable.getRow(net.getSUID()).set(OVShared.CYNETWORKTABLE_OVCOL, this.getSavedConnection());
306+
networkTable.getRow(net.getSUID()).set(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_OVCOL, this.getSavedConnection());
307307
}
308308

309309
return totalConnectedRows;
@@ -354,8 +354,8 @@ private List<CyNetwork> getConnectedNetworks() {
354354
for(CyNetwork net : this.rootNetwork.getSubNetworkList()) {
355355
CyTable netTable = net.getDefaultNetworkTable();
356356
if(netTable != null
357-
&& netTable.getColumn(OVShared.CYNETWORKTABLE_OVCOL) != null
358-
&& !netTable.getRow(net.getSUID()).get(OVShared.CYNETWORKTABLE_OVCOL, String.class).isEmpty()) {
357+
&& netTable.getColumn(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_OVCOL) != null
358+
&& !netTable.getRow(net.getSUID()).get(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_OVCOL, String.class).isEmpty()) {
359359
connectedNetwork.add(net);
360360
}
361361
}
@@ -375,18 +375,18 @@ public void connectNetwork(CyNetwork network) {
375375
CyTable networkTable = network.getDefaultNetworkTable();
376376

377377
// Link :
378-
if(networkTable.getColumn(OVShared.CYNETWORKTABLE_OVCOL) == null) {
379-
networkTable.createColumn(OVShared.CYNETWORKTABLE_OVCOL, String.class, false);
378+
if(networkTable.getColumn(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_OVCOL) == null) {
379+
networkTable.createColumn(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_OVCOL, String.class, false);
380380
}
381-
networkTable.getRow(network.getSUID()).set(OVShared.CYNETWORKTABLE_OVCOL, this.getSavedConnection());
381+
networkTable.getRow(network.getSUID()).set(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_OVCOL, this.getSavedConnection());
382382

383383

384384
// Visualization :
385-
if(networkTable.getColumn(OVShared.CYNETWORKTABLE_INNERVIZCOL) == null) {
386-
networkTable.createColumn(OVShared.CYNETWORKTABLE_INNERVIZCOL, String.class, false);
385+
if(networkTable.getColumn(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_INNERVIZCOL) == null) {
386+
networkTable.createColumn(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_INNERVIZCOL, String.class, false);
387387
}
388-
if(networkTable.getColumn(OVShared.CYNETWORKTABLE_OUTERVIZCOL) == null) {
389-
networkTable.createColumn(OVShared.CYNETWORKTABLE_OUTERVIZCOL, String.class, false);
388+
if(networkTable.getColumn(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_OUTERVIZCOL) == null) {
389+
networkTable.createColumn(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_OUTERVIZCOL, String.class, false);
390390
}
391391
String savedInnerViz = "";
392392
String savedOuterViz = "";
@@ -396,8 +396,8 @@ public void connectNetwork(CyNetwork network) {
396396
if(this.ovOuterViz != null) {
397397
savedOuterViz = this.ovOuterViz.save();
398398
}
399-
networkTable.getRow(network.getSUID()).set(OVShared.CYNETWORKTABLE_INNERVIZCOL, savedInnerViz);
400-
networkTable.getRow(network.getSUID()).set(OVShared.CYNETWORKTABLE_OUTERVIZCOL, savedOuterViz);
399+
networkTable.getRow(network.getSUID()).set(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_INNERVIZCOL, savedInnerViz);
400+
networkTable.getRow(network.getSUID()).set(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_OUTERVIZCOL, savedOuterViz);
401401
}
402402

403403
/**
@@ -422,14 +422,14 @@ public void disconnectNetwork(CyNetwork network) {
422422

423423
// We erase the link in the Network table
424424
CyTable networkTable = network.getDefaultNetworkTable();
425-
if(networkTable.getColumn(OVShared.CYNETWORKTABLE_OVCOL) != null) {
426-
networkTable.getRow(network.getSUID()).set(OVShared.CYNETWORKTABLE_OVCOL, "");
425+
if(networkTable.getColumn(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_OVCOL) != null) {
426+
networkTable.getRow(network.getSUID()).set(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_OVCOL, "");
427427
}
428-
if(networkTable.getColumn(OVShared.CYNETWORKTABLE_INNERVIZCOL) != null) {
429-
networkTable.getRow(network.getSUID()).set(OVShared.CYNETWORKTABLE_INNERVIZCOL, "");
428+
if(networkTable.getColumn(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_INNERVIZCOL) != null) {
429+
networkTable.getRow(network.getSUID()).set(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_INNERVIZCOL, "");
430430
}
431-
if(networkTable.getColumn(OVShared.CYNETWORKTABLE_OUTERVIZCOL) != null) {
432-
networkTable.getRow(network.getSUID()).set(OVShared.CYNETWORKTABLE_OUTERVIZCOL, "");
431+
if(networkTable.getColumn(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_OUTERVIZCOL) != null) {
432+
networkTable.getRow(network.getSUID()).set(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_OUTERVIZCOL, "");
433433
}
434434

435435
// We erase the Visualization

src/main/java/dk/ku/cpr/OmicsVisualizer/internal/model/OVShared.java

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,24 @@ public class OVShared {
5555
/** Name of the visual property where to store the outer visualization. */
5656
public static final String MAPPING_OUTERVIZ_IDENTIFIER="NODE_CUSTOMGRAPHICS_8";
5757

58+
/** Name of the column namespaces */
59+
public static final String OV_COLUMN_NAMESPACE = "Omics Visualizer";
60+
5861
/** Name of the column from the network's network table where the connection information is stored. */
5962
public static final String CYNETWORKTABLE_OVCOL = "OVTable";
6063
/** Name of the column from the network's network table where the inner visualization is stored. */
61-
public static final String CYNETWORKTABLE_INNERVIZCOL="OVViz PieChart";
64+
public static final String CYNETWORKTABLE_INNERVIZCOL="Viz PieChart";
6265
/** Name of the column from the network's network table where the outer visualization is stored. */
63-
public static final String CYNETWORKTABLE_OUTERVIZCOL="OVViz DonutChart";
66+
public static final String CYNETWORKTABLE_OUTERVIZCOL="Viz DonutChart";
6467

6568
/** Name of the column from the networks's node table where the number of connected rows is stored. */
66-
public static final String CYNODETABLE_CONNECTEDCOUNT = "OV Connected rows";
69+
public static final String CYNODETABLE_CONNECTEDCOUNT = "Connected rows";
6770
/** Prefix of the name of the columns from the networks's node table where the visualizations are stored. */
68-
public static final String CYNODETABLE_VIZCOL="OVViz";
71+
public static final String CYNODETABLE_VIZCOL="Viz";
6972
/** Name of the column from the networks's node table where the inner visualization is stored. */
70-
public static final String CYNODETABLE_INNERVIZCOL=CYNODETABLE_VIZCOL+"Inner";
73+
public static final String CYNODETABLE_INNERVIZCOL=CYNODETABLE_VIZCOL+" PieChart";
7174
/** Name of the column from the networks's node table where the outer visualization is stored. */
72-
public static final String CYNODETABLE_OUTERVIZCOL=CYNODETABLE_VIZCOL+"Outer";
75+
public static final String CYNODETABLE_OUTERVIZCOL=CYNODETABLE_VIZCOL+" DonutChart";
7376
/** Prefix of the name of the columns from the networks's node table where the inner visualization's values are stored. */
7477
public static final String CYNODETABLE_INNERVIZCOL_VALUES=CYNODETABLE_INNERVIZCOL + " Values ";
7578
/** Prefix of the name of the columns from the networks's node table where the outer visualization's values are stored. */
@@ -109,11 +112,18 @@ public static boolean isOVCol(String colName) {
109112
* @param cyTable The Cytoscape node table.
110113
*/
111114
public static void deleteOVColumns(CyTable cyTable) {
112-
for(Iterator<CyColumn> cycolIt = cyTable.getColumns().iterator(); cycolIt.hasNext();) {
113-
CyColumn cycol = cycolIt.next();
115+
// for(Iterator<CyColumn> cycolIt = cyTable.getColumns().iterator(); cycolIt.hasNext();) {
116+
// CyColumn cycol = cycolIt.next();
117+
//
118+
// if(cycol.getName().startsWith(OVShared.CYNODETABLE_VIZCOL)) {
119+
// cyTable.deleteColumn(cycol.getName());
120+
// }
121+
// }
122+
for(Iterator<CyColumn> cyColIt = cyTable.getColumns(OV_COLUMN_NAMESPACE).iterator(); cyColIt.hasNext() ; ) {
123+
CyColumn cyCol = cyColIt.next();
114124

115-
if(cycol.getName().startsWith(OVShared.CYNODETABLE_VIZCOL)) {
116-
cyTable.deleteColumn(cycol.getName());
125+
if(cyCol != null) {
126+
cyTable.deleteColumn(cyCol.getName());
117127
}
118128
}
119129
}
@@ -131,11 +141,18 @@ public static void deleteOVColumns(CyTable cyTable, ChartType vizType) {
131141
prefix = OVShared.CYNODETABLE_INNERVIZCOL;
132142
}
133143

134-
for(Iterator<CyColumn> cycolIt = cyTable.getColumns().iterator(); cycolIt.hasNext();) {
135-
CyColumn cycol = cycolIt.next();
144+
// for(Iterator<CyColumn> cycolIt = cyTable.getColumns().iterator(); cycolIt.hasNext();) {
145+
// CyColumn cycol = cycolIt.next();
146+
//
147+
// if(cycol.getName().startsWith(prefix)) {
148+
// cyTable.deleteColumn(cycol.getName());
149+
// }
150+
// }
151+
for(Iterator<CyColumn> cyColIt = cyTable.getColumns(OV_COLUMN_NAMESPACE).iterator(); cyColIt.hasNext() ; ) {
152+
CyColumn cyCol = cyColIt.next();
136153

137-
if(cycol.getName().startsWith(prefix)) {
138-
cyTable.deleteColumn(cycol.getName());
154+
if(cyCol != null && cyCol.getNameOnly().startsWith(prefix)) {
155+
cyTable.deleteColumn(cyCol.getName());
139156
}
140157
}
141158
}

src/main/java/dk/ku/cpr/OmicsVisualizer/internal/model/OVTable.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -559,24 +559,24 @@ public void load() {
559559
for(CyNetwork net : this.ovManager.getNetworkManager().getNetworkSet()) {
560560
CyTable netTable = net.getDefaultNetworkTable();
561561

562-
if(netTable.getColumn(OVShared.CYNETWORKTABLE_OVCOL) != null) {
562+
if(netTable.getColumn(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_OVCOL) != null) {
563563
// We found a connected network
564-
String link = netTable.getRow(net.getSUID()).get(OVShared.CYNETWORKTABLE_OVCOL, String.class);
564+
String link = netTable.getRow(net.getSUID()).get(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_OVCOL, String.class);
565565
if(link != null && !link.isEmpty()) {
566566
String splittedLink[] = DataUtils.getCSV(link);
567567

568568
if(splittedLink.length == 3 && splittedLink[0].equals(this.getTitle())) {
569569
OVConnection ovCon = this.connect(net, splittedLink[1], splittedLink[2]);
570570
// We try to load the Visualization
571571
if(ovCon != null) {
572-
if(netTable.getColumn(OVShared.CYNETWORKTABLE_INNERVIZCOL) != null) {
573-
String viz = netTable.getRow(net.getSUID()).get(OVShared.CYNETWORKTABLE_INNERVIZCOL, String.class);
572+
if(netTable.getColumn(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_INNERVIZCOL) != null) {
573+
String viz = netTable.getRow(net.getSUID()).get(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_INNERVIZCOL, String.class);
574574
if(viz != null && !viz.isEmpty()) {
575575
ovCon.setInnerVisualization(OVVisualization.load(viz), false);
576576
}
577577
}
578-
if(netTable.getColumn(OVShared.CYNETWORKTABLE_OUTERVIZCOL) != null) {
579-
String viz = netTable.getRow(net.getSUID()).get(OVShared.CYNETWORKTABLE_OUTERVIZCOL, String.class);
578+
if(netTable.getColumn(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_OUTERVIZCOL) != null) {
579+
String viz = netTable.getRow(net.getSUID()).get(OVShared.OV_COLUMN_NAMESPACE, OVShared.CYNETWORKTABLE_OUTERVIZCOL, String.class);
580580
if(viz != null && !viz.isEmpty()) {
581581
ovCon.setOuterVisualization(OVVisualization.load(viz), false);
582582
}

src/main/java/dk/ku/cpr/OmicsVisualizer/internal/task/ApplyVisualizationTask.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public ApplyVisualizationTask(OVManager ovManager, OVConnection ovCon, OVVisuali
3838
}
3939

4040
private void createOVListColumn(CyTable cyTable, String colName, Class<?> valueType) {
41-
if(cyTable.getColumn(colName) == null) {
42-
cyTable.createListColumn(colName, valueType, false);
41+
if(cyTable.getColumn(OVShared.OV_COLUMN_NAMESPACE, colName) == null) {
42+
cyTable.createListColumn(OVShared.OV_COLUMN_NAMESPACE, colName, valueType, false);
4343
}
4444
}
4545

@@ -61,7 +61,7 @@ public void run(TaskMonitor taskMonitor) throws Exception {
6161
} else {
6262
vizCol = OVShared.CYNODETABLE_INNERVIZCOL;
6363
}
64-
nodeTable.createColumn(vizCol, String.class, false);
64+
nodeTable.createColumn(OVShared.OV_COLUMN_NAMESPACE, vizCol, String.class, false);
6565

6666
double progress = 0.0;
6767
taskMonitor.setProgress(progress);
@@ -146,7 +146,7 @@ public void run(TaskMonitor taskMonitor) throws Exception {
146146
} else {
147147
colName = OVShared.CYNODETABLE_INNERVIZCOL_VALUES+(c+1);
148148
}
149-
attributeList.add(colName);
149+
attributeList.add(OVShared.OV_COLUMN_NAMESPACE+"::"+colName);
150150
// We create the column if this one does not exist yet
151151
createOVListColumn(nodeTable, colName, outputValuesType);
152152

@@ -162,7 +162,7 @@ public void run(TaskMonitor taskMonitor) throws Exception {
162162

163163
colValues.add(nodeValues.get(index));
164164
}
165-
nodeTable.getRow(node.getSUID()).set(colName, colValues);
165+
nodeTable.getRow(node.getSUID()).set(OVShared.OV_COLUMN_NAMESPACE, colName, colValues);
166166
styleValues.add(colValues);
167167
}
168168

@@ -185,7 +185,7 @@ public void run(TaskMonitor taskMonitor) throws Exception {
185185

186186
nodeStyle += " " + nodeLabels;
187187

188-
nodeTable.getRow(node.getSUID()).set(vizCol, nodeStyle);
188+
nodeTable.getRow(node.getSUID()).set(OVShared.OV_COLUMN_NAMESPACE, vizCol, nodeStyle);
189189
}
190190

191191

@@ -201,10 +201,10 @@ public void run(TaskMonitor taskMonitor) throws Exception {
201201
PassthroughMapping<?,?> pMapping;
202202
if(this.ovViz.getType().equals(ChartType.CIRCOS)) {
203203
customGraphics= lex.lookup(CyNode.class, OVShared.MAPPING_OUTERVIZ_IDENTIFIER);
204-
pMapping = (PassthroughMapping<?,?>) passthroughFactory.createVisualMappingFunction(OVShared.CYNODETABLE_OUTERVIZCOL, String.class, customGraphics);
204+
pMapping = (PassthroughMapping<?,?>) passthroughFactory.createVisualMappingFunction(OVShared.OV_COLUMN_NAMESPACE+"::"+OVShared.CYNODETABLE_OUTERVIZCOL, String.class, customGraphics);
205205
} else {
206206
customGraphics= lex.lookup(CyNode.class, OVShared.MAPPING_INNERVIZ_IDENTIFIER);
207-
pMapping = (PassthroughMapping<?,?>) passthroughFactory.createVisualMappingFunction(OVShared.CYNODETABLE_INNERVIZCOL, String.class, customGraphics);
207+
pMapping = (PassthroughMapping<?,?>) passthroughFactory.createVisualMappingFunction(OVShared.OV_COLUMN_NAMESPACE+"::"+OVShared.CYNODETABLE_INNERVIZCOL, String.class, customGraphics);
208208
}
209209
vmm.getVisualStyle(netView).addVisualMappingFunction(pMapping);
210210
netView.updateView();

src/main/java/dk/ku/cpr/OmicsVisualizer/internal/task/ShowOVPanelTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public void run(TaskMonitor taskMonitor) throws Exception {
3838

3939
OVConnection ovCon = this.ovManager.getConnection(newCurrentRootNetwork);
4040
if(ovCon != null) {
41-
this.ovManager.getOVCytoPanel().initPanel(ovCon.getOVTable(), currentNetwork);
41+
panel.initPanel(ovCon.getOVTable(), currentNetwork);
4242
ovCon.getOVTable().displaySelectedRows(currentNetwork);
4343
}
4444
}

0 commit comments

Comments
 (0)