Author: kono
Date: 2010-02-18 12:54:01 -0800 (Thu, 18 Feb 2010)
New Revision: 19366

Modified:
   
coreplugins/trunk/BioMartClient/src/edu/ucsd/bioeng/idekerlab/biomartclient/BiomartClient.java
   
coreplugins/trunk/BioMartClient/src/edu/ucsd/bioeng/idekerlab/biomartclient/BiomartStub.java
   
coreplugins/trunk/BioMartClient/src/edu/ucsd/bioeng/idekerlab/biomartclient/ui/BiomartAttrMappingPanel.java
   
coreplugins/trunk/BioMartClient/src/edu/ucsd/bioeng/idekerlab/biomartclient/ui/BiomartMainDialog.java
Log:
Fixed minor bugs and added new Tunable to send list of selected nodes only.

Modified: 
coreplugins/trunk/BioMartClient/src/edu/ucsd/bioeng/idekerlab/biomartclient/BiomartClient.java
===================================================================
--- 
coreplugins/trunk/BioMartClient/src/edu/ucsd/bioeng/idekerlab/biomartclient/BiomartClient.java
      2010-02-18 19:07:25 UTC (rev 19365)
+++ 
coreplugins/trunk/BioMartClient/src/edu/ucsd/bioeng/idekerlab/biomartclient/BiomartClient.java
      2010-02-18 20:54:01 UTC (rev 19366)
@@ -112,7 +112,7 @@
                //              props.add(new Tunable("max_interactions", 
"Maximum number of records", Tunable.INTEGER,
                //                                    new Integer(1000)));
 
-               //props.add(new Tunable("search_depth", "Search depth", 
Tunable.INTEGER, new Integer(0)));
+               props.add(new Tunable("selected_only", "Map selected nodes 
only", Tunable.BOOLEAN, new Boolean(false)));
                props.add(new Tunable("import_all", "Import all available 
entries", Tunable.BOOLEAN,
                                      new Boolean(false)));
 
@@ -181,7 +181,7 @@
        
        private List<String> mapping(BufferedReader reader, String key, String 
keyAttrName) throws IOException, CyWebServiceException {
                String line = reader.readLine();
-               //System.out.println("Table Header: " + line);
+               System.out.println("Table Header: " + line);
                final String[] columnNames = line.split("\\t");
                
                if (columnNames[0].contains("Query ERROR"))

Modified: 
coreplugins/trunk/BioMartClient/src/edu/ucsd/bioeng/idekerlab/biomartclient/BiomartStub.java
===================================================================
--- 
coreplugins/trunk/BioMartClient/src/edu/ucsd/bioeng/idekerlab/biomartclient/BiomartStub.java
        2010-02-18 19:07:25 UTC (rev 19365)
+++ 
coreplugins/trunk/BioMartClient/src/edu/ucsd/bioeng/idekerlab/biomartclient/BiomartStub.java
        2010-02-18 20:54:01 UTC (rev 19366)
@@ -204,12 +204,12 @@
                String dbID;
 
                for (int i = 0; i < locSize; i++) {
+                       
                        attrList = locations.item(i).getAttributes();
                        attrLen = attrList.getLength();
 
                        // First, get the key value
                        dbID = attrList.getNamedItem("name").getNodeValue();
-
                        Map<String, String> entry = new HashMap<String, 
String>();
 
                        for (int j = 0; j < attrLen; j++) {
@@ -239,10 +239,8 @@
                try {
                        getRegistry();
                } catch (ParserConfigurationException e) {
-                       // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (SAXException e) {
-                       // TODO Auto-generated catch block
                        e.printStackTrace();
                }
 
@@ -401,7 +399,7 @@
         */
        public BufferedReader sendQuery(String xmlQuery) throws IOException {
                
-               System.out.println("=======Query = " + xmlQuery);
+               System.out.println("Generated Query:\n\n" + xmlQuery);
                
                URL url = new URL(baseURL);
                URLConnection uc = URLUtil.getURLConnection(url);

Modified: 
coreplugins/trunk/BioMartClient/src/edu/ucsd/bioeng/idekerlab/biomartclient/ui/BiomartAttrMappingPanel.java
===================================================================
--- 
coreplugins/trunk/BioMartClient/src/edu/ucsd/bioeng/idekerlab/biomartclient/ui/BiomartAttrMappingPanel.java
 2010-02-18 19:07:25 UTC (rev 19365)
+++ 
coreplugins/trunk/BioMartClient/src/edu/ucsd/bioeng/idekerlab/biomartclient/ui/BiomartAttrMappingPanel.java
 2010-02-18 20:54:01 UTC (rev 19366)
@@ -61,6 +61,7 @@
 import cytoscape.data.webservice.CyWebServiceEvent;
 import cytoscape.data.webservice.WebServiceClientManager;
 import cytoscape.data.webservice.CyWebServiceEvent.WSEventType;
+import cytoscape.layout.Tunable;
 import cytoscape.task.Task;
 import cytoscape.task.TaskMonitor;
 import cytoscape.task.ui.JTaskConfig;
@@ -342,9 +343,6 @@
                // This is not the best way, but cannot provide universal 
solution.
                if (dbName.contains("REACTOME")) {
                        attrs[0] = new 
Attribute(stub.toAttributeName("REACTOME", filterName));
-               } else if (dbName.contains("UNIPROT")) {
-                       //System.out.println("UNIPROT found");
-                       attrs[0] = new 
Attribute(stub.toAttributeName("UNIPROT", filterName));
                } else if (dbName.contains("VARIATION")) {
 //                     String newName = filterName.replace("_id", 
"_stable_id");
 //                     newName = newName.replace("_ensembl", "");
@@ -386,11 +384,24 @@
                // Execute Task in New Thread; pop open JTask Dialog Box.
                TaskManager.executeTask(task, jTaskConfig);
 
-               firePropertyChange(CLOSE_EVENT, null, null);
+               //firePropertyChange(CLOSE_EVENT, null, null);
        }
 
        private static String getIDFilterString(String keyAttrName) {
-               final List<Node> nodes = Cytoscape.getRootGraph().nodesList();
+               
+               final Tunable tunable = 
WebServiceClientManager.getClient("biomart").getProps().get("selected_only");   
+               tunable.updateValue();
+               final Object value = tunable.getValue();
+               
+               final List<Node> nodes;
+               if (value != null && Boolean.parseBoolean(value.toString())) {
+                       // Selected nodes only
+                       nodes = new 
ArrayList<Node>(Cytoscape.getCurrentNetwork().getSelectedNodes());
+               } else {
+                       // Send all nodes in current network
+                       nodes = Cytoscape.getCurrentNetwork().nodesList();
+               }
+               
                final StringBuilder builder = new StringBuilder();
 
                // If attribute name is ID, then use node id as the key.

Modified: 
coreplugins/trunk/BioMartClient/src/edu/ucsd/bioeng/idekerlab/biomartclient/ui/BiomartMainDialog.java
===================================================================
--- 
coreplugins/trunk/BioMartClient/src/edu/ucsd/bioeng/idekerlab/biomartclient/ui/BiomartMainDialog.java
       2010-02-18 19:07:25 UTC (rev 19365)
+++ 
coreplugins/trunk/BioMartClient/src/edu/ucsd/bioeng/idekerlab/biomartclient/ui/BiomartMainDialog.java
       2010-02-18 20:54:01 UTC (rev 19366)
@@ -35,6 +35,8 @@
 package edu.ucsd.bioeng.idekerlab.biomartclient.ui;
 
 import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.GridLayout;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeSupport;
@@ -53,7 +55,6 @@
 import cytoscape.task.TaskMonitor;
 import cytoscape.task.ui.JTaskConfig;
 import cytoscape.task.util.TaskManager;
-import cytoscape.util.SwingWorker;
 
 
 /**
@@ -67,7 +68,6 @@
        private static BiomartMainDialog mainDialog = null;
        protected static Object pcsO = new Object();
        protected static PropertyChangeSupport pcs = new 
SwingPropertyChangeSupport(pcsO);
-       private JPanel filterPanel;
 
        /**
         *  DOCUMENT ME!
@@ -111,54 +111,32 @@
                final JTabbedPane tabs = new JTabbedPane();
                final List<Tunable> tunables = 
WebServiceClientManager.getClient("biomart").getProps()
                                                                .getTunables();
+               
+               final JPanel tunablePanel = new JPanel();
+               tunablePanel.setBackground(Color.white);
                final JPanel tPanel = new JPanel();
+               final Dimension panelSize = new Dimension(220, 250);
+               tPanel.setMinimumSize(panelSize);
+               tPanel.setMaximumSize(panelSize);
+               tPanel.setSize(panelSize);
                
+               
                tPanel.setBackground(Color.white);
-               tPanel.setLayout(new java.awt.GridBagLayout());
+               tPanel.setLayout(new GridLayout(0,1));
                
-               java.awt.GridBagConstraints gridBagConstraints;
-               
                for (Tunable t : tunables) {
-                       JPanel propPanel = t.getPanel(); 
-                       
+                       final JPanel propPanel = t.getPanel();
                        propPanel.setBackground(Color.white);
-                       
-                       if (t.getDescription().equalsIgnoreCase("Import all 
available entries")){
-                               gridBagConstraints = new 
java.awt.GridBagConstraints();
-                       gridBagConstraints.anchor = 
java.awt.GridBagConstraints.WEST;
-                       gridBagConstraints.insets = new java.awt.Insets(10, 10, 
10, 10);
-                       tPanel.add(propPanel, gridBagConstraints);
-                       }
-                       if (t.getDescription().equalsIgnoreCase("Show all 
available filters")){
-                       gridBagConstraints = new java.awt.GridBagConstraints();
-                       gridBagConstraints.gridy = 1;
-                       gridBagConstraints.anchor = 
java.awt.GridBagConstraints.WEST;
-                       gridBagConstraints.insets = new java.awt.Insets(10, 10, 
10, 10);
-                       tPanel.add(propPanel, gridBagConstraints);
-                       }
-                       if (t.getDescription().equalsIgnoreCase("Biomart Base 
URL")){
-                       gridBagConstraints = new java.awt.GridBagConstraints();
-                       gridBagConstraints.gridy = 2;
-                       gridBagConstraints.anchor = 
java.awt.GridBagConstraints.WEST;
-                       gridBagConstraints.weightx = 1.0;
-                       gridBagConstraints.insets = new java.awt.Insets(10, 10, 
10, 10);
-                           tPanel.add(propPanel, gridBagConstraints);
-                       }
+                       tPanel.add(propPanel);
                }
                
-               // Add a label for place holder 
-        javax.swing.JLabel jLabel4 = new javax.swing.JLabel("");
-        gridBagConstraints = new java.awt.GridBagConstraints();
-        gridBagConstraints.gridy = 3;
-        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
-        gridBagConstraints.weightx = 1.0;
-        tPanel.add(jLabel4, gridBagConstraints);
-
+               tunablePanel.add(tPanel);
+               
         
                panel = new BiomartAttrMappingPanel(monitor);
                panel.addPropertyChangeListener(this);
                tabs.addTab("Query", panel);
-               tabs.addTab("Property", tPanel);
+               tabs.addTab("Options", tunablePanel);
                                
                add(tabs);
 

-- 
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.

Reply via email to