Commit a49f59eb authored by Philipp Spohr's avatar Philipp Spohr
Browse files

Fixes to meta-graph bugs introduced recently

parent f36972a0
......@@ -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);
......
......@@ -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);
}
}
);
}
}
......
......@@ -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);
}
......
......@@ -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
......
......@@ -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;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment