Author: ghannum
Date: 2010-10-05 11:01:11 -0700 (Tue, 05 Oct 2010)
New Revision: 22146
Modified:
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/DetailedNetworkCreator.java
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/NestedNetworkCreator.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/PanGIAOutput.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/collections/HashMapUtil.java
Log:
Modified:
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/DetailedNetworkCreator.java
===================================================================
---
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/DetailedNetworkCreator.java
2010-10-05 16:22:04 UTC (rev 22145)
+++
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/DetailedNetworkCreator.java
2010-10-05 18:01:11 UTC (rev 22146)
@@ -4,7 +4,9 @@
import java.util.List;
import giny.model.GraphPerspective;
+import giny.model.Node;
import cytoscape.data.CyAttributes;
+import cytoscape.layout.CyLayoutAlgorithm;
import cytoscape.view.*;
import cytoscape.*;
@@ -13,10 +15,19 @@
@SuppressWarnings("unchecked")
public static void createDetailedView(CyNetworkView view)
{
+ if (view.getSelectedNodeIndices().length==1)
+ {
+
goToNestedNetwork(Cytoscape.getRootGraph().getNode(view.getSelectedNodeIndices()[0]));
+ System.out.println("Going to nested network.");
+ return;
+ }
+
CyNetwork origPhysNetwork =
PanGIAPlugin.output.getOrigPhysNetwork();
CyNetwork origGenNetwork =
PanGIAPlugin.output.getOrigGenNetwork();
- CyNetwork detailedNetwork =
Cytoscape.createNetwork(findNextAvailableNetworkName("Detailed View"), /*
create_view = */false);
+ String name = findNextAvailableNetworkName("Detailed View");
+
+ CyNetwork detailedNetwork = Cytoscape.createNetwork(name,
/* 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);
@@ -64,6 +75,25 @@
theView.redrawGraph(false, true);
}
+ public static void goToNestedNetwork(Node n)
+ {
+ if (n.getNestedNetwork() == null)
+ return;
+
+ CyNetwork nestedNetwork = (CyNetwork)n.getNestedNetwork();
+
+ CyNetworkView theView =
Cytoscape.getNetworkView(nestedNetwork.getIdentifier());
+ if (theView == null || theView.getIdentifier() == null)
+ {
+ theView = Cytoscape.createNetworkView(nestedNetwork);
+ CyLayoutAlgorithm alg =
cytoscape.layout.CyLayouts.getLayout("force-directed");
+ theView.applyLayout(alg);
+ theView.redrawGraph(false, false);
+ }
+
+ Cytoscape.getDesktop().setFocus(nestedNetwork.getIdentifier());
+ }
+
private static String findNextAvailableNetworkName(final String
initialPreference) {
// Try the preferred choice first:
CyNetwork network = getNetworkByTitle(initialPreference);
Modified:
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/NestedNetworkCreator.java
===================================================================
---
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/NestedNetworkCreator.java
2010-10-05 16:22:04 UTC (rev 22145)
+++
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/NestedNetworkCreator.java
2010-10-05 18:01:11 UTC (rev 22146)
@@ -87,7 +87,7 @@
private static final String LAYOUT_ALGORITHM = "force-directed";
// Also exists in BipartiteVisualiserPlugin!
- static final String REFERENCE_NETWORK_NAME_ATTRIB =
"BipartiteVisualiserReferenceNetworkName";
+ public static final String REFERENCE_NETWORK_NAME_ATTRIB =
"BipartiteVisualiserReferenceNetworkName";
/////////////// Node Attribute Names /////////////
@@ -95,16 +95,27 @@
private static final String MODULE_FINDER_PREFIX = "PanGIA.";
// Number of nodes in a module
- private static final String GENE_COUNT = MODULE_FINDER_PREFIX + "member
count";
+ private static final String GENE_COUNT = MODULE_FINDER_PREFIX + "module
size";
// And its SQRT value for visual mapping
- private static final String GENE_COUNT_SQRT = MODULE_FINDER_PREFIX +
"SQRT of member count";
+ public static final String GENE_COUNT_SQRT = MODULE_FINDER_PREFIX +
"SQRT of module size";
private static final String SCORE = MODULE_FINDER_PREFIX + "score";
+ private static final String MEMBERS = MODULE_FINDER_PREFIX + "members";
+
+ private static final String PHYS_EDGE_COUNT = MODULE_FINDER_PREFIX +
"physical interaction count";
+ private static final String GEN_EDGE_COUNT = MODULE_FINDER_PREFIX +
"genetic interaction count";
+
/////////////// Edge Attribute Names /////////////
- private static final String EDGE_SCORE = MODULE_FINDER_PREFIX + "edge
score";
+ public static final String EDGE_SCORE = MODULE_FINDER_PREFIX + "edge
score";
private static final String EDGE_PVALUE = MODULE_FINDER_PREFIX +
"p-value";
+ private static final String EDGE_GEN_EDGE_COUNT = MODULE_FINDER_PREFIX
+ "genetic interaction count";
+ private static final String EDGE_PHYS_EDGE_COUNT = MODULE_FINDER_PREFIX
+ "physical interaction count";
+ private static final String EDGE_SOURCE_SIZE = MODULE_FINDER_PREFIX +
"source size";
+ private static final String EDGE_TARGET_SIZE = MODULE_FINDER_PREFIX +
"target size";
+ private static final String EDGE_GEN_DENSITY = MODULE_FINDER_PREFIX +
"genetic interaction density";
+
private static final String COMPLEX_INTERACTION_TYPE = "module-module";
private CyNetwork overviewNetwork = null;
@@ -118,6 +129,20 @@
VisualStyle moduleVS =
Cytoscape.getVisualMappingManager().getCalculatorCatalog().
getVisualStyle(VisualStyleObserver.VS_MODULE_NAME);
+ public static List<String> getEdgeAttributeNames()
+ {
+ List<String> names = new ArrayList<String>(2);
+ names.add(EDGE_SCORE);
+ names.add(EDGE_PVALUE);
+ names.add(EDGE_GEN_EDGE_COUNT);
+ names.add(EDGE_PHYS_EDGE_COUNT);
+ names.add(EDGE_SOURCE_SIZE);
+ names.add(EDGE_TARGET_SIZE);
+ names.add(EDGE_GEN_DENSITY);
+
+ return names;
+ }
+
/**
* Instantiates an overview network of complexes (modules) and one
nested
* network for each node in the overview network.
@@ -168,7 +193,7 @@
CyNode sourceNode = moduleToCyNodeMap.get(sourceModule);
if (sourceNode == null) {
final String nodeName =
getNodeName(sourceModule,nodeIndex,module_name);
- sourceNode = makeOverviewNode(nodeName,
sourceModule,nodeAttribs);
+ sourceNode = makeOverviewNode(nodeName,
sourceModule,nodeAttribs,physicalNetwork,geneticNetwork);
//moduleToCyNodeMap.put(sourceModule,
sourceNode);
++nodeIndex;
}
@@ -177,7 +202,7 @@
CyNode targetNode = moduleToCyNodeMap.get(targetModule);
if (targetNode == null) {
final String nodeName =
getNodeName(targetModule,nodeIndex,module_name);
- targetNode = makeOverviewNode(nodeName,
targetModule,nodeAttribs);
+ targetNode = makeOverviewNode(nodeName,
targetModule,nodeAttribs,physicalNetwork,geneticNetwork);
//moduleToCyNodeMap.put(targetModule,
targetNode);
++nodeIndex;
}
@@ -205,17 +230,17 @@
final int gConnectedness =
geneticNetwork.getConnectedness(
sourceModule.asStringSet(),
targetModule.asStringSet());
edgeAttribs.setAttribute(newEdge.getIdentifier(),
- "PanGIA.genetic interaction count",
Integer.valueOf(gConnectedness));
+ EDGE_GEN_EDGE_COUNT,
Integer.valueOf(gConnectedness));
final int pConnectedness =
physicalNetwork.getConnectedness(
sourceModule.asStringSet(),
targetModule.asStringSet());
edgeAttribs.setAttribute(newEdge.getIdentifier(),
- "PanGIA.physical interaction count",
Integer.valueOf(pConnectedness));
- edgeAttribs.setAttribute(newEdge.getIdentifier(),
"PanGIA.source size",
+ EDGE_PHYS_EDGE_COUNT,
Integer.valueOf(pConnectedness));
+ edgeAttribs.setAttribute(newEdge.getIdentifier(),
EDGE_SOURCE_SIZE,
Integer.valueOf(sourceModule.size()));
- edgeAttribs.setAttribute(newEdge.getIdentifier(),
"PanGIA.target size",
+ edgeAttribs.setAttribute(newEdge.getIdentifier(),
EDGE_TARGET_SIZE,
Integer.valueOf(targetModule.size()));
final double density = edgeScore / (sourceModule.size()
* targetModule.size());
- edgeAttribs.setAttribute(newEdge.getIdentifier(),
"PanGIA.genetic interaction density", Double
+ edgeAttribs.setAttribute(newEdge.getIdentifier(),
EDGE_GEN_DENSITY, Double
.valueOf(density));
}
@@ -273,7 +298,7 @@
*/
private CyNode makeOverviewNode(final String nodeName,
final TypedLinkNodeModule<String, BFEdge> module,
- final CyAttributes nodeAttribs) {
+ final CyAttributes nodeAttribs,
TypedLinkNetwork<String, Float> physicalNetwork, TypedLinkNetwork<String,
Float> geneticNetwork) {
final CyNode newNode = Cytoscape.getCyNode(nodeName, true); //
create=true
@@ -282,6 +307,7 @@
overviewNetwork.addNode(newNode);
+ //Add attributes
final Set<String> genes = module.getMemberValues();
final Integer geneCount = Integer.valueOf(genes.size());
nodeAttribs.setAttribute(newNode.getIdentifier(), GENE_COUNT,
geneCount);
@@ -292,9 +318,21 @@
final double score = Double.valueOf(module.score());
nodeAttribs.setAttribute(newNode.getIdentifier(), SCORE, score);
- networksOrderedByScores
- .add(new NetworkAndScore(nodeName, genes,
score));
+ StringBuilder members = new StringBuilder();
+ for (String gene : genes)
+ {
+ if (members.length()!=0) members.append("|");
+ members.append(gene);
+ }
+ nodeAttribs.setAttribute(newNode.getIdentifier(), MEMBERS,
members.toString());
+
+ nodeAttribs.setAttribute(newNode.getIdentifier(),
PHYS_EDGE_COUNT, physicalNetwork.subNetwork(module.asStringSet()).numEdges());
+ nodeAttribs.setAttribute(newNode.getIdentifier(),
GEN_EDGE_COUNT, geneticNetwork.subNetwork(module.asStringSet()).numEdges());
+
+ //Add to network
+ networksOrderedByScores.add(new NetworkAndScore(nodeName,
genes, score));
+
return newNode;
}
Modified:
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIAEdgeContextMenuListener.java
===================================================================
---
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIAEdgeContextMenuListener.java
2010-10-05 16:22:04 UTC (rev 22145)
+++
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIAEdgeContextMenuListener.java
2010-10-05 18:01:11 UTC (rev 22146)
@@ -40,12 +40,14 @@
break;
}
+ final JMenu pangiaMenu = new JMenu("PanGIA");
+
if (selectedHasNested && PanGIAPlugin.output.isAvailable())
{
- final JMenu pangiaMenu = new JMenu("PanGIA");
+
JMenuItem item = new JMenuItem();
- item.setText("Create detailed view");
+ item.setText("Create Detailed View");
item.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e) {
@@ -54,8 +56,10 @@
});
pangiaMenu.add(item);
-
- menu.add(pangiaMenu);
}
+
+
+
+ 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-10-05 16:22:04 UTC (rev 22145)
+++
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIANodeContextMenuListener.java
2010-10-05 18:01:11 UTC (rev 22146)
@@ -6,10 +6,15 @@
import javax.swing.JFileChooser;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
+import org.idekerlab.PanGIAPlugin.utilities.collections.HashMapUtil;
import org.idekerlab.PanGIAPlugin.utilities.files.FileUtil;
+import giny.model.Edge;
+import giny.model.Node;
+import giny.view.EdgeView;
import giny.view.NodeView;
import cytoscape.Cytoscape;
import cytoscape.CyNode;
@@ -19,6 +24,8 @@
import java.util.*;
+import org.idekerlab.PanGIAPlugin.data.StringMatrix;
+
import java.io.*;
public class PanGIANodeContextMenuListener implements NodeContextMenuListener
@@ -58,17 +65,45 @@
DetailedNetworkCreator.createDetailedView(view);
}
});
- item.setText("Create detailed view");
+ item.setText("Create Detailed View");
pangiaMenu.add(item);
}
//ITEM2
+ //ONLY IF NETWORK IS THE OVERVIEW GRAPH!!!
+ JMenuItem item2 = new JMenuItem();
+ item2.setText("Export Modules to Tab-Delimited File");
+ item2.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e) {
+ saveModules(view);
+ }
+ });
+ pangiaMenu.add(item2);
+
+ //ITEM3
+ JMenuItem item3 = new JMenuItem();
+ item3.setText("Export Module Map to Tab-Delimited File");
+ item3.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e) {
+ saveOverviewNetwork(view);
+ }
+ });
+ pangiaMenu.add(item3);
+
+ //ITEM4
JMenu item1 = new JMenu();
- item1.setText("Save selected nodes to matrix file");
+ item1.setText("Save Selected Nodes to Matrix File");
- String[] eaNames = edgeAttr.getAttributeNames();
+ String[] ean = edgeAttr.getAttributeNames();
+ List<String> eaNames = new ArrayList<String>(ean.length);
+ for (String s : ean) eaNames.add(s);
+ eaNames.removeAll(NestedNetworkCreator.getEdgeAttributeNames());
+ eaNames.remove(NestedNetworkCreator.REFERENCE_NETWORK_NAME_ATTRIB);
+
for (final String ea : eaNames)
{
JMenuItem eaItem = new JMenuItem();
@@ -169,9 +204,150 @@
}
bw.close();
- }catch (Exception e){e.printStackTrace();}
+
+ JOptionPane.showMessageDialog(null, "Matrix saved
successfully.");
+
+ }catch (Exception e)
+ {
+ e.printStackTrace();
+ JOptionPane.showMessageDialog(null, "There was a problem
saving the matrix: "+e.getMessage());
+ }
}
+
+ public static void saveModules(CyNetworkView view)
+ {
+ JFileChooser jfc = new JFileChooser();
+ jfc.setCurrentDirectory(new File("."));
+ int returnVal = jfc.showSaveDialog(view.getComponent());
+
+ if (returnVal==JFileChooser.APPROVE_OPTION)
+ {
+ String fout = jfc.getSelectedFile().getAbsolutePath();
+
+ Map<String,Set<String>> mod_nodes = new
HashMap<String,Set<String>>(1000);
+
+ for (int ni : view.getNetwork().getNodeIndicesArray())
+ {
+ Node n = Cytoscape.getRootGraph().getNode(ni);
+
+ Set<String> nodes = new HashSet<String>(1000);
+
+ for (int ni2 :
n.getNestedNetwork().getNodeIndicesArray())
+
nodes.add(Cytoscape.getRootGraph().getNode(ni2).getIdentifier());
+
+ mod_nodes.put(n.getIdentifier(), nodes);
+ }
+
+ try
+ {
+ BufferedWriter bw = new BufferedWriter(new
FileWriter(fout));
+
+ for (String key : mod_nodes.keySet()) {
+ bw.write(key + "\t");
+ Set<String> vals = mod_nodes.get(key);
+
+ boolean first = true;
+ for (String val : vals)
+ if (!first)
+ bw.write("|" + val);
+ else {
+ first = false;
+ bw.write(val);
+ }
+
+ bw.write("\n");
+ }
+
+ bw.close();
+
+ JOptionPane.showMessageDialog(null, "Modules
saved successfully.");
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ JOptionPane.showMessageDialog(null, "There was a
problem saving the modules: "+e.getMessage());
+ }
+
+ }
+
+ }
-
+ public static void saveOverviewNetwork(CyNetworkView view)
+ {
+ JFileChooser jfc = new JFileChooser();
+ jfc.setCurrentDirectory(new File("."));
+ int returnVal = jfc.showSaveDialog(view.getComponent());
+
+ if (returnVal==JFileChooser.APPROVE_OPTION)
+ {
+ String fout = jfc.getSelectedFile().getAbsolutePath();
+
+ List<EdgeView> edges = (List<EdgeView>)
view.getEdgeViewsList();
+
+ StringMatrix out = new StringMatrix(edges.size(),9);
+
+ List<String> edgeAttributes =
NestedNetworkCreator.getEdgeAttributeNames();
+
+ List<String> colNames = new ArrayList<String>(9);
+ colNames.add("NodeA");
+ colNames.add("NodeB");
+ colNames.addAll(edgeAttributes);
+ out.setColNames(colNames);
+
+ CyAttributes edgeAttr = Cytoscape.getEdgeAttributes();
+
+ int row = 0;
+ for (EdgeView ev : edges)
+ {
+ Edge e = ev.getEdge();
+
+ out.set(row, 0, e.getSource().getIdentifier());
+ out.set(row, 1, e.getTarget().getIdentifier());
+
+ for (int j=0;j<edgeAttributes.size();j++)
+ out.set(row, j+2,
edgeAttr.getAttribute(e.getIdentifier(), edgeAttributes.get(j)).toString());
+
+ row++;
+ }
+
+ try
+ {
+ //Open/Create file for writing. If no file exists
append->false
+ BufferedWriter bw = new BufferedWriter(new
FileWriter(fout));
+
+ if (out.hasColNames())
+ {
+ if (out.hasRowNames()) bw.write("\t");
+
+ bw.write(out.getColName(0));
+ for (int i=1;i<out.numCols();i++)
+ bw.write("\t" +
out.getColName(i));
+
+ bw.write("\n");
+ }
+
+ for (int i=0;i<out.numRows();i++)
+ {
+ if (out.hasRowNames())
bw.write(out.getRowName(i)+"\t");
+
+ bw.write(out.get(i,0));
+ for (int j=1;j<out.numCols();j++)
+ bw.write("\t" + out.get(i,j));
+
+ bw.write("\n");
+ }
+
+ bw.close();
+ JOptionPane.showMessageDialog(null, "Overview network
saved successfully.");
+
+ }catch (Exception e)
+ {
+ e.printStackTrace();
+ JOptionPane.showMessageDialog(null, "There was a
problem saving the overview network: "+e.getMessage());
+ }
+
+
+
+ }
+ }
}
Modified:
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIAOutput.java
===================================================================
---
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIAOutput.java
2010-10-05 16:22:04 UTC (rev 22145)
+++
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIAOutput.java
2010-10-05 18:01:11 UTC (rev 22146)
@@ -15,6 +15,13 @@
this.origGenNetwork = origGenNetwork;
}
+ public void reset()
+ {
+ available = false;
+ origPhysNetwork = null;
+ origGenNetwork = null;
+ }
+
public boolean isAvailable()
{
return available;
Modified:
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIAPlugin.java
===================================================================
---
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIAPlugin.java
2010-10-05 16:22:04 UTC (rev 22145)
+++
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/PanGIAPlugin.java
2010-10-05 18:01:11 UTC (rev 22146)
@@ -6,13 +6,23 @@
import java.awt.event.ActionListener;
import javax.help.HelpSet;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
import java.net.URL;
+import java.util.List;
+
import javax.swing.JMenuItem;
import javax.swing.JScrollPane;
import javax.swing.SwingConstants;
import org.idekerlab.PanGIAPlugin.ui.SearchPropertyPanel;
+import org.idekerlab.PanGIAPlugin.utilities.files.FileUtil;
+import cytoscape.CyNetwork;
import cytoscape.Cytoscape;
import cytoscape.plugin.CytoscapePlugin;
import cytoscape.view.CyHelpBroker;
@@ -89,5 +99,61 @@
cytoPanel.setState(CytoPanelState.DOCK);
}
}
+
+ public void saveSessionStateFiles(List<File> pFileList)
+ {
+ try
+ {
+ BufferedWriter bw = new BufferedWriter(new
FileWriter("./PanGIA.session.tmp"));
+
+ bw.write(output.isAvailable()+"\n");
+
+ if (output.isAvailable())
+ {
+
bw.write(output.getOrigPhysNetwork().getIdentifier()+"\n");
+
bw.write(output.getOrigGenNetwork().getIdentifier()+"\n");
+ }
+
+ bw.close();
+
+ pFileList.add(new File("./PanGIA.session.tmp"));
+ }catch (Exception e)
+ {
+ System.out.println("Error saving PanGIA session file.");
+ e.printStackTrace();
+ }
+ }
+
+ public void restoreSessionState(List<File> pStateFileList)
+ {
+ try
+ {
+
+ if ((pStateFileList == null) || (pStateFileList.size()
== 0)) {
+ //No previous state to restore
+ return;
+ }
+
+ File prop_file = pStateFileList.get(0);
+
+ BufferedReader in = new BufferedReader(new
FileReader(prop_file));
+ boolean isAvailable = Boolean.valueOf(in.readLine());
+
+ if (isAvailable)
+ {
+ CyNetwork physNet =
Cytoscape.getNetwork(in.readLine());
+ CyNetwork genNet =
Cytoscape.getNetwork(in.readLine());
+ output.initialize(physNet, genNet);
+ }else output.reset();
+
+
+ in.close();
+
+ }catch (Exception e)
+ {
+ System.out.println("Error loading PanGIA session
file.");
+ e.printStackTrace();
+ }
+ }
}
Modified:
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/SearchTask.java
===================================================================
---
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/SearchTask.java
2010-10-05 16:22:04 UTC (rev 22145)
+++
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/SearchTask.java
2010-10-05 18:01:11 UTC (rev 22146)
@@ -270,7 +270,7 @@
final TypedLinkNetwork<String, Float> pNet =
physicalNetwork.asTypedLinkNetwork();
final TypedLinkNetwork<String, Float> gNet =
geneticNetwork.asTypedLinkNetwork();
- String networkName = "PanGIA Results: "+ new java.util.Date();
+ String networkName = "Module Overview Network";
final NestedNetworkCreator nnCreator =
new NestedNetworkCreator(results, physicalInputNetwork,
geneticInputNetwork,
pNet, gNet, pValueThreshold,
taskMonitor,
Modified:
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/VisualStyleObserver.java
===================================================================
---
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/VisualStyleObserver.java
2010-10-05 16:22:04 UTC (rev 22145)
+++
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/VisualStyleObserver.java
2010-10-05 18:01:11 UTC (rev 22146)
@@ -117,7 +117,7 @@
double min = Float.MAX_VALUE;
double max = Float.MIN_VALUE;
- for (double f :
(Collection<Double>)CyAttributesUtils.getAttribute("PanGIA.edge score",
Cytoscape.getEdgeAttributes()).values())
+ for (double f :
(Collection<Double>)CyAttributesUtils.getAttribute(NestedNetworkCreator.EDGE_SCORE,
Cytoscape.getEdgeAttributes()).values())
{
if (f<min) min = f;
if (f>max) max = f;
@@ -127,14 +127,14 @@
EdgeAppearanceCalculator eac =
style.getEdgeAppearanceCalculator();
ContinuousMapping cm = new
ContinuousMapping(0.0, ObjectMapping.EDGE_MAPPING);
- cm.setControllingAttributeName("PanGIA.edge
score", view.getNetwork(), true);
+
cm.setControllingAttributeName(NestedNetworkCreator.EDGE_SCORE,
view.getNetwork(), true);
cm.addPoint(min, new
BoundaryRangeValues(30,30,30));
cm.addPoint(max, new
BoundaryRangeValues(255,255,255));
Calculator edgeCalc = new
BasicCalculator(VS_OVERVIEW_NAME+"-EdgeOpacityMapping", cm,
VisualPropertyType.EDGE_OPACITY);
eac.setCalculator(edgeCalc);
cm = new ContinuousMapping(0.0,
ObjectMapping.EDGE_MAPPING);
- cm.setControllingAttributeName("PanGIA.edge
score", view.getNetwork(), true);
+
cm.setControllingAttributeName(NestedNetworkCreator.EDGE_SCORE,
view.getNetwork(), true);
cm.addPoint(min, new
BoundaryRangeValues(5,5,5));
cm.addPoint(max, new
BoundaryRangeValues(20,20,20));
edgeCalc = new
BasicCalculator(VS_OVERVIEW_NAME+"-EdgeWidthMapping", cm,
VisualPropertyType.EDGE_LINE_WIDTH);
@@ -144,7 +144,7 @@
min = Float.MAX_VALUE;
max = Float.MIN_VALUE;
- for (double f :
(Collection<Double>)CyAttributesUtils.getAttribute("PanGIA.SQRT of member
count", Cytoscape.getNodeAttributes()).values())
+ for (double f :
(Collection<Double>)CyAttributesUtils.getAttribute(NestedNetworkCreator.GENE_COUNT_SQRT,
Cytoscape.getNodeAttributes()).values())
{
if (f<min) min = f;
if (f>max) max = f;
@@ -153,7 +153,7 @@
NodeAppearanceCalculator nac =
style.getNodeAppearanceCalculator();
cm = new ContinuousMapping(0.0,
ObjectMapping.NODE_MAPPING);
- cm.setControllingAttributeName("PanGIA.SQRT of
member count", view.getNetwork(), true);
+
cm.setControllingAttributeName(NestedNetworkCreator.GENE_COUNT_SQRT,
view.getNetwork(), true);
cm.addPoint(min, new
BoundaryRangeValues(20,20,20));
double fs = Math.max(10*max,20);
cm.addPoint(max, new
BoundaryRangeValues(fs,fs,fs));
@@ -161,7 +161,7 @@
nac.setCalculator(nodeCalc);
cm = new ContinuousMapping(0.0,
ObjectMapping.NODE_MAPPING);
- cm.setControllingAttributeName("PanGIA.SQRT of
member count", view.getNetwork(), true);
+
cm.setControllingAttributeName(NestedNetworkCreator.GENE_COUNT_SQRT,
view.getNetwork(), true);
cm.addPoint(min, new
BoundaryRangeValues(10,10,10));
fs = Math.max(max,10);
cm.addPoint(max, new
BoundaryRangeValues(fs,fs,fs));
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-10-05 16:22:04 UTC (rev 22145)
+++
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/ui/SearchPropertyPanel.java
2010-10-05 18:01:11 UTC (rev 22146)
@@ -570,7 +570,7 @@
edgeFilterSlider.setPreferredSize(new java.awt.Dimension(200, 25));
edgeFilterSlider.setExtent(0);
edgeFilterSlider.setMinimum(0);
- edgeFilterSlider.setMaximum(100);
+ edgeFilterSlider.setMaximum(99);
edgeFilterSlider.setValue(90);
edgeFilterSlider.setMajorTickSpacing(10);
edgeFilterSlider.setMinorTickSpacing(5);
@@ -1354,10 +1354,10 @@
try
{
double p =
Double.parseDouble(edgeFilterTextField.getText());
- if (p<0 || p>100)
+ if (p<0 || p>99.9)
{
searchButton.setEnabled(false);
- parameterErrorTextArea.setText("Please set
percentile threshold in the range [0,100].");
+ parameterErrorTextArea.setText("Please set
percentile threshold in the range [0,99.9].");
return;
}
Modified:
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/utilities/collections/HashMapUtil.java
===================================================================
---
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/utilities/collections/HashMapUtil.java
2010-10-05 16:22:04 UTC (rev 22145)
+++
csplugins/trunk/ucsd/ruschein/PanGIA/src/org/idekerlab/PanGIAPlugin/utilities/collections/HashMapUtil.java
2010-10-05 18:01:11 UTC (rev 22146)
@@ -1,9 +1,12 @@
package org.idekerlab.PanGIAPlugin.utilities.collections;
import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
+import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -44,32 +47,29 @@
}
public static void saveMapSS(Map<String, Set<String>> hm, String
filename) {
- Set<String> keys = hm.keySet();
try {
- FileOutputStream fsout = new FileOutputStream(filename);
- PrintWriter out1 = new PrintWriter(fsout);
+ BufferedWriter bw = new BufferedWriter(new
FileWriter(filename));
+
+ for (String key : hm.keySet()) {
+ bw.write(key + "\t");
- for (String key : keys) {
- out1.print(key + "\t");
-
Set<String> vals = hm.get(key);
boolean first = true;
for (String val : vals)
if (!first)
- out1.print("|" + val);
+ bw.write("|" + val);
else {
first = false;
- out1.print(val);
+ bw.write(val);
}
- out1.print("\n");
+ bw.write("\n");
}
- out1.close();
- } catch (FileNotFoundException e) {
- System.out.println(e.getMessage());
- System.out.println("Error! Aborting program!");
+ bw.close();
+ } catch (Exception e) {
+ e.printStackTrace();
System.exit(0);
}
}
--
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.