diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/SolutionTab.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/SolutionTab.java index 104d39ae14275af3f91d1aad40f72f308e7af8b1..b0c4e99dbff3253d9d1a970dacb22f665ae70217 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/SolutionTab.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/SolutionTab.java @@ -203,22 +203,24 @@ public class SolutionTab extends JPanel { layout = new GroupLayout(this); layout.setHorizontalGroup(layout.createParallelGroup(Alignment.CENTER,true) + .addComponent(createClusterView,DEFAULT_SIZE,DEFAULT_SIZE,PREFERRED_SIZE) + .addComponent(createMetaGraph,DEFAULT_SIZE,DEFAULT_SIZE,PREFERRED_SIZE) .addGap(8) .addComponent(clusterCount,DEFAULT_SIZE,DEFAULT_SIZE,Short.MAX_VALUE) .addComponent(hideSingles,DEFAULT_SIZE,DEFAULT_SIZE,Short.MAX_VALUE) .addGap(8) .addComponent(scrollPane,PREFERRED_SIZE,PREFERRED_SIZE,Short.MAX_VALUE) - .addComponent(createClusterView,DEFAULT_SIZE,DEFAULT_SIZE,PREFERRED_SIZE) - .addComponent(createMetaGraph,DEFAULT_SIZE,DEFAULT_SIZE,PREFERRED_SIZE) + .addGap(4) ); layout.setVerticalGroup(layout.createSequentialGroup() + .addComponent(createClusterView,DEFAULT_SIZE,DEFAULT_SIZE,DEFAULT_SIZE) + .addComponent(createMetaGraph,DEFAULT_SIZE,DEFAULT_SIZE,DEFAULT_SIZE) .addGap(8) .addComponent(clusterCount,DEFAULT_SIZE,DEFAULT_SIZE,DEFAULT_SIZE) .addComponent(hideSingles,DEFAULT_SIZE,DEFAULT_SIZE,DEFAULT_SIZE) .addGap(8) .addComponent(scrollPane,DEFAULT_SIZE,DEFAULT_SIZE,DEFAULT_SIZE) - .addComponent(createClusterView,DEFAULT_SIZE,DEFAULT_SIZE,DEFAULT_SIZE) - .addComponent(createMetaGraph,DEFAULT_SIZE,DEFAULT_SIZE,DEFAULT_SIZE) + .addGap(4) ); this.setLayout(layout); diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/tasks/CreateClusterViewsTask.java b/src/main/java/de/hhu/ba/yoshikoWrapper/tasks/CreateClusterViewsTask.java index 72d6270300e9c7cb0f846599e7681cd24cc4245c..0531fa72a63ae661e5e6889ad1200edce2c8cc24 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/tasks/CreateClusterViewsTask.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/tasks/CreateClusterViewsTask.java @@ -22,6 +22,10 @@ public class CreateClusterViewsTask implements Task { @Tunable public ArrayList<YoshikoCluster> clusters; //TODO: Make Tunable, reference by ID? + /** + * Killswitch, used to determine if the algorithm has been terminated. + * We can use this to cancel at a given point (so we don't need to finish the entire task) + */ private boolean isTerminated; /** @@ -77,11 +81,8 @@ public class CreateClusterViewsTask implements Task { StyleManager.style(subnetView,CyCore.visualMappingManager.getCurrentVisualStyle()); CyCore.networkViewManager.addNetworkView(subnetView); } - } ); - - } } diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/tasks/CreateMetaGraphTask.java b/src/main/java/de/hhu/ba/yoshikoWrapper/tasks/CreateMetaGraphTask.java index 1f24dea291ab3a44cd99620a3e77873ec348e0d3..cf0ffb6193fca40221fd1adfa86e988847b5c967 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/tasks/CreateMetaGraphTask.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/tasks/CreateMetaGraphTask.java @@ -94,7 +94,7 @@ public class CreateMetaGraphTask extends AbstractTask{ //Link clusters node in meta graph and subnet graph to use Cytoscape Nested Network feature clusterNode.setNetworkPointer(subnet); //Set node attributes - metaGraph.getRow(clusterNode).set("name", LocalizationManager.get("clusters")+" "+c.getID()); + metaGraph.getRow(clusterNode).set("name", LocalizationManager.get("clusters")+" "+(c.getID()+1)); metaGraph.getRow(clusterNode).set(StyleManager.CLUSTERSIZE_COLUMN_NAME,c.getSize()); map.put(c, clusterNode); } @@ -105,12 +105,13 @@ public class CreateMetaGraphTask extends AbstractTask{ taskMonitor.setStatusMessage(LocalizationManager.get("metaGraph_edges")); Iterator<YoshikoCluster> it1 = solution.getClusters().iterator(); - Iterator<YoshikoCluster> it2 = solution.getClusters().iterator(); while (it1.hasNext()) { YoshikoCluster c1 = it1.next(); + Iterator<YoshikoCluster> it2 = solution.getClusters().iterator(); while(it2.hasNext()) { YoshikoCluster c2 = it2.next(); + System.out.println("Debug: Processing edges between cluster "+c1.getID()+" and "+c2.getID()); if(isTerminated) { throw new Exception("Terminated by user!"); @@ -126,7 +127,9 @@ public class CreateMetaGraphTask extends AbstractTask{ for (CyNode c1n : c1.getSubNetwork().getNodeList()) { for (CyNode c2n : c2.getSubNetwork().getNodeList()) { if (solution.getOriginalGraph().containsEdge(c1n, c2n) || solution.getOriginalGraph().containsEdge(c2n, c1n)) { + System.out.println("Debug: Found relevant edge from "+c1n.getSUID()+ " to "+c2n.getSUID()); if (!metaGraph.containsEdge(map.get(c1), map.get(c2))){ + System.out.println("We create a new edge for it"); CyEdge edge = metaGraph.addEdge(map.get(c1), map.get(c2), false); metaGraph.getRow(edge).set(StyleManager.EDGESTRENGTH_COLUMN_NAME,1); } diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/tasks/GetClustersTask.java b/src/main/java/de/hhu/ba/yoshikoWrapper/tasks/GetClustersTask.java index 0afa05ee33f92ccef1c46a09cdcccb6cfd4ba1c5..6a49b1ec30360ba2c7587d1d3d934301bb991b51 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/tasks/GetClustersTask.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/tasks/GetClustersTask.java @@ -9,16 +9,32 @@ import org.cytoscape.work.Tunable; import de.hhu.ba.yoshikoWrapper.core.ResultList; import de.hhu.ba.yoshikoWrapper.graphModel.YoshikoCluster; import de.hhu.ba.yoshikoWrapper.graphModel.YoshikoResult; -import de.hhu.ba.yoshikoWrapper.graphModel.YoshikoSolution; +/** + * A task that retrieves the clusters associated with a given solution in a given result. This is meant to be used via CyRest / command line functionality exclusively + * + * @author Philipp Spohr, Dec 12, 2017 + * + */ public class GetClustersTask implements ObservableTask { + + /** + * The ID of the result for which the clusters are to be retrieved + */ @Tunable(description="The result ID for which the solutions should be displayed", context="nogui") public int resultID = -1; + /** + * The ID of the solution for which the clusters are to be retrieved + */ @Tunable(description="The solution ID for which the solutions should be displayed", context="nogui") public long solutionID = -1; + + /** + * The clusters as a collection when they are retrieved + */ private Collection<YoshikoCluster> clusters; @Override diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/tasks/GetSolutionsTask.java b/src/main/java/de/hhu/ba/yoshikoWrapper/tasks/GetSolutionsTask.java index b36ef963bb0ea5351638f4897718f6e571fa21f3..b4d60d6e441b55b250880ebb1c2d5eaf55444051 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/tasks/GetSolutionsTask.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/tasks/GetSolutionsTask.java @@ -10,11 +10,23 @@ import de.hhu.ba.yoshikoWrapper.core.ResultList; import de.hhu.ba.yoshikoWrapper.graphModel.YoshikoResult; import de.hhu.ba.yoshikoWrapper.graphModel.YoshikoSolution; +/** + * Basic task that retrieves solutions associated with a run (result) + * This is meant to be invoked from cmd / CyRest exclusively to receive solution IDs + * @author Philipp Spohr, Dec 12, 2017 + * + */ public class GetSolutionsTask implements ObservableTask { + /** + * The result ID for the result/run for which the solutions are to be retrieved + */ @Tunable(description="The result ID for which the solutions should be displayed", context="nogui") public int resultID = -1; + /** + * The solutions as a collection in case the task was successful + */ private Collection<YoshikoSolution> solutions; @Override @@ -27,9 +39,7 @@ public class GetSolutionsTask implements ObservableTask { } @Override - public void cancel() { - // TODO Auto-generated method stub - } + public void cancel() {} //There is nothing here that remains in an instable state as we are simply reading / retrieving data @SuppressWarnings("unchecked") @Override @@ -44,4 +54,5 @@ public class GetSolutionsTask implements ObservableTask { return null; } + }