Author: ghannum
Date: 2010-09-01 15:58:13 -0700 (Wed, 01 Sep 2010)
New Revision: 21660
Added:
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/DetailedNetworkCreator.java
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIAOutput.java
Modified:
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/NestedNetworkCreator.java
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/NetworkType.java
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIAEdgeContextMenuListener.java
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIANodeContextMenuListener.java
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIAPlugin.java
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/SearchTask.java
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/VisualStyleObserver.java
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/ui/SearchPropertyPanel.java
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/utilities/files/FileUtil.java
Log:
Added:
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/DetailedNetworkCreator.java
===================================================================
---
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/DetailedNetworkCreator.java
(rev 0)
+++
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/DetailedNetworkCreator.java
2010-09-01 22:58:13 UTC (rev 21660)
@@ -0,0 +1,106 @@
+package org.idekerlab.PanGIAPlugin;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import giny.model.GraphPerspective;
+import cytoscape.data.CyAttributes;
+import cytoscape.view.*;
+import cytoscape.*;
+
+public class DetailedNetworkCreator
+{
+ @SuppressWarnings("unchecked")
+ public static void createDetailedView(CyNetworkView view)
+ {
+ CyNetwork origPhysNetwork =
PanGIAPlugin.output.getOrigPhysNetwork();
+ CyNetwork origGenNetwork =
PanGIAPlugin.output.getOrigGenNetwork();
+
+ CyNetwork detailedNetwork =
Cytoscape.createNetwork(findNextAvailableNetworkName("Detailed View"), /*
create_view = */false);
+ CyAttributes networkAttr = Cytoscape.getNetworkAttributes();
+ networkAttr.setAttribute(detailedNetwork.getIdentifier(),
VisualStyleObserver.NETWORK_TYPE_ATTRIBUTE_NAME, NetworkType.DETAILED.name());
+
networkAttr.setUserVisible(VisualStyleObserver.NETWORK_TYPE_ATTRIBUTE_NAME,
false);
+
networkAttr.setUserEditable(VisualStyleObserver.NETWORK_TYPE_ATTRIBUTE_NAME,
false);
+
+ //Populate network
+ //Nodes
+ for (int ni : view.getSelectedNodeIndices())
+ {
+ GraphPerspective nn =
Cytoscape.getRootGraph().getNode(ni).getNestedNetwork();
+ if (nn!=null)
+ {
+ for (int ni2 : nn.getNodeIndicesArray())
+ detailedNetwork.addNode(ni2);
+ }
+ }
+
+ //Edges
+ CyAttributes cyEdgeAttrs = Cytoscape.getEdgeAttributes();
+
+ List<CyNode> nodes = detailedNetwork.nodesList();
+
+ // Add the edges induced by "origPhysNetwork" to our new nested
network.
+ List<CyEdge> edges = (List<CyEdge>)
origPhysNetwork.getConnectingEdges(getIntersectingNodes(origPhysNetwork,
nodes));
+ for (final CyEdge edge : edges)
+ {
+ detailedNetwork.addEdge(edge);
+ cyEdgeAttrs.setAttribute(edge.getIdentifier(),
"PanGIA.Interaction Type", "Physical");
+ }
+
+ // Add the edges induced by "origGenNetwork" to our new nested
network.
+ edges = (List<CyEdge>)
origGenNetwork.getConnectingEdges(getIntersectingNodes(origGenNetwork, nodes));
+ for (final CyEdge edge : edges)
+ {
+ detailedNetwork.addEdge(edge);
+ Object existingAttribute =
cyEdgeAttrs.getAttribute(edge.getIdentifier(), "PanGIA.Interaction Type");
+ if (existingAttribute==null ||
!existingAttribute.equals("Physical"))
cyEdgeAttrs.setAttribute(edge.getIdentifier(), "PanGIA.Interaction Type",
"Genetic");
+ else cyEdgeAttrs.setAttribute(edge.getIdentifier(),
"PanGIA.Interaction Type", "Physical&Genetic");
+ }
+
+ CyNetworkView theView =
Cytoscape.createNetworkView(detailedNetwork);
+
+ theView.setVisualStyle(VisualStyleObserver.VS_MODULE_NAME);
+
Cytoscape.getVisualMappingManager().setVisualStyle(Cytoscape.getVisualMappingManager().getCalculatorCatalog().getVisualStyle(VisualStyleObserver.VS_MODULE_NAME));
+ theView.redrawGraph(false, true);
+ }
+
+ private static String findNextAvailableNetworkName(final String
initialPreference) {
+ // Try the preferred choice first:
+ CyNetwork network = getNetworkByTitle(initialPreference);
+ if (network == null)
+ return initialPreference;
+
+ for (int suffix = 1; true; ++suffix) {
+ final String titleCandidate = initialPreference + "-" +
suffix;
+ network = getNetworkByTitle(titleCandidate);
+ if (network == null)
+ return titleCandidate;
+ }
+ }
+
+ /**
+ * Returns the first network with title "networkTitle" or null, if
there is
+ * no network w/ this title.
+ */
+ private static CyNetwork getNetworkByTitle(final String networkTitle) {
+ for (final CyNetwork network : Cytoscape.getNetworkSet()) {
+ if (network.getTitle().equals(networkTitle))
+ return network;
+ }
+
+ return null;
+ }
+
+ /**
+ * @returns the list of nodes that are both, in "network", and in
"nodes"
+ */
+ private static List<CyNode> getIntersectingNodes(final CyNetwork
network, final List<CyNode> nodes) {
+ final List<CyNode> commonNodes = new ArrayList<CyNode>();
+ for (final CyNode node : nodes) {
+ if (network.containsNode(node))
+ commonNodes.add(node);
+ }
+
+ return commonNodes;
+ }
+}
Modified:
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/NestedNetworkCreator.java
===================================================================
---
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/NestedNetworkCreator.java
2010-09-01 22:52:44 UTC (rev 21659)
+++
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/NestedNetworkCreator.java
2010-09-01 22:58:13 UTC (rev 21660)
@@ -232,9 +232,7 @@
float percentCompleted = 100.0f - remainingPercentage;
while ((network = networksOrderedByScores.poll()) != null) {
final boolean createView = networkViewCount++ <
MAX_NETWORK_VIEWS;
- final CyNetwork nestedNetwork = generateNestedNetwork(
- network.getNodeName(),
network.getGenes(), origPhysNetwork,
- origGenNetwork, createView,
networkAttr);
+ final CyNetwork nestedNetwork =
generateNestedNetwork(network.getNodeName(), network.getGenes(),
origPhysNetwork,origGenNetwork, createView, networkAttr);
final CyNode node =
Cytoscape.getCyNode(network.getNodeName(), false);
node.setNestedNetwork(nestedNetwork);
@@ -311,9 +309,10 @@
// First, create network without view.
final CyNetwork nestedNetwork =
Cytoscape.createNetwork(networkName, overviewNetwork, false);
- networkAttr.setAttribute(nestedNetwork.getIdentifier(),
-
VisualStyleObserver.NETWORK_TYPE_ATTRIBUTE_NAME, NetworkType.MODULE.name());
-
+ networkAttr.setAttribute(nestedNetwork.getIdentifier(),
VisualStyleObserver.NETWORK_TYPE_ATTRIBUTE_NAME, NetworkType.MODULE.name());
+
+ CyAttributes nodeAttributes = Cytoscape.getNodeAttributes();
+
// Add the nodes to our new nested network.
final List<CyNode> nodes = new ArrayList<CyNode>();
for (final String nodeName : nodeNames) {
@@ -324,14 +323,14 @@
}
nestedNetwork.addNode(node);
nodes.add(node);
+ nodeAttributes.setAttribute(node.getIdentifier(),
VisualStyleObserver.PARENT_MODULE_ATTRIBUTE_NAME, networkName);
}
CyAttributes cyEdgeAttrs = Cytoscape.getEdgeAttributes();
// Add the edges induced by "origPhysNetwork" to our new nested
network.
- List<CyEdge> edges = (List<CyEdge>) origPhysNetwork
-
.getConnectingEdges(getIntersectingNodes(origPhysNetwork, nodes));
+ List<CyEdge> edges = (List<CyEdge>)
origPhysNetwork.getConnectingEdges(getIntersectingNodes(origPhysNetwork,
nodes));
for (final CyEdge edge : edges)
{
nestedNetwork.addEdge(edge);
@@ -339,8 +338,7 @@
}
// Add the edges induced by "origGenNetwork" to our new nested
network.
- edges = (List<CyEdge>) origGenNetwork
-
.getConnectingEdges(getIntersectingNodes(origGenNetwork, nodes));
+ edges = (List<CyEdge>)
origGenNetwork.getConnectingEdges(getIntersectingNodes(origGenNetwork, nodes));
for (final CyEdge edge : edges)
{
nestedNetwork.addEdge(edge);
Modified:
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/NetworkType.java
===================================================================
---
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/NetworkType.java
2010-09-01 22:52:44 UTC (rev 21659)
+++
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/NetworkType.java
2010-09-01 22:58:13 UTC (rev 21660)
@@ -8,5 +8,5 @@
*
*/
public enum NetworkType {
- OVERVIEW, MODULE;
+ OVERVIEW, MODULE, DETAILED;
}
Modified:
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIAEdgeContextMenuListener.java
===================================================================
---
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIAEdgeContextMenuListener.java
2010-09-01 22:52:44 UTC (rev 21659)
+++
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIAEdgeContextMenuListener.java
2010-09-01 22:58:13 UTC (rev 21660)
@@ -1,11 +1,15 @@
package org.idekerlab.PanGIAPlugin;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
import giny.view.EdgeView;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
+import cytoscape.CyNode;
import cytoscape.Cytoscape;
import cytoscape.data.CyAttributes;
import cytoscape.view.CyNetworkView;
@@ -27,13 +31,31 @@
if (menu == null)
return;
- final JMenu pangiaMenu = new JMenu("PanGIA");
-
- JMenuItem item = new JMenuItem();
- item.setText("Yeah! You got an edge!");
-
- pangiaMenu.add(item);
-
- menu.add(pangiaMenu);
+ boolean selectedHasNested = false;
+
+ for (Object n : ev.getGraphView().getSelectedNodes())
+ if
(((ding.view.DNodeView)n).getNode().getNestedNetwork()!=null)
+ {
+ selectedHasNested = true;
+ break;
+ }
+
+ if (selectedHasNested && PanGIAPlugin.output.isAvailable())
+ {
+ final JMenu pangiaMenu = new JMenu("PanGIA");
+
+ JMenuItem item = new JMenuItem();
+ item.setText("Create detailed view");
+ item.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e) {
+ DetailedNetworkCreator.createDetailedView(view);
+ }
+ });
+
+ pangiaMenu.add(item);
+
+ menu.add(pangiaMenu);
+ }
}
}
Modified:
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIANodeContextMenuListener.java
===================================================================
---
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIANodeContextMenuListener.java
2010-09-01 22:52:44 UTC (rev 21659)
+++
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIANodeContextMenuListener.java
2010-09-01 22:58:13 UTC (rev 21660)
@@ -12,6 +12,7 @@
import giny.view.NodeView;
import cytoscape.Cytoscape;
+import cytoscape.CyNode;
import cytoscape.data.CyAttributes;
import cytoscape.view.CyNetworkView;
import ding.view.NodeContextMenuListener;
@@ -38,6 +39,31 @@
final JMenu pangiaMenu = new JMenu("PanGIA");
+ boolean selectedHasNested = false;
+
+ for (Object n : nv.getGraphView().getSelectedNodes())
+ if
(((ding.view.DNodeView)n).getNode().getNestedNetwork()!=null)
+ {
+ selectedHasNested = true;
+ break;
+ }
+
+ //ITEM1
+ if (selectedHasNested && PanGIAPlugin.output.isAvailable())
+ {
+ JMenuItem item = new JMenuItem();
+ item.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e) {
+ DetailedNetworkCreator.createDetailedView(view);
+ }
+ });
+ item.setText("Create detailed view");
+
+ pangiaMenu.add(item);
+ }
+
+ //ITEM2
JMenu item1 = new JMenu();
item1.setText("Save selected nodes to matrix file");
@@ -60,9 +86,10 @@
});
item1.add(eaItem);
}
+ pangiaMenu.add(item1);
-
- pangiaMenu.add(item1);
+
+ //MENU
menu.add(pangiaMenu);
}
@@ -145,4 +172,6 @@
}catch (Exception e){e.printStackTrace();}
}
+
+
}
Added:
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIAOutput.java
===================================================================
---
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIAOutput.java
(rev 0)
+++
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIAOutput.java
2010-09-01 22:58:13 UTC (rev 21660)
@@ -0,0 +1,32 @@
+package org.idekerlab.PanGIAPlugin;
+
+import cytoscape.CyNetwork;
+
+public class PanGIAOutput
+{
+ private boolean available = false;
+ private CyNetwork origPhysNetwork = null;
+ private CyNetwork origGenNetwork = null;
+
+ public void initialize(CyNetwork origPhysNetwork, CyNetwork
origGenNetwork)
+ {
+ this.available = true;
+ this.origPhysNetwork = origPhysNetwork;
+ this.origGenNetwork = origGenNetwork;
+ }
+
+ public boolean isAvailable()
+ {
+ return available;
+ }
+
+ public CyNetwork getOrigPhysNetwork()
+ {
+ return origPhysNetwork;
+ }
+
+ public CyNetwork getOrigGenNetwork()
+ {
+ return origGenNetwork;
+ }
+}
Modified:
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIAPlugin.java
===================================================================
---
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIAPlugin.java
2010-09-01 22:52:44 UTC (rev 21659)
+++
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIAPlugin.java
2010-09-01 22:58:13 UTC (rev 21660)
@@ -1,5 +1,7 @@
package org.idekerlab.PanGIAPlugin;
+import java.awt.Component;
+import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -16,7 +18,9 @@
import cytoscape.view.CyHelpBroker;
import cytoscape.view.CytoscapeDesktop;
import cytoscape.view.cytopanels.CytoPanel;
+import cytoscape.view.cytopanels.CytoPanelImp;
import cytoscape.view.cytopanels.CytoPanelState;
+import cytoscape.view.cytopanels.BiModalJSplitPane;
/**
* PanGIA Plugin main class.
@@ -36,15 +40,14 @@
private static final String PLUGIN_NAME = "PanGIA";
public static final String VERSION = "1.0";
+ public static final PanGIAOutput output = new PanGIAOutput();
-
public PanGIAPlugin() {
this.vsObserver = new VisualStyleObserver();
addHelp();
final JMenuItem menuItem = new JMenuItem(PLUGIN_NAME);
menuItem.addActionListener(new PluginAction());
- Cytoscape.getDesktop().getCyMenus().getMenuBar().getMenu(
- "Plugins.Module Finders...").add(menuItem);
+
Cytoscape.getDesktop().getCyMenus().getMenuBar().getMenu("Plugins.Module
Finders...").add(menuItem);
Cytoscape.getSwingPropertyChangeSupport().addPropertyChangeListener(CytoscapeDesktop.NETWORK_VIEW_CREATED,new
PanGIANetworkListener());
}
@@ -67,7 +70,7 @@
class PluginAction implements ActionListener {
public void actionPerformed(ActionEvent e) {
- final CytoPanel cytoPanel =
Cytoscape.getDesktop().getCytoPanel(SwingConstants.WEST);
+ final CytoPanelImp cytoPanel =
(CytoPanelImp)Cytoscape.getDesktop().getCytoPanel(SwingConstants.WEST);
int index = cytoPanel.indexOfComponent(scrollPane);
if (index < 0) {
final SearchPropertyPanel searchPanel = new
SearchPropertyPanel();
@@ -75,11 +78,16 @@
searchPanel.setContainer(scrollPane);
searchPanel.updateAttributeLists();
searchPanel.setVisible(true);
+ scrollPane.setMinimumSize(new
Dimension(400,400));
cytoPanel.add(PLUGIN_NAME, scrollPane);
index = cytoPanel.indexOfComponent(scrollPane);
+
+ BiModalJSplitPane bmj =
(BiModalJSplitPane)cytoPanel.getParent();
+ bmj.setDividerLocation(400);
}
cytoPanel.setSelectedIndex(index);
cytoPanel.setState(CytoPanelState.DOCK);
}
}
}
+
Modified:
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/SearchTask.java
===================================================================
---
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/SearchTask.java
2010-09-01 22:52:44 UTC (rev 21659)
+++
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/SearchTask.java
2010-09-01 22:58:13 UTC (rev 21660)
@@ -282,6 +282,8 @@
setPercentCompleted(100);
+ PanGIAPlugin.output.initialize(physicalInputNetwork,
geneticInputNetwork);
+
/*
// Create an edge attribute "overlapScore", which is defined as
NumberOfSharedNodes/min(two network sizes)
CyAttributes cyEdgeAttrs = Cytoscape.getEdgeAttributes();
Modified:
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/VisualStyleObserver.java
===================================================================
---
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/VisualStyleObserver.java
2010-09-01 22:52:44 UTC (rev 21659)
+++
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/VisualStyleObserver.java
2010-09-01 22:58:13 UTC (rev 21660)
@@ -1,16 +1,24 @@
package org.idekerlab.PanGIAPlugin;
+import giny.model.Node;
+
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.net.URL;
import java.util.Collection;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import cytoscape.CyNode;
import cytoscape.Cytoscape;
+import cytoscape.data.CyAttributes;
import cytoscape.data.CyAttributesUtils;
import cytoscape.layout.CyLayoutAlgorithm;
+import cytoscape.layout.CyLayouts;
import cytoscape.view.CyNetworkView;
import cytoscape.view.CytoscapeDesktop;
import cytoscape.visual.EdgeAppearanceCalculator;
@@ -34,6 +42,7 @@
// Name of the network attribute for checking network type.
protected static final String NETWORK_TYPE_ATTRIBUTE_NAME = "Network
Type";
+ protected static final String PARENT_MODULE_ATTRIBUTE_NAME = "Parent
Module";
private static final URL visualStypePropLocation =
PanGIAPlugin.class.getResource("/resources/PanGIAVS.props");
@@ -66,9 +75,11 @@
Cytoscape.getVisualMappingManager().setVisualStyle(currentStyle);
styleMap.put(NetworkType.OVERVIEW.name(), overviewVS);
styleMap.put(NetworkType.MODULE.name(), moduleVS);
+ styleMap.put(NetworkType.DETAILED.name(), moduleVS);
System.out.println("#### Init VS finished.");
}
+ @SuppressWarnings({ "deprecation", "unchecked" })
public void propertyChange(PropertyChangeEvent evt) {
if(evt.getPropertyName().equals(Cytoscape.SESSION_LOADED)) {
@@ -76,7 +87,8 @@
return;
}
-
if(evt.getPropertyName().equals(CytoscapeDesktop.NETWORK_VIEW_CREATED)) {
+
if(evt.getPropertyName().equals(CytoscapeDesktop.NETWORK_VIEW_CREATED))
+ {
final Object newVal = evt.getNewValue();
if(newVal == null || newVal instanceof CyNetworkView ==
false)
return;
@@ -154,12 +166,59 @@
if(Cytoscape.getVisualMappingManager().getVisualStyle().equals(style) == false)
Cytoscape.getVisualMappingManager().setVisualStyle(style);
- if (style.getName().equals(VS_MODULE_NAME))
+ if (type.toString().equals(NetworkType.MODULE.name()))
{
CyLayoutAlgorithm alg =
cytoscape.layout.CyLayouts.getLayout("force-directed");
view.applyLayout(alg);
view.redrawGraph(true, true);
+ }else if
(type.toString().equals(NetworkType.DETAILED.name()))
+ {
+ CyLayoutAlgorithm alg =
CyLayouts.getLayout("attributes-layout");
+
+
alg.setLayoutAttribute(PARENT_MODULE_ATTRIBUTE_NAME);
+ alg.getSettings().updateValues();
+ alg.updateSettings();
+ view.applyLayout(alg);
+
+ view.redrawGraph(true, true);
+
+ //Get values of Parent Module attribute
+ CyAttributes nodeAttr =
Cytoscape.getNodeAttributes();
+ Map<String,Set<Node>> parentModules = new
HashMap<String,Set<Node>>();
+ for (int ni :
view.getNetwork().getNodeIndicesArray())
+ {
+ String nodeID =
view.getNetwork().getNode(ni).getIdentifier();
+ String parent =
nodeAttr.getAttribute(nodeID, PARENT_MODULE_ATTRIBUTE_NAME).toString();
+
+ Set<Node> sset =
parentModules.get(parent);
+ if (sset==null)
+ {
+ sset = new HashSet<Node>();
+
sset.add(view.getNetwork().getNode(ni));
+ parentModules.put(parent, sset);
+ }else
sset.add(view.getNetwork().getNode(ni));
+ }
+
+ //For each parent module
+ for (Entry<String,Set<Node>> e :
parentModules.entrySet())
+ {
+ //Select all nodes with this attribute
value
+ view.getNetwork().unselectAllNodes();
+
view.getNetwork().setSelectedNodeState(e.getValue(), true);
+
+ //Perform force-directed layout of just
the selected
+ CyLayoutAlgorithm fd =
CyLayouts.getLayout("force-directed");
+
+ fd.setSelectedOnly(true);
+ fd.getSettings().updateValues();
+ fd.updateSettings();
+ view.applyLayout(fd);
+
+ view.redrawGraph(true, true);
+ }
+ view.getNetwork().unselectAllNodes();
+
}else view.redrawGraph(false, true);
}
}
Modified:
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/ui/SearchPropertyPanel.java
===================================================================
---
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/ui/SearchPropertyPanel.java
2010-09-01 22:52:44 UTC (rev 21659)
+++
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/ui/SearchPropertyPanel.java
2010-09-01 22:58:13 UTC (rev 21660)
@@ -81,7 +81,7 @@
// Set the button size the same
closeButton.setPreferredSize(new java.awt.Dimension(75, 23));
aboutButton.setPreferredSize(new java.awt.Dimension(75, 23));
- helpButton.setPreferredSize(new java.awt.Dimension(75, 23));
+ //helpButton.setPreferredSize(new java.awt.Dimension(75, 23));
searchButton.setPreferredSize(new java.awt.Dimension(75, 23));
// about button is a place holder for now, hide it
@@ -131,12 +131,12 @@
genScalingMethodComboBox = new javax.swing.JComboBox();
parameterPanel = new javax.swing.JPanel();
buttonPanel = new javax.swing.JPanel();
- helpButton = new javax.swing.JButton();
+ //helpButton = new javax.swing.JButton();
aboutButton = new javax.swing.JButton();
closeButton = new javax.swing.JButton();
searchButton = new javax.swing.JButton();
- parameterErrorLabel= new JLabel();
+ parameterErrorTextArea= new JTextArea();
setLayout(new java.awt.GridBagLayout());
@@ -276,24 +276,27 @@
add(parameterPanel, gridBagConstraints);
//ParamaterErrorLabel
- parameterErrorLabel.setText("");
- parameterErrorLabel.setForeground(Color.red);
-
parameterErrorLabel.setFont(parameterErrorLabel.getFont().deriveFont(Font.BOLD));
- parameterErrorLabel.setToolTipText("This issue must be addressed
before a search can be performed.");
+ parameterErrorTextArea.setText("");
+ parameterErrorTextArea.setWrapStyleWord(true);
+ parameterErrorTextArea.setEditable(false);
+ parameterErrorTextArea.setForeground(Color.blue);
+
parameterErrorTextArea.setFont(parameterErrorTextArea.getFont().deriveFont(Font.BOLD));
+ parameterErrorTextArea.setToolTipText("This issue must be addressed
before a search can be performed.");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 5;
- gridBagConstraints.insets = new java.awt.Insets(3, 5, 3, 5);
+ gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
- add(parameterErrorLabel, gridBagConstraints);
+ add(parameterErrorTextArea, gridBagConstraints);
//Button panel
buttonPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
+ /*
helpButton.setText("Help");
helpButton.setToolTipText("Get help for PanGIA.");
CyHelpBroker.getHelpBroker().enableHelpOnButton(helpButton, "Topic",
null);
buttonPanel.add(helpButton);
-
+ */
aboutButton.setText("About");
aboutButton.setToolTipText("Learn more about PanGIA.");
aboutButton.addActionListener(new java.awt.event.ActionListener() {
@@ -387,14 +390,14 @@
scorePanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Search
Parameters"));
scorePanel.setToolTipText("Specify parameters relating to the search
procedure.");
- alphaLabel.setText("Alpha Exponent:");
+ alphaLabel.setText("Alpha (Exponent):");
alphaLabel.setToolTipText("The exponent for rewarding module size.
(reward = multiplier * moduleSize^exponent)");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
gridBagConstraints.insets = new java.awt.Insets(0, 5,3, 0);
scorePanel.add(alphaLabel, gridBagConstraints);
- alphaMultiplierLabel.setText("Alpha Multiplier:");
+ alphaMultiplierLabel.setText("Beta (Multiplier):");
alphaMultiplierLabel.setToolTipText("The multiplier for rewarding
module size. (reward = multiplier * moduleSize^exponent)");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 1;
@@ -792,7 +795,6 @@
private javax.swing.JPanel edgeFilteringPanel;
private javax.swing.JComboBox geneticEdgeAttribComboBox;
private javax.swing.JLabel geneticEdgeLabel;
- private javax.swing.JButton helpButton;
private javax.swing.JLabel lbNumberOfSamples;
private javax.swing.JLabel lbPlaceHolder1;
private javax.swing.JLabel lbPlaceHolder2;
@@ -833,7 +835,7 @@
private JButton reportPathButton;
private String reportPath="";
- private JLabel parameterErrorLabel;
+ private JTextArea parameterErrorTextArea;
// End of variables declaration
@@ -1014,38 +1016,38 @@
if (geneticAttrName == null || physicalAttrName == null)
{
searchButton.setEnabled(false);
- parameterErrorLabel.setText("Error: Must choose
physical and genetic attributes.");
+ parameterErrorTextArea.setText("Please choose physical
and genetic attributes.");
return;
}
- if (geneticAttrName.equals(physicalAttrName) &&
!geneticAttrName.equals(DEFAULT_ATTRIBUTE))
+ final CyNetwork physicalNetwork =
physicalNetworkPanel.getSelectedNetwork();
+ final CyNetwork geneticNetwork =
geneticNetworkPanel.getSelectedNetwork();
+
+ if (physicalNetwork == null && geneticNetwork==null)
{
searchButton.setEnabled(false);
- parameterErrorLabel.setText("<HTML>Error: Physical and
genetic attributes<BR>cannot be the same.</HTML>");
+ parameterErrorTextArea.setText("Please choose physical
and genetic networks.");
return;
}
- final CyNetwork physicalNetwork =
physicalNetworkPanel.getSelectedNetwork();
- final CyNetwork geneticNetwork =
geneticNetworkPanel.getSelectedNetwork();
-
if (physicalNetwork == null)
{
searchButton.setEnabled(false);
- parameterErrorLabel.setText("Error: Must choose a
physical network.");
+ parameterErrorTextArea.setText("Please choose a
physical network.");
return;
}
if (geneticNetwork == null)
{
searchButton.setEnabled(false);
- parameterErrorLabel.setText("Error: Must choose a
genetic network.");
+ parameterErrorTextArea.setText("Please choose a genetic
network.");
return;
}
if (physicalNetwork==geneticNetwork &&
geneticAttrName.equals(physicalAttrName))
{
searchButton.setEnabled(false);
- parameterErrorLabel.setText("<HTML>Error: Cannot choose
the same<BR>networks and attributes.</HTML>");
+ parameterErrorTextArea.setText("Please choose different
networks or attributes.");
return;
}
@@ -1055,7 +1057,7 @@
Cytoscape.getEdgeAttributes().getType(physicalSelected) !=
CyAttributes.TYPE_FLOATING))
{
searchButton.setEnabled(false);
- parameterErrorLabel.setText("<HTML>Error: Physical edge
score must<BR>be of type integer or float.</HTML>");
+ parameterErrorTextArea.setText("Please choose physical
edge scores of type integer or float.");
return;
}
@@ -1064,14 +1066,14 @@
Cytoscape.getEdgeAttributes().getType(geneticSelected) !=
CyAttributes.TYPE_FLOATING))
{
searchButton.setEnabled(false);
- parameterErrorLabel.setText("<HTML>Error: Genetic edge
score must<BR>be of type integer or float.</HTML>");
+ parameterErrorTextArea.setText("Please choose genetic
edge scores of type integer or float.");
return;
}
if ((annotationCheckBox.isSelected() ||
trainingCheckBoxPhysical.isSelected() || trainingCheckBoxGenetic.isSelected())
&& annotationAttribComboBox.getSelectedIndex()<0)
{
searchButton.setEnabled(false);
- parameterErrorLabel.setText("<HTML>Error: Annotation
requires an<BR>annotation node attribute.</HTML>");
+ parameterErrorTextArea.setText("To use annotation,
please choose an annotation node attribute.");
return;
}
@@ -1081,7 +1083,7 @@
catch (NumberFormatException e)
{
searchButton.setEnabled(false);
- parameterErrorLabel.setText("Error: Invalid value for
Alpha.");
+ parameterErrorTextArea.setText("Please choose a valid
value for Alpha.");
return;
}
@@ -1089,7 +1091,7 @@
catch (NumberFormatException e)
{
searchButton.setEnabled(false);
- parameterErrorLabel.setText("Error: Invalid value for
Alpha Multiplier.");
+ parameterErrorTextArea.setText("Please choose a valid
value for Beta.");
return;
}
@@ -1101,7 +1103,7 @@
if (d<0)
{
searchButton.setEnabled(false);
- parameterErrorLabel.setText("Error:
degree filter must be positive.");
+ parameterErrorTextArea.setText("Please
choose a positive value for degree filter.");
return;
}
@@ -1109,7 +1111,7 @@
catch (NumberFormatException e)
{
searchButton.setEnabled(false);
- parameterErrorLabel.setText("Error: Invalid
value for degree filter.");
+ parameterErrorTextArea.setText("Please choose a
valid value for degree filter.");
return;
}
}
@@ -1120,7 +1122,7 @@
if (p<0 || p>100)
{
searchButton.setEnabled(false);
- parameterErrorLabel.setText("<HTML>Error:
Percentile threshold must<BR>fall in the range [0,100].</HTML>");
+ parameterErrorTextArea.setText("Please set
percentile threshold in the range [0,100].");
return;
}
@@ -1128,7 +1130,7 @@
catch (NumberFormatException e)
{
searchButton.setEnabled(false);
- parameterErrorLabel.setText("Error: Invalid value for
Percentile Threshold.");
+ parameterErrorTextArea.setText("Please choose a valid
value for percentile threshold.");
return;
}
@@ -1138,7 +1140,7 @@
if (n<=0)
{
searchButton.setEnabled(false);
- parameterErrorLabel.setText("Error: Number of
samples must be positive.");
+ parameterErrorTextArea.setText("Please choose a
positive value for number of samples.");
return;
}
@@ -1146,7 +1148,7 @@
catch (NumberFormatException e)
{
searchButton.setEnabled(false);
- parameterErrorLabel.setText("Error: Invalid value for
Number of samples.");
+ parameterErrorTextArea.setText("Please choose a valid
value for number of samples.");
return;
}
@@ -1159,7 +1161,7 @@
if (p<0 || p>1)
{
searchButton.setEnabled(false);
-
parameterErrorLabel.setText("<HTML>Error: Labeling threshold must<BR>fall in
the range [0,1].</HTML>");
+ parameterErrorTextArea.setText("Please
set labeling threshold in the range [0,1].");
return;
}
@@ -1168,7 +1170,7 @@
catch (NumberFormatException e)
{
searchButton.setEnabled(false);
- parameterErrorLabel.setText("Error: Invalid
value for Labeling threshold.");
+ parameterErrorTextArea.setText("Please choose a
valid value for labeling threshold.");
return;
}
}
@@ -1176,12 +1178,12 @@
if (!reportPath.equals("") && new File(reportPath).exists() &&
new File(reportPath).isDirectory())
{
searchButton.setEnabled(false);
- parameterErrorLabel.setText("Error: Report path cannot
be a directory.");
+ parameterErrorTextArea.setText("Please choose a valid
report path.");
return;
}
- parameterErrorLabel.setText("");
+ parameterErrorTextArea.setText("");
searchButton.setEnabled(true);
}
}
Modified:
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/utilities/files/FileUtil.java
===================================================================
---
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/utilities/files/FileUtil.java
2010-09-01 22:52:44 UTC (rev 21659)
+++
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/utilities/files/FileUtil.java
2010-09-01 22:58:13 UTC (rev 21660)
@@ -146,12 +146,11 @@
}catch (IOException e)
{
- System.out.println(e.getMessage());
- System.exit(0);
+ e.printStackTrace();
}
}
- try {br.close();fr.close();} catch (IOException
ioe){System.out.println(ioe.getMessage());System.exit(0);}
+ try {br.close();fr.close();} catch (IOException
ioe){ioe.printStackTrace();}
sv = sv.sort();
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.