diff --git a/build.xml b/build.xml index 6d6d4bfe..46f95ac0 100755 --- a/build.xml +++ b/build.xml @@ -157,6 +157,7 @@ + diff --git a/lib/MultiTouchGesturesJava-1.0-SNAPSHOT.jar b/lib/MultiTouchGesturesJava-1.0-SNAPSHOT.jar new file mode 100644 index 00000000..3e7b819d Binary files /dev/null and b/lib/MultiTouchGesturesJava-1.0-SNAPSHOT.jar differ diff --git a/modules/org.pathvisio.gex/src/org/pathvisio/gexplugin/GexImportWizard.java b/modules/org.pathvisio.gex/src/org/pathvisio/gexplugin/GexImportWizard.java index 9cb9a727..43969005 100644 --- a/modules/org.pathvisio.gex/src/org/pathvisio/gexplugin/GexImportWizard.java +++ b/modules/org.pathvisio.gex/src/org/pathvisio/gexplugin/GexImportWizard.java @@ -25,11 +25,14 @@ import java.awt.Color; import java.awt.Component; +import java.awt.FileDialog; +import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.File; +import java.io.FilenameFilter; import java.io.IOException; import javax.swing.AbstractAction; @@ -112,6 +115,9 @@ public GexImportWizard (PvDesktop standaloneEngine) setCurrentPanel(FilePage.IDENTIFIER); } + + private static final boolean useFileDialog = + System.getProperty("os.name").startsWith("Mac OS X"); private class FilePage extends WizardPanelDescriptor implements ActionListener { @@ -277,7 +283,7 @@ private String getFinalPgexFileLocation(String filepath) { count++; } } - + public void actionPerformed(ActionEvent e) { String action = e.getActionCommand(); @@ -287,18 +293,45 @@ public void actionPerformed(ActionEvent e) { PreferenceManager.getCurrent().get(GlobalPreference.DB_CONNECTSTRING_GDB) ); } else if(ACTION_INPUT.equals(action)) { - - File defaultdir = PreferenceManager.getCurrent().getFile(GlobalPreference.DIR_LAST_USED_EXPRESSION_IMPORT); - JFileChooser jfc = new JFileChooser(); - jfc.setCurrentDirectory(defaultdir); - jfc.addChoosableFileFilter(new SimpleFileFilter("Data files", "*.txt|*.csv|*.tab", true)); - int result = jfc.showDialog(null, "Select data file"); - if (result == JFileChooser.APPROVE_OPTION) + File defaultDir = PreferenceManager.getCurrent().getFile(GlobalPreference.DIR_LAST_USED_EXPRESSION_IMPORT); + final File selectedFile; + final File selectedDirectory; + if (useFileDialog) { + FileDialog fileDialog = new FileDialog(new Frame(),"Select data file", FileDialog.LOAD); + fileDialog.setDirectory(defaultDir.getAbsolutePath()); + fileDialog.setFilenameFilter(new FilenameFilter() { + + @Override + public boolean accept(File dir, String name) { + return name.endsWith(".txt") || + name.endsWith(".csv") || name.endsWith(".tab"); + } + }); + fileDialog.setVisible(true); + if (fileDialog.getDirectory() == null) { + selectedDirectory = null; + selectedFile = null; + } else { + selectedDirectory = new File(fileDialog.getDirectory()); + selectedFile = new File(fileDialog.getDirectory() + "/" + fileDialog.getFile()); + } + } else { + JFileChooser jfc = new JFileChooser(); + jfc.setCurrentDirectory(defaultDir); + jfc.addChoosableFileFilter(new SimpleFileFilter("Data files", "*.txt|*.csv|*.tab", true)); + int result = jfc.showDialog(null, "Select data file"); + if (result == JFileChooser.APPROVE_OPTION) { + selectedFile = jfc.getSelectedFile(); + selectedDirectory = jfc.getCurrentDirectory(); + } else { + selectedFile = null; + selectedDirectory = null; + } + } + if (selectedFile != null) { - File f = jfc.getSelectedFile(); - defaultdir = jfc.getCurrentDirectory(); - PreferenceManager.getCurrent().setFile(GlobalPreference.DIR_LAST_USED_EXPRESSION_IMPORT, defaultdir); - txtInput.setText("" + f); + PreferenceManager.getCurrent().setFile(GlobalPreference.DIR_LAST_USED_EXPRESSION_IMPORT, selectedDirectory); + txtInput.setText("" + selectedFile); updateTxtFile (); } } else if(ACTION_OUTPUT.equals(action)) { diff --git a/modules/org.pathvisio.gui/META-INF/MANIFEST.MF b/modules/org.pathvisio.gui/META-INF/MANIFEST.MF index f9e12cac..b1bd885b 100755 --- a/modules/org.pathvisio.gui/META-INF/MANIFEST.MF +++ b/modules/org.pathvisio.gui/META-INF/MANIFEST.MF @@ -20,11 +20,14 @@ Require-Bundle: org.pathvisio.core;bundle-version="3.2.0", org.bridgedb;bundle-version="2.0.0", org.bridgedb.bio;bundle-version="2.0.0", org.bridgedb.gui;bundle-version="2.0.0", - org.bridgedb.rdb;bundle-version="2.0.0" + org.bridgedb.rdb;bundle-version="2.0.0", + com.martijncourteaux.multitouchgestures;bundle-version="1.0" Import-Package: org.osgi.framework;version="1.5.0", javax.swing, javax.swing.table, - javax.swing.text + javax.swing.text, + com.martijncourteaux.multitouchgestures, + com.martijncourteaux.multitouchgestures.event Bundle-DocURL: http://www.pathvisio.org Bundle-Vendor: PathVisio developers Bundle-Copyright: 2006-2014 BiGCaT Bioinformatics diff --git a/modules/org.pathvisio.gui/build.xml b/modules/org.pathvisio.gui/build.xml index 44f25ad4..0f3bd321 100644 --- a/modules/org.pathvisio.gui/build.xml +++ b/modules/org.pathvisio.gui/build.xml @@ -10,6 +10,7 @@ + diff --git a/modules/org.pathvisio.gui/src/org/pathvisio/gui/PathwayFileFilter.java b/modules/org.pathvisio.gui/src/org/pathvisio/gui/PathwayFileFilter.java index 2a7c70e4..3c6aaee5 100644 --- a/modules/org.pathvisio.gui/src/org/pathvisio/gui/PathwayFileFilter.java +++ b/modules/org.pathvisio.gui/src/org/pathvisio/gui/PathwayFileFilter.java @@ -17,6 +17,8 @@ package org.pathvisio.gui; import java.io.File; +import java.io.FilenameFilter; + import javax.swing.filechooser.FileFilter; import org.pathvisio.core.model.PathwayIO; @@ -26,7 +28,7 @@ * Can be used to create a {@link FileDialog} for importers or exporters. * @author thomas */ -public class PathwayFileFilter extends FileFilter { +public class PathwayFileFilter extends FileFilter implements FilenameFilter { String[] exts; String name; @@ -39,6 +41,7 @@ public String getDefaultExtension() { return exts[0]; } + @Override public boolean accept(File f) { if(f.isDirectory()) return true; @@ -55,6 +58,7 @@ public boolean accept(File f) { return false; } + @Override public String getDescription() { StringBuilder extstr = new StringBuilder(); for(String e : exts) { @@ -65,4 +69,9 @@ public String getDescription() { String str = extstr.substring(0, extstr.length() - 2); return name + " (" + str + ")"; } + + @Override + public boolean accept(File dir, String name1) { + return accept(new File(dir.getAbsoluteFile() + "/" + name1)); + } } diff --git a/modules/org.pathvisio.gui/src/org/pathvisio/gui/SwingEngine.java b/modules/org.pathvisio.gui/src/org/pathvisio/gui/SwingEngine.java index d1b1cd6f..9de7d6c4 100644 --- a/modules/org.pathvisio.gui/src/org/pathvisio/gui/SwingEngine.java +++ b/modules/org.pathvisio.gui/src/org/pathvisio/gui/SwingEngine.java @@ -19,6 +19,8 @@ import java.awt.Component; import java.awt.Container; import java.awt.Desktop; +import java.awt.FileDialog; +import java.awt.Frame; import java.io.File; import java.net.URL; import java.util.Comparator; @@ -279,17 +281,23 @@ public boolean exportPathway() return false; } + private static final boolean useFileDialog = + System.getProperty("os.name").startsWith("Mac OS X"); + /** * A wrapper around JFileChooser that has the right defaults and File Filters. */ private class PathwayChooser { private final JFileChooser jfc; + private final FileDialog fileDialog; private final String taskName; private final Preference dirPreference; - + public PathwayChooser(String taskName, int dialogType, Preference dirPreference, Set set) { + fileDialog = new FileDialog(new Frame(), taskName + " pathway", dialogType); + fileDialog.setDirectory(PreferenceManager.getCurrent().getFile(dirPreference).getAbsolutePath()); jfc = new JFileChooser(); this.taskName = taskName; this.dirPreference = dirPreference; @@ -313,15 +321,18 @@ public int compare(PathwayIO o1, PathwayIO o2) { ); exporters.addAll(set); - FileFilter selectedFilter = null; + PathwayFileFilter selectedFilter = null; for(PathwayIO exp : exporters) { - FileFilter ff = new PathwayFileFilter(exp); + PathwayFileFilter ff = new PathwayFileFilter(exp); jfc.addChoosableFileFilter(ff); if(exp instanceof GpmlFormat) { selectedFilter = ff; } } - if(selectedFilter != null) jfc.setFileFilter(selectedFilter); + if(selectedFilter != null) { + jfc.setFileFilter(selectedFilter); + fileDialog.setFilenameFilter(selectedFilter); + } } public FileFilter getFileFilter() @@ -331,6 +342,15 @@ public FileFilter getFileFilter() public int show () { + if (useFileDialog) { + fileDialog.setVisible(true); + if (fileDialog.getDirectory() == null) { + return JFileChooser.CANCEL_OPTION; + } else { + PreferenceManager.getCurrent().setFile(dirPreference, new File(fileDialog.getDirectory())); + return JFileChooser.APPROVE_OPTION; + } + } int status = jfc.showDialog(getApplicationPanel(), taskName); if(status == JFileChooser.APPROVE_OPTION) { @@ -341,6 +361,9 @@ public int show () public File getSelectedFile() { + if (useFileDialog) { + return new File(fileDialog.getDirectory() + "/" + fileDialog.getFile()); + } return jfc.getSelectedFile(); } } diff --git a/modules/org.pathvisio.gui/src/org/pathvisio/gui/view/VPathwaySwing.java b/modules/org.pathvisio.gui/src/org/pathvisio/gui/view/VPathwaySwing.java index e49897c4..b2be1d4a 100644 --- a/modules/org.pathvisio.gui/src/org/pathvisio/gui/view/VPathwaySwing.java +++ b/modules/org.pathvisio.gui/src/org/pathvisio/gui/view/VPathwaySwing.java @@ -16,6 +16,11 @@ // package org.pathvisio.gui.view; +import com.martijncourteaux.multitouchgestures.GestureAdapter; +import com.martijncourteaux.multitouchgestures.MultiTouchGestureUtilities; +import com.martijncourteaux.multitouchgestures.event.MagnifyGestureEvent; +import com.martijncourteaux.multitouchgestures.event.RotateGestureEvent; +import com.martijncourteaux.multitouchgestures.event.ScrollGestureEvent; import com.jgoodies.forms.builder.DefaultFormBuilder; import com.jgoodies.forms.layout.FormLayout; @@ -31,6 +36,7 @@ import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; +import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseAdapter; @@ -84,6 +90,9 @@ public class VPathwaySwing extends JPanel implements VPathwayWrapper, protected VPathway child; protected JScrollPane container; + + private static boolean isOSX = + System.getProperty("os.name").startsWith("Mac OS X"); public VPathwaySwing(JScrollPane parent) { super(); @@ -94,6 +103,39 @@ public VPathwaySwing(JScrollPane parent) { addMouseMotionListener(this); addKeyListener(this); addMouseWheelListener(this); + + if (isOSX) { + try { + MultiTouchGestureUtilities.addGestureListener(this, new GestureAdapter() + { + + @Override + public void magnify(MagnifyGestureEvent me) + { + child.zoomToCursor(100 * child.getZoomFactor() * (1 + me.getMagnification()), + new Point((int) me.getMouseX(), (int) me.getMouseY())); + + Component comp = container.getParent().getParent(); + if (comp instanceof MainPanel) + ((MainPanel)comp).updateZoomCombo(); + } + + @Override + public void scroll(ScrollGestureEvent e) + { + Rectangle r = container.getViewport().getViewRect(); + int newx = Math.max((int) (r.getMinX() - e.getDeltaX()), 0); + int newy = Math.max((int) (r.getMinY() - e.getDeltaY()), 0); + scrollTo(newx, newy); + } + + }); + } catch (Throwable t) { + t.printStackTrace(); + isOSX = false; + } + } + setFocusable(true); setRequestFocusEnabled(true); @@ -181,6 +223,12 @@ public void keyReleased(KeyEvent e) { public void keyTyped(KeyEvent e) { // TODO: find out how to handle this one } + + public void scrollTo(int newx, int newy) { + container.getViewport().setViewPosition( + new Point (newx, newy) + ); + } public void mouseDragged(MouseEvent e) { Rectangle r = container.getViewport().getViewRect(); @@ -204,9 +252,7 @@ public void mouseDragged(MouseEvent e) { { newy = Math.max (newy - stepSize, 0); } - container.getViewport().setViewPosition( - new Point (newx, newy) - ); + scrollTo(newx, newy); child.mouseMove(new SwingMouseEvent(e)); } @@ -215,15 +261,30 @@ public void mouseMoved(MouseEvent e) { } public void mouseWheelMoved(MouseWheelEvent e) { - int notches = e.getWheelRotation(); - if(notches < 0) { - child.zoomToCursor(child.getPctZoom() * 21 / 20, e.getPoint()); - } else { - child.zoomToCursor(child.getPctZoom() * 20 / 21, e.getPoint()); - } - - Component comp = container.getParent().getParent(); - if (comp instanceof MainPanel) ((MainPanel)comp).updateZoomCombo(); + if (isOSX) { + return; + } + int notches = e.getWheelRotation(); + + if (false) { + if(notches < 0) { + child.zoomToCursor(child.getPctZoom() * 21 / 20, e.getPoint()); + } else { + child.zoomToCursor(child.getPctZoom() * 20 / 21, e.getPoint()); + } + + Component comp = container.getParent().getParent(); + if (comp instanceof MainPanel) ((MainPanel)comp).updateZoomCombo(); + } + + boolean horizontalScroll=((e.getModifiers() & ActionEvent.SHIFT_MASK) == + ActionEvent.SHIFT_MASK) + || ((e.getModifiers() & ActionEvent.META_MASK) == ActionEvent.META_MASK); + + Rectangle r = container.getViewport().getViewRect(); + int newx = Math.min((int) r.getMinX() + (horizontalScroll ? notches : 0), 0); + int newy = Math.min((int) r.getMinY() + (horizontalScroll ? 0 : notches), 0); + scrollTo(newx, newy); } public void registerKeyboardAction(KeyStroke k, Action a) { @@ -467,6 +528,7 @@ public void dispose() ((JScrollPane)container).remove(this); child.removeVPathwayListener(this); child.removeVElementMouseListener(this); + MultiTouchGestureUtilities.removeAllGestureListeners(this); removeMouseListener(this); removeMouseMotionListener(this); diff --git a/tools/convert/SciTE.properties b/tools/convert/SciTE.properties index b0ef60d6..a4b52023 100644 --- a/tools/convert/SciTE.properties +++ b/tools/convert/SciTE.properties @@ -1,2 +1,2 @@ -command.build.*.xsd=xmllint $(FileNameExt) -noout -schema XMLSchema.xsd +command.build.*.xsd=xmllint $(FileNameExt) -noout -schema XMLSchema.xsd command.go.$(file.patterns.perl)=cmd /C perl -w $(FileNameExt) "E:\GenMAPP 2 Data\MAPPs\label_test.mapp" & pause \ No newline at end of file diff --git a/tools/convert/convert.conf.template b/tools/convert/convert.conf.template index a689be91..36986db2 100644 --- a/tools/convert/convert.conf.template +++ b/tools/convert/convert.conf.template @@ -1,20 +1,20 @@ -#point mapp_in_dir to the parent directory of all GenMAPP pathways files -mapp_in_dir= - -#point gpml_out_dir to where you want the gpml files to be located -gpml_out_dir= - -#location of the state file, to enable resuming after error -state_file= - -#location of the argument file, where the arguments of the last invocation of -#the converter will be stored. -#(this helps recreating the conditions that triggered the error) -args_file= - -#if true, stop conversion process when an error was detected -die_on_error= - -#if true, resume at last error -#if false, always start over +#point mapp_in_dir to the parent directory of all GenMAPP pathways files +mapp_in_dir= + +#point gpml_out_dir to where you want the gpml files to be located +gpml_out_dir= + +#location of the state file, to enable resuming after error +state_file= + +#location of the argument file, where the arguments of the last invocation of +#the converter will be stored. +#(this helps recreating the conditions that triggered the error) +args_file= + +#if true, stop conversion process when an error was detected +die_on_error= + +#if true, resume at last error +#if false, always start over resume= \ No newline at end of file diff --git a/tools/convert/converter.pm b/tools/convert/converter.pm index bb9ac970..2f5f3de5 100644 --- a/tools/convert/converter.pm +++ b/tools/convert/converter.pm @@ -1,62 +1,62 @@ -#!/usr/bin/perl - -use warnings; -use strict; - -package converter; - -sub gmmlOld2New -{ - my $fnGmml = shift; - my $dirInput = shift; - my $dirOutput = shift; - - # load GMMLv1 as DOM - my $parser = XML::LibXML->new(); - my $tree = $parser->parse_file($dirInput . $fnGmml); - - print "-" x 20, "\n"; - # transform - - ## first rename pathway elements to box elements - { - print "Transformation 1: Split GeneProduct to Box and PhysicalEntity\n"; - - my $doc = $tree->getDocumentElement; - my @geneProducts = $doc->getElementsByTagName('GeneProduct'); - foreach $b (@geneProducts) - { - - #rename element - $b->setNodeName ("Box"); - - my $e = XML::LibXML::Element->new("PhysicalEntity"); - - for my $attr (qw/Xref Type GeneProduct-Data-Source GeneID Name BackpageHead/) - { - $e->setAttribute ($attr, $b->getAttribute($attr)); - $b->removeAttribute ($attr); - } - - $doc->appendChild ($e); - } - } - print "-" x 20, "\n"; - - # save GMMLv2 - my $fh; - my $fnGmmlNew = $dirOutput . $fnGmml; - print "Writing to $fnGmmlNew\n"; - open $fh, "> $fnGmmlNew" or die; - print $fh $tree->toString; - close $fh; -} - -sub GmmlNew2Old -{ - my $fnGmml = shift; - my $dirInput = shift; - my $dirOutput = shift; -} - +#!/usr/bin/perl + +use warnings; +use strict; + +package converter; + +sub gmmlOld2New +{ + my $fnGmml = shift; + my $dirInput = shift; + my $dirOutput = shift; + + # load GMMLv1 as DOM + my $parser = XML::LibXML->new(); + my $tree = $parser->parse_file($dirInput . $fnGmml); + + print "-" x 20, "\n"; + # transform + + ## first rename pathway elements to box elements + { + print "Transformation 1: Split GeneProduct to Box and PhysicalEntity\n"; + + my $doc = $tree->getDocumentElement; + my @geneProducts = $doc->getElementsByTagName('GeneProduct'); + foreach $b (@geneProducts) + { + + #rename element + $b->setNodeName ("Box"); + + my $e = XML::LibXML::Element->new("PhysicalEntity"); + + for my $attr (qw/Xref Type GeneProduct-Data-Source GeneID Name BackpageHead/) + { + $e->setAttribute ($attr, $b->getAttribute($attr)); + $b->removeAttribute ($attr); + } + + $doc->appendChild ($e); + } + } + print "-" x 20, "\n"; + + # save GMMLv2 + my $fh; + my $fnGmmlNew = $dirOutput . $fnGmml; + print "Writing to $fnGmmlNew\n"; + open $fh, "> $fnGmmlNew" or die; + print $fh $tree->toString; + close $fh; +} + +sub GmmlNew2Old +{ + my $fnGmml = shift; + my $dirInput = shift; + my $dirOutput = shift; +} + 1; \ No newline at end of file diff --git a/tools/cytoscape-gpml/src/org/pathvisio/cytoscape/Label.java b/tools/cytoscape-gpml/src/org/pathvisio/cytoscape/Label.java index 7f396a21..fc9eeda2 100644 --- a/tools/cytoscape-gpml/src/org/pathvisio/cytoscape/Label.java +++ b/tools/cytoscape-gpml/src/org/pathvisio/cytoscape/Label.java @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. // -package org.pathvisio.cytoscape; +package org.pathvisio.cytoscape; import ding.view.DGraphView; - + import java.awt.Font; import java.awt.Graphics2D; import java.awt.Rectangle; @@ -28,42 +28,42 @@ /** * Cytoscape rendering of a GPML Label. * This is pure graphical annotation, not part of the graph. - */ -public class Label extends Annotation { - - public Label(PathwayElement pwElm, DGraphView view) { - super(pwElm, view); - } - - public Shape getVOutline() { -// FontMetrics fm = getFontMetrics(getVFont()); -// Rectangle2D r = fm.getStringBounds(pwElm.getTextLabel(), -// image != null ? image.createGraphics() : getGraphics()); -// return new Rectangle2D.Double(getVLeft(), getVTop(), r.getWidth(), r.getHeight()); - return new Rectangle(getVLeft(), getVTop(), getVWidth(), getVHeight()); - } - - private Font getVFont() { - int style = pwElm.isBold() ? Font.BOLD : Font.PLAIN; - style |= pwElm.isItalic() ? Font.ITALIC : Font.PLAIN; - return new Font(pwElm.getFontName(), style, (int)GpmlPlugin.mToV(pwElm.getMFontSize() * scaleFactor)); - } - - public void doPaint(Graphics2D g2d) { - Rectangle b = getBounds(); - g2d.setFont(getVFont()); - g2d.setColor(pwElm.getColor()); - - g2d.drawString(pwElm.getTextLabel(), b.x, b.y + b.height / 2); - - g2d.dispose(); - } - - double scaleFactor = 1; - - public void viewportChanged(int w, int h, double newXCenter, double newYCenter, double newScaleFactor) { - scaleFactor = newScaleFactor; - super.viewportChanged(w, h, newXCenter, newYCenter, newScaleFactor); - - } -} + */ +public class Label extends Annotation { + + public Label(PathwayElement pwElm, DGraphView view) { + super(pwElm, view); + } + + public Shape getVOutline() { +// FontMetrics fm = getFontMetrics(getVFont()); +// Rectangle2D r = fm.getStringBounds(pwElm.getTextLabel(), +// image != null ? image.createGraphics() : getGraphics()); +// return new Rectangle2D.Double(getVLeft(), getVTop(), r.getWidth(), r.getHeight()); + return new Rectangle(getVLeft(), getVTop(), getVWidth(), getVHeight()); + } + + private Font getVFont() { + int style = pwElm.isBold() ? Font.BOLD : Font.PLAIN; + style |= pwElm.isItalic() ? Font.ITALIC : Font.PLAIN; + return new Font(pwElm.getFontName(), style, (int)GpmlPlugin.mToV(pwElm.getMFontSize() * scaleFactor)); + } + + public void doPaint(Graphics2D g2d) { + Rectangle b = getBounds(); + g2d.setFont(getVFont()); + g2d.setColor(pwElm.getColor()); + + g2d.drawString(pwElm.getTextLabel(), b.x, b.y + b.height / 2); + + g2d.dispose(); + } + + double scaleFactor = 1; + + public void viewportChanged(int w, int h, double newXCenter, double newYCenter, double newScaleFactor) { + scaleFactor = newScaleFactor; + super.viewportChanged(w, h, newXCenter, newYCenter, newScaleFactor); + + } +} diff --git a/tools/cytoscape-gpml/src/org/pathvisio/cytoscape/Shape.java b/tools/cytoscape-gpml/src/org/pathvisio/cytoscape/Shape.java index 3c7997dc..d8ea2c50 100644 --- a/tools/cytoscape-gpml/src/org/pathvisio/cytoscape/Shape.java +++ b/tools/cytoscape-gpml/src/org/pathvisio/cytoscape/Shape.java @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. // -package org.pathvisio.cytoscape; - +package org.pathvisio.cytoscape; + import ding.view.DGraphView; import ding.view.ViewportChangeListener; - + import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics2D; @@ -35,100 +35,100 @@ * Cytoscape rendering of a GPML Shape. * This is pure graphical annotation, not part of the graph. */ -public class Shape extends Annotation implements ViewportChangeListener { - - public Shape(PathwayElement pwElm, DGraphView view) { - super(pwElm, view); - } - - public Rectangle2D.Double getVRectangle() { - return new Rectangle2D.Double(getVLeft(), getVTop(), getVWidth(), getVHeight()); - } - - public java.awt.Shape getVOutline() { - Rectangle2D.Double r = getVRectangle(); - r.width = r.width + 2; - r.height = r.height + 2; - AffineTransform f = new AffineTransform(); - f.rotate(pwElm.getRotation(), getVCenterX(), getVCenterY()); - java.awt.Shape outline = f.createTransformedShape(r); - return outline; - } - - public Rectangle getUnrotatedBounds() { - java.awt.Shape outline = viewportTransform(getVOutline()); - Rectangle2D b = outline.getBounds(); - AffineTransform f = new AffineTransform(); - f.rotate(-pwElm.getRotation(), b.getCenterX(), b.getCenterY()); - return f.createTransformedShape(outline).getBounds(); - } - - public void doPaint(Graphics2D g2d) { - //Rectangle b = relativeToBounds(getUnrotatedBounds()).getBounds(); - Rectangle b = viewportTransform(getVRectangle()).getBounds(); - - Color fillcolor = pwElm.getFillColor(); - Color linecolor = pwElm.getColor(); - - int sw = (int)Math.ceil(getStrokeWidth()); - int x = b.x; - int y = b.y; - int w = b.width - sw - 1; - int h = b.height - sw - 1; - int cx = x + w/2; - int cy = y + h/2; - - java.awt.Shape s = null; - - if (pwElm.getShapeType() == null || pwElm.getShapeType() == ShapeType.NONE) - { - s = ShapeRegistry.DEFAULT_SHAPE.getShape(w, h); - } - else - { - s = pwElm.getShapeType().getShape (w, h); - } - - AffineTransform t = new AffineTransform(); - t.rotate(pwElm.getRotation(), cx, cy); +public class Shape extends Annotation implements ViewportChangeListener { + + public Shape(PathwayElement pwElm, DGraphView view) { + super(pwElm, view); + } + + public Rectangle2D.Double getVRectangle() { + return new Rectangle2D.Double(getVLeft(), getVTop(), getVWidth(), getVHeight()); + } + + public java.awt.Shape getVOutline() { + Rectangle2D.Double r = getVRectangle(); + r.width = r.width + 2; + r.height = r.height + 2; + AffineTransform f = new AffineTransform(); + f.rotate(pwElm.getRotation(), getVCenterX(), getVCenterY()); + java.awt.Shape outline = f.createTransformedShape(r); + return outline; + } + + public Rectangle getUnrotatedBounds() { + java.awt.Shape outline = viewportTransform(getVOutline()); + Rectangle2D b = outline.getBounds(); + AffineTransform f = new AffineTransform(); + f.rotate(-pwElm.getRotation(), b.getCenterX(), b.getCenterY()); + return f.createTransformedShape(outline).getBounds(); + } + + public void doPaint(Graphics2D g2d) { + //Rectangle b = relativeToBounds(getUnrotatedBounds()).getBounds(); + Rectangle b = viewportTransform(getVRectangle()).getBounds(); + + Color fillcolor = pwElm.getFillColor(); + Color linecolor = pwElm.getColor(); + + int sw = (int)Math.ceil(getStrokeWidth()); + int x = b.x; + int y = b.y; + int w = b.width - sw - 1; + int h = b.height - sw - 1; + int cx = x + w/2; + int cy = y + h/2; + + java.awt.Shape s = null; + + if (pwElm.getShapeType() == null || pwElm.getShapeType() == ShapeType.NONE) + { + s = ShapeRegistry.DEFAULT_SHAPE.getShape(w, h); + } + else + { + s = pwElm.getShapeType().getShape (w, h); + } + + AffineTransform t = new AffineTransform(); + t.rotate(pwElm.getRotation(), cx, cy); t.translate(x, y); - s = t.createTransformedShape(s); - - if (pwElm.getShapeType() == ShapeType.BRACE || - pwElm.getShapeType() == ShapeType.ARC) - { - // don't fill arcs or braces - // TODO: this exception should disappear in the future, - // when we've made sure all pathways on wikipathways have - // transparent arcs and braces - } - else - { - // fill the rest - if(!pwElm.isTransparent()) - { - g2d.setColor(fillcolor); - g2d.fill(s); - } - } - - g2d.setColor(linecolor); - int ls = pwElm.getLineStyle(); - if (ls == LineStyle.SOLID) - { - g2d.setStroke(new BasicStroke()); - } - else if (ls == LineStyle.DASHED) - { - g2d.setStroke (new BasicStroke ( - 1, - BasicStroke.CAP_SQUARE, - BasicStroke.JOIN_MITER, - 10, new float[] {4, 4}, 0)); - } - - g2d.draw(s); - } - - -} + s = t.createTransformedShape(s); + + if (pwElm.getShapeType() == ShapeType.BRACE || + pwElm.getShapeType() == ShapeType.ARC) + { + // don't fill arcs or braces + // TODO: this exception should disappear in the future, + // when we've made sure all pathways on wikipathways have + // transparent arcs and braces + } + else + { + // fill the rest + if(!pwElm.isTransparent()) + { + g2d.setColor(fillcolor); + g2d.fill(s); + } + } + + g2d.setColor(linecolor); + int ls = pwElm.getLineStyle(); + if (ls == LineStyle.SOLID) + { + g2d.setStroke(new BasicStroke()); + } + else if (ls == LineStyle.DASHED) + { + g2d.setStroke (new BasicStroke ( + 1, + BasicStroke.CAP_SQUARE, + BasicStroke.JOIN_MITER, + 10, new float[] {4, 4}, 0)); + } + + g2d.draw(s); + } + + +} diff --git a/tools/gpmldiff/plan/mockups/Hs_Wnt_signaling_modified.gpml b/tools/gpmldiff/plan/mockups/Hs_Wnt_signaling_modified.gpml index e2433969..819696ec 100644 --- a/tools/gpmldiff/plan/mockups/Hs_Wnt_signaling_modified.gpml +++ b/tools/gpmldiff/plan/mockups/Hs_Wnt_signaling_modified.gpml @@ -1,577 +1,577 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MOUSE:KG38_MOUSE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MOUSE:KG38_MOUSE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/Dm_Notch_Signaling_Pathway_KEGG.gpml b/tools/gpmldiff/testcases/Dm_Notch_Signaling_Pathway_KEGG.gpml index 7b3fd35b..94268448 100644 --- a/tools/gpmldiff/testcases/Dm_Notch_Signaling_Pathway_KEGG.gpml +++ b/tools/gpmldiff/testcases/Dm_Notch_Signaling_Pathway_KEGG.gpml @@ -1,408 +1,408 @@ - - - http://www.genome.ad.jp/kegg/pathway/dme/dme04330.html - Adapted from KEGG (see notes) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + http://www.genome.ad.jp/kegg/pathway/dme/dme04330.html + Adapted from KEGG (see notes) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/Dm_Notch_Signaling_Pathway_KEGG_2.gpml b/tools/gpmldiff/testcases/Dm_Notch_Signaling_Pathway_KEGG_2.gpml index f60d9fc5..d862a165 100644 --- a/tools/gpmldiff/testcases/Dm_Notch_Signaling_Pathway_KEGG_2.gpml +++ b/tools/gpmldiff/testcases/Dm_Notch_Signaling_Pathway_KEGG_2.gpml @@ -1,418 +1,418 @@ - - - http://www.genome.ad.jp/kegg/pathway/dme/dme04330.html - Adapted from KEGG (see notes) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + http://www.genome.ad.jp/kegg/pathway/dme/dme04330.html + Adapted from KEGG (see notes) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/Hs_Acetylcholine_Synthesis.gpml b/tools/gpmldiff/testcases/Hs_Acetylcholine_Synthesis.gpml index 71208a52..13f23047 100644 --- a/tools/gpmldiff/testcases/Hs_Acetylcholine_Synthesis.gpml +++ b/tools/gpmldiff/testcases/Hs_Acetylcholine_Synthesis.gpml @@ -1,220 +1,220 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/Hs_Acetylcholine_Synthesis_2.gpml b/tools/gpmldiff/testcases/Hs_Acetylcholine_Synthesis_2.gpml index 2d144aec..93bcff21 100644 --- a/tools/gpmldiff/testcases/Hs_Acetylcholine_Synthesis_2.gpml +++ b/tools/gpmldiff/testcases/Hs_Acetylcholine_Synthesis_2.gpml @@ -1,220 +1,220 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/Hs_Acetylcholine_Synthesis_3.gpml b/tools/gpmldiff/testcases/Hs_Acetylcholine_Synthesis_3.gpml index 45ac171e..855e08b6 100644 --- a/tools/gpmldiff/testcases/Hs_Acetylcholine_Synthesis_3.gpml +++ b/tools/gpmldiff/testcases/Hs_Acetylcholine_Synthesis_3.gpml @@ -1,220 +1,220 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/Hs_Acetylcholine_Synthesis_4.gpml b/tools/gpmldiff/testcases/Hs_Acetylcholine_Synthesis_4.gpml index 46284cec..dc5b8613 100644 --- a/tools/gpmldiff/testcases/Hs_Acetylcholine_Synthesis_4.gpml +++ b/tools/gpmldiff/testcases/Hs_Acetylcholine_Synthesis_4.gpml @@ -1,220 +1,220 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/Hs_Acetylcholine_Synthesis_5.gpml b/tools/gpmldiff/testcases/Hs_Acetylcholine_Synthesis_5.gpml index 45803b95..f3a9f41a 100644 --- a/tools/gpmldiff/testcases/Hs_Acetylcholine_Synthesis_5.gpml +++ b/tools/gpmldiff/testcases/Hs_Acetylcholine_Synthesis_5.gpml @@ -1,220 +1,220 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/Hs_Acetylcholine_Synthesis_6.gpml b/tools/gpmldiff/testcases/Hs_Acetylcholine_Synthesis_6.gpml index 24e5f029..8a03fb66 100644 --- a/tools/gpmldiff/testcases/Hs_Acetylcholine_Synthesis_6.gpml +++ b/tools/gpmldiff/testcases/Hs_Acetylcholine_Synthesis_6.gpml @@ -1,220 +1,220 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/Hs_Apoptosis.gpml b/tools/gpmldiff/testcases/Hs_Apoptosis.gpml index 2888620e..be46858d 100644 --- a/tools/gpmldiff/testcases/Hs_Apoptosis.gpml +++ b/tools/gpmldiff/testcases/Hs_Apoptosis.gpml @@ -1,847 +1,847 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/Hs_Apoptosis2.gpml b/tools/gpmldiff/testcases/Hs_Apoptosis2.gpml index cf1d7abf..464a1040 100644 --- a/tools/gpmldiff/testcases/Hs_Apoptosis2.gpml +++ b/tools/gpmldiff/testcases/Hs_Apoptosis2.gpml @@ -1,847 +1,847 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/Hs_Wnt_signaling.gpml b/tools/gpmldiff/testcases/Hs_Wnt_signaling.gpml index b222e208..57d50ae3 100644 --- a/tools/gpmldiff/testcases/Hs_Wnt_signaling.gpml +++ b/tools/gpmldiff/testcases/Hs_Wnt_signaling.gpml @@ -1,555 +1,555 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MOUSE:KG38_MOUSE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MOUSE:KG38_MOUSE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/Hs_Wnt_signaling_modified.gpml b/tools/gpmldiff/testcases/Hs_Wnt_signaling_modified.gpml index e2433969..819696ec 100644 --- a/tools/gpmldiff/testcases/Hs_Wnt_signaling_modified.gpml +++ b/tools/gpmldiff/testcases/Hs_Wnt_signaling_modified.gpml @@ -1,577 +1,577 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MOUSE:KG38_MOUSE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MOUSE:KG38_MOUSE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/Simple1.1.gpml b/tools/gpmldiff/testcases/Simple1.1.gpml index 69fcadf0..980ae1df 100644 --- a/tools/gpmldiff/testcases/Simple1.1.gpml +++ b/tools/gpmldiff/testcases/Simple1.1.gpml @@ -1,22 +1,22 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/Simple1.2.1.1.gpml b/tools/gpmldiff/testcases/Simple1.2.1.1.gpml index 13b856d7..2fa4e0b7 100644 --- a/tools/gpmldiff/testcases/Simple1.2.1.1.gpml +++ b/tools/gpmldiff/testcases/Simple1.2.1.1.gpml @@ -1,31 +1,31 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/Simple1.2.1.gpml b/tools/gpmldiff/testcases/Simple1.2.1.gpml index c95e3641..b7f856bc 100644 --- a/tools/gpmldiff/testcases/Simple1.2.1.gpml +++ b/tools/gpmldiff/testcases/Simple1.2.1.gpml @@ -1,22 +1,22 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/Simple1.2.2.gpml b/tools/gpmldiff/testcases/Simple1.2.2.gpml index ef62eccb..cfe97851 100644 --- a/tools/gpmldiff/testcases/Simple1.2.2.gpml +++ b/tools/gpmldiff/testcases/Simple1.2.2.gpml @@ -1,22 +1,22 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/Simple1.2.3.gpml b/tools/gpmldiff/testcases/Simple1.2.3.gpml index 25321996..dee046c8 100644 --- a/tools/gpmldiff/testcases/Simple1.2.3.gpml +++ b/tools/gpmldiff/testcases/Simple1.2.3.gpml @@ -1,22 +1,22 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/Simple1.2.gpml b/tools/gpmldiff/testcases/Simple1.2.gpml index e59842e4..43efc256 100644 --- a/tools/gpmldiff/testcases/Simple1.2.gpml +++ b/tools/gpmldiff/testcases/Simple1.2.gpml @@ -1,22 +1,22 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/Simple1.3.gpml b/tools/gpmldiff/testcases/Simple1.3.gpml index 44450db0..9c7816e2 100644 --- a/tools/gpmldiff/testcases/Simple1.3.gpml +++ b/tools/gpmldiff/testcases/Simple1.3.gpml @@ -1,22 +1,22 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/Simple1.4.gpml b/tools/gpmldiff/testcases/Simple1.4.gpml index 6d15e540..755a4a77 100644 --- a/tools/gpmldiff/testcases/Simple1.4.gpml +++ b/tools/gpmldiff/testcases/Simple1.4.gpml @@ -1,28 +1,28 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/Simple1.5.gpml b/tools/gpmldiff/testcases/Simple1.5.gpml index e3acd46b..2d3bed7d 100644 --- a/tools/gpmldiff/testcases/Simple1.5.gpml +++ b/tools/gpmldiff/testcases/Simple1.5.gpml @@ -1,28 +1,28 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/test1-del.gpml b/tools/gpmldiff/testcases/test1-del.gpml index b2c5058d..f62f6ec2 100644 --- a/tools/gpmldiff/testcases/test1-del.gpml +++ b/tools/gpmldiff/testcases/test1-del.gpml @@ -1,12 +1,12 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/test1-ins.gpml b/tools/gpmldiff/testcases/test1-ins.gpml index 058e1a29..c09d3e94 100644 --- a/tools/gpmldiff/testcases/test1-ins.gpml +++ b/tools/gpmldiff/testcases/test1-ins.gpml @@ -1,18 +1,18 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/test1-mod.gpml b/tools/gpmldiff/testcases/test1-mod.gpml index c0fbb7ef..b5f4851b 100644 --- a/tools/gpmldiff/testcases/test1-mod.gpml +++ b/tools/gpmldiff/testcases/test1-mod.gpml @@ -1,15 +1,15 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/tools/gpmldiff/testcases/test1.gpml b/tools/gpmldiff/testcases/test1.gpml index a5b04784..09318b2c 100644 --- a/tools/gpmldiff/testcases/test1.gpml +++ b/tools/gpmldiff/testcases/test1.gpml @@ -1,15 +1,15 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/tools/lucene-indexer/test-data/5157-H.gpml b/tools/lucene-indexer/test-data/5157-H.gpml index 231621c9..18f3833b 100644 --- a/tools/lucene-indexer/test-data/5157-H.gpml +++ b/tools/lucene-indexer/test-data/5157-H.gpml @@ -1,11 +1,11 @@ - - - 5157-H - - - - - - - - + + + 5157-H + + + + + + + + diff --git a/tools/lucene-indexer/test-data/5157-L.gpml b/tools/lucene-indexer/test-data/5157-L.gpml index 26bafe96..9e19bee9 100644 --- a/tools/lucene-indexer/test-data/5157-L.gpml +++ b/tools/lucene-indexer/test-data/5157-L.gpml @@ -1,10 +1,10 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/tools/lucene-indexer/test-data/test-literature.gpml b/tools/lucene-indexer/test-data/test-literature.gpml index 68a52891..63f33431 100644 --- a/tools/lucene-indexer/test-data/test-literature.gpml +++ b/tools/lucene-indexer/test-data/test-literature.gpml @@ -1,35 +1,35 @@ - - - b0b - - - ce0 - - - - - - - 1234 - PubMed - Change in the kinetics of sulphacetamide tissue distribution in Walker tumor-bearing rats. - Drug Metab Dispos - 1975 - Nadeau D - Marchand C - - - 2345 - PubMed - Oxygen transport by haemoglobin. A comparison of whole blood, washed erythrocytes and haemoglobin solution. - Biomedicine - 1975 - Lecompte F - Sinet M - Azoulay E - Muffat-Joly M - Pocidalo JJ - - - - + + + b0b + + + ce0 + + + + + + + 1234 + PubMed + Change in the kinetics of sulphacetamide tissue distribution in Walker tumor-bearing rats. + Drug Metab Dispos + 1975 + Nadeau D + Marchand C + + + 2345 + PubMed + Oxygen transport by haemoglobin. A comparison of whole blood, washed erythrocytes and haemoglobin solution. + Biomedicine + 1975 + Lecompte F + Sinet M + Azoulay E + Muffat-Joly M + Pocidalo JJ + + + + diff --git a/tools/lucene-indexer/test-data/test-relationship.gpml b/tools/lucene-indexer/test-data/test-relationship.gpml index 91cfe870..3be32bc9 100644 --- a/tools/lucene-indexer/test-data/test-relationship.gpml +++ b/tools/lucene-indexer/test-data/test-relationship.gpml @@ -1,158 +1,158 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/perl/testdata/fatty acid metabolism all genes_voor_Martijn.txt b/tools/perl/testdata/fatty acid metabolism all genes_voor_Martijn.txt index 30e166d3..1dbf4f39 100644 --- a/tools/perl/testdata/fatty acid metabolism all genes_voor_Martijn.txt +++ b/tools/perl/testdata/fatty acid metabolism all genes_voor_Martijn.txt @@ -1,447 +1,447 @@ -GeneID SystemCode Label Head Remarks MAPPName -LABEL peroxisomal fatty acid oxidation PPAR-Alpha_Targets.MAPP -1439675_at X Ppara PPAR-Alpha_Targets.MAPP -1449051_at X Ppara PPAR-Alpha_Targets.MAPP -1431012_a_at X Peci PPAR-Alpha_Targets.MAPP -1420673_a_at X Acox2 PPAR-Alpha_Targets.MAPP -1448910_at X Pecr PPAR-Alpha_Targets.MAPP -1439167_at X Pecr PPAR-Alpha_Targets.MAPP -1460470_at X Acoxl PPAR-Alpha_Targets.MAPP -1416409_at X Acox1 PPAR-Alpha_Targets.MAPP -1416408_at X Acox1 PPAR-Alpha_Targets.MAPP -1444518_at X Acox1 PPAR-Alpha_Targets.MAPP -1423495_at X Decr2 PPAR-Alpha_Targets.MAPP -1456737_x_at X Acaa1 PPAR-Alpha_Targets.MAPP -1416947_s_at X Acaa1 PPAR-Alpha_Targets.MAPP -1416946_a_at X Acaa1 PPAR-Alpha_Targets.MAPP -1456011_x_at X Acaa1 PPAR-Alpha_Targets.MAPP -1424451_at X Acaa1b PPAR-Alpha_Targets.MAPP -1448491_at X Ech1 PPAR-Alpha_Targets.MAPP -1417449_at X Pte1 PPAR-Alpha_Targets.MAPP -1417449_at X PTE2 PPAR-Alpha_Targets.MAPP -1417449_at X Acot8 PPAR-Alpha_Targets.MAPP -1427070_at X Pte1 PPAR-Alpha_Targets.MAPP -1448382_at X Ehhadh PPAR-Alpha_Targets.MAPP -1450966_at X Crot PPAR-Alpha_Targets.MAPP -1440474_at X Crot PPAR-Alpha_Targets.MAPP -1422925_s_at X Pte2a PPAR-Alpha_Targets.MAPP -1422077_at X Pte2b PPAR-Alpha_Targets.MAPP -1422076_at X Pte2b PPAR-Alpha_Targets.MAPP -1422075_at X Pte2b PPAR-Alpha_Targets.MAPP -1425257_at X PPAR-Alpha_Targets.MAPP -1443046_at X Abcd3 PPAR-Alpha_Targets.MAPP -1416679_at X Abcd3 PPAR-Alpha_Targets.MAPP -1457991_at X Abcd3 PPAR-Alpha_Targets.MAPP -1419748_at X Abcd2 PPAR-Alpha_Targets.MAPP -1438431_at X Abcd2 PPAR-Alpha_Targets.MAPP -1439835_x_at X Abcd2 PPAR-Alpha_Targets.MAPP -1456812_at X Abcd2 PPAR-Alpha_Targets.MAPP -1418838_at X Abcd1 PPAR-Alpha_Targets.MAPP -1417369_at X Hsd17b4 PPAR-Alpha_Targets.MAPP -1455777_x_at X Hsd17b4 PPAR-Alpha_Targets.MAPP -1426219_at X Scp2 PPAR-Alpha_Targets.MAPP -1419974_at X Scp2 PPAR-Alpha_Targets.MAPP -1419975_at X Scp2 PPAR-Alpha_Targets.MAPP -1449686_s_at X Scp2 PPAR-Alpha_Targets.MAPP -1420684_at X Acox3 PPAR-Alpha_Targets.MAPP -1437352_at X Acox3 PPAR-Alpha_Targets.MAPP -LABEL mitochondrial fatty acid oxidation PPAR-Alpha_Targets.MAPP -1425703_at X Ppard PPAR-Alpha_Targets.MAPP -1439797_at X Ppard PPAR-Alpha_Targets.MAPP -1460409_at X Cpt1a PPAR-Alpha_Targets.MAPP -1438156_x_at X Cpt1a PPAR-Alpha_Targets.MAPP -1434866_x_at X Cpt1a PPAR-Alpha_Targets.MAPP -1418328_at X Cpt1b PPAR-Alpha_Targets.MAPP -1447820_x_at X Cpt2 PPAR-Alpha_Targets.MAPP -1416772_at X Cpt2 PPAR-Alpha_Targets.MAPP -1423108_at X Slc25a20 PPAR-Alpha_Targets.MAPP -1423109_s_at X Slc25a20 PPAR-Alpha_Targets.MAPP -1438187_at X Slc25a29 PPAR-Alpha_Targets.MAPP -1450395_at X Slc22a5 PPAR-Alpha_Targets.MAPP -1421848_at X Slc22a5 PPAR-Alpha_Targets.MAPP -1440536_at X Slc22a5 PPAR-Alpha_Targets.MAPP -1448544_at X Crat PPAR-Alpha_Targets.MAPP -1441919_x_at X Crat PPAR-Alpha_Targets.MAPP -1417008_at X Crat PPAR-Alpha_Targets.MAPP -1418321_at X Dci PPAR-Alpha_Targets.MAPP -1419367_at X Decr1 PPAR-Alpha_Targets.MAPP -1449443_at X Decr1 PPAR-Alpha_Targets.MAPP -1429339_a_at X Acad10 PPAR-Alpha_Targets.MAPP -1444394_at X Acad10 PPAR-Alpha_Targets.MAPP -1447741_x_at X Acad10 PPAR-Alpha_Targets.MAPP -1453206_at X Acad9 PPAR-Alpha_Targets.MAPP -1419261_at X Acad8 PPAR-Alpha_Targets.MAPP -1419262_at X Acad8 PPAR-Alpha_Targets.MAPP -1424184_at X Acadvl PPAR-Alpha_Targets.MAPP -1448987_at X Acadl PPAR-Alpha_Targets.MAPP -1415984_at X Acadm PPAR-Alpha_Targets.MAPP -1455446_x_at X Acadsb PPAR-Alpha_Targets.MAPP -1460216_at X Acads PPAR-Alpha_Targets.MAPP -1452173_at X Hadha PPAR-Alpha_Targets.MAPP -1442732_at X Hadhb PPAR-Alpha_Targets.MAPP -1426522_at X Hadhb PPAR-Alpha_Targets.MAPP -1437172_x_at X Hadhb PPAR-Alpha_Targets.MAPP -1438391_x_at X Hadh2 PPAR-Alpha_Targets.MAPP -1448286_at X Hadh2 PPAR-Alpha_Targets.MAPP -1455972_x_at X Hadhsc PPAR-Alpha_Targets.MAPP -1460184_at X Hadhsc PPAR-Alpha_Targets.MAPP -1428146_s_at X Acaa2 PPAR-Alpha_Targets.MAPP -1428145_s_at X Acaa2 PPAR-Alpha_Targets.MAPP -1455061_a_at X Acaa2 PPAR-Alpha_Targets.MAPP -1428145_at X Acaa2 PPAR-Alpha_Targets.MAPP -1418073_at X Mte2 PPAR-Alpha_Targets.MAPP -1449968_s_at X Mte2 PPAR-Alpha_Targets.MAPP -1422996_at X Mte1 PPAR-Alpha_Targets.MAPP -1422997_at X Mte1 PPAR-Alpha_Targets.MAPP -1439478_at X Mte1 PPAR-Alpha_Targets.MAPP -1451512_s_at X Hibch PPAR-Alpha_Targets.MAPP -LABEL ketone body synthesis PPAR-Alpha_Targets.MAPP -1431833_a_at X Hmgcs2 PPAR-Alpha_Targets.MAPP -1423858_a_at X Hmgcs2 PPAR-Alpha_Targets.MAPP -1424639_a_at X Hmgcl PPAR-Alpha_Targets.MAPP -1424182_at X Acat1 PPAR-Alpha_Targets.MAPP -1424183_at X Acat1 PPAR-Alpha_Targets.MAPP -1451271_a_at X Acat1 PPAR-Alpha_Targets.MAPP -LABEL microsomal fatty acid oxidation PPAR-Alpha_Targets.MAPP -1423257_at X Cyp4a14 PPAR-Alpha_Targets.MAPP -1424352_at X Cyp4a12 PPAR-Alpha_Targets.MAPP -1424943_at X Cyp4a10 PPAR-Alpha_Targets.MAPP -1440134_at X Cyp4a10 PPAR-Alpha_Targets.MAPP -1424853_s_at X Cyp4a10 PPAR-Alpha_Targets.MAPP -1415776_at X Aldh3a2 PPAR-Alpha_Targets.MAPP -LABEL fatty acid binding proteins PPAR-Alpha_Targets.MAPP -1448764_a_at X Fabp1 PPAR-Alpha_Targets.MAPP -1417556_at X Fabp1 PPAR-Alpha_Targets.MAPP -1418438_at X Fabp2 PPAR-Alpha_Targets.MAPP -1444844_at X Fabp3 PPAR-Alpha_Targets.MAPP -1416023_at X Fabp3 PPAR-Alpha_Targets.MAPP -1425809_at X Fabp4 PPAR-Alpha_Targets.MAPP -1417023_a_at X Fabp4 PPAR-Alpha_Targets.MAPP -1451263_a_at X Fabp4 PPAR-Alpha_Targets.MAPP -1424155_at X Fabp4 PPAR-Alpha_Targets.MAPP -1456290_x_at X Fabp5 PPAR-Alpha_Targets.MAPP -1416022_at X Fabp5 PPAR-Alpha_Targets.MAPP -1416021_a_at X Fabp5 PPAR-Alpha_Targets.MAPP -1450682_at X Fabp6 PPAR-Alpha_Targets.MAPP -1450779_at X Fabp7 PPAR-Alpha_Targets.MAPP - Pmp2 PPAR-Alpha_Targets.MAPP -1421804_at X Fabp9 PPAR-Alpha_Targets.MAPP -1417076_at X Fabp9 PPAR-Alpha_Targets.MAPP -LABEL lipogenesis PPAR-Alpha_Targets.MAPP -1420715_a_at X Pparg PPAR-Alpha_Targets.MAPP -1426690_a_at X Srebf1 PPAR-Alpha_Targets.MAPP -1417098_s_at X Mecr PPAR-Alpha_Targets.MAPP - TER PPAR-Alpha_Targets.MAPP -1459530_at X KAR PPAR-Alpha_Targets.MAPP -1450010_at X KAR PPAR-Alpha_Targets.MAPP -1450011_at X KAR PPAR-Alpha_Targets.MAPP -1441891_x_at X Elovl7 PPAR-Alpha_Targets.MAPP -1424098_at X Elovl7 PPAR-Alpha_Targets.MAPP -1440354_at X Elovl7 PPAR-Alpha_Targets.MAPP -1440312_at X Elovl7 PPAR-Alpha_Targets.MAPP -1424097_at X Elovl7 PPAR-Alpha_Targets.MAPP -1445578_at X Elovl6 PPAR-Alpha_Targets.MAPP -1417403_at X Elovl6 PPAR-Alpha_Targets.MAPP -1417404_at X Elovl6 PPAR-Alpha_Targets.MAPP -1445062_at X Elovl6 PPAR-Alpha_Targets.MAPP -1442656_at X Elovl6 PPAR-Alpha_Targets.MAPP -1459242_at X Elovl5 PPAR-Alpha_Targets.MAPP -1415840_at X Elovl5 PPAR-Alpha_Targets.MAPP -1437211_x_at X Elovl5 PPAR-Alpha_Targets.MAPP -1442409_at X Elovl5 PPAR-Alpha_Targets.MAPP -1451308_at X Elovl4 PPAR-Alpha_Targets.MAPP -1420722_at X Elovl3 PPAR-Alpha_Targets.MAPP -1416444_at X Elovl2 PPAR-Alpha_Targets.MAPP -1425676_a_at X Elovl1 PPAR-Alpha_Targets.MAPP -1455994_x_at X Elovl1 PPAR-Alpha_Targets.MAPP - Scd4 PPAR-Alpha_Targets.MAPP -1423366_at X Scd3 PPAR-Alpha_Targets.MAPP -1450956_at X Scd3 PPAR-Alpha_Targets.MAPP -1415824_at X Scd2 PPAR-Alpha_Targets.MAPP -1415823_at X Scd2 PPAR-Alpha_Targets.MAPP -1415822_at X Scd2 PPAR-Alpha_Targets.MAPP -1415965_at X Scd1 PPAR-Alpha_Targets.MAPP -1415964_at X Scd1 PPAR-Alpha_Targets.MAPP -1440444_at X Fads1 PPAR-Alpha_Targets.MAPP -1423680_at X Fads1 PPAR-Alpha_Targets.MAPP -1443904_at X Fads1 PPAR-Alpha_Targets.MAPP -1419031_at X Fads2 PPAR-Alpha_Targets.MAPP -1443838_x_at X Fads2 PPAR-Alpha_Targets.MAPP -1449325_at X Fads2 PPAR-Alpha_Targets.MAPP -1418773_at X Fads3 PPAR-Alpha_Targets.MAPP -1435910_at X Fads3 PPAR-Alpha_Targets.MAPP -1416632_at X Mod1 PPAR-Alpha_Targets.MAPP -1430307_a_at X Mod1 PPAR-Alpha_Targets.MAPP -1419399_at X Mttp PPAR-Alpha_Targets.MAPP -1419400_at X Mttp PPAR-Alpha_Targets.MAPP -1439445_x_at X Acly PPAR-Alpha_Targets.MAPP -1439459_x_at X Acly PPAR-Alpha_Targets.MAPP -1425326_at X Acly PPAR-Alpha_Targets.MAPP -1451666_at X Acly PPAR-Alpha_Targets.MAPP -1423828_at X Fasn PPAR-Alpha_Targets.MAPP -1444810_at X Acaca PPAR-Alpha_Targets.MAPP -1434185_at X Acaca PPAR-Alpha_Targets.MAPP -1427595_at X Acaca PPAR-Alpha_Targets.MAPP -1427052_at X Acacb PPAR-Alpha_Targets.MAPP -1425834_a_at X Gpam PPAR-Alpha_Targets.MAPP -1419499_at X Gpam PPAR-Alpha_Targets.MAPP -1418295_s_at X Dgat1 PPAR-Alpha_Targets.MAPP -1422678_at X Dgat2 PPAR-Alpha_Targets.MAPP -1422677_at X Dgat2 PPAR-Alpha_Targets.MAPP -1421025_at X Agpat1 PPAR-Alpha_Targets.MAPP -1421024_at X Agpat1 PPAR-Alpha_Targets.MAPP -1428821_at X Agpat2 PPAR-Alpha_Targets.MAPP -1433818_s_at X Agpat3 PPAR-Alpha_Targets.MAPP -1433819_s_at X Agpat3 PPAR-Alpha_Targets.MAPP -1450504_a_at X Agpat3 PPAR-Alpha_Targets.MAPP - Agpat5 PPAR-Alpha_Targets.MAPP -1450776_at X Agpat6 PPAR-Alpha_Targets.MAPP -1422841_at X Agpat6 PPAR-Alpha_Targets.MAPP -1436276_at X Agpat6 PPAR-Alpha_Targets.MAPP -1419504_at X Mogat1 PPAR-Alpha_Targets.MAPP -1416955_at X Slc25a10 PPAR-Alpha_Targets.MAPP -LABEL fatty acid activation PPAR-Alpha_Targets.MAPP -1422526_at X Acsl1 PPAR-Alpha_Targets.MAPP -1460316_at X Acsl1 PPAR-Alpha_Targets.MAPP -1423883_at X Acsl1 PPAR-Alpha_Targets.MAPP -1450643_s_at X Acsl1 PPAR-Alpha_Targets.MAPP -1428386_at X Acsl3 PPAR-Alpha_Targets.MAPP -1452771_s_at X Acsl3 PPAR-Alpha_Targets.MAPP -1428082_at X Acsl5 PPAR-Alpha_Targets.MAPP -1451828_a_at X Acsl4 PPAR-Alpha_Targets.MAPP -1433531_at X Acsl4 PPAR-Alpha_Targets.MAPP -1418911_s_at X Acsl4 PPAR-Alpha_Targets.MAPP -1418668_at X Acsm1 PPAR-Alpha_Targets.MAPP -1427215_at X Acsm2 PPAR-Alpha_Targets.MAPP -1425559_a_at X Acsm3 PPAR-Alpha_Targets.MAPP -1422479_at X Acss2 PPAR-Alpha_Targets.MAPP -LABEL lipases PPAR-Alpha_Targets.MAPP -1453836_a_at X Mgll PPAR-Alpha_Targets.MAPP -1450391_a_at X Mgll PPAR-Alpha_Targets.MAPP -1426785_s_at X Mgll PPAR-Alpha_Targets.MAPP -1442560_at X Mgll PPAR-Alpha_Targets.MAPP -1422820_at X Lipe PPAR-Alpha_Targets.MAPP -1428143_a_at X Pnpla2 PPAR-Alpha_Targets.MAPP -1419560_at X Lipc PPAR-Alpha_Targets.MAPP -1450188_s_at X Lipg PPAR-Alpha_Targets.MAPP -1421262_at X Lipg PPAR-Alpha_Targets.MAPP -1415904_at X Lpl PPAR-Alpha_Targets.MAPP -1431056_a_at X Lpl PPAR-Alpha_Targets.MAPP -LABEL fatty acid transport PPAR-Alpha_Targets.MAPP -1435658_at X Slc27a1 PPAR-Alpha_Targets.MAPP -1422811_at X Slc27a1 PPAR-Alpha_Targets.MAPP -1416316_at X Slc27a2 PPAR-Alpha_Targets.MAPP -1427180_at X Slc27a3 PPAR-Alpha_Targets.MAPP -1424441_at X Slc27a4 PPAR-Alpha_Targets.MAPP -1449112_at X Slc27a5 PPAR-Alpha_Targets.MAPP -1423166_at X Cd36 PPAR-Alpha_Targets.MAPP -1450883_a_at X Cd36 PPAR-Alpha_Targets.MAPP -1450884_at X Cd36 PPAR-Alpha_Targets.MAPP -LABEL glycerol metabolism PPAR-Alpha_Targets.MAPP -1416204_at X Gpd1 PPAR-Alpha_Targets.MAPP -1448249_at X Gpd1 PPAR-Alpha_Targets.MAPP -1439396_x_at X Gpd1 PPAR-Alpha_Targets.MAPP -1459689_at X Gpd2 PPAR-Alpha_Targets.MAPP -1428323_at X Gpd2 PPAR-Alpha_Targets.MAPP -1428324_at X Gpd2 PPAR-Alpha_Targets.MAPP -1452741_s_at X Gpd2 PPAR-Alpha_Targets.MAPP -1417434_at X Gpd2 PPAR-Alpha_Targets.MAPP -1445242_at X Gyk PPAR-Alpha_Targets.MAPP -1422703_at X Gyk PPAR-Alpha_Targets.MAPP -1422704_at X Gyk PPAR-Alpha_Targets.MAPP -1422008_a_at X Aqp3 PPAR-Alpha_Targets.MAPP -1422007_at X Aqp3 PPAR-Alpha_Targets.MAPP -1450460_at X Aqp3 PPAR-Alpha_Targets.MAPP -1418848_at X Aqp7 PPAR-Alpha_Targets.MAPP -LABEL Lipoprotein metabolism PPAR-Alpha_Targets.MAPP -1419857_at X Apoa1 PPAR-Alpha_Targets.MAPP -1419233_x_at X Apoa1 PPAR-Alpha_Targets.MAPP -1419232_a_at X Apoa1 PPAR-Alpha_Targets.MAPP -1455201_x_at X Apoa1 PPAR-Alpha_Targets.MAPP -1438840_x_at X Apoa1 PPAR-Alpha_Targets.MAPP -1415727_at X Apoa1bp PPAR-Alpha_Targets.MAPP -1417950_a_at X Apoa2 PPAR-Alpha_Targets.MAPP -1436504_x_at X Apoa4 PPAR-Alpha_Targets.MAPP -1417761_at X Apoa4 PPAR-Alpha_Targets.MAPP -1417610_at X Apoa5 PPAR-Alpha_Targets.MAPP -1455593_at X Apob PPAR-Alpha_Targets.MAPP -1451755_a_at X Apobec1 PPAR-Alpha_Targets.MAPP -1417561_at X Apoc1 PPAR-Alpha_Targets.MAPP -1418069_at X Apoc2 PPAR-Alpha_Targets.MAPP -1418278_at X Apoc3 PPAR-Alpha_Targets.MAPP -1418708_at X Apoc4 PPAR-Alpha_Targets.MAPP -1432466_a_at X Apoe PPAR-Alpha_Targets.MAPP -1418239_at X Apof PPAR-Alpha_Targets.MAPP -1416677_at X Apoh PPAR-Alpha_Targets.MAPP -1419096_at X Apom PPAR-Alpha_Targets.MAPP -1419095_a_at X Apom PPAR-Alpha_Targets.MAPP -1419869_s_at X Hdlbp PPAR-Alpha_Targets.MAPP -1449615_s_at X Hdlbp PPAR-Alpha_Targets.MAPP -1415988_at X Hdlbp PPAR-Alpha_Targets.MAPP -1415987_at X Hdlbp PPAR-Alpha_Targets.MAPP -1421821_at X Ldlr PPAR-Alpha_Targets.MAPP -1448655_at X Lrp1 PPAR-Alpha_Targets.MAPP -1416836_at X Lrp10 PPAR-Alpha_Targets.MAPP -1452320_at X Lrp2 PPAR-Alpha_Targets.MAPP -1426288_at X Lrp4 PPAR-Alpha_Targets.MAPP -1449299_at X Lrp5 PPAR-Alpha_Targets.MAPP -1452148_at X Lrpap1 PPAR-Alpha_Targets.MAPP -1426696_at X Lrpap1 PPAR-Alpha_Targets.MAPP -1426697_at X Lrpap1 PPAR-Alpha_Targets.MAPP -1436609_a_at X Lrpap1 PPAR-Alpha_Targets.MAPP -1454704_at X Scarb2 PPAR-Alpha_Targets.MAPP -1460235_at X Scarb2 PPAR-Alpha_Targets.MAPP -1455820_x_at X Scarb1 PPAR-Alpha_Targets.MAPP -1437378_x_at X Scarb1 PPAR-Alpha_Targets.MAPP -1416050_a_at X Scarb1 PPAR-Alpha_Targets.MAPP -1451156_s_at X Vldlr PPAR-Alpha_Targets.MAPP -1438258_at X Vldlr PPAR-Alpha_Targets.MAPP -1435893_at X Vldlr PPAR-Alpha_Targets.MAPP -1442169_at X Vldlr PPAR-Alpha_Targets.MAPP -1446194_at X Vldlr PPAR-Alpha_Targets.MAPP -1417900_a_at X Vldlr PPAR-Alpha_Targets.MAPP -1434465_x_at X Vldlr PPAR-Alpha_Targets.MAPP -1456424_s_at X Pltp PPAR-Alpha_Targets.MAPP -1417963_at X Pltp PPAR-Alpha_Targets.MAPP -1420983_at X Pctp PPAR-Alpha_Targets.MAPP -1420984_at X Pctp PPAR-Alpha_Targets.MAPP - Cetp PPAR-Alpha_Targets.MAPP -LABEL cholesterol synthesis/esterification PPAR-Alpha_Targets.MAPP -1426744_at X Srebf2 PPAR-Alpha_Targets.MAPP -1417980_a_at X Insig2 PPAR-Alpha_Targets.MAPP -1454671_at X Insig1 PPAR-Alpha_Targets.MAPP -1433444_at X Hmgcs1 PPAR-Alpha_Targets.MAPP -1433445_x_at X Hmgcs1 PPAR-Alpha_Targets.MAPP -1433446_at X Hmgcs1 PPAR-Alpha_Targets.MAPP -1433443_a_at X Hmgcs1 PPAR-Alpha_Targets.MAPP -1441536_at X Hmgcs1 PPAR-Alpha_Targets.MAPP -1427229_at X Hmgcr PPAR-Alpha_Targets.MAPP -1423804_a_at X Idi1 PPAR-Alpha_Targets.MAPP -1451122_at X Idi1 PPAR-Alpha_Targets.MAPP -1423418_at X Fdps PPAR-Alpha_Targets.MAPP -1438322_x_at X Fdft1 PPAR-Alpha_Targets.MAPP -1448130_at X Fdft1 PPAR-Alpha_Targets.MAPP -1459497_at X Fdft1 PPAR-Alpha_Targets.MAPP -1416222_at X Nsdhl PPAR-Alpha_Targets.MAPP -1415993_at X Sqle PPAR-Alpha_Targets.MAPP -1423078_a_at X Sc4mol PPAR-Alpha_Targets.MAPP -1437453_s_at X Pcsk9 PPAR-Alpha_Targets.MAPP -1417303_at X Mvd PPAR-Alpha_Targets.MAPP -1448663_s_at X Mvd PPAR-Alpha_Targets.MAPP -1427893_a_at X Pmvk PPAR-Alpha_Targets.MAPP -1418052_at X Mvk PPAR-Alpha_Targets.MAPP -1426913_at X Lss PPAR-Alpha_Targets.MAPP -1434520_at X Sc5d PPAR-Alpha_Targets.MAPP -1451457_at X Sc5d PPAR-Alpha_Targets.MAPP -1435630_s_at X Acat2 PPAR-Alpha_Targets.MAPP -1418129_at X Dhcr24 PPAR-Alpha_Targets.MAPP -1418129_at X Dhcr24 PPAR-Alpha_Targets.MAPP -1418130_at X Dhcr24 PPAR-Alpha_Targets.MAPP -1442696_at X Dhcr7 PPAR-Alpha_Targets.MAPP -1448619_at X Dhcr7 PPAR-Alpha_Targets.MAPP -1460722_at X Soat2 PPAR-Alpha_Targets.MAPP -1426818_at X Soat1 PPAR-Alpha_Targets.MAPP -1418780_at X Cyp39a1 PPAR-Alpha_Targets.MAPP -1417043_at X Lcat PPAR-Alpha_Targets.MAPP -1421821_at X Ldlr PPAR-Alpha_Targets.MAPP - Sterol transport/traficking PPAR-Alpha_Targets.MAPP -1421839_at X Abca1 PPAR-Alpha_Targets.MAPP -1420656_at X Abcg8 PPAR-Alpha_Targets.MAPP -1419393_at X Abcg5 PPAR-Alpha_Targets.MAPP -1423570_at X Abcg1 PPAR-Alpha_Targets.MAPP -1424437_s_at X Abcg4 PPAR-Alpha_Targets.MAPP -1449817_at X Abcb11 PPAR-Alpha_Targets.MAPP -1438514_at X Npc1l1 PPAR-Alpha_Targets.MAPP -1455011_at X Stard4 PPAR-Alpha_Targets.MAPP -1429239_a_at X Stard4 PPAR-Alpha_Targets.MAPP -1429240_at X Stard4 PPAR-Alpha_Targets.MAPP -1430274_a_at X Stard3nl PPAR-Alpha_Targets.MAPP -1417405_at X Stard3 PPAR-Alpha_Targets.MAPP -1443266_at X Npc2 PPAR-Alpha_Targets.MAPP -1448513_a_at X Npc2 PPAR-Alpha_Targets.MAPP -1443266_at X Npc2 PPAR-Alpha_Targets.MAPP -1455768_at X Npc2 PPAR-Alpha_Targets.MAPP -1423086_at X Npc1 PPAR-Alpha_Targets.MAPP -1448159_at X Rab7 PPAR-Alpha_Targets.MAPP -1415734_at X Rab7 PPAR-Alpha_Targets.MAPP -1448391_at X Rab9 PPAR-Alpha_Targets.MAPP -1449256_a_at X Rab11a PPAR-Alpha_Targets.MAPP -1418413_at X Cav3 PPAR-Alpha_Targets.MAPP -1425955_at X Cav2 PPAR-Alpha_Targets.MAPP -1417327_at X Cav2 PPAR-Alpha_Targets.MAPP -1449145_a_at X Cav1 PPAR-Alpha_Targets.MAPP -1437692_x_at X Anxa2 PPAR-Alpha_Targets.MAPP -1460350_at X Osbp PPAR-Alpha_Targets.MAPP -1438848_at X Osbp PPAR-Alpha_Targets.MAPP -1460192_at X Osbpl1a PPAR-Alpha_Targets.MAPP -1416823_a_at X Osbpl1a PPAR-Alpha_Targets.MAPP -1451974_at X Osbpl2 PPAR-Alpha_Targets.MAPP -1428356_at X Osbp2 PPAR-Alpha_Targets.MAPP -1428355_at X Osbp2 PPAR-Alpha_Targets.MAPP -1451831_at X Osbpl6 PPAR-Alpha_Targets.MAPP -1457881_at X Osbpl6 PPAR-Alpha_Targets.MAPP -1438717_a_at X Osbpl6 PPAR-Alpha_Targets.MAPP -1456495_s_at X Osbpl6 PPAR-Alpha_Targets.MAPP -1449627_at X Osbpl6 PPAR-Alpha_Targets.MAPP -1428893_at X Osbpl7 PPAR-Alpha_Targets.MAPP -1450964_a_at X Osbpl9 PPAR-Alpha_Targets.MAPP -1423383_a_at X Osbpl9 PPAR-Alpha_Targets.MAPP -1424870_at X Osbpl10 PPAR-Alpha_Targets.MAPP -1437069_at X OSBPL8 PPAR-Alpha_Targets.MAPP -1457539_at X OSBPL8 PPAR-Alpha_Targets.MAPP -1438724_at X OSBPL3 PPAR-Alpha_Targets.MAPP -1428484_at X OSBPL3 PPAR-Alpha_Targets.MAPP -1425391_a_at X OSBPL5 PPAR-Alpha_Targets.MAPP -1436027_at X OSBPL11 PPAR-Alpha_Targets.MAPP -1455534_s_at X OSBPL11 PPAR-Alpha_Targets.MAPP -LABEL Miscellanious PPAR-Alpha_Targets.MAPP -1420657_at X Ucp3 PPAR-Alpha_Targets.MAPP -1420658_at X Ucp3 PPAR-Alpha_Targets.MAPP -1459741_x_at X Ucp2 PPAR-Alpha_Targets.MAPP -1459740_s_at X Ucp2 PPAR-Alpha_Targets.MAPP -1448188_at X Ucp2 PPAR-Alpha_Targets.MAPP -1449964_a_at X Mlycd PPAR-Alpha_Targets.MAPP -1448700_at X G0s2 PPAR-Alpha_Targets.MAPP -1448318_at X Adfp PPAR-Alpha_Targets.MAPP -1417273_at X Pdk4 PPAR-Alpha_Targets.MAPP -1417130_s_at X Angptl4 PPAR-Alpha_Targets.MAPP -1424485_at X Angptl3 PPAR-Alpha_Targets.MAPP -1424785_at X Angptl6 PPAR-Alpha_Targets.MAPP -1449065_at X Acot1 PPAR-Alpha_Targets.MAPP - Acot6 PPAR-Alpha_Targets.MAPP -1419395_at X Acot12 PPAR-Alpha_Targets.MAPP -1449457_at X Acot12 PPAR-Alpha_Targets.MAPP -1417094_at X Acot7 PPAR-Alpha_Targets.MAPP -1425667_at X Acot11 PPAR-Alpha_Targets.MAPP -1429267_at X Acot11 PPAR-Alpha_Targets.MAPP -1449968_s_at X Acot10 PPAR-Alpha_Targets.MAPP -1456156_at X Lepr PPAR-Alpha_Targets.MAPP -1425644_at X Lepr PPAR-Alpha_Targets.MAPP -1425875_a_at X Lepr PPAR-Alpha_Targets.MAPP -1426516_a_at X Lpin1 PPAR-Alpha_Targets.MAPP -1418288_at X Lpin1 PPAR-Alpha_Targets.MAPP -1446316_at X Lpin2 PPAR-Alpha_Targets.MAPP -1460290_at X Lpin2 PPAR-Alpha_Targets.MAPP -1452837_at X Lpin2 PPAR-Alpha_Targets.MAPP -1452836_at X Lpin2 PPAR-Alpha_Targets.MAPP -1417867_at X And PPAR-Alpha_Targets.MAPP -1446154_at X Bdh PPAR-Alpha_Targets.MAPP -1426959_at X Bdh PPAR-Alpha_Targets.MAPP -1452257_at X Bdh PPAR-Alpha_Targets.MAPP -1438775_at X Ppargc1b PPAR-Alpha_Targets.MAPP -1457578_at X Ppargc1b PPAR-Alpha_Targets.MAPP -1460336_at X Ppargc1a PPAR-Alpha_Targets.MAPP -1456395_at X Ppargc1a PPAR-Alpha_Targets.MAPP -1437751_at X Ppargc1a PPAR-Alpha_Targets.MAPP -1449818_at X Abcb4 PPAR-Alpha_Targets.MAPP -1434329_s_at X Adipor2 PPAR-Alpha_Targets.MAPP -1437864_at X Adipor2 PPAR-Alpha_Targets.MAPP -Various L Various PPAR-Alpha_Targets.MAPP -1415996_at X Txnip PPAR-Alpha_Targets.MAPP -1415997_at X Txnip PPAR-Alpha_Targets.MAPP -1419105_at X Nr1h4 PPAR-Alpha_Targets.MAPP -1441915_s_at X 2310076L09Rik PPAR-Alpha_Targets.MAPP -1420983_at X Pctp PPAR-Alpha_Targets.MAPP -1420984_at X Pctp PPAR-Alpha_Targets.MAPP -1424011_at X Aqp9 PPAR-Alpha_Targets.MAPP +GeneID SystemCode Label Head Remarks MAPPName +LABEL peroxisomal fatty acid oxidation PPAR-Alpha_Targets.MAPP +1439675_at X Ppara PPAR-Alpha_Targets.MAPP +1449051_at X Ppara PPAR-Alpha_Targets.MAPP +1431012_a_at X Peci PPAR-Alpha_Targets.MAPP +1420673_a_at X Acox2 PPAR-Alpha_Targets.MAPP +1448910_at X Pecr PPAR-Alpha_Targets.MAPP +1439167_at X Pecr PPAR-Alpha_Targets.MAPP +1460470_at X Acoxl PPAR-Alpha_Targets.MAPP +1416409_at X Acox1 PPAR-Alpha_Targets.MAPP +1416408_at X Acox1 PPAR-Alpha_Targets.MAPP +1444518_at X Acox1 PPAR-Alpha_Targets.MAPP +1423495_at X Decr2 PPAR-Alpha_Targets.MAPP +1456737_x_at X Acaa1 PPAR-Alpha_Targets.MAPP +1416947_s_at X Acaa1 PPAR-Alpha_Targets.MAPP +1416946_a_at X Acaa1 PPAR-Alpha_Targets.MAPP +1456011_x_at X Acaa1 PPAR-Alpha_Targets.MAPP +1424451_at X Acaa1b PPAR-Alpha_Targets.MAPP +1448491_at X Ech1 PPAR-Alpha_Targets.MAPP +1417449_at X Pte1 PPAR-Alpha_Targets.MAPP +1417449_at X PTE2 PPAR-Alpha_Targets.MAPP +1417449_at X Acot8 PPAR-Alpha_Targets.MAPP +1427070_at X Pte1 PPAR-Alpha_Targets.MAPP +1448382_at X Ehhadh PPAR-Alpha_Targets.MAPP +1450966_at X Crot PPAR-Alpha_Targets.MAPP +1440474_at X Crot PPAR-Alpha_Targets.MAPP +1422925_s_at X Pte2a PPAR-Alpha_Targets.MAPP +1422077_at X Pte2b PPAR-Alpha_Targets.MAPP +1422076_at X Pte2b PPAR-Alpha_Targets.MAPP +1422075_at X Pte2b PPAR-Alpha_Targets.MAPP +1425257_at X PPAR-Alpha_Targets.MAPP +1443046_at X Abcd3 PPAR-Alpha_Targets.MAPP +1416679_at X Abcd3 PPAR-Alpha_Targets.MAPP +1457991_at X Abcd3 PPAR-Alpha_Targets.MAPP +1419748_at X Abcd2 PPAR-Alpha_Targets.MAPP +1438431_at X Abcd2 PPAR-Alpha_Targets.MAPP +1439835_x_at X Abcd2 PPAR-Alpha_Targets.MAPP +1456812_at X Abcd2 PPAR-Alpha_Targets.MAPP +1418838_at X Abcd1 PPAR-Alpha_Targets.MAPP +1417369_at X Hsd17b4 PPAR-Alpha_Targets.MAPP +1455777_x_at X Hsd17b4 PPAR-Alpha_Targets.MAPP +1426219_at X Scp2 PPAR-Alpha_Targets.MAPP +1419974_at X Scp2 PPAR-Alpha_Targets.MAPP +1419975_at X Scp2 PPAR-Alpha_Targets.MAPP +1449686_s_at X Scp2 PPAR-Alpha_Targets.MAPP +1420684_at X Acox3 PPAR-Alpha_Targets.MAPP +1437352_at X Acox3 PPAR-Alpha_Targets.MAPP +LABEL mitochondrial fatty acid oxidation PPAR-Alpha_Targets.MAPP +1425703_at X Ppard PPAR-Alpha_Targets.MAPP +1439797_at X Ppard PPAR-Alpha_Targets.MAPP +1460409_at X Cpt1a PPAR-Alpha_Targets.MAPP +1438156_x_at X Cpt1a PPAR-Alpha_Targets.MAPP +1434866_x_at X Cpt1a PPAR-Alpha_Targets.MAPP +1418328_at X Cpt1b PPAR-Alpha_Targets.MAPP +1447820_x_at X Cpt2 PPAR-Alpha_Targets.MAPP +1416772_at X Cpt2 PPAR-Alpha_Targets.MAPP +1423108_at X Slc25a20 PPAR-Alpha_Targets.MAPP +1423109_s_at X Slc25a20 PPAR-Alpha_Targets.MAPP +1438187_at X Slc25a29 PPAR-Alpha_Targets.MAPP +1450395_at X Slc22a5 PPAR-Alpha_Targets.MAPP +1421848_at X Slc22a5 PPAR-Alpha_Targets.MAPP +1440536_at X Slc22a5 PPAR-Alpha_Targets.MAPP +1448544_at X Crat PPAR-Alpha_Targets.MAPP +1441919_x_at X Crat PPAR-Alpha_Targets.MAPP +1417008_at X Crat PPAR-Alpha_Targets.MAPP +1418321_at X Dci PPAR-Alpha_Targets.MAPP +1419367_at X Decr1 PPAR-Alpha_Targets.MAPP +1449443_at X Decr1 PPAR-Alpha_Targets.MAPP +1429339_a_at X Acad10 PPAR-Alpha_Targets.MAPP +1444394_at X Acad10 PPAR-Alpha_Targets.MAPP +1447741_x_at X Acad10 PPAR-Alpha_Targets.MAPP +1453206_at X Acad9 PPAR-Alpha_Targets.MAPP +1419261_at X Acad8 PPAR-Alpha_Targets.MAPP +1419262_at X Acad8 PPAR-Alpha_Targets.MAPP +1424184_at X Acadvl PPAR-Alpha_Targets.MAPP +1448987_at X Acadl PPAR-Alpha_Targets.MAPP +1415984_at X Acadm PPAR-Alpha_Targets.MAPP +1455446_x_at X Acadsb PPAR-Alpha_Targets.MAPP +1460216_at X Acads PPAR-Alpha_Targets.MAPP +1452173_at X Hadha PPAR-Alpha_Targets.MAPP +1442732_at X Hadhb PPAR-Alpha_Targets.MAPP +1426522_at X Hadhb PPAR-Alpha_Targets.MAPP +1437172_x_at X Hadhb PPAR-Alpha_Targets.MAPP +1438391_x_at X Hadh2 PPAR-Alpha_Targets.MAPP +1448286_at X Hadh2 PPAR-Alpha_Targets.MAPP +1455972_x_at X Hadhsc PPAR-Alpha_Targets.MAPP +1460184_at X Hadhsc PPAR-Alpha_Targets.MAPP +1428146_s_at X Acaa2 PPAR-Alpha_Targets.MAPP +1428145_s_at X Acaa2 PPAR-Alpha_Targets.MAPP +1455061_a_at X Acaa2 PPAR-Alpha_Targets.MAPP +1428145_at X Acaa2 PPAR-Alpha_Targets.MAPP +1418073_at X Mte2 PPAR-Alpha_Targets.MAPP +1449968_s_at X Mte2 PPAR-Alpha_Targets.MAPP +1422996_at X Mte1 PPAR-Alpha_Targets.MAPP +1422997_at X Mte1 PPAR-Alpha_Targets.MAPP +1439478_at X Mte1 PPAR-Alpha_Targets.MAPP +1451512_s_at X Hibch PPAR-Alpha_Targets.MAPP +LABEL ketone body synthesis PPAR-Alpha_Targets.MAPP +1431833_a_at X Hmgcs2 PPAR-Alpha_Targets.MAPP +1423858_a_at X Hmgcs2 PPAR-Alpha_Targets.MAPP +1424639_a_at X Hmgcl PPAR-Alpha_Targets.MAPP +1424182_at X Acat1 PPAR-Alpha_Targets.MAPP +1424183_at X Acat1 PPAR-Alpha_Targets.MAPP +1451271_a_at X Acat1 PPAR-Alpha_Targets.MAPP +LABEL microsomal fatty acid oxidation PPAR-Alpha_Targets.MAPP +1423257_at X Cyp4a14 PPAR-Alpha_Targets.MAPP +1424352_at X Cyp4a12 PPAR-Alpha_Targets.MAPP +1424943_at X Cyp4a10 PPAR-Alpha_Targets.MAPP +1440134_at X Cyp4a10 PPAR-Alpha_Targets.MAPP +1424853_s_at X Cyp4a10 PPAR-Alpha_Targets.MAPP +1415776_at X Aldh3a2 PPAR-Alpha_Targets.MAPP +LABEL fatty acid binding proteins PPAR-Alpha_Targets.MAPP +1448764_a_at X Fabp1 PPAR-Alpha_Targets.MAPP +1417556_at X Fabp1 PPAR-Alpha_Targets.MAPP +1418438_at X Fabp2 PPAR-Alpha_Targets.MAPP +1444844_at X Fabp3 PPAR-Alpha_Targets.MAPP +1416023_at X Fabp3 PPAR-Alpha_Targets.MAPP +1425809_at X Fabp4 PPAR-Alpha_Targets.MAPP +1417023_a_at X Fabp4 PPAR-Alpha_Targets.MAPP +1451263_a_at X Fabp4 PPAR-Alpha_Targets.MAPP +1424155_at X Fabp4 PPAR-Alpha_Targets.MAPP +1456290_x_at X Fabp5 PPAR-Alpha_Targets.MAPP +1416022_at X Fabp5 PPAR-Alpha_Targets.MAPP +1416021_a_at X Fabp5 PPAR-Alpha_Targets.MAPP +1450682_at X Fabp6 PPAR-Alpha_Targets.MAPP +1450779_at X Fabp7 PPAR-Alpha_Targets.MAPP + Pmp2 PPAR-Alpha_Targets.MAPP +1421804_at X Fabp9 PPAR-Alpha_Targets.MAPP +1417076_at X Fabp9 PPAR-Alpha_Targets.MAPP +LABEL lipogenesis PPAR-Alpha_Targets.MAPP +1420715_a_at X Pparg PPAR-Alpha_Targets.MAPP +1426690_a_at X Srebf1 PPAR-Alpha_Targets.MAPP +1417098_s_at X Mecr PPAR-Alpha_Targets.MAPP + TER PPAR-Alpha_Targets.MAPP +1459530_at X KAR PPAR-Alpha_Targets.MAPP +1450010_at X KAR PPAR-Alpha_Targets.MAPP +1450011_at X KAR PPAR-Alpha_Targets.MAPP +1441891_x_at X Elovl7 PPAR-Alpha_Targets.MAPP +1424098_at X Elovl7 PPAR-Alpha_Targets.MAPP +1440354_at X Elovl7 PPAR-Alpha_Targets.MAPP +1440312_at X Elovl7 PPAR-Alpha_Targets.MAPP +1424097_at X Elovl7 PPAR-Alpha_Targets.MAPP +1445578_at X Elovl6 PPAR-Alpha_Targets.MAPP +1417403_at X Elovl6 PPAR-Alpha_Targets.MAPP +1417404_at X Elovl6 PPAR-Alpha_Targets.MAPP +1445062_at X Elovl6 PPAR-Alpha_Targets.MAPP +1442656_at X Elovl6 PPAR-Alpha_Targets.MAPP +1459242_at X Elovl5 PPAR-Alpha_Targets.MAPP +1415840_at X Elovl5 PPAR-Alpha_Targets.MAPP +1437211_x_at X Elovl5 PPAR-Alpha_Targets.MAPP +1442409_at X Elovl5 PPAR-Alpha_Targets.MAPP +1451308_at X Elovl4 PPAR-Alpha_Targets.MAPP +1420722_at X Elovl3 PPAR-Alpha_Targets.MAPP +1416444_at X Elovl2 PPAR-Alpha_Targets.MAPP +1425676_a_at X Elovl1 PPAR-Alpha_Targets.MAPP +1455994_x_at X Elovl1 PPAR-Alpha_Targets.MAPP + Scd4 PPAR-Alpha_Targets.MAPP +1423366_at X Scd3 PPAR-Alpha_Targets.MAPP +1450956_at X Scd3 PPAR-Alpha_Targets.MAPP +1415824_at X Scd2 PPAR-Alpha_Targets.MAPP +1415823_at X Scd2 PPAR-Alpha_Targets.MAPP +1415822_at X Scd2 PPAR-Alpha_Targets.MAPP +1415965_at X Scd1 PPAR-Alpha_Targets.MAPP +1415964_at X Scd1 PPAR-Alpha_Targets.MAPP +1440444_at X Fads1 PPAR-Alpha_Targets.MAPP +1423680_at X Fads1 PPAR-Alpha_Targets.MAPP +1443904_at X Fads1 PPAR-Alpha_Targets.MAPP +1419031_at X Fads2 PPAR-Alpha_Targets.MAPP +1443838_x_at X Fads2 PPAR-Alpha_Targets.MAPP +1449325_at X Fads2 PPAR-Alpha_Targets.MAPP +1418773_at X Fads3 PPAR-Alpha_Targets.MAPP +1435910_at X Fads3 PPAR-Alpha_Targets.MAPP +1416632_at X Mod1 PPAR-Alpha_Targets.MAPP +1430307_a_at X Mod1 PPAR-Alpha_Targets.MAPP +1419399_at X Mttp PPAR-Alpha_Targets.MAPP +1419400_at X Mttp PPAR-Alpha_Targets.MAPP +1439445_x_at X Acly PPAR-Alpha_Targets.MAPP +1439459_x_at X Acly PPAR-Alpha_Targets.MAPP +1425326_at X Acly PPAR-Alpha_Targets.MAPP +1451666_at X Acly PPAR-Alpha_Targets.MAPP +1423828_at X Fasn PPAR-Alpha_Targets.MAPP +1444810_at X Acaca PPAR-Alpha_Targets.MAPP +1434185_at X Acaca PPAR-Alpha_Targets.MAPP +1427595_at X Acaca PPAR-Alpha_Targets.MAPP +1427052_at X Acacb PPAR-Alpha_Targets.MAPP +1425834_a_at X Gpam PPAR-Alpha_Targets.MAPP +1419499_at X Gpam PPAR-Alpha_Targets.MAPP +1418295_s_at X Dgat1 PPAR-Alpha_Targets.MAPP +1422678_at X Dgat2 PPAR-Alpha_Targets.MAPP +1422677_at X Dgat2 PPAR-Alpha_Targets.MAPP +1421025_at X Agpat1 PPAR-Alpha_Targets.MAPP +1421024_at X Agpat1 PPAR-Alpha_Targets.MAPP +1428821_at X Agpat2 PPAR-Alpha_Targets.MAPP +1433818_s_at X Agpat3 PPAR-Alpha_Targets.MAPP +1433819_s_at X Agpat3 PPAR-Alpha_Targets.MAPP +1450504_a_at X Agpat3 PPAR-Alpha_Targets.MAPP + Agpat5 PPAR-Alpha_Targets.MAPP +1450776_at X Agpat6 PPAR-Alpha_Targets.MAPP +1422841_at X Agpat6 PPAR-Alpha_Targets.MAPP +1436276_at X Agpat6 PPAR-Alpha_Targets.MAPP +1419504_at X Mogat1 PPAR-Alpha_Targets.MAPP +1416955_at X Slc25a10 PPAR-Alpha_Targets.MAPP +LABEL fatty acid activation PPAR-Alpha_Targets.MAPP +1422526_at X Acsl1 PPAR-Alpha_Targets.MAPP +1460316_at X Acsl1 PPAR-Alpha_Targets.MAPP +1423883_at X Acsl1 PPAR-Alpha_Targets.MAPP +1450643_s_at X Acsl1 PPAR-Alpha_Targets.MAPP +1428386_at X Acsl3 PPAR-Alpha_Targets.MAPP +1452771_s_at X Acsl3 PPAR-Alpha_Targets.MAPP +1428082_at X Acsl5 PPAR-Alpha_Targets.MAPP +1451828_a_at X Acsl4 PPAR-Alpha_Targets.MAPP +1433531_at X Acsl4 PPAR-Alpha_Targets.MAPP +1418911_s_at X Acsl4 PPAR-Alpha_Targets.MAPP +1418668_at X Acsm1 PPAR-Alpha_Targets.MAPP +1427215_at X Acsm2 PPAR-Alpha_Targets.MAPP +1425559_a_at X Acsm3 PPAR-Alpha_Targets.MAPP +1422479_at X Acss2 PPAR-Alpha_Targets.MAPP +LABEL lipases PPAR-Alpha_Targets.MAPP +1453836_a_at X Mgll PPAR-Alpha_Targets.MAPP +1450391_a_at X Mgll PPAR-Alpha_Targets.MAPP +1426785_s_at X Mgll PPAR-Alpha_Targets.MAPP +1442560_at X Mgll PPAR-Alpha_Targets.MAPP +1422820_at X Lipe PPAR-Alpha_Targets.MAPP +1428143_a_at X Pnpla2 PPAR-Alpha_Targets.MAPP +1419560_at X Lipc PPAR-Alpha_Targets.MAPP +1450188_s_at X Lipg PPAR-Alpha_Targets.MAPP +1421262_at X Lipg PPAR-Alpha_Targets.MAPP +1415904_at X Lpl PPAR-Alpha_Targets.MAPP +1431056_a_at X Lpl PPAR-Alpha_Targets.MAPP +LABEL fatty acid transport PPAR-Alpha_Targets.MAPP +1435658_at X Slc27a1 PPAR-Alpha_Targets.MAPP +1422811_at X Slc27a1 PPAR-Alpha_Targets.MAPP +1416316_at X Slc27a2 PPAR-Alpha_Targets.MAPP +1427180_at X Slc27a3 PPAR-Alpha_Targets.MAPP +1424441_at X Slc27a4 PPAR-Alpha_Targets.MAPP +1449112_at X Slc27a5 PPAR-Alpha_Targets.MAPP +1423166_at X Cd36 PPAR-Alpha_Targets.MAPP +1450883_a_at X Cd36 PPAR-Alpha_Targets.MAPP +1450884_at X Cd36 PPAR-Alpha_Targets.MAPP +LABEL glycerol metabolism PPAR-Alpha_Targets.MAPP +1416204_at X Gpd1 PPAR-Alpha_Targets.MAPP +1448249_at X Gpd1 PPAR-Alpha_Targets.MAPP +1439396_x_at X Gpd1 PPAR-Alpha_Targets.MAPP +1459689_at X Gpd2 PPAR-Alpha_Targets.MAPP +1428323_at X Gpd2 PPAR-Alpha_Targets.MAPP +1428324_at X Gpd2 PPAR-Alpha_Targets.MAPP +1452741_s_at X Gpd2 PPAR-Alpha_Targets.MAPP +1417434_at X Gpd2 PPAR-Alpha_Targets.MAPP +1445242_at X Gyk PPAR-Alpha_Targets.MAPP +1422703_at X Gyk PPAR-Alpha_Targets.MAPP +1422704_at X Gyk PPAR-Alpha_Targets.MAPP +1422008_a_at X Aqp3 PPAR-Alpha_Targets.MAPP +1422007_at X Aqp3 PPAR-Alpha_Targets.MAPP +1450460_at X Aqp3 PPAR-Alpha_Targets.MAPP +1418848_at X Aqp7 PPAR-Alpha_Targets.MAPP +LABEL Lipoprotein metabolism PPAR-Alpha_Targets.MAPP +1419857_at X Apoa1 PPAR-Alpha_Targets.MAPP +1419233_x_at X Apoa1 PPAR-Alpha_Targets.MAPP +1419232_a_at X Apoa1 PPAR-Alpha_Targets.MAPP +1455201_x_at X Apoa1 PPAR-Alpha_Targets.MAPP +1438840_x_at X Apoa1 PPAR-Alpha_Targets.MAPP +1415727_at X Apoa1bp PPAR-Alpha_Targets.MAPP +1417950_a_at X Apoa2 PPAR-Alpha_Targets.MAPP +1436504_x_at X Apoa4 PPAR-Alpha_Targets.MAPP +1417761_at X Apoa4 PPAR-Alpha_Targets.MAPP +1417610_at X Apoa5 PPAR-Alpha_Targets.MAPP +1455593_at X Apob PPAR-Alpha_Targets.MAPP +1451755_a_at X Apobec1 PPAR-Alpha_Targets.MAPP +1417561_at X Apoc1 PPAR-Alpha_Targets.MAPP +1418069_at X Apoc2 PPAR-Alpha_Targets.MAPP +1418278_at X Apoc3 PPAR-Alpha_Targets.MAPP +1418708_at X Apoc4 PPAR-Alpha_Targets.MAPP +1432466_a_at X Apoe PPAR-Alpha_Targets.MAPP +1418239_at X Apof PPAR-Alpha_Targets.MAPP +1416677_at X Apoh PPAR-Alpha_Targets.MAPP +1419096_at X Apom PPAR-Alpha_Targets.MAPP +1419095_a_at X Apom PPAR-Alpha_Targets.MAPP +1419869_s_at X Hdlbp PPAR-Alpha_Targets.MAPP +1449615_s_at X Hdlbp PPAR-Alpha_Targets.MAPP +1415988_at X Hdlbp PPAR-Alpha_Targets.MAPP +1415987_at X Hdlbp PPAR-Alpha_Targets.MAPP +1421821_at X Ldlr PPAR-Alpha_Targets.MAPP +1448655_at X Lrp1 PPAR-Alpha_Targets.MAPP +1416836_at X Lrp10 PPAR-Alpha_Targets.MAPP +1452320_at X Lrp2 PPAR-Alpha_Targets.MAPP +1426288_at X Lrp4 PPAR-Alpha_Targets.MAPP +1449299_at X Lrp5 PPAR-Alpha_Targets.MAPP +1452148_at X Lrpap1 PPAR-Alpha_Targets.MAPP +1426696_at X Lrpap1 PPAR-Alpha_Targets.MAPP +1426697_at X Lrpap1 PPAR-Alpha_Targets.MAPP +1436609_a_at X Lrpap1 PPAR-Alpha_Targets.MAPP +1454704_at X Scarb2 PPAR-Alpha_Targets.MAPP +1460235_at X Scarb2 PPAR-Alpha_Targets.MAPP +1455820_x_at X Scarb1 PPAR-Alpha_Targets.MAPP +1437378_x_at X Scarb1 PPAR-Alpha_Targets.MAPP +1416050_a_at X Scarb1 PPAR-Alpha_Targets.MAPP +1451156_s_at X Vldlr PPAR-Alpha_Targets.MAPP +1438258_at X Vldlr PPAR-Alpha_Targets.MAPP +1435893_at X Vldlr PPAR-Alpha_Targets.MAPP +1442169_at X Vldlr PPAR-Alpha_Targets.MAPP +1446194_at X Vldlr PPAR-Alpha_Targets.MAPP +1417900_a_at X Vldlr PPAR-Alpha_Targets.MAPP +1434465_x_at X Vldlr PPAR-Alpha_Targets.MAPP +1456424_s_at X Pltp PPAR-Alpha_Targets.MAPP +1417963_at X Pltp PPAR-Alpha_Targets.MAPP +1420983_at X Pctp PPAR-Alpha_Targets.MAPP +1420984_at X Pctp PPAR-Alpha_Targets.MAPP + Cetp PPAR-Alpha_Targets.MAPP +LABEL cholesterol synthesis/esterification PPAR-Alpha_Targets.MAPP +1426744_at X Srebf2 PPAR-Alpha_Targets.MAPP +1417980_a_at X Insig2 PPAR-Alpha_Targets.MAPP +1454671_at X Insig1 PPAR-Alpha_Targets.MAPP +1433444_at X Hmgcs1 PPAR-Alpha_Targets.MAPP +1433445_x_at X Hmgcs1 PPAR-Alpha_Targets.MAPP +1433446_at X Hmgcs1 PPAR-Alpha_Targets.MAPP +1433443_a_at X Hmgcs1 PPAR-Alpha_Targets.MAPP +1441536_at X Hmgcs1 PPAR-Alpha_Targets.MAPP +1427229_at X Hmgcr PPAR-Alpha_Targets.MAPP +1423804_a_at X Idi1 PPAR-Alpha_Targets.MAPP +1451122_at X Idi1 PPAR-Alpha_Targets.MAPP +1423418_at X Fdps PPAR-Alpha_Targets.MAPP +1438322_x_at X Fdft1 PPAR-Alpha_Targets.MAPP +1448130_at X Fdft1 PPAR-Alpha_Targets.MAPP +1459497_at X Fdft1 PPAR-Alpha_Targets.MAPP +1416222_at X Nsdhl PPAR-Alpha_Targets.MAPP +1415993_at X Sqle PPAR-Alpha_Targets.MAPP +1423078_a_at X Sc4mol PPAR-Alpha_Targets.MAPP +1437453_s_at X Pcsk9 PPAR-Alpha_Targets.MAPP +1417303_at X Mvd PPAR-Alpha_Targets.MAPP +1448663_s_at X Mvd PPAR-Alpha_Targets.MAPP +1427893_a_at X Pmvk PPAR-Alpha_Targets.MAPP +1418052_at X Mvk PPAR-Alpha_Targets.MAPP +1426913_at X Lss PPAR-Alpha_Targets.MAPP +1434520_at X Sc5d PPAR-Alpha_Targets.MAPP +1451457_at X Sc5d PPAR-Alpha_Targets.MAPP +1435630_s_at X Acat2 PPAR-Alpha_Targets.MAPP +1418129_at X Dhcr24 PPAR-Alpha_Targets.MAPP +1418129_at X Dhcr24 PPAR-Alpha_Targets.MAPP +1418130_at X Dhcr24 PPAR-Alpha_Targets.MAPP +1442696_at X Dhcr7 PPAR-Alpha_Targets.MAPP +1448619_at X Dhcr7 PPAR-Alpha_Targets.MAPP +1460722_at X Soat2 PPAR-Alpha_Targets.MAPP +1426818_at X Soat1 PPAR-Alpha_Targets.MAPP +1418780_at X Cyp39a1 PPAR-Alpha_Targets.MAPP +1417043_at X Lcat PPAR-Alpha_Targets.MAPP +1421821_at X Ldlr PPAR-Alpha_Targets.MAPP + Sterol transport/traficking PPAR-Alpha_Targets.MAPP +1421839_at X Abca1 PPAR-Alpha_Targets.MAPP +1420656_at X Abcg8 PPAR-Alpha_Targets.MAPP +1419393_at X Abcg5 PPAR-Alpha_Targets.MAPP +1423570_at X Abcg1 PPAR-Alpha_Targets.MAPP +1424437_s_at X Abcg4 PPAR-Alpha_Targets.MAPP +1449817_at X Abcb11 PPAR-Alpha_Targets.MAPP +1438514_at X Npc1l1 PPAR-Alpha_Targets.MAPP +1455011_at X Stard4 PPAR-Alpha_Targets.MAPP +1429239_a_at X Stard4 PPAR-Alpha_Targets.MAPP +1429240_at X Stard4 PPAR-Alpha_Targets.MAPP +1430274_a_at X Stard3nl PPAR-Alpha_Targets.MAPP +1417405_at X Stard3 PPAR-Alpha_Targets.MAPP +1443266_at X Npc2 PPAR-Alpha_Targets.MAPP +1448513_a_at X Npc2 PPAR-Alpha_Targets.MAPP +1443266_at X Npc2 PPAR-Alpha_Targets.MAPP +1455768_at X Npc2 PPAR-Alpha_Targets.MAPP +1423086_at X Npc1 PPAR-Alpha_Targets.MAPP +1448159_at X Rab7 PPAR-Alpha_Targets.MAPP +1415734_at X Rab7 PPAR-Alpha_Targets.MAPP +1448391_at X Rab9 PPAR-Alpha_Targets.MAPP +1449256_a_at X Rab11a PPAR-Alpha_Targets.MAPP +1418413_at X Cav3 PPAR-Alpha_Targets.MAPP +1425955_at X Cav2 PPAR-Alpha_Targets.MAPP +1417327_at X Cav2 PPAR-Alpha_Targets.MAPP +1449145_a_at X Cav1 PPAR-Alpha_Targets.MAPP +1437692_x_at X Anxa2 PPAR-Alpha_Targets.MAPP +1460350_at X Osbp PPAR-Alpha_Targets.MAPP +1438848_at X Osbp PPAR-Alpha_Targets.MAPP +1460192_at X Osbpl1a PPAR-Alpha_Targets.MAPP +1416823_a_at X Osbpl1a PPAR-Alpha_Targets.MAPP +1451974_at X Osbpl2 PPAR-Alpha_Targets.MAPP +1428356_at X Osbp2 PPAR-Alpha_Targets.MAPP +1428355_at X Osbp2 PPAR-Alpha_Targets.MAPP +1451831_at X Osbpl6 PPAR-Alpha_Targets.MAPP +1457881_at X Osbpl6 PPAR-Alpha_Targets.MAPP +1438717_a_at X Osbpl6 PPAR-Alpha_Targets.MAPP +1456495_s_at X Osbpl6 PPAR-Alpha_Targets.MAPP +1449627_at X Osbpl6 PPAR-Alpha_Targets.MAPP +1428893_at X Osbpl7 PPAR-Alpha_Targets.MAPP +1450964_a_at X Osbpl9 PPAR-Alpha_Targets.MAPP +1423383_a_at X Osbpl9 PPAR-Alpha_Targets.MAPP +1424870_at X Osbpl10 PPAR-Alpha_Targets.MAPP +1437069_at X OSBPL8 PPAR-Alpha_Targets.MAPP +1457539_at X OSBPL8 PPAR-Alpha_Targets.MAPP +1438724_at X OSBPL3 PPAR-Alpha_Targets.MAPP +1428484_at X OSBPL3 PPAR-Alpha_Targets.MAPP +1425391_a_at X OSBPL5 PPAR-Alpha_Targets.MAPP +1436027_at X OSBPL11 PPAR-Alpha_Targets.MAPP +1455534_s_at X OSBPL11 PPAR-Alpha_Targets.MAPP +LABEL Miscellanious PPAR-Alpha_Targets.MAPP +1420657_at X Ucp3 PPAR-Alpha_Targets.MAPP +1420658_at X Ucp3 PPAR-Alpha_Targets.MAPP +1459741_x_at X Ucp2 PPAR-Alpha_Targets.MAPP +1459740_s_at X Ucp2 PPAR-Alpha_Targets.MAPP +1448188_at X Ucp2 PPAR-Alpha_Targets.MAPP +1449964_a_at X Mlycd PPAR-Alpha_Targets.MAPP +1448700_at X G0s2 PPAR-Alpha_Targets.MAPP +1448318_at X Adfp PPAR-Alpha_Targets.MAPP +1417273_at X Pdk4 PPAR-Alpha_Targets.MAPP +1417130_s_at X Angptl4 PPAR-Alpha_Targets.MAPP +1424485_at X Angptl3 PPAR-Alpha_Targets.MAPP +1424785_at X Angptl6 PPAR-Alpha_Targets.MAPP +1449065_at X Acot1 PPAR-Alpha_Targets.MAPP + Acot6 PPAR-Alpha_Targets.MAPP +1419395_at X Acot12 PPAR-Alpha_Targets.MAPP +1449457_at X Acot12 PPAR-Alpha_Targets.MAPP +1417094_at X Acot7 PPAR-Alpha_Targets.MAPP +1425667_at X Acot11 PPAR-Alpha_Targets.MAPP +1429267_at X Acot11 PPAR-Alpha_Targets.MAPP +1449968_s_at X Acot10 PPAR-Alpha_Targets.MAPP +1456156_at X Lepr PPAR-Alpha_Targets.MAPP +1425644_at X Lepr PPAR-Alpha_Targets.MAPP +1425875_a_at X Lepr PPAR-Alpha_Targets.MAPP +1426516_a_at X Lpin1 PPAR-Alpha_Targets.MAPP +1418288_at X Lpin1 PPAR-Alpha_Targets.MAPP +1446316_at X Lpin2 PPAR-Alpha_Targets.MAPP +1460290_at X Lpin2 PPAR-Alpha_Targets.MAPP +1452837_at X Lpin2 PPAR-Alpha_Targets.MAPP +1452836_at X Lpin2 PPAR-Alpha_Targets.MAPP +1417867_at X And PPAR-Alpha_Targets.MAPP +1446154_at X Bdh PPAR-Alpha_Targets.MAPP +1426959_at X Bdh PPAR-Alpha_Targets.MAPP +1452257_at X Bdh PPAR-Alpha_Targets.MAPP +1438775_at X Ppargc1b PPAR-Alpha_Targets.MAPP +1457578_at X Ppargc1b PPAR-Alpha_Targets.MAPP +1460336_at X Ppargc1a PPAR-Alpha_Targets.MAPP +1456395_at X Ppargc1a PPAR-Alpha_Targets.MAPP +1437751_at X Ppargc1a PPAR-Alpha_Targets.MAPP +1449818_at X Abcb4 PPAR-Alpha_Targets.MAPP +1434329_s_at X Adipor2 PPAR-Alpha_Targets.MAPP +1437864_at X Adipor2 PPAR-Alpha_Targets.MAPP +Various L Various PPAR-Alpha_Targets.MAPP +1415996_at X Txnip PPAR-Alpha_Targets.MAPP +1415997_at X Txnip PPAR-Alpha_Targets.MAPP +1419105_at X Nr1h4 PPAR-Alpha_Targets.MAPP +1441915_s_at X 2310076L09Rik PPAR-Alpha_Targets.MAPP +1420983_at X Pctp PPAR-Alpha_Targets.MAPP +1420984_at X Pctp PPAR-Alpha_Targets.MAPP +1424011_at X Aqp9 PPAR-Alpha_Targets.MAPP 1421605_a_at X Aqp9 PPAR-Alpha_Targets.MAPP diff --git a/tools/php_pathvisio/createsvg.php b/tools/php_pathvisio/createsvg.php index db6eae62..a73e21bf 100644 --- a/tools/php_pathvisio/createsvg.php +++ b/tools/php_pathvisio/createsvg.php @@ -1,132 +1,132 @@ -"); -fwrite($svg, ""); -//imagefilledpolygon($im, $values, 3, 3); -// - - - -} - -$deel_factor = 10; -$doc_complete = new DOMDocument(); -$doc_complete->load('Hs_Fatty_Acid_Beta_Oxidation_1_BiGCaT.gpml'); -$entry1 = $doc_complete->getElementsByTagName("Graphics"); -$boardwidth = intval($entry1->item(0)->getAttribute("BoardWidth"))/$deel_factor; -$boardheight = intval($entry1->item(0)->getAttribute("BoardHeight"))/$deel_factor*4; -$svg = fopen('test.svg', 'w+'); -fwrite($svg, "\n - -\n\n"); - -//print arrows -$entries = $doc_complete->getElementsByTagName("Line"); -foreach ($entries as $entry){ - $start_x = intval($entry->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(0)->getAttribute("x"))/$deel_factor; - $start_y = intval($entry->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(0)->getAttribute("y"))/$deel_factor; - $stop_x = intval($entry->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(1)->getAttribute("x"))/$deel_factor; - $stop_y = intval($entry->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(1)->getAttribute("y"))/$deel_factor; - arrow($svg, $start_x, $start_y, $stop_x, $stop_y, 3, 3, 1); -} - - -//GeneProducts -$entries = $doc_complete->getElementsByTagName("GeneProduct"); -foreach ($entries as $entry){ - - $y_cor = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY"))/$deel_factor; - $x_cor = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterX"))/$deel_factor; - $width = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("Width"))/$deel_factor; - $height = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("Height"))/$deel_factor; - $x_cor = $x_cor-($width/2); - $y_cor = $y_cor-($height/2); - fwrite($svg, "\n\n"); - - $y_cor = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY"))/$deel_factor; - $x_cor = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterX"))/$deel_factor; - $font = "Century.ttf"; - $fontsize = 12; - $text = $entry->getAttribute("GeneID"); - $angle = 0; - $wordlengtharray = imagettfbbox($fontsize, 0, $font, $text); - $wordlength = $wordlengtharray[4]-$wordlengtharray[6]; - $wordheigtharray = imagettfbbox($fontsize, 0, $font, $text); - $wordheigth = $wordheightarray[7]-$wordheightarray[5]; - $x_cor = $x_cor - ($wordlength/2); - $y_cor = $y_cor + 5; - fwrite($svg, " $text - \n"); -} - -//Print labels -$entries = $doc_complete->getElementsByTagName("Label"); -foreach ($entries as $entry){ - $y_cor = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY"))/$deel_factor; - $x_cor = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterX"))/$deel_factor; - //$wordlength = strlen($entry->getAttribute("TextLabel")); - $fontsize = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("FontSize")); - $text = $entry->getAttribute("TextLabel"); - $font = $entry->getElementsByTagName("Graphics")->item(0)->getAttribute("FontName").".ttf"; - $hexcolor = $entry->getElementsByTagName("Graphics")->item(0)->getAttribute("Color"); - $r = hexdec(substr($hexcolor, 0,2)); - $g = hexdec(substr($hexcolor, 2,2)); - $b = hexdec(substr($hexcolor, 4,2)); - $angle = 0; - $wordlengtharray = imagettfbbox($fontsize, 0, $font, $text); - $wordlength = $wordlengtharray[4]-$wordlengtharray[6]; - $wordheigtharray = imagettfbbox($fontsize, 0, $font, $text); - $wordheigth = $wordheightarray[7]-$wordheightarray[5]; - $x_cor = $x_cor - ($wordlength/2); - $y_cor = $y_cor + ($wordheigth/2); - fwrite($svg, " $text - \n"); - //imagettftext($im,$fontsize, $angle, $x_cor-($wordlength/2), $y_cor-($wordheigth/2), $text_color, $font, $text); - // imagestring($im, 5, $x_cor, $y_cor, $text, $text_color); -} - - - -fwrite($svg, ""); -fclose($svg); - -print ""; - - - -?> +"); +fwrite($svg, ""); +//imagefilledpolygon($im, $values, 3, 3); +// + + + +} + +$deel_factor = 10; +$doc_complete = new DOMDocument(); +$doc_complete->load('Hs_Fatty_Acid_Beta_Oxidation_1_BiGCaT.gpml'); +$entry1 = $doc_complete->getElementsByTagName("Graphics"); +$boardwidth = intval($entry1->item(0)->getAttribute("BoardWidth"))/$deel_factor; +$boardheight = intval($entry1->item(0)->getAttribute("BoardHeight"))/$deel_factor*4; +$svg = fopen('test.svg', 'w+'); +fwrite($svg, "\n + +\n\n"); + +//print arrows +$entries = $doc_complete->getElementsByTagName("Line"); +foreach ($entries as $entry){ + $start_x = intval($entry->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(0)->getAttribute("x"))/$deel_factor; + $start_y = intval($entry->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(0)->getAttribute("y"))/$deel_factor; + $stop_x = intval($entry->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(1)->getAttribute("x"))/$deel_factor; + $stop_y = intval($entry->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(1)->getAttribute("y"))/$deel_factor; + arrow($svg, $start_x, $start_y, $stop_x, $stop_y, 3, 3, 1); +} + + +//GeneProducts +$entries = $doc_complete->getElementsByTagName("GeneProduct"); +foreach ($entries as $entry){ + + $y_cor = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY"))/$deel_factor; + $x_cor = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterX"))/$deel_factor; + $width = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("Width"))/$deel_factor; + $height = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("Height"))/$deel_factor; + $x_cor = $x_cor-($width/2); + $y_cor = $y_cor-($height/2); + fwrite($svg, "\n\n"); + + $y_cor = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY"))/$deel_factor; + $x_cor = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterX"))/$deel_factor; + $font = "Century.ttf"; + $fontsize = 12; + $text = $entry->getAttribute("GeneID"); + $angle = 0; + $wordlengtharray = imagettfbbox($fontsize, 0, $font, $text); + $wordlength = $wordlengtharray[4]-$wordlengtharray[6]; + $wordheigtharray = imagettfbbox($fontsize, 0, $font, $text); + $wordheigth = $wordheightarray[7]-$wordheightarray[5]; + $x_cor = $x_cor - ($wordlength/2); + $y_cor = $y_cor + 5; + fwrite($svg, " $text + \n"); +} + +//Print labels +$entries = $doc_complete->getElementsByTagName("Label"); +foreach ($entries as $entry){ + $y_cor = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY"))/$deel_factor; + $x_cor = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterX"))/$deel_factor; + //$wordlength = strlen($entry->getAttribute("TextLabel")); + $fontsize = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("FontSize")); + $text = $entry->getAttribute("TextLabel"); + $font = $entry->getElementsByTagName("Graphics")->item(0)->getAttribute("FontName").".ttf"; + $hexcolor = $entry->getElementsByTagName("Graphics")->item(0)->getAttribute("Color"); + $r = hexdec(substr($hexcolor, 0,2)); + $g = hexdec(substr($hexcolor, 2,2)); + $b = hexdec(substr($hexcolor, 4,2)); + $angle = 0; + $wordlengtharray = imagettfbbox($fontsize, 0, $font, $text); + $wordlength = $wordlengtharray[4]-$wordlengtharray[6]; + $wordheigtharray = imagettfbbox($fontsize, 0, $font, $text); + $wordheigth = $wordheightarray[7]-$wordheightarray[5]; + $x_cor = $x_cor - ($wordlength/2); + $y_cor = $y_cor + ($wordheigth/2); + fwrite($svg, " $text + \n"); + //imagettftext($im,$fontsize, $angle, $x_cor-($wordlength/2), $y_cor-($wordheigth/2), $text_color, $font, $text); + // imagestring($im, 5, $x_cor, $y_cor, $text, $text_color); +} + + + +fwrite($svg, ""); +fclose($svg); + +print ""; + + + +?> diff --git a/tools/php_pathvisio/draw_arrow.php b/tools/php_pathvisio/draw_arrow.php index e543fdb8..5fe69427 100644 --- a/tools/php_pathvisio/draw_arrow.php +++ b/tools/php_pathvisio/draw_arrow.php @@ -1,55 +1,55 @@ - - - + + + diff --git a/tools/php_pathvisio/merge_gpml.php b/tools/php_pathvisio/merge_gpml.php index c9d019f8..a4678c70 100644 --- a/tools/php_pathvisio/merge_gpml.php +++ b/tools/php_pathvisio/merge_gpml.php @@ -1,122 +1,122 @@ -load('Hs_Fatty_Acid_Beta_Oxidation_1_BiGCaT.gpml');//first file -$entry1 = $doc_complete->getElementsByTagName("Graphics"); -$windowwidth = intval($entry1->item(0)->getAttribute("WindowWidth")); -$windowheight = intval($entry1->item(0)->getAttribute("WindowHeight")); -$height1 = $windowheight; -$boardwidth = intval($entry1->item(0)->getAttribute("BoardWidth")); -$boardheight = intval($entry1->item(0)->getAttribute("BoardHeight")); - print "WindowWidth:". $windowwidth."
"; - print "WindowHeight:". $windowheight."
"; - print "BoardWidth:".$boardwidth ."
"; - print "BoardHeight:".$boardheight ."
"; - -$doc2->load('Hs_Fatty_Acid_Beta_Oxidation_2_BiGCaT.gpml'); -$entry2 = $doc2->getElementsByTagName("Graphics"); -print "
"; -if ($windowwidth < intval($entry2->item(0)->getAttribute("WindowWidth"))) - $windowwidth = intval($entry2->item(0)->getAttribute("WindowWidth")); -$windowheight = $windowheight + intval($entry2->item(0)->getAttribute("WindowHeight")); -$height2 = intval($entry2->item(0)->getAttribute("WindowHeight")); -if ($boardwidth < intval($entry2->item(0)->getAttribute("BoardWidth"))) - $boardwidth = intval($entry2->item(0)->getAttribute("BoardWidth")); -$boardheight = $boardheight + intval($entry2->item(0)->getAttribute("BoardHeight")); - print "WindowWidth:". $windowwidth."
"; - print "WindowHeight:". $windowheight."
"; - print "BoardWidth:".$boardwidth ."
"; - print "BoardHeight:".$boardheight ."
"; -$doc3->load('Hs_Fatty_Acid_Beta_Oxidation_3_BiGCaT.gpml'); -$entry3 = $doc3->getElementsByTagName("Graphics"); -print "
"; -if ($windowwidth < intval($entry3->item(0)->getAttribute("WindowWidth"))) - $windowwidth = intval($entry3->item(0)->getAttribute("WindowWidth")); -$windowheight = $windowheight + intval($entry3->item(0)->getAttribute("WindowHeight")); -if ($boardwidth < intval($entry3->item(0)->getAttribute("BoardWidth"))) - $boardwidth = intval($entry3->item(0)->getAttribute("BoardWidth")); -$boardheight = $boardheight + intval($entry3->item(0)->getAttribute("BoardHeight")); - print "WindowWidth:". $windowwidth."
"; - print "WindowHeight:". $windowheight."
"; - print "BoardWidth:".$boardwidth ."
"; - print "BoardHeight:".$boardheight ."
"; - -$entry1->item(0)->setAttribute("WindowWidth", $windowwidth); -$entry1->item(0)->setAttribute("WindowHeight", $windowheight); -$entry1->item(0)->setAttribute("BoardWidth", $boardwidth); -$entry1->item(0)->setAttribute("BoardHeight", $boardheight); - -//In the following section, the two final xml files are merged into the complete file -//To achieve this al GeneProduct nodes are merged. - -$attachpoint = $doc_complete->getElementsByTagName("Pathway"); -$attachnode = $attachpoint->item(0); -$entries = $doc2->getElementsByTagName("GeneProduct"); -foreach ($entries as $entry){ - $imported_node = $doc_complete->importNode($entry, TRUE); - $oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY")); - $imported_node->getElementsByTagName("Graphics")->item(0)->setAttribute("CenterY", $oldvalue + $height1); - $attachnode->appendChild($imported_node); -} - -$entries = $doc2->getElementsByTagName("Line"); -foreach ($entries as $entry){ - $imported_node = $doc_complete->importNode($entry, TRUE); - $oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(0)->getAttribute("y")); - $imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(0)->setAttribute("y", $oldvalue + $height1); -$oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(1)->getAttribute("y")); - $imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(1)->setAttribute("y", $oldvalue + $height1); - $attachnode->appendChild($imported_node); -} - -$entries = $doc2->getElementsByTagName("Label"); -foreach ($entries as $entry){ - $imported_node = $doc_complete->importNode($entry, TRUE); - $oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY")); - $imported_node->getElementsByTagName("Graphics")->item(0)->setAttribute("CenterY", $oldvalue + $height1); - $attachnode->appendChild($imported_node); -} - -$entries = $doc3->getElementsByTagName("GeneProduct"); -foreach ($entries as $entry){ - $imported_node = $doc_complete->importNode($entry, TRUE); - $oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY")); - $imported_node->getElementsByTagName("Graphics")->item(0)->setAttribute("CenterY", $oldvalue + $height1 + $height2); - $attachnode->appendChild($imported_node); -} - -$entries = $doc3->getElementsByTagName("Line"); -foreach ($entries as $entry){ - $imported_node = $doc_complete->importNode($entry, TRUE); - $oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(0)->getAttribute("y")); - $imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(0)->setAttribute("y", $oldvalue + $height1 + $height2); -$oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(1)->getAttribute("y")); - $imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(1)->setAttribute("y", $oldvalue + $height1 + $height2); - $attachnode->appendChild($imported_node); -} - -$entries = $doc3->getElementsByTagName("Label"); -foreach ($entries as $entry){ - $imported_node = $doc_complete->importNode($entry, TRUE); - $oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY")); - $imported_node->getElementsByTagName("Graphics")->item(0)->setAttribute("CenterY", $oldvalue + $height1 + $height2); - $attachnode->appendChild($imported_node); -} - -print $doc_complete->save('Hs_Fatty_Acid_Beta_Oxidation_all_BiGCaT.gpml'); - - -?> - +load('Hs_Fatty_Acid_Beta_Oxidation_1_BiGCaT.gpml');//first file +$entry1 = $doc_complete->getElementsByTagName("Graphics"); +$windowwidth = intval($entry1->item(0)->getAttribute("WindowWidth")); +$windowheight = intval($entry1->item(0)->getAttribute("WindowHeight")); +$height1 = $windowheight; +$boardwidth = intval($entry1->item(0)->getAttribute("BoardWidth")); +$boardheight = intval($entry1->item(0)->getAttribute("BoardHeight")); + print "WindowWidth:". $windowwidth."
"; + print "WindowHeight:". $windowheight."
"; + print "BoardWidth:".$boardwidth ."
"; + print "BoardHeight:".$boardheight ."
"; + +$doc2->load('Hs_Fatty_Acid_Beta_Oxidation_2_BiGCaT.gpml'); +$entry2 = $doc2->getElementsByTagName("Graphics"); +print "
"; +if ($windowwidth < intval($entry2->item(0)->getAttribute("WindowWidth"))) + $windowwidth = intval($entry2->item(0)->getAttribute("WindowWidth")); +$windowheight = $windowheight + intval($entry2->item(0)->getAttribute("WindowHeight")); +$height2 = intval($entry2->item(0)->getAttribute("WindowHeight")); +if ($boardwidth < intval($entry2->item(0)->getAttribute("BoardWidth"))) + $boardwidth = intval($entry2->item(0)->getAttribute("BoardWidth")); +$boardheight = $boardheight + intval($entry2->item(0)->getAttribute("BoardHeight")); + print "WindowWidth:". $windowwidth."
"; + print "WindowHeight:". $windowheight."
"; + print "BoardWidth:".$boardwidth ."
"; + print "BoardHeight:".$boardheight ."
"; +$doc3->load('Hs_Fatty_Acid_Beta_Oxidation_3_BiGCaT.gpml'); +$entry3 = $doc3->getElementsByTagName("Graphics"); +print "
"; +if ($windowwidth < intval($entry3->item(0)->getAttribute("WindowWidth"))) + $windowwidth = intval($entry3->item(0)->getAttribute("WindowWidth")); +$windowheight = $windowheight + intval($entry3->item(0)->getAttribute("WindowHeight")); +if ($boardwidth < intval($entry3->item(0)->getAttribute("BoardWidth"))) + $boardwidth = intval($entry3->item(0)->getAttribute("BoardWidth")); +$boardheight = $boardheight + intval($entry3->item(0)->getAttribute("BoardHeight")); + print "WindowWidth:". $windowwidth."
"; + print "WindowHeight:". $windowheight."
"; + print "BoardWidth:".$boardwidth ."
"; + print "BoardHeight:".$boardheight ."
"; + +$entry1->item(0)->setAttribute("WindowWidth", $windowwidth); +$entry1->item(0)->setAttribute("WindowHeight", $windowheight); +$entry1->item(0)->setAttribute("BoardWidth", $boardwidth); +$entry1->item(0)->setAttribute("BoardHeight", $boardheight); + +//In the following section, the two final xml files are merged into the complete file +//To achieve this al GeneProduct nodes are merged. + +$attachpoint = $doc_complete->getElementsByTagName("Pathway"); +$attachnode = $attachpoint->item(0); +$entries = $doc2->getElementsByTagName("GeneProduct"); +foreach ($entries as $entry){ + $imported_node = $doc_complete->importNode($entry, TRUE); + $oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY")); + $imported_node->getElementsByTagName("Graphics")->item(0)->setAttribute("CenterY", $oldvalue + $height1); + $attachnode->appendChild($imported_node); +} + +$entries = $doc2->getElementsByTagName("Line"); +foreach ($entries as $entry){ + $imported_node = $doc_complete->importNode($entry, TRUE); + $oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(0)->getAttribute("y")); + $imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(0)->setAttribute("y", $oldvalue + $height1); +$oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(1)->getAttribute("y")); + $imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(1)->setAttribute("y", $oldvalue + $height1); + $attachnode->appendChild($imported_node); +} + +$entries = $doc2->getElementsByTagName("Label"); +foreach ($entries as $entry){ + $imported_node = $doc_complete->importNode($entry, TRUE); + $oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY")); + $imported_node->getElementsByTagName("Graphics")->item(0)->setAttribute("CenterY", $oldvalue + $height1); + $attachnode->appendChild($imported_node); +} + +$entries = $doc3->getElementsByTagName("GeneProduct"); +foreach ($entries as $entry){ + $imported_node = $doc_complete->importNode($entry, TRUE); + $oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY")); + $imported_node->getElementsByTagName("Graphics")->item(0)->setAttribute("CenterY", $oldvalue + $height1 + $height2); + $attachnode->appendChild($imported_node); +} + +$entries = $doc3->getElementsByTagName("Line"); +foreach ($entries as $entry){ + $imported_node = $doc_complete->importNode($entry, TRUE); + $oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(0)->getAttribute("y")); + $imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(0)->setAttribute("y", $oldvalue + $height1 + $height2); +$oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(1)->getAttribute("y")); + $imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(1)->setAttribute("y", $oldvalue + $height1 + $height2); + $attachnode->appendChild($imported_node); +} + +$entries = $doc3->getElementsByTagName("Label"); +foreach ($entries as $entry){ + $imported_node = $doc_complete->importNode($entry, TRUE); + $oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY")); + $imported_node->getElementsByTagName("Graphics")->item(0)->setAttribute("CenterY", $oldvalue + $height1 + $height2); + $attachnode->appendChild($imported_node); +} + +print $doc_complete->save('Hs_Fatty_Acid_Beta_Oxidation_all_BiGCaT.gpml'); + + +?> + diff --git a/tools/php_pathvisio/pathvisio.php b/tools/php_pathvisio/pathvisio.php index b6a5c7ec..b2aeed51 100644 --- a/tools/php_pathvisio/pathvisio.php +++ b/tools/php_pathvisio/pathvisio.php @@ -1,119 +1,119 @@ -load($_FILES['userfile']['tmp_name']); -$entry1 = $doc_complete->getElementsByTagName("Graphics"); -$boardwidth = intval($entry1->item(0)->getAttribute("BoardWidth"))/15; -$boardheight = intval($entry1->item(0)->getAttribute("BoardHeight"))/15; - - -$im = @imagecreatetruecolor($boardwidth,$boardheight) - or die("Cannot Initialize new GD image stream"); -$background_color = imagecolorallocate($im, 255, 255, 255); -imagefilledrectangle($im, 0, 0, $boardwidth,$boardheight, $background_color); -$text_color = imagecolorallocate($im, 233, 14, 91); - -//Print labels -$entries = $doc_complete->getElementsByTagName("Label"); -foreach ($entries as $entry){ - $y_cor = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY"))/15; - $x_cor = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterX"))/15; - //$wordlength = strlen($entry->getAttribute("TextLabel")); - $fontsize = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("FontSize")); - $text = $entry->getAttribute("TextLabel"); - $font = $entry->getElementsByTagName("Graphics")->item(0)->getAttribute("FontName").".ttf"; - $hexcolor = $entry->getElementsByTagName("Graphics")->item(0)->getAttribute("Color"); - $r = hexdec(substr($hexcolor, 0,2)); - $g = hexdec(substr($hexcolor, 2,2)); - $b = hexdec(substr($hexcolor, 4,2)); - $text_color = imagecolorallocate($im, $r, $g, $b); - $angle = 0; - $wordlengtharray = imagettfbbox($fontsize, 0, $font, $text); - $wordlength = $wordlengtharray[4]-$wordlengtharray[6]; - $wordheigtharray = imagettfbbox($fontsize, 0, $font, $text); - $wordheigth = $wordheightarray[7]-$wordheightarray[5]; - imagettftext($im,$fontsize, $angle, $x_cor-($wordlength/2), $y_cor-($wordheigth/2), $text_color, $font, $text); -// imagestring($im, 5, $x_cor, $y_cor, $text, $text_color); -} - -//print geneproducts -$entries = $doc_complete->getElementsByTagName("GeneProduct"); -foreach ($entries as $entry){ - $y_cor = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY"))/15; - $x_cor = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterX"))/15; - $width = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("Width"))/15; - $height = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("Height"))/15; - imagerectangle ($im, $x_cor-($width/2), $y_cor-($height/2), $x_cor+($width/2), $y_cor+($height/2), 1); - $fontsize = 12; - $text = $entry->getAttribute("GeneID"); - $angle = 0; - $wordlengtharray = imagettfbbox($fontsize, 0, $font, $text); - $wordlength = $wordlengtharray[4]-$wordlengtharray[6]; - $wordheigtharray = imagettfbbox($fontsize, 0, $font, $text); - $wordheigth = $wordheightarray[7]-$wordheightarray[5]; - imagettftext($im,$fontsize, $angle, $x_cor-($wordlength/2), $y_cor-($wordheigth/2), $text_color, $font, $text); -// imagestring($im, 5, $x_cor-($width/2), $y_cor-($height/2), $text , $text_color); -} - -//print arrows -$entries = $doc_complete->getElementsByTagName("Line"); -foreach ($entries as $entry){ - - $start_x = intval($entry->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(0)->getAttribute("x"))/15; - $start_y = intval($entry->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(0)->getAttribute("y"))/15; - $stop_x = intval($entry->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(1)->getAttribute("x"))/15; - $stop_y = intval($entry->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(1)->getAttribute("y"))/15; - arrow($im, $start_x, $start_y, $stop_x, $stop_y, 3, 3, 1); - -} - -//Infobox - -imagestring($im, 5, 500, 1, "Name: ".$doc_complete->getElementsByTagName("Pathway")->item(0)->getAttribute("Name"), $text_color); -imagestring($im, 5, 500, 15, "Author: ".$doc_complete->getElementsByTagName("Pathway")->item(0)->getAttribute("Author"), $text_color); -imagestring($im, 5, 500, 30, "Maintained by: ".$doc_complete->getElementsByTagName("Pathway")->item(0)->getAttribute("Maintained-By"), $text_color); -imagestring($im, 5, 500, 45, "Email: ".$doc_complete->getElementsByTagName("Pathway")->item(0)->getAttribute("Email"), $text_color); -imagestring($im, 5, 500, 60, "Availability: ".$doc_complete->getElementsByTagName("Pathway")->item(0)->getAttribute("Availability"), $text_color); -imagestring($im, 5, 500, 75, "Last Modified: ".$doc_complete->getElementsByTagName("Pathway")->item(0)->getAttribute("Last-Modified"), $text_color); - - - - - -header("Content-type: image/png"); -imagepng($im); -imagedestroy($im); -?> - +load($_FILES['userfile']['tmp_name']); +$entry1 = $doc_complete->getElementsByTagName("Graphics"); +$boardwidth = intval($entry1->item(0)->getAttribute("BoardWidth"))/15; +$boardheight = intval($entry1->item(0)->getAttribute("BoardHeight"))/15; + + +$im = @imagecreatetruecolor($boardwidth,$boardheight) + or die("Cannot Initialize new GD image stream"); +$background_color = imagecolorallocate($im, 255, 255, 255); +imagefilledrectangle($im, 0, 0, $boardwidth,$boardheight, $background_color); +$text_color = imagecolorallocate($im, 233, 14, 91); + +//Print labels +$entries = $doc_complete->getElementsByTagName("Label"); +foreach ($entries as $entry){ + $y_cor = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY"))/15; + $x_cor = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterX"))/15; + //$wordlength = strlen($entry->getAttribute("TextLabel")); + $fontsize = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("FontSize")); + $text = $entry->getAttribute("TextLabel"); + $font = $entry->getElementsByTagName("Graphics")->item(0)->getAttribute("FontName").".ttf"; + $hexcolor = $entry->getElementsByTagName("Graphics")->item(0)->getAttribute("Color"); + $r = hexdec(substr($hexcolor, 0,2)); + $g = hexdec(substr($hexcolor, 2,2)); + $b = hexdec(substr($hexcolor, 4,2)); + $text_color = imagecolorallocate($im, $r, $g, $b); + $angle = 0; + $wordlengtharray = imagettfbbox($fontsize, 0, $font, $text); + $wordlength = $wordlengtharray[4]-$wordlengtharray[6]; + $wordheigtharray = imagettfbbox($fontsize, 0, $font, $text); + $wordheigth = $wordheightarray[7]-$wordheightarray[5]; + imagettftext($im,$fontsize, $angle, $x_cor-($wordlength/2), $y_cor-($wordheigth/2), $text_color, $font, $text); +// imagestring($im, 5, $x_cor, $y_cor, $text, $text_color); +} + +//print geneproducts +$entries = $doc_complete->getElementsByTagName("GeneProduct"); +foreach ($entries as $entry){ + $y_cor = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY"))/15; + $x_cor = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterX"))/15; + $width = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("Width"))/15; + $height = intval($entry->getElementsByTagName("Graphics")->item(0)->getAttribute("Height"))/15; + imagerectangle ($im, $x_cor-($width/2), $y_cor-($height/2), $x_cor+($width/2), $y_cor+($height/2), 1); + $fontsize = 12; + $text = $entry->getAttribute("GeneID"); + $angle = 0; + $wordlengtharray = imagettfbbox($fontsize, 0, $font, $text); + $wordlength = $wordlengtharray[4]-$wordlengtharray[6]; + $wordheigtharray = imagettfbbox($fontsize, 0, $font, $text); + $wordheigth = $wordheightarray[7]-$wordheightarray[5]; + imagettftext($im,$fontsize, $angle, $x_cor-($wordlength/2), $y_cor-($wordheigth/2), $text_color, $font, $text); +// imagestring($im, 5, $x_cor-($width/2), $y_cor-($height/2), $text , $text_color); +} + +//print arrows +$entries = $doc_complete->getElementsByTagName("Line"); +foreach ($entries as $entry){ + + $start_x = intval($entry->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(0)->getAttribute("x"))/15; + $start_y = intval($entry->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(0)->getAttribute("y"))/15; + $stop_x = intval($entry->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(1)->getAttribute("x"))/15; + $stop_y = intval($entry->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(1)->getAttribute("y"))/15; + arrow($im, $start_x, $start_y, $stop_x, $stop_y, 3, 3, 1); + +} + +//Infobox + +imagestring($im, 5, 500, 1, "Name: ".$doc_complete->getElementsByTagName("Pathway")->item(0)->getAttribute("Name"), $text_color); +imagestring($im, 5, 500, 15, "Author: ".$doc_complete->getElementsByTagName("Pathway")->item(0)->getAttribute("Author"), $text_color); +imagestring($im, 5, 500, 30, "Maintained by: ".$doc_complete->getElementsByTagName("Pathway")->item(0)->getAttribute("Maintained-By"), $text_color); +imagestring($im, 5, 500, 45, "Email: ".$doc_complete->getElementsByTagName("Pathway")->item(0)->getAttribute("Email"), $text_color); +imagestring($im, 5, 500, 60, "Availability: ".$doc_complete->getElementsByTagName("Pathway")->item(0)->getAttribute("Availability"), $text_color); +imagestring($im, 5, 500, 75, "Last Modified: ".$doc_complete->getElementsByTagName("Pathway")->item(0)->getAttribute("Last-Modified"), $text_color); + + + + + +header("Content-type: image/png"); +imagepng($im); +imagedestroy($im); +?> + diff --git a/tools/php_pathvisio/readxml.php b/tools/php_pathvisio/readxml.php index 74d8cf7f..b92203fb 100644 --- a/tools/php_pathvisio/readxml.php +++ b/tools/php_pathvisio/readxml.php @@ -1,62 +1,62 @@ -attributes() as $a => $b) - print "$a => $b
"; -foreach ($xml1->{"Graphics"}->attributes() as $a => $b) - print "$a => $b
"; -print "
"; -$xml2 = simplexml_load_file('Hs_Fatty_Acid_Beta_Oxidation_2_BiGCaT.gpml'); - -foreach ($xml2->attributes() as $a => $b) - print "$a => $b
"; -foreach ($xml2->{"Graphics"}->attributes() as $a => $b) - print "$a => $b
"; -print "
"; -$xml3 = simplexml_load_file('Hs_Fatty_Acid_Beta_Oxidation_3_BiGCaT.gpml'); - -foreach ($xml3->attributes() as $a => $b) - print "$a => $b
"; -foreach ($xml3->{"Graphics"}->attributes() as $a => $b) - print "$a => $b
"; -print "
"; - -$xml = ""; -$complete = new SimpleXMLElement($xml); -$complete->addAttribute('Name', 'Fatty Acid Beta Oxidation complete'); -$complete->addAttribute('Data-Source', $xml1['Data-Source']); -$datestamp = date("d/m/y"); -$complete->addAttribute('Version', $xml1['Last-Modified']); -$complete->addAttribute('Author', $xml1['Author']); -$complete->addAttribute('Maintained-By', $xml1['Maintained-By']); -$complete->addAttribute('Email', $xml1['Email']); -$complete->addAttribute('Availability', $xml1['Availability']); -$complete->addAttribute('Last-Modified', $datestamp); -$complete->addChild('Graphics'); - -$maxWindowWidth = intval($xml1->{"Graphics"}['WindowWidth']); -$maxWindowHeight = intval($xml1->{"Graphics"}['WindowHeight']); -if ($maxWindowHeight < intval($xml2->{"Graphics"}['WindowHeight'])) $maxWindowHeight = intval($xml2->{"Graphics"}['WindowHeight']); -if ($maxWindowHeight < intval($xml3->{"Graphics"}['WindowHeight'])) $maxWindowHeight = intval($xml3->{"Graphics"}['WindowHeight']); -if ($maxWindowWidth < intval($xml2->{"Graphics"}['WindowWidth'])) $maxWindowWidth = intval($xml2->{"Graphics"}['WindowWidth']); -if ($maxWindowWidth < intval($xml3->{"Graphics"}['WindowWidth'])) $maxWindowWidth = intval($xml3->{"Graphics"}['WindowWidth']); -$complete->{"Graphics"}->addAttribute('WindowWidth', $maxWindowWidth); -$complete->{"Graphics"}->addAttribute('WindowHeight', $maxWindowHeight); -$teller = 0; -foreach($xml2->GeneProduct as $geneproduct){ - $teller++; - print "$teller
"; - $current_gp = $complete->addChild('GeneProduct'); - foreach ($geneproduct->attributes() as $a => $b) $current_gp->addAttribute(strval($a), strval($b)); - $current_gp->addChild("Notes", $xml2->GeneProduct->Notes); - foreach($geneproduct->Notes->attributes() as $a => $b) $current_gp->Notes->addAttribute($a, $b); - $current_gp->addChild("Comment", $xml2->GeneProduct->Comment); - foreach($geneproduct->Comment->attributes() as $a => $b) $current_gp->Comment->addAttribute($a, $b); - $current_gp->addChild("Graphics", $xml2->GeneProduct->Graphics); - foreach($xml2->Graphics->attributes() as $a => $b) $current_gp->Graphics->addAttribute($a, $b); -} -print $complete->asXML("test.xml"); - - - -?> +attributes() as $a => $b) + print "$a => $b
"; +foreach ($xml1->{"Graphics"}->attributes() as $a => $b) + print "$a => $b
"; +print "
"; +$xml2 = simplexml_load_file('Hs_Fatty_Acid_Beta_Oxidation_2_BiGCaT.gpml'); + +foreach ($xml2->attributes() as $a => $b) + print "$a => $b
"; +foreach ($xml2->{"Graphics"}->attributes() as $a => $b) + print "$a => $b
"; +print "
"; +$xml3 = simplexml_load_file('Hs_Fatty_Acid_Beta_Oxidation_3_BiGCaT.gpml'); + +foreach ($xml3->attributes() as $a => $b) + print "$a => $b
"; +foreach ($xml3->{"Graphics"}->attributes() as $a => $b) + print "$a => $b
"; +print "
"; + +$xml = ""; +$complete = new SimpleXMLElement($xml); +$complete->addAttribute('Name', 'Fatty Acid Beta Oxidation complete'); +$complete->addAttribute('Data-Source', $xml1['Data-Source']); +$datestamp = date("d/m/y"); +$complete->addAttribute('Version', $xml1['Last-Modified']); +$complete->addAttribute('Author', $xml1['Author']); +$complete->addAttribute('Maintained-By', $xml1['Maintained-By']); +$complete->addAttribute('Email', $xml1['Email']); +$complete->addAttribute('Availability', $xml1['Availability']); +$complete->addAttribute('Last-Modified', $datestamp); +$complete->addChild('Graphics'); + +$maxWindowWidth = intval($xml1->{"Graphics"}['WindowWidth']); +$maxWindowHeight = intval($xml1->{"Graphics"}['WindowHeight']); +if ($maxWindowHeight < intval($xml2->{"Graphics"}['WindowHeight'])) $maxWindowHeight = intval($xml2->{"Graphics"}['WindowHeight']); +if ($maxWindowHeight < intval($xml3->{"Graphics"}['WindowHeight'])) $maxWindowHeight = intval($xml3->{"Graphics"}['WindowHeight']); +if ($maxWindowWidth < intval($xml2->{"Graphics"}['WindowWidth'])) $maxWindowWidth = intval($xml2->{"Graphics"}['WindowWidth']); +if ($maxWindowWidth < intval($xml3->{"Graphics"}['WindowWidth'])) $maxWindowWidth = intval($xml3->{"Graphics"}['WindowWidth']); +$complete->{"Graphics"}->addAttribute('WindowWidth', $maxWindowWidth); +$complete->{"Graphics"}->addAttribute('WindowHeight', $maxWindowHeight); +$teller = 0; +foreach($xml2->GeneProduct as $geneproduct){ + $teller++; + print "$teller
"; + $current_gp = $complete->addChild('GeneProduct'); + foreach ($geneproduct->attributes() as $a => $b) $current_gp->addAttribute(strval($a), strval($b)); + $current_gp->addChild("Notes", $xml2->GeneProduct->Notes); + foreach($geneproduct->Notes->attributes() as $a => $b) $current_gp->Notes->addAttribute($a, $b); + $current_gp->addChild("Comment", $xml2->GeneProduct->Comment); + foreach($geneproduct->Comment->attributes() as $a => $b) $current_gp->Comment->addAttribute($a, $b); + $current_gp->addChild("Graphics", $xml2->GeneProduct->Graphics); + foreach($xml2->Graphics->attributes() as $a => $b) $current_gp->Graphics->addAttribute($a, $b); +} +print $complete->asXML("test.xml"); + + + +?> diff --git a/tools/php_pathvisio/readxml_dom.php b/tools/php_pathvisio/readxml_dom.php index c9d019f8..a4678c70 100644 --- a/tools/php_pathvisio/readxml_dom.php +++ b/tools/php_pathvisio/readxml_dom.php @@ -1,122 +1,122 @@ -load('Hs_Fatty_Acid_Beta_Oxidation_1_BiGCaT.gpml');//first file -$entry1 = $doc_complete->getElementsByTagName("Graphics"); -$windowwidth = intval($entry1->item(0)->getAttribute("WindowWidth")); -$windowheight = intval($entry1->item(0)->getAttribute("WindowHeight")); -$height1 = $windowheight; -$boardwidth = intval($entry1->item(0)->getAttribute("BoardWidth")); -$boardheight = intval($entry1->item(0)->getAttribute("BoardHeight")); - print "WindowWidth:". $windowwidth."
"; - print "WindowHeight:". $windowheight."
"; - print "BoardWidth:".$boardwidth ."
"; - print "BoardHeight:".$boardheight ."
"; - -$doc2->load('Hs_Fatty_Acid_Beta_Oxidation_2_BiGCaT.gpml'); -$entry2 = $doc2->getElementsByTagName("Graphics"); -print "
"; -if ($windowwidth < intval($entry2->item(0)->getAttribute("WindowWidth"))) - $windowwidth = intval($entry2->item(0)->getAttribute("WindowWidth")); -$windowheight = $windowheight + intval($entry2->item(0)->getAttribute("WindowHeight")); -$height2 = intval($entry2->item(0)->getAttribute("WindowHeight")); -if ($boardwidth < intval($entry2->item(0)->getAttribute("BoardWidth"))) - $boardwidth = intval($entry2->item(0)->getAttribute("BoardWidth")); -$boardheight = $boardheight + intval($entry2->item(0)->getAttribute("BoardHeight")); - print "WindowWidth:". $windowwidth."
"; - print "WindowHeight:". $windowheight."
"; - print "BoardWidth:".$boardwidth ."
"; - print "BoardHeight:".$boardheight ."
"; -$doc3->load('Hs_Fatty_Acid_Beta_Oxidation_3_BiGCaT.gpml'); -$entry3 = $doc3->getElementsByTagName("Graphics"); -print "
"; -if ($windowwidth < intval($entry3->item(0)->getAttribute("WindowWidth"))) - $windowwidth = intval($entry3->item(0)->getAttribute("WindowWidth")); -$windowheight = $windowheight + intval($entry3->item(0)->getAttribute("WindowHeight")); -if ($boardwidth < intval($entry3->item(0)->getAttribute("BoardWidth"))) - $boardwidth = intval($entry3->item(0)->getAttribute("BoardWidth")); -$boardheight = $boardheight + intval($entry3->item(0)->getAttribute("BoardHeight")); - print "WindowWidth:". $windowwidth."
"; - print "WindowHeight:". $windowheight."
"; - print "BoardWidth:".$boardwidth ."
"; - print "BoardHeight:".$boardheight ."
"; - -$entry1->item(0)->setAttribute("WindowWidth", $windowwidth); -$entry1->item(0)->setAttribute("WindowHeight", $windowheight); -$entry1->item(0)->setAttribute("BoardWidth", $boardwidth); -$entry1->item(0)->setAttribute("BoardHeight", $boardheight); - -//In the following section, the two final xml files are merged into the complete file -//To achieve this al GeneProduct nodes are merged. - -$attachpoint = $doc_complete->getElementsByTagName("Pathway"); -$attachnode = $attachpoint->item(0); -$entries = $doc2->getElementsByTagName("GeneProduct"); -foreach ($entries as $entry){ - $imported_node = $doc_complete->importNode($entry, TRUE); - $oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY")); - $imported_node->getElementsByTagName("Graphics")->item(0)->setAttribute("CenterY", $oldvalue + $height1); - $attachnode->appendChild($imported_node); -} - -$entries = $doc2->getElementsByTagName("Line"); -foreach ($entries as $entry){ - $imported_node = $doc_complete->importNode($entry, TRUE); - $oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(0)->getAttribute("y")); - $imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(0)->setAttribute("y", $oldvalue + $height1); -$oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(1)->getAttribute("y")); - $imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(1)->setAttribute("y", $oldvalue + $height1); - $attachnode->appendChild($imported_node); -} - -$entries = $doc2->getElementsByTagName("Label"); -foreach ($entries as $entry){ - $imported_node = $doc_complete->importNode($entry, TRUE); - $oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY")); - $imported_node->getElementsByTagName("Graphics")->item(0)->setAttribute("CenterY", $oldvalue + $height1); - $attachnode->appendChild($imported_node); -} - -$entries = $doc3->getElementsByTagName("GeneProduct"); -foreach ($entries as $entry){ - $imported_node = $doc_complete->importNode($entry, TRUE); - $oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY")); - $imported_node->getElementsByTagName("Graphics")->item(0)->setAttribute("CenterY", $oldvalue + $height1 + $height2); - $attachnode->appendChild($imported_node); -} - -$entries = $doc3->getElementsByTagName("Line"); -foreach ($entries as $entry){ - $imported_node = $doc_complete->importNode($entry, TRUE); - $oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(0)->getAttribute("y")); - $imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(0)->setAttribute("y", $oldvalue + $height1 + $height2); -$oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(1)->getAttribute("y")); - $imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(1)->setAttribute("y", $oldvalue + $height1 + $height2); - $attachnode->appendChild($imported_node); -} - -$entries = $doc3->getElementsByTagName("Label"); -foreach ($entries as $entry){ - $imported_node = $doc_complete->importNode($entry, TRUE); - $oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY")); - $imported_node->getElementsByTagName("Graphics")->item(0)->setAttribute("CenterY", $oldvalue + $height1 + $height2); - $attachnode->appendChild($imported_node); -} - -print $doc_complete->save('Hs_Fatty_Acid_Beta_Oxidation_all_BiGCaT.gpml'); - - -?> - +load('Hs_Fatty_Acid_Beta_Oxidation_1_BiGCaT.gpml');//first file +$entry1 = $doc_complete->getElementsByTagName("Graphics"); +$windowwidth = intval($entry1->item(0)->getAttribute("WindowWidth")); +$windowheight = intval($entry1->item(0)->getAttribute("WindowHeight")); +$height1 = $windowheight; +$boardwidth = intval($entry1->item(0)->getAttribute("BoardWidth")); +$boardheight = intval($entry1->item(0)->getAttribute("BoardHeight")); + print "WindowWidth:". $windowwidth."
"; + print "WindowHeight:". $windowheight."
"; + print "BoardWidth:".$boardwidth ."
"; + print "BoardHeight:".$boardheight ."
"; + +$doc2->load('Hs_Fatty_Acid_Beta_Oxidation_2_BiGCaT.gpml'); +$entry2 = $doc2->getElementsByTagName("Graphics"); +print "
"; +if ($windowwidth < intval($entry2->item(0)->getAttribute("WindowWidth"))) + $windowwidth = intval($entry2->item(0)->getAttribute("WindowWidth")); +$windowheight = $windowheight + intval($entry2->item(0)->getAttribute("WindowHeight")); +$height2 = intval($entry2->item(0)->getAttribute("WindowHeight")); +if ($boardwidth < intval($entry2->item(0)->getAttribute("BoardWidth"))) + $boardwidth = intval($entry2->item(0)->getAttribute("BoardWidth")); +$boardheight = $boardheight + intval($entry2->item(0)->getAttribute("BoardHeight")); + print "WindowWidth:". $windowwidth."
"; + print "WindowHeight:". $windowheight."
"; + print "BoardWidth:".$boardwidth ."
"; + print "BoardHeight:".$boardheight ."
"; +$doc3->load('Hs_Fatty_Acid_Beta_Oxidation_3_BiGCaT.gpml'); +$entry3 = $doc3->getElementsByTagName("Graphics"); +print "
"; +if ($windowwidth < intval($entry3->item(0)->getAttribute("WindowWidth"))) + $windowwidth = intval($entry3->item(0)->getAttribute("WindowWidth")); +$windowheight = $windowheight + intval($entry3->item(0)->getAttribute("WindowHeight")); +if ($boardwidth < intval($entry3->item(0)->getAttribute("BoardWidth"))) + $boardwidth = intval($entry3->item(0)->getAttribute("BoardWidth")); +$boardheight = $boardheight + intval($entry3->item(0)->getAttribute("BoardHeight")); + print "WindowWidth:". $windowwidth."
"; + print "WindowHeight:". $windowheight."
"; + print "BoardWidth:".$boardwidth ."
"; + print "BoardHeight:".$boardheight ."
"; + +$entry1->item(0)->setAttribute("WindowWidth", $windowwidth); +$entry1->item(0)->setAttribute("WindowHeight", $windowheight); +$entry1->item(0)->setAttribute("BoardWidth", $boardwidth); +$entry1->item(0)->setAttribute("BoardHeight", $boardheight); + +//In the following section, the two final xml files are merged into the complete file +//To achieve this al GeneProduct nodes are merged. + +$attachpoint = $doc_complete->getElementsByTagName("Pathway"); +$attachnode = $attachpoint->item(0); +$entries = $doc2->getElementsByTagName("GeneProduct"); +foreach ($entries as $entry){ + $imported_node = $doc_complete->importNode($entry, TRUE); + $oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY")); + $imported_node->getElementsByTagName("Graphics")->item(0)->setAttribute("CenterY", $oldvalue + $height1); + $attachnode->appendChild($imported_node); +} + +$entries = $doc2->getElementsByTagName("Line"); +foreach ($entries as $entry){ + $imported_node = $doc_complete->importNode($entry, TRUE); + $oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(0)->getAttribute("y")); + $imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(0)->setAttribute("y", $oldvalue + $height1); +$oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(1)->getAttribute("y")); + $imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(1)->setAttribute("y", $oldvalue + $height1); + $attachnode->appendChild($imported_node); +} + +$entries = $doc2->getElementsByTagName("Label"); +foreach ($entries as $entry){ + $imported_node = $doc_complete->importNode($entry, TRUE); + $oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY")); + $imported_node->getElementsByTagName("Graphics")->item(0)->setAttribute("CenterY", $oldvalue + $height1); + $attachnode->appendChild($imported_node); +} + +$entries = $doc3->getElementsByTagName("GeneProduct"); +foreach ($entries as $entry){ + $imported_node = $doc_complete->importNode($entry, TRUE); + $oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY")); + $imported_node->getElementsByTagName("Graphics")->item(0)->setAttribute("CenterY", $oldvalue + $height1 + $height2); + $attachnode->appendChild($imported_node); +} + +$entries = $doc3->getElementsByTagName("Line"); +foreach ($entries as $entry){ + $imported_node = $doc_complete->importNode($entry, TRUE); + $oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(0)->getAttribute("y")); + $imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(0)->setAttribute("y", $oldvalue + $height1 + $height2); +$oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(1)->getAttribute("y")); + $imported_node->getElementsByTagName("Graphics")->item(0)->getElementsByTagName("Point")->item(1)->setAttribute("y", $oldvalue + $height1 + $height2); + $attachnode->appendChild($imported_node); +} + +$entries = $doc3->getElementsByTagName("Label"); +foreach ($entries as $entry){ + $imported_node = $doc_complete->importNode($entry, TRUE); + $oldvalue = intval($imported_node->getElementsByTagName("Graphics")->item(0)->getAttribute("CenterY")); + $imported_node->getElementsByTagName("Graphics")->item(0)->setAttribute("CenterY", $oldvalue + $height1 + $height2); + $attachnode->appendChild($imported_node); +} + +print $doc_complete->save('Hs_Fatty_Acid_Beta_Oxidation_all_BiGCaT.gpml'); + + +?> + diff --git a/tools/php_pathvisio/test.php b/tools/php_pathvisio/test.php index 588cd5d3..075f4411 100644 --- a/tools/php_pathvisio/test.php +++ b/tools/php_pathvisio/test.php @@ -1,5 +1,5 @@ - "\n"); -echo http_build_query($data); -?> - + "\n"); +echo http_build_query($data); +?> + diff --git a/tools/php_pathvisio/testserver.php b/tools/php_pathvisio/testserver.php index 6007ce52..95d84c67 100644 --- a/tools/php_pathvisio/testserver.php +++ b/tools/php_pathvisio/testserver.php @@ -1,4 +1,4 @@ -"; - print_r($_SERVER); -?> +"; + print_r($_SERVER); +?> diff --git a/tools/php_pathvisio/view_gpml.php b/tools/php_pathvisio/view_gpml.php index a5659be0..d435fa96 100644 --- a/tools/php_pathvisio/view_gpml.php +++ b/tools/php_pathvisio/view_gpml.php @@ -1,9 +1,9 @@ -
- Upload gpml file: - -
- -

Nog te doen

-* Validatie GPML bestand - - +
+ Upload gpml file: + +
+ +

Nog te doen

+* Validatie GPML bestand + + diff --git a/tools/project2008/org/pathvisio/plugins/project2008/GoTermDistributionGUI.java b/tools/project2008/org/pathvisio/plugins/project2008/GoTermDistributionGUI.java index f8b93c16..1fb794e2 100644 --- a/tools/project2008/org/pathvisio/plugins/project2008/GoTermDistributionGUI.java +++ b/tools/project2008/org/pathvisio/plugins/project2008/GoTermDistributionGUI.java @@ -1,240 +1,240 @@ -// PathVisio, -// a tool for data visualization and analysis using Biological Pathways -// Copyright 2006-2011 BiGCaT Bioinformatics -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -package org.pathvisio.plugins.project2008; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.File; -import java.util.HashSet; -import java.util.Set; -import javax.swing.AbstractButton; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTree; -import javax.swing.tree.TreeSelectionModel; -import org.pathvisio.data.DataException; -import org.pathvisio.go.GoMap; -import org.pathvisio.go.GoReader; -import org.pathvisio.go.GoTerm; -import org.pathvisio.go.GoTreeModel; -import org.pathvisio.model.ConverterException; - -/** - * This program shows the distribution of GO Terms. It also shows how much - * genes it contains; and how much of these genes are found in the pathways. - */ -public class GoTermDistributionGUI { - - // make 2 private variables. The first one a set of strings "genidInPway", - // which will be loaded with all the (ensemble formatted) genid's found - // in the loaded pathways. - // The second one, a map with a String as key and a GoTerm as value "treeString_GoTerm" - // will be loaded with the Strings that represent the tree values as a key, and the - // corresponding GoTerm. - private Set genidInPway = new HashSet(); - private GoReader goReader = null; - private boolean pwaysRead = false; - private GoMap goMap = null; - - private String martexport; - private String pgdb; - private String pathwayroot; - - /** - * - * The program requires 4 args: - * Gene ontology database (e.g. "C:\\gene_ontology.obo") - * Pathway database (e.g. "C:\\databases\\Rn_39_34i.pgdb") - * Pathways (e.g. "C:\\WPClient\\Rattus_norvegicus") - * Table from GOid to Ensembl (e.g. C:\\mart_export1.txt") * - */ - public static void main(String[] args) throws DataException, ConverterException - { - GoTermDistributionGUI x = new GoTermDistributionGUI( - new File (args[0]), args[1], args[2], args[3]); - x.run(); - } - - public static void goTermDistribution(String[]args,String[]organism) throws DataException, ConverterException - { - GoTermDistributionGUI x = new GoTermDistributionGUI( - new File (args[3]), args[0] + organism[0], args[1] + organism[1], args[4]); - x.run(); - } - - public GoTermDistributionGUI(File oboFile, - String pgdb, - String pathwayroot, String martexport) - { - goReader = new GoReader (oboFile); - this.pgdb = pgdb; - this.martexport = martexport; - this.pathwayroot = pathwayroot; - } - - public void readPathwayData() - { - try - { - genidInPway = GenidPway.getGenidPways(pgdb, pathwayroot); - } - catch(DataException e) - { - System.out.println("Error!"); - } - catch(ConverterException e) - { - System.out.println("Error!"); - } - - System.out.println("Pathways read"); - - goMap = new GoMap (new File (martexport)); - - goMap.calculateNM (goReader.getRoots(), genidInPway); - - pwaysRead = true; - } - - public void run () throws DataException, ConverterException - { - // create a new frame - final JFrame frame = new JFrame("GOTerm Distribution"); - - // When click on exit, exit the frame - frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); - - // set the size of the frame - frame.setSize(350,570); - frame.setLayout(new BorderLayout()); - - // create a new panel - JPanel canvasButtons = new JPanel(); - - GoTreeModel model = new GoTreeModel(goReader.getRoots()); - final JTree tree = new JTree(model) { - private static final long serialVersionUID = 1L; - - @Override - public String convertValueToText ( - Object value, - boolean selected, - boolean expended, - boolean leaf, - int row, - boolean hasFocus) - { - if (!pwaysRead || !(value instanceof GoTerm)) - { - return "" + value; - } - GoTerm goterm = (GoTerm)value; - - // get the number of genes in this term - int m = goMap.getM(goterm); - - // get the number of genes the term overlaps with all the pathway genes - int n = goMap.getN(goterm); - - // create a string with the goterm name, and the n and m values - // (see above) and print it to the console - double percentage = ((double)n/(double)m)*100; - return goterm.getName() + " " + "("+n+"/"+m+") ("+String.format("%3.1f", percentage)+"%)"; - } - }; - - // set the selectionmodel (only one branch can be selected at one time) - tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); - - // create two new buttons, using the makeButton method - JButton calcButton = makeButton("Calculate"); - JButton closeButton = makeButton("Close"); - - // add the functionality to the close button - closeButton.addActionListener( - new ActionListener(){ - public void actionPerformed(ActionEvent ae){ - // close the program when the button is clicked - frame.dispose(); - } - } - ); - - // add the functionality to the calculate button - calcButton.addActionListener( - new ActionListener() - { - public void actionPerformed(ActionEvent ae) - { - if (!pwaysRead) - { - readPathwayData(); - tree.invalidate(); // cause repaint - } - } - }); - - // add the buttons to the canvas - canvasButtons.add(calcButton); - canvasButtons.add(closeButton); - - // add the canvas to the frame - frame.add(canvasButtons, BorderLayout.SOUTH); - - // create a scroll pane containing the tree - JScrollPane scrollPane = new JScrollPane(tree); - - // add the canvas to the frame - frame.add(scrollPane, BorderLayout.CENTER); - // Show the frame - frame.setVisible(true); - } - - /** - * create a new JButton of a preferred size, and the text centered. - */ - //TODO: move to utility class or deprecate - public static JButton makeButton(String name) - { - // create a new button - JButton button = new JButton(name); - - // set the size of the button - Dimension sizeButton = new Dimension(130,30); - button.setPreferredSize(sizeButton); - - // center the text (horizontally and vertically) in the button - button.setVerticalTextPosition(AbstractButton.CENTER); - button.setHorizontalTextPosition(AbstractButton.CENTER); - - // return the button - return button; - } - - public static void printMemUsage (String msg) - { - Runtime runtime = Runtime.getRuntime(); - runtime.gc(); - long mem = runtime.totalMemory() - runtime.freeMemory(); - System.out.println((mem >> 20) + "Mb used: " + msg); - } - -} +// PathVisio, +// a tool for data visualization and analysis using Biological Pathways +// Copyright 2006-2011 BiGCaT Bioinformatics +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +package org.pathvisio.plugins.project2008; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.util.HashSet; +import java.util.Set; +import javax.swing.AbstractButton; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTree; +import javax.swing.tree.TreeSelectionModel; +import org.pathvisio.data.DataException; +import org.pathvisio.go.GoMap; +import org.pathvisio.go.GoReader; +import org.pathvisio.go.GoTerm; +import org.pathvisio.go.GoTreeModel; +import org.pathvisio.model.ConverterException; + +/** + * This program shows the distribution of GO Terms. It also shows how much + * genes it contains; and how much of these genes are found in the pathways. + */ +public class GoTermDistributionGUI { + + // make 2 private variables. The first one a set of strings "genidInPway", + // which will be loaded with all the (ensemble formatted) genid's found + // in the loaded pathways. + // The second one, a map with a String as key and a GoTerm as value "treeString_GoTerm" + // will be loaded with the Strings that represent the tree values as a key, and the + // corresponding GoTerm. + private Set genidInPway = new HashSet(); + private GoReader goReader = null; + private boolean pwaysRead = false; + private GoMap goMap = null; + + private String martexport; + private String pgdb; + private String pathwayroot; + + /** + * + * The program requires 4 args: + * Gene ontology database (e.g. "C:\\gene_ontology.obo") + * Pathway database (e.g. "C:\\databases\\Rn_39_34i.pgdb") + * Pathways (e.g. "C:\\WPClient\\Rattus_norvegicus") + * Table from GOid to Ensembl (e.g. C:\\mart_export1.txt") * + */ + public static void main(String[] args) throws DataException, ConverterException + { + GoTermDistributionGUI x = new GoTermDistributionGUI( + new File (args[0]), args[1], args[2], args[3]); + x.run(); + } + + public static void goTermDistribution(String[]args,String[]organism) throws DataException, ConverterException + { + GoTermDistributionGUI x = new GoTermDistributionGUI( + new File (args[3]), args[0] + organism[0], args[1] + organism[1], args[4]); + x.run(); + } + + public GoTermDistributionGUI(File oboFile, + String pgdb, + String pathwayroot, String martexport) + { + goReader = new GoReader (oboFile); + this.pgdb = pgdb; + this.martexport = martexport; + this.pathwayroot = pathwayroot; + } + + public void readPathwayData() + { + try + { + genidInPway = GenidPway.getGenidPways(pgdb, pathwayroot); + } + catch(DataException e) + { + System.out.println("Error!"); + } + catch(ConverterException e) + { + System.out.println("Error!"); + } + + System.out.println("Pathways read"); + + goMap = new GoMap (new File (martexport)); + + goMap.calculateNM (goReader.getRoots(), genidInPway); + + pwaysRead = true; + } + + public void run () throws DataException, ConverterException + { + // create a new frame + final JFrame frame = new JFrame("GOTerm Distribution"); + + // When click on exit, exit the frame + frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); + + // set the size of the frame + frame.setSize(350,570); + frame.setLayout(new BorderLayout()); + + // create a new panel + JPanel canvasButtons = new JPanel(); + + GoTreeModel model = new GoTreeModel(goReader.getRoots()); + final JTree tree = new JTree(model) { + private static final long serialVersionUID = 1L; + + @Override + public String convertValueToText ( + Object value, + boolean selected, + boolean expended, + boolean leaf, + int row, + boolean hasFocus) + { + if (!pwaysRead || !(value instanceof GoTerm)) + { + return "" + value; + } + GoTerm goterm = (GoTerm)value; + + // get the number of genes in this term + int m = goMap.getM(goterm); + + // get the number of genes the term overlaps with all the pathway genes + int n = goMap.getN(goterm); + + // create a string with the goterm name, and the n and m values + // (see above) and print it to the console + double percentage = ((double)n/(double)m)*100; + return goterm.getName() + " " + "("+n+"/"+m+") ("+String.format("%3.1f", percentage)+"%)"; + } + }; + + // set the selectionmodel (only one branch can be selected at one time) + tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); + + // create two new buttons, using the makeButton method + JButton calcButton = makeButton("Calculate"); + JButton closeButton = makeButton("Close"); + + // add the functionality to the close button + closeButton.addActionListener( + new ActionListener(){ + public void actionPerformed(ActionEvent ae){ + // close the program when the button is clicked + frame.dispose(); + } + } + ); + + // add the functionality to the calculate button + calcButton.addActionListener( + new ActionListener() + { + public void actionPerformed(ActionEvent ae) + { + if (!pwaysRead) + { + readPathwayData(); + tree.invalidate(); // cause repaint + } + } + }); + + // add the buttons to the canvas + canvasButtons.add(calcButton); + canvasButtons.add(closeButton); + + // add the canvas to the frame + frame.add(canvasButtons, BorderLayout.SOUTH); + + // create a scroll pane containing the tree + JScrollPane scrollPane = new JScrollPane(tree); + + // add the canvas to the frame + frame.add(scrollPane, BorderLayout.CENTER); + // Show the frame + frame.setVisible(true); + } + + /** + * create a new JButton of a preferred size, and the text centered. + */ + //TODO: move to utility class or deprecate + public static JButton makeButton(String name) + { + // create a new button + JButton button = new JButton(name); + + // set the size of the button + Dimension sizeButton = new Dimension(130,30); + button.setPreferredSize(sizeButton); + + // center the text (horizontally and vertically) in the button + button.setVerticalTextPosition(AbstractButton.CENTER); + button.setHorizontalTextPosition(AbstractButton.CENTER); + + // return the button + return button; + } + + public static void printMemUsage (String msg) + { + Runtime runtime = Runtime.getRuntime(); + runtime.gc(); + long mem = runtime.totalMemory() - runtime.freeMemory(); + System.out.println((mem >> 20) + "Mb used: " + msg); + } + +} diff --git a/tools/readme.txt b/tools/readme.txt index 86923ba8..2866b0fd 100644 --- a/tools/readme.txt +++ b/tools/readme.txt @@ -1,118 +1,118 @@ -Here is a list of all tools subdirectories, with a description. - -AtlastMapper - maps data on pathways by connecting WikiPathways webservice with - Atlas webservice. - See also http://atlas.wikipathways.org/ - -ComponentTest - This was a test to see how well swing handles mouseover events, - to support the plan to make swing components out of all gpml objects. - status: not in active use - -convert - Scripts to convert a batch of pathways automatically, and - even test roundtrip conversion of GPML<->GenMAPP. - status: useful but outdated. Needs work. - -cytoscape-gpml - Cytoscape plugin to load GPML pathways as Cytoscape networks - status: active. You need cytoscape libraries to compile this. - -dailybuild - used to contain continuous build script. Continous build script - has moved to http://svn.bigcat.unimaas.nl/buildsystem - Now only contains a script to get a few code metrics - (file size, lines of code) and a script to fix license headers. - status: in active use - -debian - attempt to create ubuntu / debian package for pathvisio - status: work in progress - -downloader - webstart that downloads - Derby databases and places them in the correct folder. - Used on http://www.pathvisio.org/Download - -get_defaults - script that reads GPML.xsd and generates the attribute - table for PathwayElement.java - Use this whenever GPML.xsd is modified. - -gexview - Attempt for a program to view imported microarray data as a heatmap. - May not compile, don't worry about it. - status: work in progress. - -gpmldiff - Scripts and testcases for generating / applying a "diff" of - two gpml files - -KeggConverter - converts Kegg to GPML - -lucene-indexer - program to maintain a cache of wikipathways pathways - and have it indexed - -makeGdb - program to make Derby databases based amongst others on HMDB - status: I'll move this to the bridgedb repo, where it belongs - -mappdiff - script to compate two GenMAPP MAPP files, - used as a test-case for roundtrip conversion - status: should be merged with the "convert" directory, - they belong together. - -path2java - program to convert an SVG path to a series of java Graphics2D calls - -pathway_metabolizer - script by andra to convert labels to metabolites - by guessing the right metabolite ID - -pathwaywiki - This script was used to generate the first version of WikiPathways! - status: won't even work again. can I delete this? - -perl - perl library with some useful routines for dealing with GPML files. - Now also contains script to do pathway inference - Pathway inference script should really be in a separate directory. - various perl scripts for dealing with pathways, - including - gpmlbuilder - mappbuilder-like tool to make gpml - based on a list of genes - webservice_example example script - that makes use of the wikipathways webservice - -php_pathvisio - gpml to svg converter in php, written by Andra - -project2008 - project by a student group. This will be moved to a plugin - status: work in progress. - -ReactomeConverter - converts reactome pathways to GPML. Doesnt work very well, - but it takes layout info directly from Reactome, so - it might still be useful in addition to - BioPAX conversion. - -superpathways - Cytoscape plugin by Helen, merges multiple pathways from - wikipathways into a Cytoscape network - -syscodeTable - script to generate a html table from our syscode file - status: will be moved to bridgedb or deleted - -wikipathways-maintenance - scripts for maintenance of pathways, using the webservice - status: useful as example code - -wikipathways-search - this is the code for http://search.wikipathways.org +Here is a list of all tools subdirectories, with a description. + +AtlastMapper + maps data on pathways by connecting WikiPathways webservice with + Atlas webservice. + See also http://atlas.wikipathways.org/ + +ComponentTest + This was a test to see how well swing handles mouseover events, + to support the plan to make swing components out of all gpml objects. + status: not in active use + +convert + Scripts to convert a batch of pathways automatically, and + even test roundtrip conversion of GPML<->GenMAPP. + status: useful but outdated. Needs work. + +cytoscape-gpml + Cytoscape plugin to load GPML pathways as Cytoscape networks + status: active. You need cytoscape libraries to compile this. + +dailybuild + used to contain continuous build script. Continous build script + has moved to http://svn.bigcat.unimaas.nl/buildsystem + Now only contains a script to get a few code metrics + (file size, lines of code) and a script to fix license headers. + status: in active use + +debian + attempt to create ubuntu / debian package for pathvisio + status: work in progress + +downloader + webstart that downloads + Derby databases and places them in the correct folder. + Used on http://www.pathvisio.org/Download + +get_defaults + script that reads GPML.xsd and generates the attribute + table for PathwayElement.java + Use this whenever GPML.xsd is modified. + +gexview + Attempt for a program to view imported microarray data as a heatmap. + May not compile, don't worry about it. + status: work in progress. + +gpmldiff + Scripts and testcases for generating / applying a "diff" of + two gpml files + +KeggConverter + converts Kegg to GPML + +lucene-indexer + program to maintain a cache of wikipathways pathways + and have it indexed + +makeGdb + program to make Derby databases based amongst others on HMDB + status: I'll move this to the bridgedb repo, where it belongs + +mappdiff + script to compate two GenMAPP MAPP files, + used as a test-case for roundtrip conversion + status: should be merged with the "convert" directory, + they belong together. + +path2java + program to convert an SVG path to a series of java Graphics2D calls + +pathway_metabolizer + script by andra to convert labels to metabolites + by guessing the right metabolite ID + +pathwaywiki + This script was used to generate the first version of WikiPathways! + status: won't even work again. can I delete this? + +perl + perl library with some useful routines for dealing with GPML files. + Now also contains script to do pathway inference + Pathway inference script should really be in a separate directory. + various perl scripts for dealing with pathways, + including + gpmlbuilder + mappbuilder-like tool to make gpml + based on a list of genes + webservice_example example script + that makes use of the wikipathways webservice + +php_pathvisio + gpml to svg converter in php, written by Andra + +project2008 + project by a student group. This will be moved to a plugin + status: work in progress. + +ReactomeConverter + converts reactome pathways to GPML. Doesnt work very well, + but it takes layout info directly from Reactome, so + it might still be useful in addition to + BioPAX conversion. + +superpathways + Cytoscape plugin by Helen, merges multiple pathways from + wikipathways into a Cytoscape network + +syscodeTable + script to generate a html table from our syscode file + status: will be moved to bridgedb or deleted + +wikipathways-maintenance + scripts for maintenance of pathways, using the webservice + status: useful as example code + +wikipathways-search + this is the code for http://search.wikipathways.org diff --git a/tools/superpathways/build.xml b/tools/superpathways/build.xml index 0bf0d1d9..100940c8 100644 --- a/tools/superpathways/build.xml +++ b/tools/superpathways/build.xml @@ -1,146 +1,146 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/superpathways/plugin.props b/tools/superpathways/plugin.props index 8ed74d95..19a8dd2c 100644 --- a/tools/superpathways/plugin.props +++ b/tools/superpathways/plugin.props @@ -1,34 +1,34 @@ -#plugin.props - -# This props file should be filled out and included in the plugin jar file. This props file will be used -# to put information into the Plugin Manager about the plugin - -# -- The following properties are REQUIRED -- # - -# The plugin name that will be displayed to users, white space within name is not allowed -pluginName=Superpathways-Plugin - -# Description used to give users information about the plugin such as what it does. -# Html tags are encouraged for formatting purposes. -pluginDescription=The Superpathways plugin for Cytoscape is to help merge multiple pathways into a single Cytoscape network.

This plugin makes it possible to select multiple pathways from Wiki Pathways and load them in a single network. The plugin would merge nodes that represent the same biological entity (e.g. gene, protein or molecule).

- -# Plugin version number, this must be two numbers separated by a decimlal. Ex. 0.2, 14.03 -pluginVersion=1.2 - -# Compatible Cytoscape version. If there are more than one version, seperate by ",". -cytoscapeVersion=2.6 - -# Category, use one of the categories listed on the http://cytoscape.org/plugins2.php site -pluginCategory=Network and Attribute I/O - -# -- The following properties are OPTIONAL -- # - -# URL to a website that gives more information about your plugin, Ex. http://my-lab-site.org -projectURL=http://www.bigcat.unimaas.nl/tracprojects/pathvisio/wiki/SuperPathways - -# List of authors. Note each author and institution pair are separated by a : (colon) -# each additional author institution pair must be separated from other pairs bye a ; (semicolon) -pluginAuthorsInstitutions=Xuemin Liu:Iowa State University - -# If this plugin is never meant to be downloaded except as part of a plugin (not common) add this property. Default is "no" -themeOnly=no +#plugin.props + +# This props file should be filled out and included in the plugin jar file. This props file will be used +# to put information into the Plugin Manager about the plugin + +# -- The following properties are REQUIRED -- # + +# The plugin name that will be displayed to users, white space within name is not allowed +pluginName=Superpathways-Plugin + +# Description used to give users information about the plugin such as what it does. +# Html tags are encouraged for formatting purposes. +pluginDescription=The Superpathways plugin for Cytoscape is to help merge multiple pathways into a single Cytoscape network.

This plugin makes it possible to select multiple pathways from Wiki Pathways and load them in a single network. The plugin would merge nodes that represent the same biological entity (e.g. gene, protein or molecule).

+ +# Plugin version number, this must be two numbers separated by a decimlal. Ex. 0.2, 14.03 +pluginVersion=1.2 + +# Compatible Cytoscape version. If there are more than one version, seperate by ",". +cytoscapeVersion=2.6 + +# Category, use one of the categories listed on the http://cytoscape.org/plugins2.php site +pluginCategory=Network and Attribute I/O + +# -- The following properties are OPTIONAL -- # + +# URL to a website that gives more information about your plugin, Ex. http://my-lab-site.org +projectURL=http://www.bigcat.unimaas.nl/tracprojects/pathvisio/wiki/SuperPathways + +# List of authors. Note each author and institution pair are separated by a : (colon) +# each additional author institution pair must be separated from other pairs bye a ; (semicolon) +pluginAuthorsInstitutions=Xuemin Liu:Iowa State University + +# If this plugin is never meant to be downloaded except as part of a plugin (not common) add this property. Default is "no" +themeOnly=no diff --git a/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/CommonNodeView.java b/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/CommonNodeView.java index 1b0d10b3..e7d54ee9 100644 --- a/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/CommonNodeView.java +++ b/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/CommonNodeView.java @@ -1,476 +1,476 @@ -// PathVisio, -// a tool for data visualization and analysis using Biological Pathways -// Copyright 2006-2011 BiGCaT Bioinformatics -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package org.pathvisio.cytoscape.superpathways; - -import java.awt.Color; -import java.io.File; -import java.rmi.RemoteException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.Set; - -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; - -import org.bridgedb.BridgeDb; -import org.bridgedb.DataSource; -import org.bridgedb.IDMapper; -import org.bridgedb.IDMapperException; -import org.bridgedb.Xref; -import org.bridgedb.bio.Organism; -import org.pathvisio.core.debug.Logger; -import org.pathvisio.core.model.ConverterException; -import org.pathvisio.core.model.ObjectType; -import org.pathvisio.core.model.Pathway; -import org.pathvisio.core.model.PathwayElement; -import org.pathvisio.core.preferences.GlobalPreference; -import org.pathvisio.wikipathways.webservice.WSPathway; -import org.wikipathways.client.WikiPathwaysClient; - -import cytoscape.CyEdge; -import cytoscape.CyNetwork; -import cytoscape.CyNode; -import cytoscape.Cytoscape; -import cytoscape.data.CyAttributes; -import cytoscape.data.Semantics; -import cytoscape.layout.CyLayoutAlgorithm; -import cytoscape.layout.CyLayouts; -import cytoscape.layout.LayoutProperties; -import cytoscape.layout.Tunable; - - -public class CommonNodeView { - - // List selectedPwsNameId; - List mSelectedPwsID; - - List mSelectedPwsNameID; - - SuperpathwaysClient mClient; - - Map nodePairByTranslation; - - List colorPool; - - protected boolean interrupted; // to enable cancel of the network merge - - static String dbLocation = GlobalPreference.getDataDir().toString() - + "/gene databases/"; - - public CommonNodeView(List pwId, List pwNameID, SuperpathwaysClient c) { - mSelectedPwsID = pwId; - mClient = c; - mSelectedPwsNameID=pwNameID; - nodePairByTranslation = new HashMap(); - interrupted = false; - - } - - public void interrupt() { - interrupted = true; - } - - public List getColorPool() { - return colorPool; - } - - public Map getNodePairByTranslation() { - return nodePairByTranslation; - } - - public commonNodePathwayPair findCommonNode(String pw1ID, String pw1NameID, String pw2ID, String pw2NameID) throws ClassNotFoundException, IDMapperException { - commonNodePathwayPair cnPwPair = new commonNodePathwayPair(); - - int commonNode = 0; - - // Create a client to the WikiPathways web service - WikiPathwaysClient client = mClient.getStub(); - - // Download these two pathways from WikiPathways by passing their id - WSPathway wsPathway1 = new WSPathway(); - WSPathway wsPathway2 = new WSPathway(); - try { - wsPathway1 = client.getPathway(pw1ID); - wsPathway2 = client.getPathway(pw2ID); - - } catch (RemoteException e) { - Logger.log.error( - "Unable to get the pathway due to the RemoteException", e); - } catch (ConverterException e) { - Logger.log.error( - "Unable to get the pathway due to the ConverterException", - e); - } - // Create two corresponding pathway objects - Pathway pathway1 = new Pathway(); - Pathway pathway2 = new Pathway(); - try { - pathway1 = WikiPathwaysClient.toPathway(wsPathway1); - pathway2 = WikiPathwaysClient.toPathway(wsPathway2); - } catch (ConverterException e) { - Logger.log.error( - "Unable to get the pathway due to the RemoteException", e); - } - - List XrefListPw1 = new ArrayList(); - List XrefListPw2 = new ArrayList(); - List XrefListCommonNode = new ArrayList(); - - // create the list of Xref for the pathway1: XrefListPw1 - System.out.println("Xref info of one pathway: " + pw1ID); - for (PathwayElement pw1Elm : pathway1.getDataObjects()) { - // Only take elements with type DATANODE (genes, proteins, - // metabolites) - - if (pw1Elm.getObjectType() == ObjectType.DATANODE) { - - String id = pw1Elm.getGeneID(); - DataSource ds = pw1Elm.getDataSource(); - if (!checkString(id) || ds == null) { - continue; // Skip empty id/codes - } - // System.out.println("before translation: "); - // System.out.println(pw1Elm.getXref().toString()); - - XrefListPw1.add(pw1Elm.getXref()); - } - - } - - // deternmine which database to be loaded according to the species of - // pathway2 - Organism organism = Organism.fromLatinName(pathway2.getMappInfo() - .getOrganism()); - // System.out.println("The organism for pathway2 is " + organism); - - IDMapper gdb = mClient.getPlugin().getIDMapper(organism); - - // create the list of Xref for the pathway2: XrefListPw2 - System.out.println("Xref info of the other pathway: " + pw2ID); - for (PathwayElement pw2Elm : pathway2.getDataObjects()) { - if (pw2Elm.getObjectType() == ObjectType.DATANODE) { - - if (interrupted) - return null; - - boolean isMapped = false; - - String id = pw2Elm.getGeneID(); - DataSource ds = pw2Elm.getDataSource(); - if (!checkString(id) || ds == null) - continue; // Skip empty - // id/codes - - // System.out.println(pw2Elm.getXref().toString()); - XrefListPw2.add(pw2Elm.getXref()); - - for (int k = 0; k < XrefListPw1.size(); k++) { - try { - Set xrefs2 = gdb.mapID(pw2Elm.getXref()); - if (xrefs2.contains(XrefListPw1.get(k))) { - isMapped = true; - - System.out.println(pw2Elm.getXref().toString() - + "======" + XrefListPw1.get(k).toString()); - // this map is for later use--when merging pathways - nodePairByTranslation.put(pw2Elm.getXref(), - XrefListPw1.get(k)); - } - } catch (IDMapperException e) { - Logger.log - .error( - "Problem while getting the all the Xrefs for the pathwayElement of pw2!", - e); - System.out - .println("Problem while getting the all the Xrefs for the pathwayElement of pw2!"); - break; - } - } - - if ((XrefListPw1.contains(pw2Elm.getXref().toString()) || isMapped) - && !XrefListCommonNode.contains(pw2Elm.getXref() - .toString())) { - // maybe need to change later!! - commonNode = commonNode + 1; - XrefListCommonNode.add(pw2Elm.getXref().toString()); - - } - } - } - - // the following code is for printing out the common nodes returned by - // the code - System.out.println("The common node: "); - for (int k = 0; k < XrefListCommonNode.size(); k++) { - System.out.println(XrefListCommonNode.get(k)); - } - - cnPwPair.pathway1NameID = pw1NameID; - cnPwPair.pathway2NameID = pw2NameID; - cnPwPair.commonNodeNumber = commonNode; - cnPwPair.geneIDListOfCommonNode = XrefListCommonNode; - return cnPwPair; - } - - public List findCommonNodeForPathwaysGroup() throws ClassNotFoundException, IDMapperException { - List commonNodeInfoPwGroup = new ArrayList(); - - System.out.println("For Databases: " + dbLocation); - - Object[] arrayOfSelectedPwsId = mSelectedPwsID.toArray(); - Object[] arrayOfSelectedPwsNameId = mSelectedPwsNameID.toArray(); - - int len = arrayOfSelectedPwsId.length; - - for (int i = 0; i < len; i++) { - for (int j = i + 1; j < len; j++) { - - if (interrupted) - return null; - - commonNodeInfoPwGroup.add(findCommonNode( - (String) arrayOfSelectedPwsId[i], (String) arrayOfSelectedPwsNameId[i], - (String) arrayOfSelectedPwsId[j], (String) arrayOfSelectedPwsNameId[j])); - } - } - - return commonNodeInfoPwGroup; - } - - public Map drawCommonNodeView() throws ClassNotFoundException, IDMapperException { - - if (interrupted) - return null; - - Map pwNameToColor=new HashMap(); - - colorPool = new ArrayList(); - - String[] shapePool = { "Diamond", "Hexagon", "Parallelogram", - "Round Rectange", "Rectangle", "Ellipse", "Triangle", "Octagon" }; - - List cnInfoPwGroup = findCommonNodeForPathwaysGroup(); - - CyNetwork cyNetwork = Cytoscape - .createNetwork("Common Node View", false); - - - CyAttributes nodeAtts = Cytoscape.getNodeAttributes(); - CyAttributes edgeAtts = Cytoscape.getEdgeAttributes(); - - if (interrupted) - return null; - CyNode[] groupPwsIcons = new CyNode[mSelectedPwsID.size()]; - for (int i = 0; i < mSelectedPwsID.size(); i++) { - groupPwsIcons[i] = Cytoscape.getCyNode(mSelectedPwsNameID.get(i), true); - cyNetwork.addNode(groupPwsIcons[i]); - nodeAtts.setAttribute(mSelectedPwsNameID.get(i), "node.fontSize", "10"); - - } - - if (interrupted) - return null; - CyEdge[] groupEdges = new CyEdge[cnInfoPwGroup.size()]; - int[] commonNodeNumber = new int[cnInfoPwGroup.size()]; - int numberOfEdges = 0; - for (int j = 0; j < cnInfoPwGroup.size(); j++) { - commonNodePathwayPair temp = cnInfoPwGroup.get(j); - if (temp.commonNodeNumber != 0) { - CyNode n1 = Cytoscape.getCyNode(temp.pathway1NameID, false); - CyNode n2 = Cytoscape.getCyNode(temp.pathway2NameID, false); - groupEdges[numberOfEdges] = Cytoscape.getCyEdge(n1, n2, Semantics.INTERACTION, "pp", true); - commonNodeNumber[numberOfEdges] = temp.commonNodeNumber; - cyNetwork.addEdge(groupEdges[numberOfEdges]); - edgeAtts.setAttribute(groupEdges[numberOfEdges].getIdentifier(), "weight", commonNodeNumber[numberOfEdges]); - numberOfEdges++; - } - } - - int numberOfSelectedPws = mSelectedPwsID.size(); - double division1 = 360 / numberOfSelectedPws; - double division2 = 50 / numberOfSelectedPws; - - for (int i = 0; i < mSelectedPwsID.size(); i++) { - - // String temp=getRandomColorInString(); - - //use hsv and convert it to rgb - double h2=i*division1; - double s2=i*division2; - double v2=i*division2; - - int h=Double.valueOf(h2).intValue(); - int s=Double.valueOf(s2).intValue(); - int v=Double.valueOf(v2).intValue(); - System.out.println("value of h "+ h); - RGB tempRGB=hsvToRgb(h, 100, 100); - String temp=String.valueOf(Double.valueOf(tempRGB.r).intValue())+", "+String.valueOf(Double.valueOf(tempRGB.g).intValue())+", "+String.valueOf(Double.valueOf(tempRGB.b).intValue()); - System.out.println("after conversion hsv to rgb"+ temp); - - nodeAtts.setAttribute(groupPwsIcons[i].getIdentifier(), - "node.fillColor", temp); - - //this part is for storing the info into the pwNameToColor - String pwNameID=mSelectedPwsNameID.get(i); - int index2 = pwNameID.lastIndexOf("("); - String pwName = pwNameID.substring(0, index2); - System.out.println(Double.valueOf(tempRGB.r).intValue()+";"+Double.valueOf(tempRGB.g).intValue()+";"+Double.valueOf(tempRGB.b).intValue()); - Color result=new Color(Double.valueOf(tempRGB.r).intValue(), Double.valueOf(tempRGB.g).intValue(),Double.valueOf(tempRGB.b).intValue()); - pwNameToColor.put(pwName,result); - - colorPool.add(temp); - nodeAtts.setAttribute(groupPwsIcons[i].getIdentifier(), - "node.shape", shapePool[i % shapePool.length]); - // re-use shapes from the shapePool when the number of - // selected Pws is larger than 8 - } - - for (int j = 0; j < numberOfEdges; j++) { - edgeAtts.setAttribute(groupEdges[j].getIdentifier(), "edge.label", - String.valueOf(commonNodeNumber[j])); - } - - - // display the common node view - Cytoscape.createNetworkView(cyNetwork, "Common Node View"); - - - - //the following code is for set the edge-weighted spring embedded layout (weight=the number of shared nodes) - CyLayoutAlgorithm alg = CyLayouts.getLayout("force-directed"); - LayoutProperties props = alg.getSettings(); - Tunable weightAttribute = props.get("edge_attribute"); - weightAttribute.setValue("weight"); - alg.updateSettings(); - Cytoscape.getCurrentNetworkView().applyLayout(alg); - - - return pwNameToColor; - } - - private static boolean checkString(String string) { - return string != null && string.length() > 0; - } - - /* - * public static Color getRandomColor() { Random numGen = new Random(); - * return new Color(numGen.nextInt(256), numGen.nextInt(256), - * numGen.nextInt(256)); } - */ - - public static String getRandomColorInString() { - Random numGen = new Random(); - return new String(numGen.nextInt(256) + ", " + numGen.nextInt(256) - + ", " + numGen.nextInt(256)); - } - - public static RGB hsvToRgb(int h, int s, int v) { - RGB result = new RGB(); - int i; - double f, p, q, t; - - // Make sure our arguments stay in-range - h = Math.max(0, Math.min(360, h)); - s = Math.max(0, Math.min(100, s)); - v = Math.max(0, Math.min(100, v)); - - // We accept saturation and value arguments from 0 to 100 because that's - // how Photoshop represents those values. Internally, however, the - // saturation and value are calculated from a range of 0 to 1. We make - // That conversion here. - double s2 = (double)s / 100; - double v2 = (double)v / 100; - - if (s2 == 0) { - // Achromatic (grey) - result.r = Math.round(v2 * 255); - result.g = Math.round(v2 * 255); - result.b = Math.round(v2 * 255); - return result; - } - - double h2 = (double)h / 60; // sector 0 to 5 - double i2 = Math.floor(h2); - i = Double.valueOf(i2).intValue(); - f = h2 - i; // factorial part of h - p = v2 * (1 - s2); - q = v2 * (1 - s2 * f); - t = v2 * (1 - s2 * (1 - f)); - - switch (i) { - - case 0: - result.r = v2; - result.g = t; - result.b = p; - break; - case 1: - result.r = q; - result.g = v2; - result.b = p; - break; - case 2: - result.r = p; - result.g = v2; - result.b = t; - break; - case 3: - result.r = p; - result.g = q; - result.b = v2; - break; - case 4: - result.r = t; - result.g = p; - result.b = v2; - break; - default: // case 5: - result.r = v2; - result.g = p; - result.b = q; - } - - result.r = Math.round(result.r * 255); - result.g = Math.round(result.g * 255); - result.b = Math.round(result.b * 255); - - return result; - - } - - public static class commonNodePathwayPair { - public String pathway1NameID; - - public String pathway2NameID; - - public int commonNodeNumber; - - public List geneIDListOfCommonNode = null; - } - - public static class RGB { - public double r; - - public double g; - - public double b; - } -} +// PathVisio, +// a tool for data visualization and analysis using Biological Pathways +// Copyright 2006-2011 BiGCaT Bioinformatics +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +package org.pathvisio.cytoscape.superpathways; + +import java.awt.Color; +import java.io.File; +import java.rmi.RemoteException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; + +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; + +import org.bridgedb.BridgeDb; +import org.bridgedb.DataSource; +import org.bridgedb.IDMapper; +import org.bridgedb.IDMapperException; +import org.bridgedb.Xref; +import org.bridgedb.bio.Organism; +import org.pathvisio.core.debug.Logger; +import org.pathvisio.core.model.ConverterException; +import org.pathvisio.core.model.ObjectType; +import org.pathvisio.core.model.Pathway; +import org.pathvisio.core.model.PathwayElement; +import org.pathvisio.core.preferences.GlobalPreference; +import org.pathvisio.wikipathways.webservice.WSPathway; +import org.wikipathways.client.WikiPathwaysClient; + +import cytoscape.CyEdge; +import cytoscape.CyNetwork; +import cytoscape.CyNode; +import cytoscape.Cytoscape; +import cytoscape.data.CyAttributes; +import cytoscape.data.Semantics; +import cytoscape.layout.CyLayoutAlgorithm; +import cytoscape.layout.CyLayouts; +import cytoscape.layout.LayoutProperties; +import cytoscape.layout.Tunable; + + +public class CommonNodeView { + + // List selectedPwsNameId; + List mSelectedPwsID; + + List mSelectedPwsNameID; + + SuperpathwaysClient mClient; + + Map nodePairByTranslation; + + List colorPool; + + protected boolean interrupted; // to enable cancel of the network merge + + static String dbLocation = GlobalPreference.getDataDir().toString() + + "/gene databases/"; + + public CommonNodeView(List pwId, List pwNameID, SuperpathwaysClient c) { + mSelectedPwsID = pwId; + mClient = c; + mSelectedPwsNameID=pwNameID; + nodePairByTranslation = new HashMap(); + interrupted = false; + + } + + public void interrupt() { + interrupted = true; + } + + public List getColorPool() { + return colorPool; + } + + public Map getNodePairByTranslation() { + return nodePairByTranslation; + } + + public commonNodePathwayPair findCommonNode(String pw1ID, String pw1NameID, String pw2ID, String pw2NameID) throws ClassNotFoundException, IDMapperException { + commonNodePathwayPair cnPwPair = new commonNodePathwayPair(); + + int commonNode = 0; + + // Create a client to the WikiPathways web service + WikiPathwaysClient client = mClient.getStub(); + + // Download these two pathways from WikiPathways by passing their id + WSPathway wsPathway1 = new WSPathway(); + WSPathway wsPathway2 = new WSPathway(); + try { + wsPathway1 = client.getPathway(pw1ID); + wsPathway2 = client.getPathway(pw2ID); + + } catch (RemoteException e) { + Logger.log.error( + "Unable to get the pathway due to the RemoteException", e); + } catch (ConverterException e) { + Logger.log.error( + "Unable to get the pathway due to the ConverterException", + e); + } + // Create two corresponding pathway objects + Pathway pathway1 = new Pathway(); + Pathway pathway2 = new Pathway(); + try { + pathway1 = WikiPathwaysClient.toPathway(wsPathway1); + pathway2 = WikiPathwaysClient.toPathway(wsPathway2); + } catch (ConverterException e) { + Logger.log.error( + "Unable to get the pathway due to the RemoteException", e); + } + + List XrefListPw1 = new ArrayList(); + List XrefListPw2 = new ArrayList(); + List XrefListCommonNode = new ArrayList(); + + // create the list of Xref for the pathway1: XrefListPw1 + System.out.println("Xref info of one pathway: " + pw1ID); + for (PathwayElement pw1Elm : pathway1.getDataObjects()) { + // Only take elements with type DATANODE (genes, proteins, + // metabolites) + + if (pw1Elm.getObjectType() == ObjectType.DATANODE) { + + String id = pw1Elm.getGeneID(); + DataSource ds = pw1Elm.getDataSource(); + if (!checkString(id) || ds == null) { + continue; // Skip empty id/codes + } + // System.out.println("before translation: "); + // System.out.println(pw1Elm.getXref().toString()); + + XrefListPw1.add(pw1Elm.getXref()); + } + + } + + // deternmine which database to be loaded according to the species of + // pathway2 + Organism organism = Organism.fromLatinName(pathway2.getMappInfo() + .getOrganism()); + // System.out.println("The organism for pathway2 is " + organism); + + IDMapper gdb = mClient.getPlugin().getIDMapper(organism); + + // create the list of Xref for the pathway2: XrefListPw2 + System.out.println("Xref info of the other pathway: " + pw2ID); + for (PathwayElement pw2Elm : pathway2.getDataObjects()) { + if (pw2Elm.getObjectType() == ObjectType.DATANODE) { + + if (interrupted) + return null; + + boolean isMapped = false; + + String id = pw2Elm.getGeneID(); + DataSource ds = pw2Elm.getDataSource(); + if (!checkString(id) || ds == null) + continue; // Skip empty + // id/codes + + // System.out.println(pw2Elm.getXref().toString()); + XrefListPw2.add(pw2Elm.getXref()); + + for (int k = 0; k < XrefListPw1.size(); k++) { + try { + Set xrefs2 = gdb.mapID(pw2Elm.getXref()); + if (xrefs2.contains(XrefListPw1.get(k))) { + isMapped = true; + + System.out.println(pw2Elm.getXref().toString() + + "======" + XrefListPw1.get(k).toString()); + // this map is for later use--when merging pathways + nodePairByTranslation.put(pw2Elm.getXref(), + XrefListPw1.get(k)); + } + } catch (IDMapperException e) { + Logger.log + .error( + "Problem while getting the all the Xrefs for the pathwayElement of pw2!", + e); + System.out + .println("Problem while getting the all the Xrefs for the pathwayElement of pw2!"); + break; + } + } + + if ((XrefListPw1.contains(pw2Elm.getXref().toString()) || isMapped) + && !XrefListCommonNode.contains(pw2Elm.getXref() + .toString())) { + // maybe need to change later!! + commonNode = commonNode + 1; + XrefListCommonNode.add(pw2Elm.getXref().toString()); + + } + } + } + + // the following code is for printing out the common nodes returned by + // the code + System.out.println("The common node: "); + for (int k = 0; k < XrefListCommonNode.size(); k++) { + System.out.println(XrefListCommonNode.get(k)); + } + + cnPwPair.pathway1NameID = pw1NameID; + cnPwPair.pathway2NameID = pw2NameID; + cnPwPair.commonNodeNumber = commonNode; + cnPwPair.geneIDListOfCommonNode = XrefListCommonNode; + return cnPwPair; + } + + public List findCommonNodeForPathwaysGroup() throws ClassNotFoundException, IDMapperException { + List commonNodeInfoPwGroup = new ArrayList(); + + System.out.println("For Databases: " + dbLocation); + + Object[] arrayOfSelectedPwsId = mSelectedPwsID.toArray(); + Object[] arrayOfSelectedPwsNameId = mSelectedPwsNameID.toArray(); + + int len = arrayOfSelectedPwsId.length; + + for (int i = 0; i < len; i++) { + for (int j = i + 1; j < len; j++) { + + if (interrupted) + return null; + + commonNodeInfoPwGroup.add(findCommonNode( + (String) arrayOfSelectedPwsId[i], (String) arrayOfSelectedPwsNameId[i], + (String) arrayOfSelectedPwsId[j], (String) arrayOfSelectedPwsNameId[j])); + } + } + + return commonNodeInfoPwGroup; + } + + public Map drawCommonNodeView() throws ClassNotFoundException, IDMapperException { + + if (interrupted) + return null; + + Map pwNameToColor=new HashMap(); + + colorPool = new ArrayList(); + + String[] shapePool = { "Diamond", "Hexagon", "Parallelogram", + "Round Rectange", "Rectangle", "Ellipse", "Triangle", "Octagon" }; + + List cnInfoPwGroup = findCommonNodeForPathwaysGroup(); + + CyNetwork cyNetwork = Cytoscape + .createNetwork("Common Node View", false); + + + CyAttributes nodeAtts = Cytoscape.getNodeAttributes(); + CyAttributes edgeAtts = Cytoscape.getEdgeAttributes(); + + if (interrupted) + return null; + CyNode[] groupPwsIcons = new CyNode[mSelectedPwsID.size()]; + for (int i = 0; i < mSelectedPwsID.size(); i++) { + groupPwsIcons[i] = Cytoscape.getCyNode(mSelectedPwsNameID.get(i), true); + cyNetwork.addNode(groupPwsIcons[i]); + nodeAtts.setAttribute(mSelectedPwsNameID.get(i), "node.fontSize", "10"); + + } + + if (interrupted) + return null; + CyEdge[] groupEdges = new CyEdge[cnInfoPwGroup.size()]; + int[] commonNodeNumber = new int[cnInfoPwGroup.size()]; + int numberOfEdges = 0; + for (int j = 0; j < cnInfoPwGroup.size(); j++) { + commonNodePathwayPair temp = cnInfoPwGroup.get(j); + if (temp.commonNodeNumber != 0) { + CyNode n1 = Cytoscape.getCyNode(temp.pathway1NameID, false); + CyNode n2 = Cytoscape.getCyNode(temp.pathway2NameID, false); + groupEdges[numberOfEdges] = Cytoscape.getCyEdge(n1, n2, Semantics.INTERACTION, "pp", true); + commonNodeNumber[numberOfEdges] = temp.commonNodeNumber; + cyNetwork.addEdge(groupEdges[numberOfEdges]); + edgeAtts.setAttribute(groupEdges[numberOfEdges].getIdentifier(), "weight", commonNodeNumber[numberOfEdges]); + numberOfEdges++; + } + } + + int numberOfSelectedPws = mSelectedPwsID.size(); + double division1 = 360 / numberOfSelectedPws; + double division2 = 50 / numberOfSelectedPws; + + for (int i = 0; i < mSelectedPwsID.size(); i++) { + + // String temp=getRandomColorInString(); + + //use hsv and convert it to rgb + double h2=i*division1; + double s2=i*division2; + double v2=i*division2; + + int h=Double.valueOf(h2).intValue(); + int s=Double.valueOf(s2).intValue(); + int v=Double.valueOf(v2).intValue(); + System.out.println("value of h "+ h); + RGB tempRGB=hsvToRgb(h, 100, 100); + String temp=String.valueOf(Double.valueOf(tempRGB.r).intValue())+", "+String.valueOf(Double.valueOf(tempRGB.g).intValue())+", "+String.valueOf(Double.valueOf(tempRGB.b).intValue()); + System.out.println("after conversion hsv to rgb"+ temp); + + nodeAtts.setAttribute(groupPwsIcons[i].getIdentifier(), + "node.fillColor", temp); + + //this part is for storing the info into the pwNameToColor + String pwNameID=mSelectedPwsNameID.get(i); + int index2 = pwNameID.lastIndexOf("("); + String pwName = pwNameID.substring(0, index2); + System.out.println(Double.valueOf(tempRGB.r).intValue()+";"+Double.valueOf(tempRGB.g).intValue()+";"+Double.valueOf(tempRGB.b).intValue()); + Color result=new Color(Double.valueOf(tempRGB.r).intValue(), Double.valueOf(tempRGB.g).intValue(),Double.valueOf(tempRGB.b).intValue()); + pwNameToColor.put(pwName,result); + + colorPool.add(temp); + nodeAtts.setAttribute(groupPwsIcons[i].getIdentifier(), + "node.shape", shapePool[i % shapePool.length]); + // re-use shapes from the shapePool when the number of + // selected Pws is larger than 8 + } + + for (int j = 0; j < numberOfEdges; j++) { + edgeAtts.setAttribute(groupEdges[j].getIdentifier(), "edge.label", + String.valueOf(commonNodeNumber[j])); + } + + + // display the common node view + Cytoscape.createNetworkView(cyNetwork, "Common Node View"); + + + + //the following code is for set the edge-weighted spring embedded layout (weight=the number of shared nodes) + CyLayoutAlgorithm alg = CyLayouts.getLayout("force-directed"); + LayoutProperties props = alg.getSettings(); + Tunable weightAttribute = props.get("edge_attribute"); + weightAttribute.setValue("weight"); + alg.updateSettings(); + Cytoscape.getCurrentNetworkView().applyLayout(alg); + + + return pwNameToColor; + } + + private static boolean checkString(String string) { + return string != null && string.length() > 0; + } + + /* + * public static Color getRandomColor() { Random numGen = new Random(); + * return new Color(numGen.nextInt(256), numGen.nextInt(256), + * numGen.nextInt(256)); } + */ + + public static String getRandomColorInString() { + Random numGen = new Random(); + return new String(numGen.nextInt(256) + ", " + numGen.nextInt(256) + + ", " + numGen.nextInt(256)); + } + + public static RGB hsvToRgb(int h, int s, int v) { + RGB result = new RGB(); + int i; + double f, p, q, t; + + // Make sure our arguments stay in-range + h = Math.max(0, Math.min(360, h)); + s = Math.max(0, Math.min(100, s)); + v = Math.max(0, Math.min(100, v)); + + // We accept saturation and value arguments from 0 to 100 because that's + // how Photoshop represents those values. Internally, however, the + // saturation and value are calculated from a range of 0 to 1. We make + // That conversion here. + double s2 = (double)s / 100; + double v2 = (double)v / 100; + + if (s2 == 0) { + // Achromatic (grey) + result.r = Math.round(v2 * 255); + result.g = Math.round(v2 * 255); + result.b = Math.round(v2 * 255); + return result; + } + + double h2 = (double)h / 60; // sector 0 to 5 + double i2 = Math.floor(h2); + i = Double.valueOf(i2).intValue(); + f = h2 - i; // factorial part of h + p = v2 * (1 - s2); + q = v2 * (1 - s2 * f); + t = v2 * (1 - s2 * (1 - f)); + + switch (i) { + + case 0: + result.r = v2; + result.g = t; + result.b = p; + break; + case 1: + result.r = q; + result.g = v2; + result.b = p; + break; + case 2: + result.r = p; + result.g = v2; + result.b = t; + break; + case 3: + result.r = p; + result.g = q; + result.b = v2; + break; + case 4: + result.r = t; + result.g = p; + result.b = v2; + break; + default: // case 5: + result.r = v2; + result.g = p; + result.b = q; + } + + result.r = Math.round(result.r * 255); + result.g = Math.round(result.g * 255); + result.b = Math.round(result.b * 255); + + return result; + + } + + public static class commonNodePathwayPair { + public String pathway1NameID; + + public String pathway2NameID; + + public int commonNodeNumber; + + public List geneIDListOfCommonNode = null; + } + + public static class RGB { + public double r; + + public double g; + + public double b; + } +} diff --git a/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/CustomNodeGenerator.java b/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/CustomNodeGenerator.java index 8489e38e..5655750f 100644 --- a/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/CustomNodeGenerator.java +++ b/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/CustomNodeGenerator.java @@ -1,66 +1,66 @@ -// PathVisio, -// a tool for data visualization and analysis using Biological Pathways -// Copyright 2006-2011 BiGCaT Bioinformatics -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package org.pathvisio.cytoscape.superpathways; - -import giny.model.Node; - -import java.awt.Paint; -import java.awt.Shape; -import java.awt.geom.Rectangle2D; -import java.io.File; - -import cytoscape.CyNetwork; -import cytoscape.Cytoscape; -import ding.view.DNodeView; - -public class CustomNodeGenerator { - - String pieLocation; - Node node; - - - public CustomNodeGenerator(String loc, Node n) { - pieLocation = new String(loc); - node = n; - } - - // to create custom node graphics - public void createCustomNode(CyNetwork cyNetwork) { - Cytoscape.createNetworkView(cyNetwork); - Rectangle2D rect = new Rectangle2D.Double(-20.0, -20.0, 40.0, 40.0); - - Paint paint = null; - - try { - paint = new java.awt.TexturePaint(javax.imageio.ImageIO - .read(new File(pieLocation)), rect); - - // new java.net.URL("http://cytoscape.org/people_photos/nerius.jpg") - - } catch (Exception exc) { - paint = java.awt.Color.black; - } - - giny.view.NodeView nv; - // Obtain an instance of NodeView using documented Cytoscape API..... - nv = (DNodeView) Cytoscape.getCurrentNetworkView().getNodeView(node); - - ding.view.DNodeView dnv = (ding.view.DNodeView) nv; - dnv.addCustomGraphic(rect, paint, (byte)0); - } -} +// PathVisio, +// a tool for data visualization and analysis using Biological Pathways +// Copyright 2006-2011 BiGCaT Bioinformatics +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +package org.pathvisio.cytoscape.superpathways; + +import giny.model.Node; + +import java.awt.Paint; +import java.awt.Shape; +import java.awt.geom.Rectangle2D; +import java.io.File; + +import cytoscape.CyNetwork; +import cytoscape.Cytoscape; +import ding.view.DNodeView; + +public class CustomNodeGenerator { + + String pieLocation; + Node node; + + + public CustomNodeGenerator(String loc, Node n) { + pieLocation = new String(loc); + node = n; + } + + // to create custom node graphics + public void createCustomNode(CyNetwork cyNetwork) { + Cytoscape.createNetworkView(cyNetwork); + Rectangle2D rect = new Rectangle2D.Double(-20.0, -20.0, 40.0, 40.0); + + Paint paint = null; + + try { + paint = new java.awt.TexturePaint(javax.imageio.ImageIO + .read(new File(pieLocation)), rect); + + // new java.net.URL("http://cytoscape.org/people_photos/nerius.jpg") + + } catch (Exception exc) { + paint = java.awt.Color.black; + } + + giny.view.NodeView nv; + // Obtain an instance of NodeView using documented Cytoscape API..... + nv = (DNodeView) Cytoscape.getCurrentNetworkView().getNodeView(node); + + ding.view.DNodeView dnv = (ding.view.DNodeView) nv; + dnv.addCustomGraphic(rect, paint, (byte)0); + } +} diff --git a/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/FindRelatedPwsDialog.java b/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/FindRelatedPwsDialog.java index ac69fd73..7e2c69b7 100644 --- a/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/FindRelatedPwsDialog.java +++ b/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/FindRelatedPwsDialog.java @@ -1,791 +1,791 @@ -// PathVisio, -// a tool for data visualization and analysis using Biological Pathways -// Copyright 2006-2011 BiGCaT Bioinformatics -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package org.pathvisio.cytoscape.superpathways; - -import java.awt.Cursor; -import java.rmi.RemoteException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.swing.JDialog; -import javax.swing.JOptionPane; -import javax.swing.ListSelectionModel; -import javax.swing.table.DefaultTableModel; -import javax.swing.table.TableColumn; - -import org.pathvisio.core.debug.Logger; -import org.pathvisio.core.model.ConverterException; -import org.pathvisio.core.model.ObjectType; -import org.pathvisio.core.model.Pathway; -import org.pathvisio.core.model.PathwayElement; -import org.pathvisio.cytoscape.superpathways.SuperpathwaysGui.ResultRow; -import org.pathvisio.wikipathways.webservice.WSPathway; -import org.pathvisio.wikipathways.webservice.WSSearchResult; -import org.wikipathways.client.WikiPathwaysClient; - -import cytoscape.task.Task; -import cytoscape.task.TaskMonitor; -import cytoscape.task.ui.JTaskConfig; -import cytoscape.task.util.TaskManager; - -public class FindRelatedPwsDialog extends JDialog { - - SuperpathwaysClient mClient; - - private List mCandidatePw; - - String anchorPwNameID; - - int mNoGeneNode; - - private Map mNodeIdToPwsSharingNode = new HashMap(); - - List selectedPws; - - public FindRelatedPwsDialog(SuperpathwaysClient client, String s, - String anchorPw) { - super(client.getPlugin().mWindow, s); - mClient = client; - setSize(250, 300); - setModal(true); - initComponents(anchorPw); - setModal(false); - - } - - private void initComponents(String anchorPw) { - - anchorPwNameID = anchorPw; - // the following items are in helpPanel Dialog - helpPanel = new javax.swing.JPanel(); - anchorPathwayLabel = new javax.swing.JLabel(); - sharingNodeNoLabel = new javax.swing.JLabel(); - // anchorPathwayComboBox = new javax.swing.JComboBox(); - anchorPathwayNameIDLabel = new javax.swing.JLabel(); - - lowerBoundSharingNodeNoComboBox = new javax.swing.JComboBox(); - candidatePathwaysSharingNodesScrollPane = new javax.swing.JScrollPane(); - candidatePathwaysSharingNodesTable = new javax.swing.JTable(); - - explainHelpLabel1 = new javax.swing.JLabel(); - addHelpButton = new javax.swing.JButton(); - lowerBoundLabel = new javax.swing.JLabel(); - upperBoundLabel = new javax.swing.JLabel(); - upperBoundSharingNodeNoComboBox = new javax.swing.JComboBox(); - explainHelpLabel2 = new javax.swing.JLabel(); - // backToSearchButton = new javax.swing.JButton(); - searchHelpButton = new javax.swing.JButton(); - lastLabel = new javax.swing.JLabel(); - - // the follwoing code is for Search Help tab - anchorPathwayLabel.setForeground(new java.awt.Color(0, 0, 255)); - anchorPathwayLabel.setText("Selected Pathway: "); - - anchorPathwayNameIDLabel.setForeground(new java.awt.Color(0, 0, 255)); - anchorPathwayNameIDLabel.setText(anchorPw); - - sharingNodeNoLabel.setForeground(new java.awt.Color(0, 0, 255)); - sharingNodeNoLabel.setText("Sharing"); - - // anchorPathwayComboBox.setModel(new - // DefaultComboBoxModel(mAvailablePathwaysNameIDList.toArray())); - - lowerBoundSharingNodeNoComboBox - .setModel(new javax.swing.DefaultComboBoxModel(new String[] { - "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" })); - - // candidatePathwaysSharingNodesTable.setModel(); - - explainHelpLabel1.setFont(new java.awt.Font("Dialog", 1, 11)); // NOI18N - explainHelpLabel1.setForeground(new java.awt.Color(102, 0, 0)); - explainHelpLabel1 - .setText("Set the range of sharing nodes number for the selected pathway, a list of candidate"); - - explainHelpLabel2.setFont(new java.awt.Font("Dialog", 1, 11)); // NOI18N - explainHelpLabel2.setForeground(new java.awt.Color(102, 0, 0)); - explainHelpLabel2 - .setText("pathways with sharing nodes would be returned after clicking Search button."); - - addHelpButton.setText("Add"); - addHelpButton - .setToolTipText("add the selected pathways to the 'Available Pathways' list"); - - addHelpButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - addHelpButtonActionPerformed(evt); - } - }); - - lowerBoundLabel.setForeground(new java.awt.Color(0, 0, 255)); - lowerBoundLabel.setText("Minimum"); - - upperBoundLabel.setForeground(new java.awt.Color(0, 0, 255)); - upperBoundLabel.setText("Maximum"); - - // set the numbers for according to the selected pathway - int index1 = anchorPw.lastIndexOf("("); - int index2 = anchorPw.lastIndexOf(")"); - String anchorPwID = anchorPw.substring(index1 + 1, index2); - - // Create a client to the WikiPathways web service - WikiPathwaysClient client = mClient.getStub(); - WSPathway anchorPathway = new WSPathway(); - - try { - anchorPathway = client.getPathway(anchorPwID); - - } catch (RemoteException e) { - Logger.log.error( - "Unable to get the pathway due to the RemoteException", e); - } catch (ConverterException e) { - Logger.log.error( - "Unable to get the pathway due to the ConverterException", - e); - } - // Create the corresponding pathway objects - Pathway mAnchorPw = new Pathway(); - - try { - mAnchorPw = WikiPathwaysClient.toPathway(anchorPathway); - } catch (ConverterException e) { - Logger.log.error( - "Unable to get the pathway due to the RemoteException", e); - } - - mNoGeneNode = 0; - for (PathwayElement pwElm : mAnchorPw.getDataObjects()) { - if (pwElm.getObjectType() == ObjectType.DATANODE) { - mNoGeneNode = mNoGeneNode + 1; - - } - } - String[] temp = new String[mNoGeneNode]; - for (int i = 1; i <= mNoGeneNode; i++) { - temp[i - 1] = String.valueOf(i); - } - upperBoundSharingNodeNoComboBox - .setModel(new javax.swing.DefaultComboBoxModel(temp)); - - lastLabel.setForeground(new java.awt.Color(0, 0, 255)); - lastLabel.setText("Nodes"); - - searchHelpButton.setText("Search"); - searchHelpButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - searchHelpButtonActionPerformed(evt); - } - }); - - candidatePathwaysSharingNodesTableModel.addColumn("Pathway Name"); - candidatePathwaysSharingNodesTableModel.addColumn("ID"); - candidatePathwaysSharingNodesTableModel.addColumn("No. Shared Nodes"); - - candidatePathwaysSharingNodesTable - .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - candidatePathwaysSharingNodesScrollPane - .setViewportView(candidatePathwaysSharingNodesTable); - candidatePathwaysSharingNodesTable - .setModel(candidatePathwaysSharingNodesTableModel); - - TableColumn column = null; - for (int i = 0; i < 3; i++) { - column = candidatePathwaysSharingNodesTable.getColumnModel() - .getColumn(i); - if (i == 0) { - column.setPreferredWidth(150); - } else if (i == 1) { - column.setPreferredWidth(40); - } else { - column.setPreferredWidth(60); - } - - } - - org.jdesktop.layout.GroupLayout helpPanelLayout = new org.jdesktop.layout.GroupLayout( - helpPanel); - helpPanel.setLayout(helpPanelLayout); - helpPanelLayout - .setHorizontalGroup(helpPanelLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - helpPanelLayout - .createSequentialGroup() - .add( - helpPanelLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - helpPanelLayout - .createSequentialGroup() - .addContainerGap() - .add( - explainHelpLabel1)) - .add( - helpPanelLayout - .createSequentialGroup() - .addContainerGap() - .add( - explainHelpLabel2)) - .add( - helpPanelLayout - .createSequentialGroup() - .add( - 19, - 19, - 19) - .add( - helpPanelLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - anchorPathwayLabel) - .add( - sharingNodeNoLabel)) - .add( - 6, - 6, - 6) - .add( - helpPanelLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING, - false) - .add( - helpPanelLayout - .createSequentialGroup() - .add( - lowerBoundLabel) - .add( - 18, - 18, - 18) - .add( - lowerBoundSharingNodeNoComboBox, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add( - 18, - 18, - 18) - .add( - upperBoundLabel) - .add( - 18, - 18, - 18) - .add( - upperBoundSharingNodeNoComboBox, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .add( - helpPanelLayout - .createSequentialGroup() - .add( - 23, - 23, - 23) - .add( - anchorPathwayNameIDLabel, - 0, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE))) - .add( - 18, - 18, - 18) - .add( - lastLabel) - .add( - 18, - 18, - 18) - .add( - searchHelpButton))) - .addContainerGap(24, Short.MAX_VALUE)) - .add( - org.jdesktop.layout.GroupLayout.TRAILING, - helpPanelLayout - .createSequentialGroup() - .addContainerGap(190, Short.MAX_VALUE) - // .add(backToSearchButton) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.RELATED) - .add(addHelpButton).add(26, 26, 26)) - .add( - helpPanelLayout - .createSequentialGroup() - .addContainerGap() - .add( - candidatePathwaysSharingNodesScrollPane, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - 402, Short.MAX_VALUE).add(16, - 16, 16))); - - /* - * helpPanelLayout.linkSize(new java.awt.Component[] { addHelpButton, - * backToSearchButton }, org.jdesktop.layout.GroupLayout.HORIZONTAL); - */ - - helpPanelLayout - .setVerticalGroup(helpPanelLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - helpPanelLayout - .createSequentialGroup() - .add(33, 33, 33) - .add(explainHelpLabel1) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.UNRELATED) - .add(explainHelpLabel2) - .add(44, 44, 44) - .add( - helpPanelLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.BASELINE) - .add(anchorPathwayLabel) - .add( - anchorPathwayNameIDLabel, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .add(23, 23, 23) - .add( - helpPanelLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.BASELINE) - .add(lowerBoundLabel) - .add( - lowerBoundSharingNodeNoComboBox, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(upperBoundLabel) - .add( - upperBoundSharingNodeNoComboBox, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(lastLabel) - .add(searchHelpButton) - .add(sharingNodeNoLabel)) - .add(53, 53, 53) - .add( - candidatePathwaysSharingNodesScrollPane, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - 251, Short.MAX_VALUE) - .add(29, 29, 29) - .add( - helpPanelLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.BASELINE) - // .add(backToSearchButton) - .add(addHelpButton)) - .addContainerGap(131, Short.MAX_VALUE))); - - /* - * helpPanelLayout.linkSize(new java.awt.Component[] { addHelpButton, - * backToSearchButton }, org.jdesktop.layout.GroupLayout.VERTICAL); - */ - - helpPanelLayout.linkSize(new java.awt.Component[] { lastLabel, - lowerBoundLabel, lowerBoundSharingNodeNoComboBox, - searchHelpButton, sharingNodeNoLabel, upperBoundLabel, - upperBoundSharingNodeNoComboBox }, - org.jdesktop.layout.GroupLayout.VERTICAL); - - // setLayout(helpPanelLayout); - setContentPane(helpPanel); - pack(); - - } - - private void searchHelpButtonActionPerformed(java.awt.event.ActionEvent evt) { - - // clean the table - int num = candidatePathwaysSharingNodesTableModel.getRowCount(); - for (int t = 0; t < num; t++) { - candidatePathwaysSharingNodesTableModel.removeRow(t); - } - - candidatePathwaysSharingNodesTable - .setModel(candidatePathwaysSharingNodesTableModel); - setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - - // debugging - /* - * Class columnType = - * candidatePathwaysSharingNodesTableModel.getColumnClass(2); - * System.out.println("2. in searchHelpButtonActionPerformed, right - * after adding column names"); System.out.println(columnType+""); - */ - - // String anchorPwNameAndId = - // anchorPathwayComboBox.getSelectedItem().toString(); - int lowerBound = Integer.parseInt(lowerBoundSharingNodeNoComboBox - .getSelectedItem().toString()); - int upperBound = Integer.parseInt(upperBoundSharingNodeNoComboBox - .getSelectedItem().toString()); - - // mCandidatePwList = findCandidatePwBySharingNodes(lowerBound, - // upperBound); - - searchSharingNodePwsTask task = new searchSharingNodePwsTask( - lowerBound, upperBound); - - JTaskConfig config = new JTaskConfig(); - config.displayCancelButton(true); - // config.displayCloseButton(true); - // config.displayStatus(true); - config.setModal(true); - TaskManager.executeTask(task, config); - setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - - } - - private void addHelpButtonActionPerformed(java.awt.event.ActionEvent evt) { - - selectedPws = new ArrayList(); - int[] selectedRowIndices = candidatePathwaysSharingNodesTable - .getSelectedRows(); - - for (int i = 0; i < selectedRowIndices.length; i++) { - int viewRow = selectedRowIndices[i]; - int modelRow = sorter.modelIndex(viewRow); - - String pwNameId = (String) candidatePathwaysSharingNodesTableModel - .getValueAt(modelRow, 0) - + "(" - + (String) candidatePathwaysSharingNodesTableModel - .getValueAt(modelRow, 1) + ")"; - System.out - .println("After clicking the Add button in the 'Search Help' panel!"); - System.out.println(pwNameId); - - selectedPws.add(pwNameId); - SuperpathwaysGui spGUI = mClient.getGUI(); - if (!spGUI.selectedPathwaysListModel.contains(pwNameId)) { - spGUI.selectedPathwaysListModel.addElement((Object) pwNameId); - spGUI.selectedPathwaysList - .setModel(spGUI.selectedPathwaysListModel); - - /*if (spGUI.availablePathwaysListModel.getSize() > 0) { - spGUI.rightButton.setEnabled(true); - }*/ - } - } - // superpathwayPanel.setSelectedIndex(0); - setVisible(false); - - } - - // private javax.swing.JComboBox anchorPathwayComboBox; - - private TableSorter sorter; - - private javax.swing.JLabel anchorPathwayLabel; - - private javax.swing.JLabel anchorPathwayNameIDLabel; - - // private javax.swing.DefaultComboBoxModel anchorPathwayComboBoxModel; - - // private javax.swing.JButton backToSearchButton; - - private javax.swing.JScrollPane candidatePathwaysSharingNodesScrollPane; - - private javax.swing.JLabel lowerBoundLabel; - - private javax.swing.JLabel explainHelpLabel1; - - private javax.swing.JLabel explainHelpLabel2; - - private javax.swing.JPanel helpPanel; - - private javax.swing.JLabel upperBoundLabel; - - private javax.swing.JComboBox upperBoundSharingNodeNoComboBox; - - private javax.swing.JButton searchHelpButton; - - private javax.swing.JLabel lastLabel; - - private javax.swing.JTable candidatePathwaysSharingNodesTable; - - private javax.swing.JLabel sharingNodeNoLabel; - - private javax.swing.JButton addHelpButton; - - private javax.swing.JComboBox lowerBoundSharingNodeNoComboBox; - - private javax.swing.table.DefaultTableModel candidatePathwaysSharingNodesTableModel = new DefaultTableModel() { - Class[] classes = { String.class, String.class, Integer.class }; - - public Class getColumnClass(int column) { - return classes[column]; - } - };; - - public class searchSharingNodePwsTask implements Task { - - TaskMonitor monitor; - - int lowerBound; - - int upperBound; - - boolean cancelled; - - public searchSharingNodePwsTask(int lb, int ub) { - lowerBound = lb; - upperBound = ub; - cancelled = false; - } - - /** - * Run the Task. - */ - public void run() { - - try { - mCandidatePw = new ArrayList(); - if (lowerBound > upperBound) { - JOptionPane.showMessageDialog(helpPanel, - "Please reset the range of sharing nodes number!"); - } else { - - Map sharingNodeNumberofPws = new HashMap(); - List geneIDList = new ArrayList(); - int percentComplete = 0; - int t = 0; - - // Create a client to the WikiPathways web service - WikiPathwaysClient client = mClient.getStub(); - - int index1 = anchorPwNameID.lastIndexOf("("); - int index2 = anchorPwNameID.lastIndexOf(")"); - String anchorPwID = anchorPwNameID.substring(index1 + 1, - index2); - - WSPathway anchorPathway = new WSPathway(); - - try { - anchorPathway = client.getPathway(anchorPwID); - - } catch (RemoteException e) { - Logger.log - .error( - "Unable to get the pathway due to the RemoteException", - e); - } catch (ConverterException e) { - Logger.log - .error( - "Unable to get the pathway due to the ConverterException", - e); - } - // Create two corresponding pathway objects - Pathway mAnchorPw = new Pathway(); - - try { - mAnchorPw = WikiPathwaysClient.toPathway(anchorPathway); - } catch (ConverterException e) { - Logger.log - .error( - "Unable to get the pathway due to the RemoteException", - e); - } - - // the following code is get a map "mNodeIdToPwsSharingNode" - // with key of GeneID and value of a list of pathways which - // contain the GeneID - for (PathwayElement pwElm : mAnchorPw.getDataObjects()) { - // Only take elements with type DATANODE (genes, - // proteins, metabolites) - if (pwElm.getObjectType() == ObjectType.DATANODE) { - - if (!cancelled) { - percentComplete = (int) (((double) t / mNoGeneNode) * 98); - - System.out.println(pwElm.getXref().toString()); - geneIDList.add(pwElm.getXref().toString()); - - try { - WSSearchResult[] PwsSharingNode = client - .findPathwaysByXref(pwElm.getXref()); - // System.out.println("" + - // PwsSharingNode.length); - mNodeIdToPwsSharingNode.put(pwElm.getXref() - .toString(), PwsSharingNode); - - if (monitor != null) { - monitor - .setPercentCompleted(percentComplete); - } - - } catch (RemoteException e) { - Logger.log - .error( - "Unable to find the candidate pathways due to the RemoteException", - e); - } - } - } - t++; - - } - - // the following code is for converting the above map to - // another map "sharingNodeNumberofPws" with key of - // the name and id of a pathway, and value of the number of - // shared node of this pathway and the anchor pathway - for (int i = 0; i < mNoGeneNode; i++) { - if (!cancelled) { - WSSearchResult[] pwsArray = mNodeIdToPwsSharingNode - .get(geneIDList.get(i)); - - for (int j = 0; j < pwsArray.length; j++) { - WSSearchResult pw = pwsArray[j]; - // pay attention to the following two code lines - SuperpathwaysGui spGui = mClient.getGUI(); - ResultRow pwResultRow = spGui.new ResultRow(pw); - String onePwNameAndId = pwResultRow - .getProperty(ResultProperty.NAME) - + "(" - + pwResultRow - .getProperty(ResultProperty.ID) - + ")"; - - if (sharingNodeNumberofPws - .containsKey(onePwNameAndId)) { - Integer oldValue = sharingNodeNumberofPws - .get(onePwNameAndId); - Integer newValue = new Integer(oldValue + 1); - sharingNodeNumberofPws.put(onePwNameAndId, - newValue); - } else { - sharingNodeNumberofPws.put(onePwNameAndId, - 1); - } - } - } - } - - // the following code is for displaying the result in the - // table of "Search Help" panel - if (!cancelled) { - Set sharingNodePwsSet = sharingNodeNumberofPws - .keySet(); - Iterator it = sharingNodePwsSet.iterator(); - while (it.hasNext()) { - String temp = it.next(); - Integer value = sharingNodeNumberofPws.get(temp); - if (value >= lowerBound && value <= upperBound) { - mCandidatePw.add(temp - + ", sharing node number: " - + String.valueOf(value)); - } - } - } - - } - - // mCandidatePw is a list of string with elements in format - // "Pathway - // Name (pw id), sharing node number: a int" - // System.out.println(mCandidatePw.size()+""); - if (!cancelled) { - Iterator it = mCandidatePw.iterator(); - - while (it.hasNext()) { - String temp = it.next(); - // candidatePathwaysSharingNodesListModel.addElement(temp); - - // System.out.println(temp); - // parse the string into three parts: pathway name, id, - // and - // No. - // Sharing Nodes - int index1 = temp.lastIndexOf(","); - String temp1 = temp.substring(0, index1); - - int index2 = temp1.lastIndexOf("("); - int index3 = temp1.lastIndexOf(")"); - String pwName = temp1.substring(0, index2); - // System.out.println(pwName); - String pwId = temp1.substring(index2 + 1, index3); - // System.out.println(pwId); - - // String temp2 = temp.substring(index1+1); - int index4 = temp.lastIndexOf(":"); - String NoSharingNode = temp.substring(index4 + 2); - Integer NoSharingNodeInteger = Integer - .valueOf(NoSharingNode); - - Object[] row = new Object[3]; - row[0] = pwName; - row[1] = pwId; - row[2] = NoSharingNodeInteger; - // row[2] = NoSharingNode; - candidatePathwaysSharingNodesTableModel.addRow(row); - } - - sorter = new TableSorter( - candidatePathwaysSharingNodesTableModel); - candidatePathwaysSharingNodesTable.setModel(sorter); - sorter.setTableHeader(candidatePathwaysSharingNodesTable - .getTableHeader()); - - // candidatePathwaysSharingNodesList.setModel(candidatePathwaysSharingNodesListModel); - setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - - if (monitor != null) { - monitor.setPercentCompleted(100); - } - // System.out.println("We reach here 2!"); - } - } catch (Exception e) { - Logger.log.error("Error while searching candidate pathways", e); - JOptionPane.showMessageDialog(mClient.getGUI(), "Error: " - + e.getMessage() + ". See log for details", "Error", - JOptionPane.ERROR_MESSAGE); - } - - } - - public void halt() { - cancelled = true; - } - - public void setTaskMonitor(TaskMonitor m) - throws IllegalThreadStateException { - monitor = m; - } - - public String getTitle() { - return new String( - "Searching candidate pathways with shared nodes..."); - } - } - +// PathVisio, +// a tool for data visualization and analysis using Biological Pathways +// Copyright 2006-2011 BiGCaT Bioinformatics +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +package org.pathvisio.cytoscape.superpathways; + +import java.awt.Cursor; +import java.rmi.RemoteException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.swing.JDialog; +import javax.swing.JOptionPane; +import javax.swing.ListSelectionModel; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableColumn; + +import org.pathvisio.core.debug.Logger; +import org.pathvisio.core.model.ConverterException; +import org.pathvisio.core.model.ObjectType; +import org.pathvisio.core.model.Pathway; +import org.pathvisio.core.model.PathwayElement; +import org.pathvisio.cytoscape.superpathways.SuperpathwaysGui.ResultRow; +import org.pathvisio.wikipathways.webservice.WSPathway; +import org.pathvisio.wikipathways.webservice.WSSearchResult; +import org.wikipathways.client.WikiPathwaysClient; + +import cytoscape.task.Task; +import cytoscape.task.TaskMonitor; +import cytoscape.task.ui.JTaskConfig; +import cytoscape.task.util.TaskManager; + +public class FindRelatedPwsDialog extends JDialog { + + SuperpathwaysClient mClient; + + private List mCandidatePw; + + String anchorPwNameID; + + int mNoGeneNode; + + private Map mNodeIdToPwsSharingNode = new HashMap(); + + List selectedPws; + + public FindRelatedPwsDialog(SuperpathwaysClient client, String s, + String anchorPw) { + super(client.getPlugin().mWindow, s); + mClient = client; + setSize(250, 300); + setModal(true); + initComponents(anchorPw); + setModal(false); + + } + + private void initComponents(String anchorPw) { + + anchorPwNameID = anchorPw; + // the following items are in helpPanel Dialog + helpPanel = new javax.swing.JPanel(); + anchorPathwayLabel = new javax.swing.JLabel(); + sharingNodeNoLabel = new javax.swing.JLabel(); + // anchorPathwayComboBox = new javax.swing.JComboBox(); + anchorPathwayNameIDLabel = new javax.swing.JLabel(); + + lowerBoundSharingNodeNoComboBox = new javax.swing.JComboBox(); + candidatePathwaysSharingNodesScrollPane = new javax.swing.JScrollPane(); + candidatePathwaysSharingNodesTable = new javax.swing.JTable(); + + explainHelpLabel1 = new javax.swing.JLabel(); + addHelpButton = new javax.swing.JButton(); + lowerBoundLabel = new javax.swing.JLabel(); + upperBoundLabel = new javax.swing.JLabel(); + upperBoundSharingNodeNoComboBox = new javax.swing.JComboBox(); + explainHelpLabel2 = new javax.swing.JLabel(); + // backToSearchButton = new javax.swing.JButton(); + searchHelpButton = new javax.swing.JButton(); + lastLabel = new javax.swing.JLabel(); + + // the follwoing code is for Search Help tab + anchorPathwayLabel.setForeground(new java.awt.Color(0, 0, 255)); + anchorPathwayLabel.setText("Selected Pathway: "); + + anchorPathwayNameIDLabel.setForeground(new java.awt.Color(0, 0, 255)); + anchorPathwayNameIDLabel.setText(anchorPw); + + sharingNodeNoLabel.setForeground(new java.awt.Color(0, 0, 255)); + sharingNodeNoLabel.setText("Sharing"); + + // anchorPathwayComboBox.setModel(new + // DefaultComboBoxModel(mAvailablePathwaysNameIDList.toArray())); + + lowerBoundSharingNodeNoComboBox + .setModel(new javax.swing.DefaultComboBoxModel(new String[] { + "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" })); + + // candidatePathwaysSharingNodesTable.setModel(); + + explainHelpLabel1.setFont(new java.awt.Font("Dialog", 1, 11)); // NOI18N + explainHelpLabel1.setForeground(new java.awt.Color(102, 0, 0)); + explainHelpLabel1 + .setText("Set the range of sharing nodes number for the selected pathway, a list of candidate"); + + explainHelpLabel2.setFont(new java.awt.Font("Dialog", 1, 11)); // NOI18N + explainHelpLabel2.setForeground(new java.awt.Color(102, 0, 0)); + explainHelpLabel2 + .setText("pathways with sharing nodes would be returned after clicking Search button."); + + addHelpButton.setText("Add"); + addHelpButton + .setToolTipText("add the selected pathways to the 'Available Pathways' list"); + + addHelpButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + addHelpButtonActionPerformed(evt); + } + }); + + lowerBoundLabel.setForeground(new java.awt.Color(0, 0, 255)); + lowerBoundLabel.setText("Minimum"); + + upperBoundLabel.setForeground(new java.awt.Color(0, 0, 255)); + upperBoundLabel.setText("Maximum"); + + // set the numbers for according to the selected pathway + int index1 = anchorPw.lastIndexOf("("); + int index2 = anchorPw.lastIndexOf(")"); + String anchorPwID = anchorPw.substring(index1 + 1, index2); + + // Create a client to the WikiPathways web service + WikiPathwaysClient client = mClient.getStub(); + WSPathway anchorPathway = new WSPathway(); + + try { + anchorPathway = client.getPathway(anchorPwID); + + } catch (RemoteException e) { + Logger.log.error( + "Unable to get the pathway due to the RemoteException", e); + } catch (ConverterException e) { + Logger.log.error( + "Unable to get the pathway due to the ConverterException", + e); + } + // Create the corresponding pathway objects + Pathway mAnchorPw = new Pathway(); + + try { + mAnchorPw = WikiPathwaysClient.toPathway(anchorPathway); + } catch (ConverterException e) { + Logger.log.error( + "Unable to get the pathway due to the RemoteException", e); + } + + mNoGeneNode = 0; + for (PathwayElement pwElm : mAnchorPw.getDataObjects()) { + if (pwElm.getObjectType() == ObjectType.DATANODE) { + mNoGeneNode = mNoGeneNode + 1; + + } + } + String[] temp = new String[mNoGeneNode]; + for (int i = 1; i <= mNoGeneNode; i++) { + temp[i - 1] = String.valueOf(i); + } + upperBoundSharingNodeNoComboBox + .setModel(new javax.swing.DefaultComboBoxModel(temp)); + + lastLabel.setForeground(new java.awt.Color(0, 0, 255)); + lastLabel.setText("Nodes"); + + searchHelpButton.setText("Search"); + searchHelpButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + searchHelpButtonActionPerformed(evt); + } + }); + + candidatePathwaysSharingNodesTableModel.addColumn("Pathway Name"); + candidatePathwaysSharingNodesTableModel.addColumn("ID"); + candidatePathwaysSharingNodesTableModel.addColumn("No. Shared Nodes"); + + candidatePathwaysSharingNodesTable + .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + candidatePathwaysSharingNodesScrollPane + .setViewportView(candidatePathwaysSharingNodesTable); + candidatePathwaysSharingNodesTable + .setModel(candidatePathwaysSharingNodesTableModel); + + TableColumn column = null; + for (int i = 0; i < 3; i++) { + column = candidatePathwaysSharingNodesTable.getColumnModel() + .getColumn(i); + if (i == 0) { + column.setPreferredWidth(150); + } else if (i == 1) { + column.setPreferredWidth(40); + } else { + column.setPreferredWidth(60); + } + + } + + org.jdesktop.layout.GroupLayout helpPanelLayout = new org.jdesktop.layout.GroupLayout( + helpPanel); + helpPanel.setLayout(helpPanelLayout); + helpPanelLayout + .setHorizontalGroup(helpPanelLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add( + helpPanelLayout + .createSequentialGroup() + .add( + helpPanelLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add( + helpPanelLayout + .createSequentialGroup() + .addContainerGap() + .add( + explainHelpLabel1)) + .add( + helpPanelLayout + .createSequentialGroup() + .addContainerGap() + .add( + explainHelpLabel2)) + .add( + helpPanelLayout + .createSequentialGroup() + .add( + 19, + 19, + 19) + .add( + helpPanelLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add( + anchorPathwayLabel) + .add( + sharingNodeNoLabel)) + .add( + 6, + 6, + 6) + .add( + helpPanelLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING, + false) + .add( + helpPanelLayout + .createSequentialGroup() + .add( + lowerBoundLabel) + .add( + 18, + 18, + 18) + .add( + lowerBoundSharingNodeNoComboBox, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add( + 18, + 18, + 18) + .add( + upperBoundLabel) + .add( + 18, + 18, + 18) + .add( + upperBoundSharingNodeNoComboBox, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add( + helpPanelLayout + .createSequentialGroup() + .add( + 23, + 23, + 23) + .add( + anchorPathwayNameIDLabel, + 0, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE))) + .add( + 18, + 18, + 18) + .add( + lastLabel) + .add( + 18, + 18, + 18) + .add( + searchHelpButton))) + .addContainerGap(24, Short.MAX_VALUE)) + .add( + org.jdesktop.layout.GroupLayout.TRAILING, + helpPanelLayout + .createSequentialGroup() + .addContainerGap(190, Short.MAX_VALUE) + // .add(backToSearchButton) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add(addHelpButton).add(26, 26, 26)) + .add( + helpPanelLayout + .createSequentialGroup() + .addContainerGap() + .add( + candidatePathwaysSharingNodesScrollPane, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + 402, Short.MAX_VALUE).add(16, + 16, 16))); + + /* + * helpPanelLayout.linkSize(new java.awt.Component[] { addHelpButton, + * backToSearchButton }, org.jdesktop.layout.GroupLayout.HORIZONTAL); + */ + + helpPanelLayout + .setVerticalGroup(helpPanelLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add( + helpPanelLayout + .createSequentialGroup() + .add(33, 33, 33) + .add(explainHelpLabel1) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.UNRELATED) + .add(explainHelpLabel2) + .add(44, 44, 44) + .add( + helpPanelLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(anchorPathwayLabel) + .add( + anchorPathwayNameIDLabel, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(23, 23, 23) + .add( + helpPanelLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(lowerBoundLabel) + .add( + lowerBoundSharingNodeNoComboBox, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(upperBoundLabel) + .add( + upperBoundSharingNodeNoComboBox, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(lastLabel) + .add(searchHelpButton) + .add(sharingNodeNoLabel)) + .add(53, 53, 53) + .add( + candidatePathwaysSharingNodesScrollPane, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + 251, Short.MAX_VALUE) + .add(29, 29, 29) + .add( + helpPanelLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + // .add(backToSearchButton) + .add(addHelpButton)) + .addContainerGap(131, Short.MAX_VALUE))); + + /* + * helpPanelLayout.linkSize(new java.awt.Component[] { addHelpButton, + * backToSearchButton }, org.jdesktop.layout.GroupLayout.VERTICAL); + */ + + helpPanelLayout.linkSize(new java.awt.Component[] { lastLabel, + lowerBoundLabel, lowerBoundSharingNodeNoComboBox, + searchHelpButton, sharingNodeNoLabel, upperBoundLabel, + upperBoundSharingNodeNoComboBox }, + org.jdesktop.layout.GroupLayout.VERTICAL); + + // setLayout(helpPanelLayout); + setContentPane(helpPanel); + pack(); + + } + + private void searchHelpButtonActionPerformed(java.awt.event.ActionEvent evt) { + + // clean the table + int num = candidatePathwaysSharingNodesTableModel.getRowCount(); + for (int t = 0; t < num; t++) { + candidatePathwaysSharingNodesTableModel.removeRow(t); + } + + candidatePathwaysSharingNodesTable + .setModel(candidatePathwaysSharingNodesTableModel); + setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + + // debugging + /* + * Class columnType = + * candidatePathwaysSharingNodesTableModel.getColumnClass(2); + * System.out.println("2. in searchHelpButtonActionPerformed, right + * after adding column names"); System.out.println(columnType+""); + */ + + // String anchorPwNameAndId = + // anchorPathwayComboBox.getSelectedItem().toString(); + int lowerBound = Integer.parseInt(lowerBoundSharingNodeNoComboBox + .getSelectedItem().toString()); + int upperBound = Integer.parseInt(upperBoundSharingNodeNoComboBox + .getSelectedItem().toString()); + + // mCandidatePwList = findCandidatePwBySharingNodes(lowerBound, + // upperBound); + + searchSharingNodePwsTask task = new searchSharingNodePwsTask( + lowerBound, upperBound); + + JTaskConfig config = new JTaskConfig(); + config.displayCancelButton(true); + // config.displayCloseButton(true); + // config.displayStatus(true); + config.setModal(true); + TaskManager.executeTask(task, config); + setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + + } + + private void addHelpButtonActionPerformed(java.awt.event.ActionEvent evt) { + + selectedPws = new ArrayList(); + int[] selectedRowIndices = candidatePathwaysSharingNodesTable + .getSelectedRows(); + + for (int i = 0; i < selectedRowIndices.length; i++) { + int viewRow = selectedRowIndices[i]; + int modelRow = sorter.modelIndex(viewRow); + + String pwNameId = (String) candidatePathwaysSharingNodesTableModel + .getValueAt(modelRow, 0) + + "(" + + (String) candidatePathwaysSharingNodesTableModel + .getValueAt(modelRow, 1) + ")"; + System.out + .println("After clicking the Add button in the 'Search Help' panel!"); + System.out.println(pwNameId); + + selectedPws.add(pwNameId); + SuperpathwaysGui spGUI = mClient.getGUI(); + if (!spGUI.selectedPathwaysListModel.contains(pwNameId)) { + spGUI.selectedPathwaysListModel.addElement((Object) pwNameId); + spGUI.selectedPathwaysList + .setModel(spGUI.selectedPathwaysListModel); + + /*if (spGUI.availablePathwaysListModel.getSize() > 0) { + spGUI.rightButton.setEnabled(true); + }*/ + } + } + // superpathwayPanel.setSelectedIndex(0); + setVisible(false); + + } + + // private javax.swing.JComboBox anchorPathwayComboBox; + + private TableSorter sorter; + + private javax.swing.JLabel anchorPathwayLabel; + + private javax.swing.JLabel anchorPathwayNameIDLabel; + + // private javax.swing.DefaultComboBoxModel anchorPathwayComboBoxModel; + + // private javax.swing.JButton backToSearchButton; + + private javax.swing.JScrollPane candidatePathwaysSharingNodesScrollPane; + + private javax.swing.JLabel lowerBoundLabel; + + private javax.swing.JLabel explainHelpLabel1; + + private javax.swing.JLabel explainHelpLabel2; + + private javax.swing.JPanel helpPanel; + + private javax.swing.JLabel upperBoundLabel; + + private javax.swing.JComboBox upperBoundSharingNodeNoComboBox; + + private javax.swing.JButton searchHelpButton; + + private javax.swing.JLabel lastLabel; + + private javax.swing.JTable candidatePathwaysSharingNodesTable; + + private javax.swing.JLabel sharingNodeNoLabel; + + private javax.swing.JButton addHelpButton; + + private javax.swing.JComboBox lowerBoundSharingNodeNoComboBox; + + private javax.swing.table.DefaultTableModel candidatePathwaysSharingNodesTableModel = new DefaultTableModel() { + Class[] classes = { String.class, String.class, Integer.class }; + + public Class getColumnClass(int column) { + return classes[column]; + } + };; + + public class searchSharingNodePwsTask implements Task { + + TaskMonitor monitor; + + int lowerBound; + + int upperBound; + + boolean cancelled; + + public searchSharingNodePwsTask(int lb, int ub) { + lowerBound = lb; + upperBound = ub; + cancelled = false; + } + + /** + * Run the Task. + */ + public void run() { + + try { + mCandidatePw = new ArrayList(); + if (lowerBound > upperBound) { + JOptionPane.showMessageDialog(helpPanel, + "Please reset the range of sharing nodes number!"); + } else { + + Map sharingNodeNumberofPws = new HashMap(); + List geneIDList = new ArrayList(); + int percentComplete = 0; + int t = 0; + + // Create a client to the WikiPathways web service + WikiPathwaysClient client = mClient.getStub(); + + int index1 = anchorPwNameID.lastIndexOf("("); + int index2 = anchorPwNameID.lastIndexOf(")"); + String anchorPwID = anchorPwNameID.substring(index1 + 1, + index2); + + WSPathway anchorPathway = new WSPathway(); + + try { + anchorPathway = client.getPathway(anchorPwID); + + } catch (RemoteException e) { + Logger.log + .error( + "Unable to get the pathway due to the RemoteException", + e); + } catch (ConverterException e) { + Logger.log + .error( + "Unable to get the pathway due to the ConverterException", + e); + } + // Create two corresponding pathway objects + Pathway mAnchorPw = new Pathway(); + + try { + mAnchorPw = WikiPathwaysClient.toPathway(anchorPathway); + } catch (ConverterException e) { + Logger.log + .error( + "Unable to get the pathway due to the RemoteException", + e); + } + + // the following code is get a map "mNodeIdToPwsSharingNode" + // with key of GeneID and value of a list of pathways which + // contain the GeneID + for (PathwayElement pwElm : mAnchorPw.getDataObjects()) { + // Only take elements with type DATANODE (genes, + // proteins, metabolites) + if (pwElm.getObjectType() == ObjectType.DATANODE) { + + if (!cancelled) { + percentComplete = (int) (((double) t / mNoGeneNode) * 98); + + System.out.println(pwElm.getXref().toString()); + geneIDList.add(pwElm.getXref().toString()); + + try { + WSSearchResult[] PwsSharingNode = client + .findPathwaysByXref(pwElm.getXref()); + // System.out.println("" + + // PwsSharingNode.length); + mNodeIdToPwsSharingNode.put(pwElm.getXref() + .toString(), PwsSharingNode); + + if (monitor != null) { + monitor + .setPercentCompleted(percentComplete); + } + + } catch (RemoteException e) { + Logger.log + .error( + "Unable to find the candidate pathways due to the RemoteException", + e); + } + } + } + t++; + + } + + // the following code is for converting the above map to + // another map "sharingNodeNumberofPws" with key of + // the name and id of a pathway, and value of the number of + // shared node of this pathway and the anchor pathway + for (int i = 0; i < mNoGeneNode; i++) { + if (!cancelled) { + WSSearchResult[] pwsArray = mNodeIdToPwsSharingNode + .get(geneIDList.get(i)); + + for (int j = 0; j < pwsArray.length; j++) { + WSSearchResult pw = pwsArray[j]; + // pay attention to the following two code lines + SuperpathwaysGui spGui = mClient.getGUI(); + ResultRow pwResultRow = spGui.new ResultRow(pw); + String onePwNameAndId = pwResultRow + .getProperty(ResultProperty.NAME) + + "(" + + pwResultRow + .getProperty(ResultProperty.ID) + + ")"; + + if (sharingNodeNumberofPws + .containsKey(onePwNameAndId)) { + Integer oldValue = sharingNodeNumberofPws + .get(onePwNameAndId); + Integer newValue = new Integer(oldValue + 1); + sharingNodeNumberofPws.put(onePwNameAndId, + newValue); + } else { + sharingNodeNumberofPws.put(onePwNameAndId, + 1); + } + } + } + } + + // the following code is for displaying the result in the + // table of "Search Help" panel + if (!cancelled) { + Set sharingNodePwsSet = sharingNodeNumberofPws + .keySet(); + Iterator it = sharingNodePwsSet.iterator(); + while (it.hasNext()) { + String temp = it.next(); + Integer value = sharingNodeNumberofPws.get(temp); + if (value >= lowerBound && value <= upperBound) { + mCandidatePw.add(temp + + ", sharing node number: " + + String.valueOf(value)); + } + } + } + + } + + // mCandidatePw is a list of string with elements in format + // "Pathway + // Name (pw id), sharing node number: a int" + // System.out.println(mCandidatePw.size()+""); + if (!cancelled) { + Iterator it = mCandidatePw.iterator(); + + while (it.hasNext()) { + String temp = it.next(); + // candidatePathwaysSharingNodesListModel.addElement(temp); + + // System.out.println(temp); + // parse the string into three parts: pathway name, id, + // and + // No. + // Sharing Nodes + int index1 = temp.lastIndexOf(","); + String temp1 = temp.substring(0, index1); + + int index2 = temp1.lastIndexOf("("); + int index3 = temp1.lastIndexOf(")"); + String pwName = temp1.substring(0, index2); + // System.out.println(pwName); + String pwId = temp1.substring(index2 + 1, index3); + // System.out.println(pwId); + + // String temp2 = temp.substring(index1+1); + int index4 = temp.lastIndexOf(":"); + String NoSharingNode = temp.substring(index4 + 2); + Integer NoSharingNodeInteger = Integer + .valueOf(NoSharingNode); + + Object[] row = new Object[3]; + row[0] = pwName; + row[1] = pwId; + row[2] = NoSharingNodeInteger; + // row[2] = NoSharingNode; + candidatePathwaysSharingNodesTableModel.addRow(row); + } + + sorter = new TableSorter( + candidatePathwaysSharingNodesTableModel); + candidatePathwaysSharingNodesTable.setModel(sorter); + sorter.setTableHeader(candidatePathwaysSharingNodesTable + .getTableHeader()); + + // candidatePathwaysSharingNodesList.setModel(candidatePathwaysSharingNodesListModel); + setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + + if (monitor != null) { + monitor.setPercentCompleted(100); + } + // System.out.println("We reach here 2!"); + } + } catch (Exception e) { + Logger.log.error("Error while searching candidate pathways", e); + JOptionPane.showMessageDialog(mClient.getGUI(), "Error: " + + e.getMessage() + ". See log for details", "Error", + JOptionPane.ERROR_MESSAGE); + } + + } + + public void halt() { + cancelled = true; + } + + public void setTaskMonitor(TaskMonitor m) + throws IllegalThreadStateException { + monitor = m; + } + + public String getTitle() { + return new String( + "Searching candidate pathways with shared nodes..."); + } + } + } \ No newline at end of file diff --git a/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/PieGenerator.java b/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/PieGenerator.java index 970f8c1f..e229926b 100644 --- a/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/PieGenerator.java +++ b/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/PieGenerator.java @@ -1,110 +1,110 @@ -// PathVisio, -// a tool for data visualization and analysis using Biological Pathways -// Copyright 2006-2011 BiGCaT Bioinformatics -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package org.pathvisio.cytoscape.superpathways; - -import java.awt.Color; -import java.io.File; -import java.util.List; - -import org.jfree.chart.ChartFactory; -import org.jfree.chart.ChartPanel; -import org.jfree.chart.ChartUtilities; -import org.jfree.chart.JFreeChart; -import org.jfree.chart.plot.PiePlot; -import org.jfree.data.general.DefaultPieDataset; -import org.jfree.ui.ApplicationFrame; -import org.jfree.ui.RefineryUtilities; -import org.pathvisio.core.preferences.GlobalPreference; - -public class PieGenerator{ // extends ApplicationFrame { - - Color[] colors; - static String imageLocation = GlobalPreference.getApplicationDir() .toString()+ "/" ; - - public PieGenerator(Color[] c){ //(final String title) { - colors=c; - } - - public void generatePie(int number){ - // Defining the dataset - DefaultPieDataset dataset = new DefaultPieDataset(); - for (int i=0; i keys = dataset.getKeys(); - int aInt; - - for (int i = 0; i < keys.size(); i++) { - aInt = i % this.color.length; - plot.setSectionPaint(keys.get(i), this.color[aInt]); - } - } - } - +// PathVisio, +// a tool for data visualization and analysis using Biological Pathways +// Copyright 2006-2011 BiGCaT Bioinformatics +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +package org.pathvisio.cytoscape.superpathways; + +import java.awt.Color; +import java.io.File; +import java.util.List; + +import org.jfree.chart.ChartFactory; +import org.jfree.chart.ChartPanel; +import org.jfree.chart.ChartUtilities; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.plot.PiePlot; +import org.jfree.data.general.DefaultPieDataset; +import org.jfree.ui.ApplicationFrame; +import org.jfree.ui.RefineryUtilities; +import org.pathvisio.core.preferences.GlobalPreference; + +public class PieGenerator{ // extends ApplicationFrame { + + Color[] colors; + static String imageLocation = GlobalPreference.getApplicationDir() .toString()+ "/" ; + + public PieGenerator(Color[] c){ //(final String title) { + colors=c; + } + + public void generatePie(int number){ + // Defining the dataset + DefaultPieDataset dataset = new DefaultPieDataset(); + for (int i=0; i keys = dataset.getKeys(); + int aInt; + + for (int i = 0; i < keys.size(); i++) { + aInt = i % this.color.length; + plot.setSectionPaint(keys.get(i), this.color[aInt]); + } + } + } + } \ No newline at end of file diff --git a/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/SuperpathwaysClient.java b/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/SuperpathwaysClient.java index f45f6687..975b16d8 100644 --- a/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/SuperpathwaysClient.java +++ b/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/SuperpathwaysClient.java @@ -1,282 +1,282 @@ -// PathVisio, -// a tool for data visualization and analysis using Biological Pathways -// Copyright 2006-2011 BiGCaT Bioinformatics -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package org.pathvisio.cytoscape.superpathways; - -import static cytoscape.data.webservice.CyWebServiceEvent.WSEventType.IMPORT_NETWORK; -import static cytoscape.data.webservice.CyWebServiceEvent.WSEventType.SEARCH_DATABASE; - -import java.net.MalformedURLException; -import java.net.URL; -import java.rmi.RemoteException; -import java.util.Properties; - -import javax.swing.JOptionPane; -import javax.swing.SwingUtilities; -import javax.xml.rpc.ServiceException; - -import org.bridgedb.bio.Organism; -import org.pathvisio.core.debug.Logger; -import org.pathvisio.core.model.Pathway; -import org.pathvisio.wikipathways.webservice.WSPathway; -import org.pathvisio.wikipathways.webservice.WSSearchResult; -import org.wikipathways.client.WikiPathwaysClient; - -import cytoscape.CyNetwork; -import cytoscape.Cytoscape; -import cytoscape.CytoscapeInit; -import cytoscape.data.webservice.CyWebServiceEvent; -import cytoscape.data.webservice.CyWebServiceEventListener; -import cytoscape.data.webservice.CyWebServiceException; -import cytoscape.data.webservice.NetworkImportWebServiceClient; -import cytoscape.data.webservice.WebServiceClientImplWithGUI; -import cytoscape.data.webservice.WebServiceClientManager; -import cytoscape.data.webservice.WebServiceClientManager.ClientType; -import cytoscape.task.Task; -import cytoscape.task.TaskMonitor; -import cytoscape.task.ui.JTaskConfig; -import cytoscape.task.util.TaskManager; -import cytoscape.util.ModulePropertiesImpl; -import cytoscape.visual.VisualStyle; - -public class SuperpathwaysClient extends WebServiceClientImplWithGUI implements NetworkImportWebServiceClient { - private static final String DISPLAY_NAME = "Superpathways Web Service Client"; - private static final String CLIENT_ID = "superpathways"; - - //private static final String DISPLAY_NAME = "WikiPathways Web Service Client"; - //private static final String CLIENT_ID = "wikipathways"; - - protected static final String WEBSERVICE_URL = "wikipathways.webservice.uri"; - public static final String ATTR_PATHWAY_URL = "wikipathways.url"; - - private WikiPathwaysClient stub; - private String prevURL = null; - - private SuperpathwaysPlugin spPlugin; - //private GpmlPlugin gpmlPlugin; - - public SuperpathwaysClient(SuperpathwaysPlugin spPlugin) { - super(CLIENT_ID, DISPLAY_NAME, new ClientType[] { ClientType.NETWORK }, null, null, null); - Logger.log.setLogLevel(true, true, true, true, true, true); - setProperties(); - getStub(); - this.spPlugin = spPlugin; - setGUI(new SuperpathwaysGui(this)); - SuperpathwaysGui a=getGUI(); - } - - public SuperpathwaysPlugin getPlugin(){ - return spPlugin; - } - - - private void setProperties() { - //Using global properties, but need to initialize moduleproperties anyway. - props = new ModulePropertiesImpl(CLIENT_ID, "wsc"); - - Properties p = CytoscapeInit.getProperties(); - if(p.get(WEBSERVICE_URL) == null) { - p.put( - WEBSERVICE_URL, - "http://www.wikipathways.org/wpi/webservice/webservice.php" - ); - } - } - - - public WikiPathwaysClient getStub() { - String urlString = CytoscapeInit.getProperties().getProperty(WEBSERVICE_URL); - if(stub == null || prevURL == null || !prevURL.equals(urlString)) { - try { - URL url = new URL(urlString); - stub = new WikiPathwaysClient(url); - setClientStub(stub); - prevURL = urlString; - - if(gui != null) gui.resetOrganisms(); - } catch (ServiceException e) { - Logger.log.error("Unable to create WikiPathways webservice", e); - } catch (MalformedURLException ue) { - Logger.log.error("Invalid url to wsdl", ue); - } - } - return stub; - } - - - - - public void executeService(CyWebServiceEvent e)throws CyWebServiceException { - //must implemented, since WebServiceClientImplWithGUI is subclass of WebServiceClientImpl, and executeService is an abstract method of WebServiceClientImpl - if(CLIENT_ID.equals(e.getSource())) { - switch(e.getEventType()) { - case IMPORT_NETWORK: - Logger.log.info("Importing " + e.getParameter()); - openPathway((GetPathwayParameters)e.getParameter()); - break; - case SEARCH_DATABASE: - Logger.log.info("Searching " + e.getParameter()); - search((FindPathwaysByTextParameters)e.getParameter()); - break; - } - } - } - protected void openPathway(GetPathwayParameters query) { - OpenTask task = new OpenTask(query); - - JTaskConfig config = new JTaskConfig(); - config.displayCancelButton(false); - config.setModal(true); - TaskManager.executeTask(task, config); - } - - private void search(FindPathwaysByTextParameters request) throws CyWebServiceException { - SearchTask task = new SearchTask(request); - JTaskConfig config = new JTaskConfig(); - config.displayCancelButton(true); - config.setModal(false); - TaskManager.executeTask(task, config); - } - - protected String[] listOrganisms() throws RemoteException { - return getStub().listOrganisms(); - } - - class OpenTask implements Task { - TaskMonitor monitor; - GetPathwayParameters query; - - public OpenTask(GetPathwayParameters query) { - this.query = query; - } - - public String getTitle() { - return "Opening pathway..."; - } - - public void halt() { - } - - public void run() { - try { - WSPathway r = getStub().getPathway(query.id, query.revision); - Pathway pathway = WikiPathwaysClient.toPathway(r); - CyNetwork network = spPlugin.load(pathway, true); - if(network != null) { - Cytoscape.getNetworkAttributes().setAttribute( - network.getIdentifier(), ATTR_PATHWAY_URL, r.getUrl() - ); - } - } catch (Exception e) { - Logger.log.error("Error while opening pathway", e); - JOptionPane.showMessageDialog( - gui, "Error: " + e.getMessage() + ". See log for details", - "Error", JOptionPane.ERROR_MESSAGE - ); - } - } - - public void setTaskMonitor(TaskMonitor m)throws IllegalThreadStateException { - monitor = m; - } - - } - - class SearchTask implements Task, CyWebServiceEventListener { - - FindPathwaysByTextParameters query; - TaskMonitor monitor; - - public SearchTask(FindPathwaysByTextParameters query) { - this.query = query; - WebServiceClientManager.getCyWebServiceEventSupport().addCyWebServiceEventListener(this); - } - - public String getTitle() { - return "Searching..."; - } - - public void run() { - try { - WSSearchResult[] result = getStub().findPathwaysByText(query.query, query.species); - gui.setResults(result); - System.out.println("Superpathways-run!"); - if(result == null || result.length == 0) { - SwingUtilities.invokeLater(new Runnable() { - public void run() { - JOptionPane.showMessageDialog( - gui, "The search didn't return any results", - "No results", JOptionPane.INFORMATION_MESSAGE - ); - } - }); - - } - } catch (final Exception e) { - Logger.log.error("Error while searching", e); - SwingUtilities.invokeLater(new Runnable() { - public void run() { - JOptionPane.showMessageDialog( - gui, "Error: " + e.getMessage() + ". See log for details", - "Error", JOptionPane.ERROR_MESSAGE - ); - } - }); - } - } - - public void halt() { - //Not 2.6 compatible - // WebServiceClientManager.getCyWebServiceEventSupport().fireCyWebServiceEvent( - // new CyWebServiceEvent(CLIENT_ID, WSEventType.CANCEL, query) - // ); - } - - public void setTaskMonitor(TaskMonitor m) - throws IllegalThreadStateException { - this.monitor = m; - } - - public void executeService(CyWebServiceEvent event) throws CyWebServiceException { - //Not 2.6 compatible - // if (event.getEventType().equals(WSEventType.CANCEL)) { - // throw new CyWebServiceException(CyWebServiceException.WSErrorCode.REMOTE_EXEC_FAILED); - // } - } - } - - - - - public VisualStyle getDefaultVisualStyle() { - //must implemented here, since this class implement interface NetworkImportWebServiceClient - return null; //TODO - } - - public static class FindPathwaysByTextParameters { - public String query; - public Organism species = null; - } - - public static class GetPathwayParameters { - public String id; - public int revision; - } - - - -} +// PathVisio, +// a tool for data visualization and analysis using Biological Pathways +// Copyright 2006-2011 BiGCaT Bioinformatics +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +package org.pathvisio.cytoscape.superpathways; + +import static cytoscape.data.webservice.CyWebServiceEvent.WSEventType.IMPORT_NETWORK; +import static cytoscape.data.webservice.CyWebServiceEvent.WSEventType.SEARCH_DATABASE; + +import java.net.MalformedURLException; +import java.net.URL; +import java.rmi.RemoteException; +import java.util.Properties; + +import javax.swing.JOptionPane; +import javax.swing.SwingUtilities; +import javax.xml.rpc.ServiceException; + +import org.bridgedb.bio.Organism; +import org.pathvisio.core.debug.Logger; +import org.pathvisio.core.model.Pathway; +import org.pathvisio.wikipathways.webservice.WSPathway; +import org.pathvisio.wikipathways.webservice.WSSearchResult; +import org.wikipathways.client.WikiPathwaysClient; + +import cytoscape.CyNetwork; +import cytoscape.Cytoscape; +import cytoscape.CytoscapeInit; +import cytoscape.data.webservice.CyWebServiceEvent; +import cytoscape.data.webservice.CyWebServiceEventListener; +import cytoscape.data.webservice.CyWebServiceException; +import cytoscape.data.webservice.NetworkImportWebServiceClient; +import cytoscape.data.webservice.WebServiceClientImplWithGUI; +import cytoscape.data.webservice.WebServiceClientManager; +import cytoscape.data.webservice.WebServiceClientManager.ClientType; +import cytoscape.task.Task; +import cytoscape.task.TaskMonitor; +import cytoscape.task.ui.JTaskConfig; +import cytoscape.task.util.TaskManager; +import cytoscape.util.ModulePropertiesImpl; +import cytoscape.visual.VisualStyle; + +public class SuperpathwaysClient extends WebServiceClientImplWithGUI implements NetworkImportWebServiceClient { + private static final String DISPLAY_NAME = "Superpathways Web Service Client"; + private static final String CLIENT_ID = "superpathways"; + + //private static final String DISPLAY_NAME = "WikiPathways Web Service Client"; + //private static final String CLIENT_ID = "wikipathways"; + + protected static final String WEBSERVICE_URL = "wikipathways.webservice.uri"; + public static final String ATTR_PATHWAY_URL = "wikipathways.url"; + + private WikiPathwaysClient stub; + private String prevURL = null; + + private SuperpathwaysPlugin spPlugin; + //private GpmlPlugin gpmlPlugin; + + public SuperpathwaysClient(SuperpathwaysPlugin spPlugin) { + super(CLIENT_ID, DISPLAY_NAME, new ClientType[] { ClientType.NETWORK }, null, null, null); + Logger.log.setLogLevel(true, true, true, true, true, true); + setProperties(); + getStub(); + this.spPlugin = spPlugin; + setGUI(new SuperpathwaysGui(this)); + SuperpathwaysGui a=getGUI(); + } + + public SuperpathwaysPlugin getPlugin(){ + return spPlugin; + } + + + private void setProperties() { + //Using global properties, but need to initialize moduleproperties anyway. + props = new ModulePropertiesImpl(CLIENT_ID, "wsc"); + + Properties p = CytoscapeInit.getProperties(); + if(p.get(WEBSERVICE_URL) == null) { + p.put( + WEBSERVICE_URL, + "http://www.wikipathways.org/wpi/webservice/webservice.php" + ); + } + } + + + public WikiPathwaysClient getStub() { + String urlString = CytoscapeInit.getProperties().getProperty(WEBSERVICE_URL); + if(stub == null || prevURL == null || !prevURL.equals(urlString)) { + try { + URL url = new URL(urlString); + stub = new WikiPathwaysClient(url); + setClientStub(stub); + prevURL = urlString; + + if(gui != null) gui.resetOrganisms(); + } catch (ServiceException e) { + Logger.log.error("Unable to create WikiPathways webservice", e); + } catch (MalformedURLException ue) { + Logger.log.error("Invalid url to wsdl", ue); + } + } + return stub; + } + + + + + public void executeService(CyWebServiceEvent e)throws CyWebServiceException { + //must implemented, since WebServiceClientImplWithGUI is subclass of WebServiceClientImpl, and executeService is an abstract method of WebServiceClientImpl + if(CLIENT_ID.equals(e.getSource())) { + switch(e.getEventType()) { + case IMPORT_NETWORK: + Logger.log.info("Importing " + e.getParameter()); + openPathway((GetPathwayParameters)e.getParameter()); + break; + case SEARCH_DATABASE: + Logger.log.info("Searching " + e.getParameter()); + search((FindPathwaysByTextParameters)e.getParameter()); + break; + } + } + } + protected void openPathway(GetPathwayParameters query) { + OpenTask task = new OpenTask(query); + + JTaskConfig config = new JTaskConfig(); + config.displayCancelButton(false); + config.setModal(true); + TaskManager.executeTask(task, config); + } + + private void search(FindPathwaysByTextParameters request) throws CyWebServiceException { + SearchTask task = new SearchTask(request); + JTaskConfig config = new JTaskConfig(); + config.displayCancelButton(true); + config.setModal(false); + TaskManager.executeTask(task, config); + } + + protected String[] listOrganisms() throws RemoteException { + return getStub().listOrganisms(); + } + + class OpenTask implements Task { + TaskMonitor monitor; + GetPathwayParameters query; + + public OpenTask(GetPathwayParameters query) { + this.query = query; + } + + public String getTitle() { + return "Opening pathway..."; + } + + public void halt() { + } + + public void run() { + try { + WSPathway r = getStub().getPathway(query.id, query.revision); + Pathway pathway = WikiPathwaysClient.toPathway(r); + CyNetwork network = spPlugin.load(pathway, true); + if(network != null) { + Cytoscape.getNetworkAttributes().setAttribute( + network.getIdentifier(), ATTR_PATHWAY_URL, r.getUrl() + ); + } + } catch (Exception e) { + Logger.log.error("Error while opening pathway", e); + JOptionPane.showMessageDialog( + gui, "Error: " + e.getMessage() + ". See log for details", + "Error", JOptionPane.ERROR_MESSAGE + ); + } + } + + public void setTaskMonitor(TaskMonitor m)throws IllegalThreadStateException { + monitor = m; + } + + } + + class SearchTask implements Task, CyWebServiceEventListener { + + FindPathwaysByTextParameters query; + TaskMonitor monitor; + + public SearchTask(FindPathwaysByTextParameters query) { + this.query = query; + WebServiceClientManager.getCyWebServiceEventSupport().addCyWebServiceEventListener(this); + } + + public String getTitle() { + return "Searching..."; + } + + public void run() { + try { + WSSearchResult[] result = getStub().findPathwaysByText(query.query, query.species); + gui.setResults(result); + System.out.println("Superpathways-run!"); + if(result == null || result.length == 0) { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + JOptionPane.showMessageDialog( + gui, "The search didn't return any results", + "No results", JOptionPane.INFORMATION_MESSAGE + ); + } + }); + + } + } catch (final Exception e) { + Logger.log.error("Error while searching", e); + SwingUtilities.invokeLater(new Runnable() { + public void run() { + JOptionPane.showMessageDialog( + gui, "Error: " + e.getMessage() + ". See log for details", + "Error", JOptionPane.ERROR_MESSAGE + ); + } + }); + } + } + + public void halt() { + //Not 2.6 compatible + // WebServiceClientManager.getCyWebServiceEventSupport().fireCyWebServiceEvent( + // new CyWebServiceEvent(CLIENT_ID, WSEventType.CANCEL, query) + // ); + } + + public void setTaskMonitor(TaskMonitor m) + throws IllegalThreadStateException { + this.monitor = m; + } + + public void executeService(CyWebServiceEvent event) throws CyWebServiceException { + //Not 2.6 compatible + // if (event.getEventType().equals(WSEventType.CANCEL)) { + // throw new CyWebServiceException(CyWebServiceException.WSErrorCode.REMOTE_EXEC_FAILED); + // } + } + } + + + + + public VisualStyle getDefaultVisualStyle() { + //must implemented here, since this class implement interface NetworkImportWebServiceClient + return null; //TODO + } + + public static class FindPathwaysByTextParameters { + public String query; + public Organism species = null; + } + + public static class GetPathwayParameters { + public String id; + public int revision; + } + + + +} diff --git a/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/SuperpathwaysGui.java b/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/SuperpathwaysGui.java index a7a7ff23..b9f4b906 100644 --- a/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/SuperpathwaysGui.java +++ b/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/SuperpathwaysGui.java @@ -1,1866 +1,1866 @@ -// PathVisio, -// a tool for data visualization and analysis using Biological Pathways -// Copyright 2006-2011 BiGCaT Bioinformatics -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package org.pathvisio.cytoscape.superpathways; - -import java.awt.Color; -import java.awt.Cursor; -import java.rmi.RemoteException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.swing.DefaultComboBoxModel; -import javax.swing.DefaultListModel; -import javax.swing.JList; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.ListSelectionModel; -import javax.swing.table.TableColumn; - -import org.bridgedb.Xref; -import org.bridgedb.bio.Organism; -import org.pathvisio.core.debug.Logger; -import org.pathvisio.core.model.ConverterException; -import org.pathvisio.core.model.ObjectType; -import org.pathvisio.core.model.Pathway; -import org.pathvisio.core.model.PathwayElement; -import org.pathvisio.cytoscape.GpmlHandler; -import org.pathvisio.cytoscape.superpathways.SuperpathwaysClient.FindPathwaysByTextParameters; -import org.pathvisio.cytoscape.superpathways.SuperpathwaysClient.GetPathwayParameters; -import org.pathvisio.desktop.util.ListWithPropertiesTableModel; -import org.pathvisio.desktop.util.RowWithProperties; -import org.pathvisio.wikipathways.webservice.WSPathway; -import org.pathvisio.wikipathways.webservice.WSSearchResult; -import org.wikipathways.client.WikiPathwaysClient; - -import cytoscape.CyNetwork; -import cytoscape.Cytoscape; -import cytoscape.data.webservice.CyWebServiceEvent; -import cytoscape.data.webservice.CyWebServiceException; -import cytoscape.data.webservice.WebServiceClientManager; -import cytoscape.data.webservice.CyWebServiceEvent.WSEventType; -import cytoscape.ding.CyGraphAllLOD; -import cytoscape.task.Task; -import cytoscape.task.TaskMonitor; -import cytoscape.task.ui.JTaskConfig; -import cytoscape.task.util.TaskManager; -import cytoscape.view.CyNetworkView; -import cytoscape.visual.CalculatorCatalog; -import cytoscape.visual.GlobalAppearanceCalculator; -import cytoscape.visual.VisualMappingManager; -import cytoscape.visual.VisualStyle; -import ding.view.DGraphView; - -//public class SuperpathwaysGui extends JFrame implements ActionListener{ -public class SuperpathwaysGui extends JPanel { - - // private static String ACTION_SEARCH = "Search"; - - private static String ORGANISM_ALL = "All organisms"; - - final SuperpathwaysClient mClient; - - ResultRow mSelectedInHelpPanel; - - List mClickedPathwayNameID = new ArrayList(); - - List mSelectedPathwayNameID = new ArrayList(); - - // this mSelectedPathwaysID is used for pass the reference of Pws to the - // method in CommonNodeView class - // use the identifier directly, not the name/identifier combination. - List mSelectedPathwaysID = new ArrayList(); - - // String[] mSelectedPathwaysID = new String[20]; - - String mSelectedPwInHelpPanel = "not defined"; - - private Map mNodeIdToPwsSharingNode = new HashMap(); - - private List mCandidatePw; - - int mNoGeneNode; - - Pathway mAnchorPw; - - CommonNodeView cnViewObject; - - PathwaysMerge pMerge; - - static int superpathwaysVisualStyleCounter; - - // List selectedPwsNameId; - - public SuperpathwaysGui(SuperpathwaysClient c) { - mClient = c; - - initComponents(); - - cnViewObject = null; - - superpathwaysVisualStyleCounter = 1; - - } - - // the following code is generated in Netbean IDE - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // - private void initComponents() { - - jScrollPane2 = new javax.swing.JScrollPane(); - - // superpathwayPanel = new javax.swing.JTabbedPane(); - searchPane = new javax.swing.JPanel(); - stepLabel1 = new javax.swing.JLabel(); - searchText = new javax.swing.JTextField(); - organismCombo = new javax.swing.JComboBox(); - searchBtn = new javax.swing.JButton(); - // helpButton = new javax.swing.JButton(); - hintLabel1 = new javax.swing.JLabel(); - resultScrolllPane1 = new javax.swing.JScrollPane(); - resultTable = new javax.swing.JTable(); - addBtn = new javax.swing.JButton(); - selectPanel = new javax.swing.JPanel(); - - /* - * availablePathwaysScrollPane = new javax.swing.JScrollPane(); - * availablePathwaysList = new javax.swing.JList(); - * availablePathwaysListModel = new DefaultListModel(); - * availablePathwaysLabel = new javax.swing.JLabel(); - */ - removeBtn = new javax.swing.JButton(); - - selectedPathwaysLabel = new javax.swing.JLabel(); - selectedPathwaysScrollPane = new javax.swing.JScrollPane(); - selectedPathwaysList = new javax.swing.JList(); - selectedPathwaysListModel = new DefaultListModel(); - - findRelatedPwsBtn = new javax.swing.JButton(); - // rightButton = new javax.swing.JButton(); - // leftButton = new javax.swing.JButton(); - - ClearBtn = new javax.swing.JButton(); - CommonNodeViewBtn = new javax.swing.JButton(); - MergeBtn = new javax.swing.JButton(); - - helpPanel = new javax.swing.JPanel(); - anchorPathwayLabel = new javax.swing.JLabel(); - sharingNodeNoLabel = new javax.swing.JLabel(); - anchorPathwayComboBox = new javax.swing.JComboBox(); - lowerBoundSharingNodeNoComboBox = new javax.swing.JComboBox(); - candidatePathwaysSharingNodesScrollPane = new javax.swing.JScrollPane(); - - // candidatePathwaysSharingNodesList = new javax.swing.JList(); - // candidatePathwaysSharingNodesListModel = new DefaultListModel(); - - candidatePathwaysSharingNodesTable = new javax.swing.JTable(); - candidatePathwaysSharingNodesTableModel = new javax.swing.table.DefaultTableModel(); - - // candidatePathwaysSharingNodesTable.setAutoCreateRowSorter(true); - - explainHelpLabel1 = new javax.swing.JLabel(); - addHelpButton = new javax.swing.JButton(); - lowerBoundLabel = new javax.swing.JLabel(); - upperBoundLabel = new javax.swing.JLabel(); - upperBoundSharingNodeNoComboBox = new javax.swing.JComboBox(); - explainHelpLabel2 = new javax.swing.JLabel(); - backToSearchButton = new javax.swing.JButton(); - searchHelpButton = new javax.swing.JButton(); - lastLabel = new javax.swing.JLabel(); - - // setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - // setTitle("Superpathways"); - // setBackground(new java.awt.Color(255, 255, 255)); - - /* - * superpathwayPanel.setToolTipText(""); - * superpathwayPanel.setName("search_select_tab"); // NOI18N - * superpathwayPanel.setPreferredSize(new java.awt.Dimension(440, 680)); - */ - - searchPane.setToolTipText(""); - - stepLabel1.setBackground(new java.awt.Color(204, 204, 255)); - stepLabel1.setFont(new java.awt.Font("Dialog", 1, 11)); // NOI18N - stepLabel1.setForeground(new java.awt.Color(102, 0, 0)); - stepLabel1 - .setText("Search and select multiple pathways from WikiPathways"); - - searchText.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - searchTextActionPerformed(evt); - } - }); - - resetOrganisms(); - - searchBtn.setText("Search"); - searchBtn.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - searchBtnActionPerformed(evt); - } - }); - - hintLabel1.setFont(new java.awt.Font("Dialog", 1, 11)); // NOI18N - hintLabel1 - .setText("You can search by: pathway name, gene/protein name, or any page content"); - - resultTable - .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - - resultScrolllPane1.setViewportView(resultTable); - - addBtn.setText("Add"); - addBtn - .setToolTipText("add the selected pathway to the \"Available Pathways\" list"); - addBtn.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - addBtnActionPerformed(evt); - } - }); - - /* - * selectPanel.setBorder(javax.swing.BorderFactory.createTitledBorder( - * javax.swing.BorderFactory .createTitledBorder("Please select pathways - * to merge"), "", - * javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, - * javax.swing.border.TitledBorder.DEFAULT_POSITION, new - * java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 255))); // - * NOI18N - */ - - selectPanel.setBorder(javax.swing.BorderFactory.createTitledBorder( - null, "", - javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, - javax.swing.border.TitledBorder.DEFAULT_POSITION, - new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, - 255))); // NOI18N - /* - * availablePathwaysList - * .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - * availablePathwaysList.setLayoutOrientation(JList.VERTICAL); - * availablePathwaysList.setVisibleRowCount(8); - * - * availablePathwaysScrollPane.setViewportView(availablePathwaysList); - */ - - selectedPathwaysList - .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - selectedPathwaysList.setLayoutOrientation(JList.VERTICAL); - selectedPathwaysList.setVisibleRowCount(8); - selectedPathwaysScrollPane.setViewportView(selectedPathwaysList); - - /* - * availablePathwaysLabel.setFont(new java.awt.Font("Tahoma", 1, 11)); // - * NOI18N availablePathwaysLabel.setForeground(new java.awt.Color(102, - * 0, 0)); availablePathwaysLabel.setText("Available Pathways"); - */ - selectedPathwaysLabel.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N - selectedPathwaysLabel.setForeground(new java.awt.Color(102, 0, 0)); - selectedPathwaysLabel.setText("Selected Pathways"); - - removeBtn.setText("Remove"); - removeBtn.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - removeBtnActionPerformed(evt); - } - }); - - ClearBtn.setText("Clear"); - ClearBtn - .setToolTipText("clear all the previously selected pathways"); - ClearBtn.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - ClearBtnActionPerformed(evt); - } - }); - - org.jdesktop.layout.GroupLayout selectPanelLayout = new org.jdesktop.layout.GroupLayout( - selectPanel); - selectPanel.setLayout(selectPanelLayout); - selectPanelLayout - .setHorizontalGroup(selectPanelLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - selectPanelLayout - .createSequentialGroup() - .addContainerGap() - .add( - selectPanelLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - org.jdesktop.layout.GroupLayout.TRAILING, - selectedPathwaysScrollPane, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - 371, - Short.MAX_VALUE) - .add( - selectedPathwaysLabel) - .add( - org.jdesktop.layout.GroupLayout.TRAILING, - selectPanelLayout - .createSequentialGroup() - .add( - ClearBtn) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.RELATED) - .add( - removeBtn, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - 71, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) - .addContainerGap())); - selectPanelLayout - .setVerticalGroup(selectPanelLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - selectPanelLayout - .createSequentialGroup() - .add(selectedPathwaysLabel) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.RELATED) - .add( - selectedPathwaysScrollPane, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - 110, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.RELATED, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE) - .add( - selectPanelLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.BASELINE) - .add(removeBtn).add( - ClearBtn)))); - - /* - * org.jdesktop.layout.GroupLayout selectPanelLayout = new - * org.jdesktop.layout.GroupLayout(selectPanel); - * selectPanel.setLayout(selectPanelLayout); - * selectPanelLayout.setHorizontalGroup( - * selectPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - * .add(selectPanelLayout.createSequentialGroup() .addContainerGap() - * .add(selectPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - * .add(org.jdesktop.layout.GroupLayout.TRAILING, - * selectedPathwaysScrollPane, - * org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 371, Short.MAX_VALUE) - * .add(selectedPathwaysLabel) - * .add(org.jdesktop.layout.GroupLayout.TRAILING, removeBtn)) - * .addContainerGap()) ); selectPanelLayout.setVerticalGroup( - * selectPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - * .add(selectPanelLayout.createSequentialGroup() - * .add(selectedPathwaysLabel) - * .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - * .add(selectedPathwaysScrollPane, - * org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 110, - * org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - * .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, - * org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - * .add(removeBtn)) ); - */ - - findRelatedPwsBtn.setText("Find Related Pathways"); - findRelatedPwsBtn - .setToolTipText("find the related pathways which share nodes with the one you select"); - findRelatedPwsBtn - .addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - findRelatedPwsBtnActionPerformed(evt); - } - }); - - - - CommonNodeViewBtn.setText("Common Node View"); - CommonNodeViewBtn - .setToolTipText("generate a network view showing the number of shared nodes between every two selected pathways"); - CommonNodeViewBtn - .addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - CommonNodeViewBtnActionPerformed(evt); - } - }); - - /* - * helpButton.setText("Help"); helpButton .setToolTipText("switch to - * Search Help tab, where you're provided with help for finding - * candidate pathways with shared nodes"); - * helpButton.addActionListener(new java.awt.event.ActionListener() { - * public void actionPerformed(java.awt.event.ActionEvent evt) { - * helpButtonActionPerformed(evt); } }); - */ - - MergeBtn.setText("Merge"); - MergeBtn.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - MergeBtnActionPerformed(evt); - } - }); - - org.jdesktop.layout.GroupLayout searchPaneLayout = new org.jdesktop.layout.GroupLayout( - searchPane); - searchPane.setLayout(searchPaneLayout); - searchPaneLayout - .setHorizontalGroup(searchPaneLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - searchPaneLayout - .createSequentialGroup() - .addContainerGap() - .add( - searchPaneLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - searchPaneLayout - .createSequentialGroup() - .add( - stepLabel1) - .addContainerGap( - 79, - Short.MAX_VALUE)) - .add( - searchPaneLayout - .createSequentialGroup() - .add( - hintLabel1, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - 412, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .addContainerGap( - 18, - Short.MAX_VALUE)) - .add( - org.jdesktop.layout.GroupLayout.TRAILING, - searchPaneLayout - .createSequentialGroup() - .add( - searchPaneLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.TRAILING) - .add( - searchPaneLayout - .createSequentialGroup() - - /*.add( - ClearBtn)*/ - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.RELATED) - .add( - CommonNodeViewBtn) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.RELATED) - .add( - MergeBtn) - .add( - 6, - 6, - 6)) - .add( - searchPaneLayout - .createSequentialGroup() - .add( - findRelatedPwsBtn) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.UNRELATED) - .add( - addBtn, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - 67, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .add( - org.jdesktop.layout.GroupLayout.LEADING, - selectPanel, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE) - .add( - org.jdesktop.layout.GroupLayout.LEADING, - resultScrolllPane1, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - 407, - Short.MAX_VALUE) - .add( - org.jdesktop.layout.GroupLayout.LEADING, - searchPaneLayout - .createSequentialGroup() - .add( - searchText, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - 171, - Short.MAX_VALUE) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.UNRELATED) - .add( - organismCombo, - 0, - 151, - Short.MAX_VALUE) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.UNRELATED) - .add( - searchBtn))) - .add( - 23, - 23, - 23))))); - - /* - * searchPaneLayout.linkSize(new java.awt.Component[] { ClearBtn, - * helpButton }, org.jdesktop.layout.GroupLayout.HORIZONTAL); - */ - - searchPaneLayout - .setVerticalGroup(searchPaneLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - searchPaneLayout - .createSequentialGroup() - .add(28, 28, 28) - .add(stepLabel1) - .add(18, 18, 18) - .add(hintLabel1) - .add(32, 32, 32) - .add( - searchPaneLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.BASELINE) - .add( - searchText, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - 23, - Short.MAX_VALUE) - .add(organismCombo) - .add(searchBtn)) - .add(18, 18, 18) - .add( - resultScrolllPane1, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - 176, Short.MAX_VALUE) - .add(18, 18, 18) - .add( - searchPaneLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.BASELINE) - .add(findRelatedPwsBtn) - .add(addBtn)) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.RELATED) - .add( - selectPanel, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE) - .add(39, 39, 39) - .add( - searchPaneLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.BASELINE) - .add(MergeBtn) - .add(CommonNodeViewBtn) - /*.add(ClearBtn)*/).add(43, - 43, 43))); - - searchPaneLayout.linkSize(new java.awt.Component[] { addBtn, - findRelatedPwsBtn }, org.jdesktop.layout.GroupLayout.VERTICAL); - - searchPaneLayout.linkSize(new java.awt.Component[] { searchBtn, - searchText }, org.jdesktop.layout.GroupLayout.VERTICAL); - - /*searchPaneLayout.linkSize(new java.awt.Component[] { ClearBtn, - CommonNodeViewBtn }, org.jdesktop.layout.GroupLayout.VERTICAL);*/ - - // superpathwayPanel.addTab("Search/Select", searchPane); - - anchorPathwayLabel.setForeground(new java.awt.Color(0, 0, 255)); - anchorPathwayLabel.setText("Pathway"); - - sharingNodeNoLabel.setForeground(new java.awt.Color(0, 0, 255)); - sharingNodeNoLabel.setText("Sharing"); - - // anchorPathwayComboBox.setModel(new - // DefaultComboBoxModel(mAvailablePathwaysNameIDList.toArray())); - - anchorPathwayComboBoxModel = new DefaultComboBoxModel(); - anchorPathwayComboBoxModel.addElement((Object) new String( - "choose one pathway")); - anchorPathwayComboBox.setModel(anchorPathwayComboBoxModel); - - anchorPathwayComboBox - .addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - anchorPathwayComboBoxActionPerformed(evt); - } - }); - - lowerBoundSharingNodeNoComboBox - .setModel(new javax.swing.DefaultComboBoxModel(new String[] { - "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" })); - - // candidatePathwaysSharingNodesTable.setModel(); - - explainHelpLabel1.setFont(new java.awt.Font("Dialog", 1, 11)); // NOI18N - explainHelpLabel1.setForeground(new java.awt.Color(102, 0, 0)); - explainHelpLabel1 - .setText("Choose a pathway and set the range of sharing nodes number, a list of "); - - addHelpButton.setText("Add"); - addHelpButton - .setToolTipText("add the selected pathways to the 'Available Pathways' list"); - /* - * addHelpButton.addActionListener(new java.awt.event.ActionListener() { - * public void actionPerformed(java.awt.event.ActionEvent evt) { - * addHelpButtonActionPerformed(evt); } }); - */ - - lowerBoundLabel.setForeground(new java.awt.Color(0, 0, 255)); - lowerBoundLabel.setText("Minimum"); - - upperBoundLabel.setForeground(new java.awt.Color(0, 0, 255)); - upperBoundLabel.setText("Maximum"); - - upperBoundSharingNodeNoComboBox - .setModel(new javax.swing.DefaultComboBoxModel(new String[] { - "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", - "11", "12", "13", "14", "15", "16", "17", "18", "19", - "20" })); - - explainHelpLabel2.setFont(new java.awt.Font("Dialog", 1, 11)); // NOI18N - explainHelpLabel2.setForeground(new java.awt.Color(102, 0, 0)); - explainHelpLabel2 - .setText("candidate pathways with sharing nodes would be returned."); - - lastLabel.setForeground(new java.awt.Color(0, 0, 255)); - lastLabel.setText("Nodes"); - - backToSearchButton.setText("Back to Search"); - backToSearchButton - .addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - backtoSearchButtonActionPerformed(evt); - } - }); - - searchHelpButton.setText("Search"); - searchHelpButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - searchHelpButtonActionPerformed(evt); - } - }); - - /* - * candidatePathwaysSharingNodesList - * .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - * candidatePathwaysSharingNodesScrollPane - * .setViewportView(candidatePathwaysSharingNodesList); - */ - - candidatePathwaysSharingNodesTableModel.addColumn("Pathway Name"); - candidatePathwaysSharingNodesTableModel.addColumn("ID"); - candidatePathwaysSharingNodesTableModel.addColumn("No. Shared Nodes"); - - candidatePathwaysSharingNodesTable - .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - candidatePathwaysSharingNodesScrollPane - .setViewportView(candidatePathwaysSharingNodesTable); - candidatePathwaysSharingNodesTable - .setModel(candidatePathwaysSharingNodesTableModel); - - TableColumn column = null; - for (int i = 0; i < 3; i++) { - column = candidatePathwaysSharingNodesTable.getColumnModel() - .getColumn(i); - if (i == 0) { - column.setPreferredWidth(150); // third column is bigger - } else if (i == 1) { - column.setPreferredWidth(40); - } else { - column.setPreferredWidth(60); - } - - } - - org.jdesktop.layout.GroupLayout helpPanelLayout = new org.jdesktop.layout.GroupLayout( - helpPanel); - helpPanel.setLayout(helpPanelLayout); - helpPanelLayout - .setHorizontalGroup(helpPanelLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - helpPanelLayout - .createSequentialGroup() - .add( - helpPanelLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - helpPanelLayout - .createSequentialGroup() - .addContainerGap() - .add( - explainHelpLabel1)) - .add( - helpPanelLayout - .createSequentialGroup() - .addContainerGap() - .add( - explainHelpLabel2)) - .add( - helpPanelLayout - .createSequentialGroup() - .add( - 19, - 19, - 19) - .add( - helpPanelLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - anchorPathwayLabel) - .add( - sharingNodeNoLabel)) - .add( - 6, - 6, - 6) - .add( - helpPanelLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING, - false) - .add( - helpPanelLayout - .createSequentialGroup() - .add( - lowerBoundLabel) - .add( - 18, - 18, - 18) - .add( - lowerBoundSharingNodeNoComboBox, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add( - 18, - 18, - 18) - .add( - upperBoundLabel) - .add( - 18, - 18, - 18) - .add( - upperBoundSharingNodeNoComboBox, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .add( - helpPanelLayout - .createSequentialGroup() - .add( - 23, - 23, - 23) - .add( - anchorPathwayComboBox, - 0, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE))) - .add( - 18, - 18, - 18) - .add( - lastLabel) - .add( - 18, - 18, - 18) - .add( - searchHelpButton))) - .addContainerGap(24, Short.MAX_VALUE)) - .add( - org.jdesktop.layout.GroupLayout.TRAILING, - helpPanelLayout - .createSequentialGroup() - .addContainerGap(190, Short.MAX_VALUE) - .add(backToSearchButton) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.RELATED) - .add(addHelpButton).add(26, 26, 26)) - .add( - helpPanelLayout - .createSequentialGroup() - .addContainerGap() - .add( - candidatePathwaysSharingNodesScrollPane, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - 402, Short.MAX_VALUE).add(16, - 16, 16))); - - helpPanelLayout.linkSize(new java.awt.Component[] { addHelpButton, - backToSearchButton }, - org.jdesktop.layout.GroupLayout.HORIZONTAL); - - helpPanelLayout - .setVerticalGroup(helpPanelLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING) - .add( - helpPanelLayout - .createSequentialGroup() - .add(33, 33, 33) - .add(explainHelpLabel1) - .addPreferredGap( - org.jdesktop.layout.LayoutStyle.UNRELATED) - .add(explainHelpLabel2) - .add(44, 44, 44) - .add( - helpPanelLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.BASELINE) - .add(anchorPathwayLabel) - .add( - anchorPathwayComboBox, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .add(23, 23, 23) - .add( - helpPanelLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.BASELINE) - .add(lowerBoundLabel) - .add( - lowerBoundSharingNodeNoComboBox, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(upperBoundLabel) - .add( - upperBoundSharingNodeNoComboBox, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(lastLabel) - .add(searchHelpButton) - .add(sharingNodeNoLabel)) - .add(53, 53, 53) - .add( - candidatePathwaysSharingNodesScrollPane, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, - 251, Short.MAX_VALUE) - .add(29, 29, 29) - .add( - helpPanelLayout - .createParallelGroup( - org.jdesktop.layout.GroupLayout.BASELINE) - .add(backToSearchButton) - .add(addHelpButton)) - .addContainerGap(131, Short.MAX_VALUE))); - - helpPanelLayout.linkSize(new java.awt.Component[] { addHelpButton, - backToSearchButton }, org.jdesktop.layout.GroupLayout.VERTICAL); - - helpPanelLayout.linkSize(new java.awt.Component[] { lastLabel, - lowerBoundLabel, lowerBoundSharingNodeNoComboBox, - searchHelpButton, sharingNodeNoLabel, upperBoundLabel, - upperBoundSharingNodeNoComboBox }, - org.jdesktop.layout.GroupLayout.VERTICAL); - - // remove the Search Help panel - /* - * superpathwayPanel .addTab("Search Help", null, helpPanel, "help is - * provided for finding candidate pathways with shared nodes"); - */ - // jScrollPane2.setViewportView(superpathwayPanel); - jScrollPane2.setViewportView(searchPane); - - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout( - this); - setLayout(layout); - layout.setHorizontalGroup(layout.createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING).add( - layout.createSequentialGroup().add(18, 18, 18).add( - jScrollPane2, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 447, - Short.MAX_VALUE).add(20, 20, 20))); - layout.setVerticalGroup(layout.createParallelGroup( - org.jdesktop.layout.GroupLayout.LEADING).add( - layout.createSequentialGroup().add(20, 20, 20).add( - jScrollPane2, - org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 701, - Short.MAX_VALUE).addContainerGap())); - - // pack(); - }// - - private void searchTextActionPerformed(java.awt.event.ActionEvent evt) { - searchActionPerformed(evt); - } - - private void searchBtnActionPerformed(java.awt.event.ActionEvent evt) { - searchActionPerformed(evt); - } - - private void addBtnActionPerformed(java.awt.event.ActionEvent evt) { - // System.out.println(mClickedPathwayNameID.size() + ""); - mClickedPathwayNameID.clear(); - - int[] rows = resultTable.getSelectedRows(); - for (int k = 0; k < rows.length; k++) { - int viewRow = rows[k]; - int modelRow = sorter.modelIndex(viewRow); - - ResultRow t = tableModel.getRow(modelRow); - String temp = t.getProperty(ResultProperty.NAME) + "(" - + t.getProperty(ResultProperty.ID) + ")"; - - mClickedPathwayNameID.add(temp); - - } - for (int i = 0; i < mClickedPathwayNameID.size(); i++) { - System.out.println(mClickedPathwayNameID.get(i)); - if (!selectedPathwaysListModel.contains(mClickedPathwayNameID - .get(i))) { - selectedPathwaysListModel.addElement(mClickedPathwayNameID - .get(i)); - selectedPathwaysList.setModel(selectedPathwaysListModel); - /* - * if (availablePathwaysListModel.getSize() > 0) { - * rightButton.setEnabled(true); } - */ - - mSelectedPathwayNameID.add(mClickedPathwayNameID.get(i)); - - // add the pathways IDs to the list mSelectedPathwaysID - String t = mClickedPathwayNameID.get(i); - int index1 = t.lastIndexOf("("); - int index2 = t.lastIndexOf(")"); - String pwID = t.substring(index1 + 1, index2); - mSelectedPathwaysID.add(pwID); - - /* - * anchorPathwayComboBoxModel.addElement(mClickedPathwayNameID - * .get(i)); - * anchorPathwayComboBox.setModel(anchorPathwayComboBoxModel); - */ - } - } - - } - - private void removeBtnActionPerformed(java.awt.event.ActionEvent evt) { - Object[] temp = selectedPathwaysList.getSelectedValues(); - for (int i = 0; i < temp.length; i++) { - mSelectedPathwayNameID.remove((String) temp[i]); - - // removed the selected item in the selected pathways list - selectedPathwaysListModel.removeElement(temp[i]); - String t = (String) temp[i]; - int index1 = t.lastIndexOf("("); - int index2 = t.lastIndexOf(")"); - String pwID = t.substring(index1 + 1, index2); - mSelectedPathwaysID.remove(pwID); - } - } - - private void findRelatedPwsBtnActionPerformed(java.awt.event.ActionEvent evt) { - System.out.println("After clicking 'Find Related Pathways' button!"); - int[] rows = resultTable.getSelectedRows(); - - if (rows.length > 1 || rows.length == 0) { - JOptionPane - .showMessageDialog( - this, - "Please select ONE pathway among the search result", - "find related pathways...", - JOptionPane.INFORMATION_MESSAGE); - } else { - int viewRow = rows[0]; - int modelRow = sorter.modelIndex(viewRow); - - ResultRow t = tableModel.getRow(modelRow); - String temp = t.getProperty(ResultProperty.NAME) + "(" - + t.getProperty(ResultProperty.ID) + ")"; - - FindRelatedPwsDialog relatedPwsDialog = new FindRelatedPwsDialog( - mClient, "Find related pathways...", temp); - relatedPwsDialog.setVisible(true); - - } - - } - - private void ClearBtnActionPerformed(java.awt.event.ActionEvent evt) { - // SuperpathwaysPlugin spPlugin = SuperpathwaysPlugin.getInstance(); - // spPlugin.mWindow.setVisible(false); - // spPlugin.mWindow.dispose(); - searchText.setText(""); - /* - * availablePathwaysListModel.clear(); - * availablePathwaysList.setModel(availablePathwaysListModel); - */ - selectedPathwaysListModel.clear(); - selectedPathwaysList.setModel(selectedPathwaysListModel); - //anchorPathwayComboBox.setModel(new DefaultComboBoxModel()); - mSelectedPathwaysID.clear(); - mSelectedPathwayNameID.clear(); - - } - - private void CommonNodeViewBtnActionPerformed(java.awt.event.ActionEvent evt) { - - System.out.println("Display the selected pws' id:"); - for (int k = 0; k < mSelectedPathwaysID.size(); k++) { - System.out.println(mSelectedPathwaysID.get(k)); - } - - /* - * Object[] selectedPwNameId = selectedPathwaysListModel.toArray(); - * selectedPwsNameId = new ArrayList(); for (int i = 0; i < - * selectedPwNameId.length; i++) { selectedPwsNameId.add((String) - * selectedPwNameId[i]); } - */ - - commonNodeViewTask task = new commonNodeViewTask(mClient); - JTaskConfig config = new JTaskConfig(); - config.displayCancelButton(true); - // config.setModal(true); - config.setModal(false); - TaskManager.executeTask(task, config); - } - - private void searchHelpButtonActionPerformed(java.awt.event.ActionEvent evt) { - - candidatePathwaysSharingNodesTableModel = new javax.swing.table.DefaultTableModel(); - candidatePathwaysSharingNodesTableModel.addColumn("Pathway Name"); - candidatePathwaysSharingNodesTableModel.addColumn("ID"); - candidatePathwaysSharingNodesTableModel.addColumn("No. Shared Nodes"); - - candidatePathwaysSharingNodesTable - .setModel(candidatePathwaysSharingNodesTableModel); - setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - - // String anchorPwNameAndId = - // anchorPathwayComboBox.getSelectedItem().toString(); - int lowerBound = Integer.parseInt(lowerBoundSharingNodeNoComboBox - .getSelectedItem().toString()); - int upperBound = Integer.parseInt(upperBoundSharingNodeNoComboBox - .getSelectedItem().toString()); - - // mCandidatePwList = findCandidatePwBySharingNodes(lowerBound, - // upperBound); - - searchSharingNodePwsTask task = new searchSharingNodePwsTask( - lowerBound, upperBound); - - JTaskConfig config = new JTaskConfig(); - config.displayCancelButton(true); - // config.displayCloseButton(true); - // config.displayStatus(true); - config.setModal(true); - TaskManager.executeTask(task, config); - - // mCandidatePw is a list of string with elements in format "Pathway - // Name (pw id), sharing node number: a int" - - // System.out.println("We reach here 3!"); - // System.out.println(mCandidatePw.size()+""); - Iterator it = mCandidatePw.iterator(); - while (it.hasNext()) { - String temp = it.next(); - // candidatePathwaysSharingNodesListModel.addElement(temp); - - // System.out.println(temp); - // parse the string into three parts: pathway name, id, and No. - // Sharing Nodes - int index1 = temp.indexOf(","); - String temp1 = temp.substring(0, index1); - - int index2 = temp1.lastIndexOf("("); - int index3 = temp1.lastIndexOf(")"); - String pwName = temp1.substring(0, index2); - // System.out.println(pwName); - String pwId = temp1.substring(index2 + 1, index3); - // System.out.println(pwId); - - // String temp2 = temp.substring(index1+1); - int index4 = temp.indexOf(":"); - String NoSharingNode = temp.substring(index4 + 2); - // System.out.println(NoSharingNode); - - Object[] row = new Object[3]; - row[0] = (Object) pwName; - row[1] = (Object) pwId; - row[2] = (Object) NoSharingNode; - - candidatePathwaysSharingNodesTableModel.addRow(row); - - } - - sorter = new TableSorter(candidatePathwaysSharingNodesTableModel); - candidatePathwaysSharingNodesTable.setModel(sorter); - sorter.setTableHeader(candidatePathwaysSharingNodesTable - .getTableHeader()); - - // candidatePathwaysSharingNodesList.setModel(candidatePathwaysSharingNodesListModel); - setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - } - - private void backtoSearchButtonActionPerformed( - java.awt.event.ActionEvent evt) { - // System.out.println("Clicking the back to search button!"); - // superpathwayPanel.setSelectedIndex(0); - } - - private void anchorPathwayComboBoxActionPerformed( - java.awt.event.ActionEvent evt) { - String anchorPwNameId = anchorPathwayComboBox.getSelectedItem() - .toString(); - - if (anchorPwNameId.equalsIgnoreCase("choose one pathway")) { - - } else { - int index1 = anchorPwNameId.lastIndexOf("("); - int index2 = anchorPwNameId.lastIndexOf(")"); - String anchorPwID = anchorPwNameId.substring(index1 + 1, index2); - - // Create a client to the WikiPathways web service - WikiPathwaysClient client = mClient.getStub(); - - // Download these two pathways from WikiPathways by passing their id - WSPathway anchorPathway = new WSPathway(); - - try { - anchorPathway = client.getPathway(anchorPwID); - - } catch (RemoteException e) { - Logger.log.error( - "Unable to get the pathway due to the RemoteException", - e); - } catch (ConverterException e) { - Logger.log - .error( - "Unable to get the pathway due to the ConverterException", - e); - } - // Create two corresponding pathway objects - mAnchorPw = new Pathway(); - - try { - mAnchorPw = WikiPathwaysClient.toPathway(anchorPathway); - } catch (ConverterException e) { - Logger.log.error( - "Unable to get the pathway due to the RemoteException", - e); - } - - mNoGeneNode = 0; - for (PathwayElement pwElm : mAnchorPw.getDataObjects()) { - if (pwElm.getObjectType() == ObjectType.DATANODE) { - mNoGeneNode = mNoGeneNode + 1; - - } - } - - String[] temp = new String[mNoGeneNode]; - for (int i = 1; i <= mNoGeneNode; i++) { - temp[i - 1] = String.valueOf(i); - } - - upperBoundSharingNodeNoComboBox - .setModel(new javax.swing.DefaultComboBoxModel(temp)); - - } - } - - private void MergeBtnActionPerformed(java.awt.event.ActionEvent evt) { - // SimpleCaseMergeTest test=new SimpleCaseMergeTest(); - - WikiPathwaysClient client = mClient.getStub(); - SuperpathwaysPlugin spPlugin = SuperpathwaysPlugin.getInstance(); - MergeTask task = new MergeTask(spPlugin, client); - - // Configure JTask Dialog Pop-Up Box - final JTaskConfig jTaskConfig = new JTaskConfig(); - - jTaskConfig.displayCloseButton(true); - jTaskConfig.displayCancelButton(true); - jTaskConfig.displayStatus(true); - jTaskConfig.displayTimeElapsed(true); - - jTaskConfig.setAutoDispose(false); - // jTaskConfig.setModal(true); - jTaskConfig.setModal(false); - - // Execute Task in New Thread; pop open JTask Dialog Box. - TaskManager.executeTask(task, jTaskConfig); - if (task.isCancelled()) - return; - - } - - // the code above is generated in Netbean IDE - - protected void resetOrganisms() { - List organisms = new ArrayList(); - organisms.add(ORGANISM_ALL); - try { - organisms.addAll(Arrays.asList(mClient.listOrganisms())); - } catch (Exception e) { - Logger.log.error("Unable to get organisms for WikiPathways client", - e); - } - - organismCombo.setModel(new DefaultComboBoxModel(organisms.toArray())); - } - - public void searchActionPerformed(java.awt.event.ActionEvent evt) { - // String action = e.getActionCommand(); - // if(ACTION_SEARCH.equals(action)) { - FindPathwaysByTextParameters request = new FindPathwaysByTextParameters(); - request.query = searchText.getText(); - String org = organismCombo.getSelectedItem().toString(); - if (!ORGANISM_ALL.equals(org)) { - request.species = Organism.fromLatinName(org); - } - try { - WebServiceClientManager - .getCyWebServiceEventSupport() - .fireCyWebServiceEvent( - new CyWebServiceEvent( - mClient.getClientID(), - WSEventType.SEARCH_DATABASE, request)); - - } catch (CyWebServiceException ex) { - switch (ex.getErrorCode()) { - case NO_RESULT: - JOptionPane.showMessageDialog(this, - "The search didn't return any results", "No results", - JOptionPane.INFORMATION_MESSAGE); - break; - case OPERATION_NOT_SUPPORTED: - case REMOTE_EXEC_FAILED: - JOptionPane.showMessageDialog(this, "Error: " - + ex.getErrorCode() + ". See log for details", "Error", - JOptionPane.ERROR_MESSAGE); - break; - } - ex.printStackTrace(); - } - // } - } - - private void openNetwork(ResultRow mSelected) { - try { - GetPathwayParameters request = new GetPathwayParameters(); - WSSearchResult result = mSelected.getResult(); - request.id = result.getId(); - request.revision = Integer.parseInt(result.getRevision()); - WebServiceClientManager.getCyWebServiceEventSupport() - .fireCyWebServiceEvent( - new CyWebServiceEvent(mClient.getClientID(), - WSEventType.IMPORT_NETWORK, request)); - } catch (CyWebServiceException ex) { - JOptionPane.showMessageDialog(SuperpathwaysGui.this, "Error: " - + ex.getErrorCode() + ". See error log for details", - "Error", JOptionPane.ERROR_MESSAGE); - } - } - - public void setResults(WSSearchResult[] results) { - - tableModel = new ListWithPropertiesTableModel(); - if (results != null) { - tableModel.setColumns(new ResultProperty[] { ResultProperty.NAME, - ResultProperty.ID, ResultProperty.ORGANISM, }); - - resultTable.setModel(tableModel); - for (WSSearchResult r : results) { - tableModel.addRow(new ResultRow(r)); - } - } - - sorter = new TableSorter(tableModel); - resultTable.setModel(sorter); - sorter.setTableHeader(resultTable.getTableHeader()); - - // resultTable.setModel(tableModel); - System.out.println("Superpathways!"); - - } - - // private javax.swing.DefaultListModel availablePathwaysListModel; - // javax.swing.DefaultListModel availablePathwaysListModel; - - // private javax.swing.DefaultListModel selectedPathwaysListModel; - javax.swing.DefaultListModel selectedPathwaysListModel; - - private javax.swing.DefaultComboBoxModel anchorPathwayComboBoxModel; - - // private javax.swing.DefaultListModel - // candidatePathwaysSharingNodesListModel; - - private javax.swing.table.DefaultTableModel candidatePathwaysSharingNodesTableModel; - - private TableSorter sorter; - - private javax.swing.JButton ClearBtn; - - private javax.swing.JButton CommonNodeViewBtn; - - private javax.swing.JButton addBtn; - - private javax.swing.JButton addHelpButton; - - private javax.swing.JComboBox anchorPathwayComboBox; - - private javax.swing.JLabel anchorPathwayLabel; - - // private javax.swing.JLabel availablePathwaysLabel; - - // private javax.swing.JList availablePathwaysList; - // javax.swing.JList availablePathwaysList; - - // private javax.swing.JScrollPane availablePathwaysScrollPane; - - private javax.swing.JButton backToSearchButton; - - private javax.swing.JScrollPane candidatePathwaysSharingNodesScrollPane; - - // private javax.swing.JList candidatePathwaysSharingNodesList; - - private javax.swing.JLabel explainHelpLabel1; - - private javax.swing.JLabel explainHelpLabel2; - - private javax.swing.JPanel helpPanel; - - private javax.swing.JLabel hintLabel1; - - // private javax.swing.JButton leftButton; - - private javax.swing.JLabel lowerBoundLabel; - - private javax.swing.JComboBox lowerBoundSharingNodeNoComboBox; - - private javax.swing.JButton findRelatedPwsBtn; - - private javax.swing.JComboBox organismCombo; - - private javax.swing.JScrollPane resultScrolllPane1; - - private javax.swing.JTable resultTable; - - // private javax.swing.JButton rightButton; - // javax.swing.JButton rightButton; - - private javax.swing.JButton searchBtn; - - private javax.swing.JPanel searchPane; - - private javax.swing.JTextField searchText; - - private javax.swing.JPanel selectPanel; - - private javax.swing.JLabel selectedPathwaysLabel; - - // private javax.swing.JList selectedPathwaysList; - javax.swing.JList selectedPathwaysList; - - private javax.swing.JScrollPane selectedPathwaysScrollPane; - - private javax.swing.JLabel sharingNodeNoLabel; - - private javax.swing.JLabel stepLabel1; - - private javax.swing.JLabel stepLabel2; - - // private javax.swing.JTabbedPane superpathwayPanel; - - private javax.swing.JLabel upperBoundLabel; - - private javax.swing.JComboBox upperBoundSharingNodeNoComboBox; - - private javax.swing.JButton searchHelpButton; - - // private javax.swing.JButton helpButton; - - private javax.swing.JLabel lastLabel; - - private javax.swing.JTable candidatePathwaysSharingNodesTable; - - private javax.swing.JScrollPane jScrollPane2; - - private javax.swing.JButton MergeBtn; - - private javax.swing.JButton removeBtn; - - // private javax.swing.JList candidatePathwaysSharingNodesList; - - // End of variables declaration - ListWithPropertiesTableModel tableModel; - - class ResultRow implements RowWithProperties { - WSSearchResult result; - - public ResultRow(WSSearchResult result) { - this.result = result; - } - - public WSSearchResult getResult() { - return result; - } - - public String getProperty(ResultProperty prop) { - switch (prop) { - case NAME: - return result.getName(); - case ORGANISM: - return result.getSpecies(); - case SCORE: - return Double.toString(result.getScore()); - case URL: - return result.getUrl(); - // helen add - case ID: - return result.getId(); - } - return null; - } - } - - public class searchSharingNodePwsTask implements Task { - - TaskMonitor monitor; - - int lowerBound; - - int upperBound; - - public searchSharingNodePwsTask(int lb, int ub) { - lowerBound = lb; - upperBound = ub; - } - - /** - * Run the Task. - */ - public void run() { - - try { - mCandidatePw = new ArrayList(); - if (lowerBound > upperBound) { - JOptionPane.showMessageDialog(helpPanel, - "Please reset the range of sharing nodes number!"); - } else { - - Map sharingNodeNumberofPws = new HashMap(); - List geneIDList = new ArrayList(); - int percentComplete = 0; - int t = 0; - - // Create a client to the WikiPathways web service - WikiPathwaysClient client = mClient.getStub(); - - // the following code is get a map "mNodeIdToPwsSharingNode" - // with key of GeneID and value of a list of pathways which - // contain the GeneID - for (PathwayElement pwElm : mAnchorPw.getDataObjects()) { - // Only take elements with type DATANODE (genes, - // proteins, metabolites) - if (pwElm.getObjectType() == ObjectType.DATANODE) { - - percentComplete = (int) (((double) t / mNoGeneNode) * 98); - - // System.out.println(pwElm.getXref().toString()); - geneIDList.add(pwElm.getXref().toString()); - - try { - - WSSearchResult[] PwsSharingNode = client - .findPathwaysByXref(pwElm.getXref()); - // System.out.println("" + - // PwsSharingNode.length); - mNodeIdToPwsSharingNode.put(pwElm.getXref() - .toString(), PwsSharingNode); - - if (monitor != null) { - monitor - .setPercentCompleted(percentComplete); - } - - } catch (RemoteException e) { - Logger.log - .error( - "Unable to find the candidate pathways due to the RemoteException", - e); - } - } - t++; - - } - - // the following code is for converting the above map to - // another map "sharingNodeNumberofPws" with key of - // the name and id of a pathway, and value of the number of - // shared node of this pathway and the anchor pathway - for (int i = 0; i < mNoGeneNode; i++) { - WSSearchResult[] pwsArray = mNodeIdToPwsSharingNode - .get(geneIDList.get(i)); - - for (int j = 0; j < pwsArray.length; j++) { - WSSearchResult pw = pwsArray[j]; - ResultRow pwResultRow = new ResultRow(pw); - String onePwNameAndId = pwResultRow - .getProperty(ResultProperty.NAME) - + "(" - + pwResultRow - .getProperty(ResultProperty.ID) - + ")"; - - if (sharingNodeNumberofPws - .containsKey(onePwNameAndId)) { - Integer oldValue = sharingNodeNumberofPws - .get(onePwNameAndId); - Integer newValue = new Integer(oldValue + 1); - sharingNodeNumberofPws.put(onePwNameAndId, - newValue); - } else { - sharingNodeNumberofPws.put(onePwNameAndId, 1); - } - } - } - - // the following code is for displaying the result in the - // table of - // "Search Help" panel - Set sharingNodePwsSet = sharingNodeNumberofPws - .keySet(); - Iterator it = sharingNodePwsSet.iterator(); - while (it.hasNext()) { - String temp = it.next(); - Integer value = sharingNodeNumberofPws.get(temp); - if (value >= lowerBound && value <= upperBound) { - mCandidatePw.add(temp + ", sharing node number: " - + String.valueOf(value)); - } - } - - } - - if (monitor != null) { - monitor.setPercentCompleted(100); - } - // System.out.println("We reach here 2!"); - } catch (Exception e) { - Logger.log.error("Error while searching candidate pathways", e); - JOptionPane.showMessageDialog(mClient.getGUI(), "Error: " - + e.getMessage() + ". See log for details", "Error", - JOptionPane.ERROR_MESSAGE); - } - - } - - public void halt() { - } - - public void setTaskMonitor(TaskMonitor m) - throws IllegalThreadStateException { - monitor = m; - } - - public String getTitle() { - return new String( - "Searching candidate pathways with shared nodes..."); - } - } - - public class commonNodeViewTask implements Task { - - TaskMonitor monitor; - - boolean cancelled; - - // List selectedPwNameId; - SuperpathwaysClient client; - - public commonNodeViewTask(SuperpathwaysClient b) { - // selectedPwNameId=a; - client = b; - cancelled = false; - } - - public void run() { - try { - - cnViewObject = new CommonNodeView(mSelectedPathwaysID, - mSelectedPathwayNameID, client); - cnViewObject.drawCommonNodeView(); - - // the following code is for printing out the matched node pair - // by translation - System.out - .println("printing out the matched node pair by translation"); - Set s = cnViewObject.getNodePairByTranslation().keySet(); - Iterator it = s.iterator(); - while (it.hasNext()) { - Xref x1 = it.next(); - Xref x2 = cnViewObject.getNodePairByTranslation().get(x1); - System.out - .println(x1.toString() + "======" + x2.toString()); - } - - } catch (Exception e) { - Logger.log.error("Error while searching candidate pathways", e); - JOptionPane.showMessageDialog(mClient.getGUI(), "Error: " - + e.getMessage() + ". See log for details", "Error", - JOptionPane.ERROR_MESSAGE); - } - } - - public void halt() { - cancelled = true; - cnViewObject.interrupt(); - } - - public void setTaskMonitor(TaskMonitor m) - throws IllegalThreadStateException { - monitor = m; - } - - public String getTitle() { - return new String("Generating common node view..."); - } - - } - - class MergeTask implements Task { - - TaskMonitor monitor; - - boolean cancelled; - - // PathwaysMerge pMerge; - SuperpathwaysPlugin spPlugin; - - WikiPathwaysClient client; - - /** - * Constructor.
- * - */ - public MergeTask(SuperpathwaysPlugin sp, WikiPathwaysClient c) { - cancelled = false; - spPlugin = sp; - client = c; - } - - public boolean isCancelled() { - return cancelled; - } - - public void run() { - - // if (cnViewObject==null){ - // here we need to re-run the CommonNodeView to get the correct - // NodePairByTranslation, and colorPool - - cnViewObject = new CommonNodeView(mSelectedPathwaysID, - mSelectedPathwayNameID, mClient); - - pMerge = new PathwaysMerge(null, cnViewObject - .getNodePairByTranslation(), null); - // here we call the method drawCommonNodeView(), because we want to - // make the correspondance of the color between the common node view - // and the merged network - - Map pwNameToColor = null; - if (!isCancelled()) { - try { - pwNameToColor = cnViewObject.drawCommonNodeView(); - } catch (Exception e) { - Logger.log.error("Unable to draw common node view", e); - } - - WSPathway wsPathway = new WSPathway(); - Pathway pathway = new Pathway(); - List listOfNetworks = new ArrayList(); - - for (int i = 0; i < selectedPathwaysListModel.getSize(); i++) { - - System.out.println("in for loop: " + i + ""); - String selectedOnePwNameID = (String) selectedPathwaysListModel - .get(i); - System.out.println(selectedOnePwNameID); - int index1 = selectedOnePwNameID.lastIndexOf("("); - int index2 = selectedOnePwNameID.lastIndexOf(")"); - String pwID = selectedOnePwNameID.substring(index1 + 1, - index2); - String pwName = selectedOnePwNameID.substring(0, index1); - // System.out.println(pwID); - // System.out.println(pwName); - - try { - wsPathway = client.getPathway(pwID); - pathway = WikiPathwaysClient.toPathway(wsPathway); - } catch (RemoteException e) { - Logger.log - .error( - "Unable to get the pathway due to the RemoteException", - e); - } catch (ConverterException e) { - Logger.log - .error( - "Unable to get the pathway due to the ConverterException", - e); - } - - CyNetwork net = spPlugin.load(pathway, true); - - // the following code is for coloring the nodes by default - if(pwNameToColor != null) applyGpmlVisualStyle(mClient.getPlugin().mGpmlHandler, - pwNameToColor, pwName, true, - superpathwaysVisualStyleCounter); - - listOfNetworks.add(net); - } - - // convert the array of type Color to an array of type String - String[] temp = new String[cnViewObject.getColorPool().size()]; - Object[] colors = cnViewObject.getColorPool().toArray(); - for (int s = 0; s < temp.length; s++) { - temp[s] = (String) colors[s]; - } - System.out.println("Problem is here2!"); - pMerge = new PathwaysMerge(listOfNetworks, cnViewObject - .getNodePairByTranslation(), temp); - - try { - pMerge.setTaskMonitor(monitor); - - CyNetwork mergedNetwork = pMerge.mergeNetwork( - "Merged Network", cnViewObject - .getNodePairByTranslation()); - CyNetworkView view = Cytoscape - .createNetworkView(mergedNetwork); - - superpathwaysVisualStyle vs = new superpathwaysVisualStyle( - "Merged Network", pwNameToColor, - superpathwaysVisualStyleCounter); - superpathwaysVisualStyleCounter++; - - } catch (Exception e) { - monitor.setException(e, "Network Merge Failed!"); - e.printStackTrace(); - } - - // the following code is for forcing detail rendering at any - // level of - // zoom - CyNetworkView currView = Cytoscape.getCurrentNetworkView(); - ding.view.DGraphView nv; - nv = (DGraphView) currView; - nv.setGraphLOD(new CyGraphAllLOD()); - } - - } - - public void halt() { - cancelled = true; - cnViewObject.interrupt(); - pMerge.interrupt(); - } - - public void setTaskMonitor(TaskMonitor taskMonitor) - throws IllegalThreadStateException { - this.monitor = taskMonitor; - } - - public String getTitle() { - return "Merging pathways"; - } - } - - public void applyGpmlVisualStyle(GpmlHandler gpmlHandler, - Map pwNameToColor, String t, - boolean coloringNodeInGpml, int version) { - - if (coloringNodeInGpml == true) { - VisualMappingManager vmm = Cytoscape.getVisualMappingManager(); - CalculatorCatalog catalog = vmm.getCalculatorCatalog(); - // the next code line is used for fix the bug (when doing several - // merges) - // catalog.removeVisualStyle(gpmlExtendVisualStyle.NAME); - - String styleName = gpmlExtendVisualStyle.NAME + "-" - + String.valueOf(version); - System.out.println("GPML-extention style name: " + styleName); - - VisualStyle gpmlExtensionStyle = catalog.getVisualStyle(styleName); - - if (gpmlExtensionStyle == null) { // Create the GPML visual style - Logger.log.trace("VisualStyle: creating GPML-extension style"); - System.out.println(pwNameToColor.size() + ""); - gpmlExtensionStyle = new gpmlExtendVisualStyle(gpmlHandler, - pwNameToColor, t, version); - - // set the background color - GlobalAppearanceCalculator gCalc = gpmlExtensionStyle - .getGlobalAppearanceCalculator(); - gCalc.setDefaultBackgroundColor(new Color(200, 200, 255)); - vmm.applyGlobalAppearances(); - - catalog.addVisualStyle(gpmlExtensionStyle); - } else { - System.out.println("gpml-extension style is not null!"); - Logger.log.trace("VisualStyle: reusing GPML-extension style"); - } - System.out.println("Problem is here1!"); - cytoscape.view.CyNetworkView networkView = Cytoscape - .getNetworkView(t); - networkView.setVisualStyle(gpmlExtensionStyle.getName()); - - // actually apply the visual style - vmm.setVisualStyle(gpmlExtensionStyle); - networkView.redrawGraph(true, true); - } - } +// PathVisio, +// a tool for data visualization and analysis using Biological Pathways +// Copyright 2006-2011 BiGCaT Bioinformatics +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +package org.pathvisio.cytoscape.superpathways; + +import java.awt.Color; +import java.awt.Cursor; +import java.rmi.RemoteException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.swing.DefaultComboBoxModel; +import javax.swing.DefaultListModel; +import javax.swing.JList; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.ListSelectionModel; +import javax.swing.table.TableColumn; + +import org.bridgedb.Xref; +import org.bridgedb.bio.Organism; +import org.pathvisio.core.debug.Logger; +import org.pathvisio.core.model.ConverterException; +import org.pathvisio.core.model.ObjectType; +import org.pathvisio.core.model.Pathway; +import org.pathvisio.core.model.PathwayElement; +import org.pathvisio.cytoscape.GpmlHandler; +import org.pathvisio.cytoscape.superpathways.SuperpathwaysClient.FindPathwaysByTextParameters; +import org.pathvisio.cytoscape.superpathways.SuperpathwaysClient.GetPathwayParameters; +import org.pathvisio.desktop.util.ListWithPropertiesTableModel; +import org.pathvisio.desktop.util.RowWithProperties; +import org.pathvisio.wikipathways.webservice.WSPathway; +import org.pathvisio.wikipathways.webservice.WSSearchResult; +import org.wikipathways.client.WikiPathwaysClient; + +import cytoscape.CyNetwork; +import cytoscape.Cytoscape; +import cytoscape.data.webservice.CyWebServiceEvent; +import cytoscape.data.webservice.CyWebServiceException; +import cytoscape.data.webservice.WebServiceClientManager; +import cytoscape.data.webservice.CyWebServiceEvent.WSEventType; +import cytoscape.ding.CyGraphAllLOD; +import cytoscape.task.Task; +import cytoscape.task.TaskMonitor; +import cytoscape.task.ui.JTaskConfig; +import cytoscape.task.util.TaskManager; +import cytoscape.view.CyNetworkView; +import cytoscape.visual.CalculatorCatalog; +import cytoscape.visual.GlobalAppearanceCalculator; +import cytoscape.visual.VisualMappingManager; +import cytoscape.visual.VisualStyle; +import ding.view.DGraphView; + +//public class SuperpathwaysGui extends JFrame implements ActionListener{ +public class SuperpathwaysGui extends JPanel { + + // private static String ACTION_SEARCH = "Search"; + + private static String ORGANISM_ALL = "All organisms"; + + final SuperpathwaysClient mClient; + + ResultRow mSelectedInHelpPanel; + + List mClickedPathwayNameID = new ArrayList(); + + List mSelectedPathwayNameID = new ArrayList(); + + // this mSelectedPathwaysID is used for pass the reference of Pws to the + // method in CommonNodeView class + // use the identifier directly, not the name/identifier combination. + List mSelectedPathwaysID = new ArrayList(); + + // String[] mSelectedPathwaysID = new String[20]; + + String mSelectedPwInHelpPanel = "not defined"; + + private Map mNodeIdToPwsSharingNode = new HashMap(); + + private List mCandidatePw; + + int mNoGeneNode; + + Pathway mAnchorPw; + + CommonNodeView cnViewObject; + + PathwaysMerge pMerge; + + static int superpathwaysVisualStyleCounter; + + // List selectedPwsNameId; + + public SuperpathwaysGui(SuperpathwaysClient c) { + mClient = c; + + initComponents(); + + cnViewObject = null; + + superpathwaysVisualStyleCounter = 1; + + } + + // the following code is generated in Netbean IDE + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // + private void initComponents() { + + jScrollPane2 = new javax.swing.JScrollPane(); + + // superpathwayPanel = new javax.swing.JTabbedPane(); + searchPane = new javax.swing.JPanel(); + stepLabel1 = new javax.swing.JLabel(); + searchText = new javax.swing.JTextField(); + organismCombo = new javax.swing.JComboBox(); + searchBtn = new javax.swing.JButton(); + // helpButton = new javax.swing.JButton(); + hintLabel1 = new javax.swing.JLabel(); + resultScrolllPane1 = new javax.swing.JScrollPane(); + resultTable = new javax.swing.JTable(); + addBtn = new javax.swing.JButton(); + selectPanel = new javax.swing.JPanel(); + + /* + * availablePathwaysScrollPane = new javax.swing.JScrollPane(); + * availablePathwaysList = new javax.swing.JList(); + * availablePathwaysListModel = new DefaultListModel(); + * availablePathwaysLabel = new javax.swing.JLabel(); + */ + removeBtn = new javax.swing.JButton(); + + selectedPathwaysLabel = new javax.swing.JLabel(); + selectedPathwaysScrollPane = new javax.swing.JScrollPane(); + selectedPathwaysList = new javax.swing.JList(); + selectedPathwaysListModel = new DefaultListModel(); + + findRelatedPwsBtn = new javax.swing.JButton(); + // rightButton = new javax.swing.JButton(); + // leftButton = new javax.swing.JButton(); + + ClearBtn = new javax.swing.JButton(); + CommonNodeViewBtn = new javax.swing.JButton(); + MergeBtn = new javax.swing.JButton(); + + helpPanel = new javax.swing.JPanel(); + anchorPathwayLabel = new javax.swing.JLabel(); + sharingNodeNoLabel = new javax.swing.JLabel(); + anchorPathwayComboBox = new javax.swing.JComboBox(); + lowerBoundSharingNodeNoComboBox = new javax.swing.JComboBox(); + candidatePathwaysSharingNodesScrollPane = new javax.swing.JScrollPane(); + + // candidatePathwaysSharingNodesList = new javax.swing.JList(); + // candidatePathwaysSharingNodesListModel = new DefaultListModel(); + + candidatePathwaysSharingNodesTable = new javax.swing.JTable(); + candidatePathwaysSharingNodesTableModel = new javax.swing.table.DefaultTableModel(); + + // candidatePathwaysSharingNodesTable.setAutoCreateRowSorter(true); + + explainHelpLabel1 = new javax.swing.JLabel(); + addHelpButton = new javax.swing.JButton(); + lowerBoundLabel = new javax.swing.JLabel(); + upperBoundLabel = new javax.swing.JLabel(); + upperBoundSharingNodeNoComboBox = new javax.swing.JComboBox(); + explainHelpLabel2 = new javax.swing.JLabel(); + backToSearchButton = new javax.swing.JButton(); + searchHelpButton = new javax.swing.JButton(); + lastLabel = new javax.swing.JLabel(); + + // setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + // setTitle("Superpathways"); + // setBackground(new java.awt.Color(255, 255, 255)); + + /* + * superpathwayPanel.setToolTipText(""); + * superpathwayPanel.setName("search_select_tab"); // NOI18N + * superpathwayPanel.setPreferredSize(new java.awt.Dimension(440, 680)); + */ + + searchPane.setToolTipText(""); + + stepLabel1.setBackground(new java.awt.Color(204, 204, 255)); + stepLabel1.setFont(new java.awt.Font("Dialog", 1, 11)); // NOI18N + stepLabel1.setForeground(new java.awt.Color(102, 0, 0)); + stepLabel1 + .setText("Search and select multiple pathways from WikiPathways"); + + searchText.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + searchTextActionPerformed(evt); + } + }); + + resetOrganisms(); + + searchBtn.setText("Search"); + searchBtn.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + searchBtnActionPerformed(evt); + } + }); + + hintLabel1.setFont(new java.awt.Font("Dialog", 1, 11)); // NOI18N + hintLabel1 + .setText("You can search by: pathway name, gene/protein name, or any page content"); + + resultTable + .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + + resultScrolllPane1.setViewportView(resultTable); + + addBtn.setText("Add"); + addBtn + .setToolTipText("add the selected pathway to the \"Available Pathways\" list"); + addBtn.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + addBtnActionPerformed(evt); + } + }); + + /* + * selectPanel.setBorder(javax.swing.BorderFactory.createTitledBorder( + * javax.swing.BorderFactory .createTitledBorder("Please select pathways + * to merge"), "", + * javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, + * javax.swing.border.TitledBorder.DEFAULT_POSITION, new + * java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 255))); // + * NOI18N + */ + + selectPanel.setBorder(javax.swing.BorderFactory.createTitledBorder( + null, "", + javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, + javax.swing.border.TitledBorder.DEFAULT_POSITION, + new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, + 255))); // NOI18N + /* + * availablePathwaysList + * .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + * availablePathwaysList.setLayoutOrientation(JList.VERTICAL); + * availablePathwaysList.setVisibleRowCount(8); + * + * availablePathwaysScrollPane.setViewportView(availablePathwaysList); + */ + + selectedPathwaysList + .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + selectedPathwaysList.setLayoutOrientation(JList.VERTICAL); + selectedPathwaysList.setVisibleRowCount(8); + selectedPathwaysScrollPane.setViewportView(selectedPathwaysList); + + /* + * availablePathwaysLabel.setFont(new java.awt.Font("Tahoma", 1, 11)); // + * NOI18N availablePathwaysLabel.setForeground(new java.awt.Color(102, + * 0, 0)); availablePathwaysLabel.setText("Available Pathways"); + */ + selectedPathwaysLabel.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + selectedPathwaysLabel.setForeground(new java.awt.Color(102, 0, 0)); + selectedPathwaysLabel.setText("Selected Pathways"); + + removeBtn.setText("Remove"); + removeBtn.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + removeBtnActionPerformed(evt); + } + }); + + ClearBtn.setText("Clear"); + ClearBtn + .setToolTipText("clear all the previously selected pathways"); + ClearBtn.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + ClearBtnActionPerformed(evt); + } + }); + + org.jdesktop.layout.GroupLayout selectPanelLayout = new org.jdesktop.layout.GroupLayout( + selectPanel); + selectPanel.setLayout(selectPanelLayout); + selectPanelLayout + .setHorizontalGroup(selectPanelLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add( + selectPanelLayout + .createSequentialGroup() + .addContainerGap() + .add( + selectPanelLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add( + org.jdesktop.layout.GroupLayout.TRAILING, + selectedPathwaysScrollPane, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + 371, + Short.MAX_VALUE) + .add( + selectedPathwaysLabel) + .add( + org.jdesktop.layout.GroupLayout.TRAILING, + selectPanelLayout + .createSequentialGroup() + .add( + ClearBtn) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add( + removeBtn, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + 71, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) + .addContainerGap())); + selectPanelLayout + .setVerticalGroup(selectPanelLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add( + selectPanelLayout + .createSequentialGroup() + .add(selectedPathwaysLabel) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add( + selectedPathwaysScrollPane, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + 110, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .add( + selectPanelLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(removeBtn).add( + ClearBtn)))); + + /* + * org.jdesktop.layout.GroupLayout selectPanelLayout = new + * org.jdesktop.layout.GroupLayout(selectPanel); + * selectPanel.setLayout(selectPanelLayout); + * selectPanelLayout.setHorizontalGroup( + * selectPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + * .add(selectPanelLayout.createSequentialGroup() .addContainerGap() + * .add(selectPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + * .add(org.jdesktop.layout.GroupLayout.TRAILING, + * selectedPathwaysScrollPane, + * org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 371, Short.MAX_VALUE) + * .add(selectedPathwaysLabel) + * .add(org.jdesktop.layout.GroupLayout.TRAILING, removeBtn)) + * .addContainerGap()) ); selectPanelLayout.setVerticalGroup( + * selectPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + * .add(selectPanelLayout.createSequentialGroup() + * .add(selectedPathwaysLabel) + * .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + * .add(selectedPathwaysScrollPane, + * org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 110, + * org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + * .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, + * org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + * .add(removeBtn)) ); + */ + + findRelatedPwsBtn.setText("Find Related Pathways"); + findRelatedPwsBtn + .setToolTipText("find the related pathways which share nodes with the one you select"); + findRelatedPwsBtn + .addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + findRelatedPwsBtnActionPerformed(evt); + } + }); + + + + CommonNodeViewBtn.setText("Common Node View"); + CommonNodeViewBtn + .setToolTipText("generate a network view showing the number of shared nodes between every two selected pathways"); + CommonNodeViewBtn + .addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + CommonNodeViewBtnActionPerformed(evt); + } + }); + + /* + * helpButton.setText("Help"); helpButton .setToolTipText("switch to + * Search Help tab, where you're provided with help for finding + * candidate pathways with shared nodes"); + * helpButton.addActionListener(new java.awt.event.ActionListener() { + * public void actionPerformed(java.awt.event.ActionEvent evt) { + * helpButtonActionPerformed(evt); } }); + */ + + MergeBtn.setText("Merge"); + MergeBtn.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + MergeBtnActionPerformed(evt); + } + }); + + org.jdesktop.layout.GroupLayout searchPaneLayout = new org.jdesktop.layout.GroupLayout( + searchPane); + searchPane.setLayout(searchPaneLayout); + searchPaneLayout + .setHorizontalGroup(searchPaneLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add( + searchPaneLayout + .createSequentialGroup() + .addContainerGap() + .add( + searchPaneLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add( + searchPaneLayout + .createSequentialGroup() + .add( + stepLabel1) + .addContainerGap( + 79, + Short.MAX_VALUE)) + .add( + searchPaneLayout + .createSequentialGroup() + .add( + hintLabel1, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + 412, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addContainerGap( + 18, + Short.MAX_VALUE)) + .add( + org.jdesktop.layout.GroupLayout.TRAILING, + searchPaneLayout + .createSequentialGroup() + .add( + searchPaneLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.TRAILING) + .add( + searchPaneLayout + .createSequentialGroup() + + /*.add( + ClearBtn)*/ + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add( + CommonNodeViewBtn) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add( + MergeBtn) + .add( + 6, + 6, + 6)) + .add( + searchPaneLayout + .createSequentialGroup() + .add( + findRelatedPwsBtn) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.UNRELATED) + .add( + addBtn, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + 67, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add( + org.jdesktop.layout.GroupLayout.LEADING, + selectPanel, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .add( + org.jdesktop.layout.GroupLayout.LEADING, + resultScrolllPane1, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + 407, + Short.MAX_VALUE) + .add( + org.jdesktop.layout.GroupLayout.LEADING, + searchPaneLayout + .createSequentialGroup() + .add( + searchText, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + 171, + Short.MAX_VALUE) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.UNRELATED) + .add( + organismCombo, + 0, + 151, + Short.MAX_VALUE) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.UNRELATED) + .add( + searchBtn))) + .add( + 23, + 23, + 23))))); + + /* + * searchPaneLayout.linkSize(new java.awt.Component[] { ClearBtn, + * helpButton }, org.jdesktop.layout.GroupLayout.HORIZONTAL); + */ + + searchPaneLayout + .setVerticalGroup(searchPaneLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add( + searchPaneLayout + .createSequentialGroup() + .add(28, 28, 28) + .add(stepLabel1) + .add(18, 18, 18) + .add(hintLabel1) + .add(32, 32, 32) + .add( + searchPaneLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add( + searchText, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + 23, + Short.MAX_VALUE) + .add(organismCombo) + .add(searchBtn)) + .add(18, 18, 18) + .add( + resultScrolllPane1, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + 176, Short.MAX_VALUE) + .add(18, 18, 18) + .add( + searchPaneLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(findRelatedPwsBtn) + .add(addBtn)) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add( + selectPanel, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .add(39, 39, 39) + .add( + searchPaneLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(MergeBtn) + .add(CommonNodeViewBtn) + /*.add(ClearBtn)*/).add(43, + 43, 43))); + + searchPaneLayout.linkSize(new java.awt.Component[] { addBtn, + findRelatedPwsBtn }, org.jdesktop.layout.GroupLayout.VERTICAL); + + searchPaneLayout.linkSize(new java.awt.Component[] { searchBtn, + searchText }, org.jdesktop.layout.GroupLayout.VERTICAL); + + /*searchPaneLayout.linkSize(new java.awt.Component[] { ClearBtn, + CommonNodeViewBtn }, org.jdesktop.layout.GroupLayout.VERTICAL);*/ + + // superpathwayPanel.addTab("Search/Select", searchPane); + + anchorPathwayLabel.setForeground(new java.awt.Color(0, 0, 255)); + anchorPathwayLabel.setText("Pathway"); + + sharingNodeNoLabel.setForeground(new java.awt.Color(0, 0, 255)); + sharingNodeNoLabel.setText("Sharing"); + + // anchorPathwayComboBox.setModel(new + // DefaultComboBoxModel(mAvailablePathwaysNameIDList.toArray())); + + anchorPathwayComboBoxModel = new DefaultComboBoxModel(); + anchorPathwayComboBoxModel.addElement((Object) new String( + "choose one pathway")); + anchorPathwayComboBox.setModel(anchorPathwayComboBoxModel); + + anchorPathwayComboBox + .addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + anchorPathwayComboBoxActionPerformed(evt); + } + }); + + lowerBoundSharingNodeNoComboBox + .setModel(new javax.swing.DefaultComboBoxModel(new String[] { + "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" })); + + // candidatePathwaysSharingNodesTable.setModel(); + + explainHelpLabel1.setFont(new java.awt.Font("Dialog", 1, 11)); // NOI18N + explainHelpLabel1.setForeground(new java.awt.Color(102, 0, 0)); + explainHelpLabel1 + .setText("Choose a pathway and set the range of sharing nodes number, a list of "); + + addHelpButton.setText("Add"); + addHelpButton + .setToolTipText("add the selected pathways to the 'Available Pathways' list"); + /* + * addHelpButton.addActionListener(new java.awt.event.ActionListener() { + * public void actionPerformed(java.awt.event.ActionEvent evt) { + * addHelpButtonActionPerformed(evt); } }); + */ + + lowerBoundLabel.setForeground(new java.awt.Color(0, 0, 255)); + lowerBoundLabel.setText("Minimum"); + + upperBoundLabel.setForeground(new java.awt.Color(0, 0, 255)); + upperBoundLabel.setText("Maximum"); + + upperBoundSharingNodeNoComboBox + .setModel(new javax.swing.DefaultComboBoxModel(new String[] { + "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", + "11", "12", "13", "14", "15", "16", "17", "18", "19", + "20" })); + + explainHelpLabel2.setFont(new java.awt.Font("Dialog", 1, 11)); // NOI18N + explainHelpLabel2.setForeground(new java.awt.Color(102, 0, 0)); + explainHelpLabel2 + .setText("candidate pathways with sharing nodes would be returned."); + + lastLabel.setForeground(new java.awt.Color(0, 0, 255)); + lastLabel.setText("Nodes"); + + backToSearchButton.setText("Back to Search"); + backToSearchButton + .addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + backtoSearchButtonActionPerformed(evt); + } + }); + + searchHelpButton.setText("Search"); + searchHelpButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + searchHelpButtonActionPerformed(evt); + } + }); + + /* + * candidatePathwaysSharingNodesList + * .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + * candidatePathwaysSharingNodesScrollPane + * .setViewportView(candidatePathwaysSharingNodesList); + */ + + candidatePathwaysSharingNodesTableModel.addColumn("Pathway Name"); + candidatePathwaysSharingNodesTableModel.addColumn("ID"); + candidatePathwaysSharingNodesTableModel.addColumn("No. Shared Nodes"); + + candidatePathwaysSharingNodesTable + .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + candidatePathwaysSharingNodesScrollPane + .setViewportView(candidatePathwaysSharingNodesTable); + candidatePathwaysSharingNodesTable + .setModel(candidatePathwaysSharingNodesTableModel); + + TableColumn column = null; + for (int i = 0; i < 3; i++) { + column = candidatePathwaysSharingNodesTable.getColumnModel() + .getColumn(i); + if (i == 0) { + column.setPreferredWidth(150); // third column is bigger + } else if (i == 1) { + column.setPreferredWidth(40); + } else { + column.setPreferredWidth(60); + } + + } + + org.jdesktop.layout.GroupLayout helpPanelLayout = new org.jdesktop.layout.GroupLayout( + helpPanel); + helpPanel.setLayout(helpPanelLayout); + helpPanelLayout + .setHorizontalGroup(helpPanelLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add( + helpPanelLayout + .createSequentialGroup() + .add( + helpPanelLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add( + helpPanelLayout + .createSequentialGroup() + .addContainerGap() + .add( + explainHelpLabel1)) + .add( + helpPanelLayout + .createSequentialGroup() + .addContainerGap() + .add( + explainHelpLabel2)) + .add( + helpPanelLayout + .createSequentialGroup() + .add( + 19, + 19, + 19) + .add( + helpPanelLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add( + anchorPathwayLabel) + .add( + sharingNodeNoLabel)) + .add( + 6, + 6, + 6) + .add( + helpPanelLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING, + false) + .add( + helpPanelLayout + .createSequentialGroup() + .add( + lowerBoundLabel) + .add( + 18, + 18, + 18) + .add( + lowerBoundSharingNodeNoComboBox, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add( + 18, + 18, + 18) + .add( + upperBoundLabel) + .add( + 18, + 18, + 18) + .add( + upperBoundSharingNodeNoComboBox, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add( + helpPanelLayout + .createSequentialGroup() + .add( + 23, + 23, + 23) + .add( + anchorPathwayComboBox, + 0, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE))) + .add( + 18, + 18, + 18) + .add( + lastLabel) + .add( + 18, + 18, + 18) + .add( + searchHelpButton))) + .addContainerGap(24, Short.MAX_VALUE)) + .add( + org.jdesktop.layout.GroupLayout.TRAILING, + helpPanelLayout + .createSequentialGroup() + .addContainerGap(190, Short.MAX_VALUE) + .add(backToSearchButton) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.RELATED) + .add(addHelpButton).add(26, 26, 26)) + .add( + helpPanelLayout + .createSequentialGroup() + .addContainerGap() + .add( + candidatePathwaysSharingNodesScrollPane, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + 402, Short.MAX_VALUE).add(16, + 16, 16))); + + helpPanelLayout.linkSize(new java.awt.Component[] { addHelpButton, + backToSearchButton }, + org.jdesktop.layout.GroupLayout.HORIZONTAL); + + helpPanelLayout + .setVerticalGroup(helpPanelLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING) + .add( + helpPanelLayout + .createSequentialGroup() + .add(33, 33, 33) + .add(explainHelpLabel1) + .addPreferredGap( + org.jdesktop.layout.LayoutStyle.UNRELATED) + .add(explainHelpLabel2) + .add(44, 44, 44) + .add( + helpPanelLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(anchorPathwayLabel) + .add( + anchorPathwayComboBox, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(23, 23, 23) + .add( + helpPanelLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(lowerBoundLabel) + .add( + lowerBoundSharingNodeNoComboBox, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(upperBoundLabel) + .add( + upperBoundSharingNodeNoComboBox, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(lastLabel) + .add(searchHelpButton) + .add(sharingNodeNoLabel)) + .add(53, 53, 53) + .add( + candidatePathwaysSharingNodesScrollPane, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, + 251, Short.MAX_VALUE) + .add(29, 29, 29) + .add( + helpPanelLayout + .createParallelGroup( + org.jdesktop.layout.GroupLayout.BASELINE) + .add(backToSearchButton) + .add(addHelpButton)) + .addContainerGap(131, Short.MAX_VALUE))); + + helpPanelLayout.linkSize(new java.awt.Component[] { addHelpButton, + backToSearchButton }, org.jdesktop.layout.GroupLayout.VERTICAL); + + helpPanelLayout.linkSize(new java.awt.Component[] { lastLabel, + lowerBoundLabel, lowerBoundSharingNodeNoComboBox, + searchHelpButton, sharingNodeNoLabel, upperBoundLabel, + upperBoundSharingNodeNoComboBox }, + org.jdesktop.layout.GroupLayout.VERTICAL); + + // remove the Search Help panel + /* + * superpathwayPanel .addTab("Search Help", null, helpPanel, "help is + * provided for finding candidate pathways with shared nodes"); + */ + // jScrollPane2.setViewportView(superpathwayPanel); + jScrollPane2.setViewportView(searchPane); + + org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout( + this); + setLayout(layout); + layout.setHorizontalGroup(layout.createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING).add( + layout.createSequentialGroup().add(18, 18, 18).add( + jScrollPane2, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 447, + Short.MAX_VALUE).add(20, 20, 20))); + layout.setVerticalGroup(layout.createParallelGroup( + org.jdesktop.layout.GroupLayout.LEADING).add( + layout.createSequentialGroup().add(20, 20, 20).add( + jScrollPane2, + org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 701, + Short.MAX_VALUE).addContainerGap())); + + // pack(); + }// + + private void searchTextActionPerformed(java.awt.event.ActionEvent evt) { + searchActionPerformed(evt); + } + + private void searchBtnActionPerformed(java.awt.event.ActionEvent evt) { + searchActionPerformed(evt); + } + + private void addBtnActionPerformed(java.awt.event.ActionEvent evt) { + // System.out.println(mClickedPathwayNameID.size() + ""); + mClickedPathwayNameID.clear(); + + int[] rows = resultTable.getSelectedRows(); + for (int k = 0; k < rows.length; k++) { + int viewRow = rows[k]; + int modelRow = sorter.modelIndex(viewRow); + + ResultRow t = tableModel.getRow(modelRow); + String temp = t.getProperty(ResultProperty.NAME) + "(" + + t.getProperty(ResultProperty.ID) + ")"; + + mClickedPathwayNameID.add(temp); + + } + for (int i = 0; i < mClickedPathwayNameID.size(); i++) { + System.out.println(mClickedPathwayNameID.get(i)); + if (!selectedPathwaysListModel.contains(mClickedPathwayNameID + .get(i))) { + selectedPathwaysListModel.addElement(mClickedPathwayNameID + .get(i)); + selectedPathwaysList.setModel(selectedPathwaysListModel); + /* + * if (availablePathwaysListModel.getSize() > 0) { + * rightButton.setEnabled(true); } + */ + + mSelectedPathwayNameID.add(mClickedPathwayNameID.get(i)); + + // add the pathways IDs to the list mSelectedPathwaysID + String t = mClickedPathwayNameID.get(i); + int index1 = t.lastIndexOf("("); + int index2 = t.lastIndexOf(")"); + String pwID = t.substring(index1 + 1, index2); + mSelectedPathwaysID.add(pwID); + + /* + * anchorPathwayComboBoxModel.addElement(mClickedPathwayNameID + * .get(i)); + * anchorPathwayComboBox.setModel(anchorPathwayComboBoxModel); + */ + } + } + + } + + private void removeBtnActionPerformed(java.awt.event.ActionEvent evt) { + Object[] temp = selectedPathwaysList.getSelectedValues(); + for (int i = 0; i < temp.length; i++) { + mSelectedPathwayNameID.remove((String) temp[i]); + + // removed the selected item in the selected pathways list + selectedPathwaysListModel.removeElement(temp[i]); + String t = (String) temp[i]; + int index1 = t.lastIndexOf("("); + int index2 = t.lastIndexOf(")"); + String pwID = t.substring(index1 + 1, index2); + mSelectedPathwaysID.remove(pwID); + } + } + + private void findRelatedPwsBtnActionPerformed(java.awt.event.ActionEvent evt) { + System.out.println("After clicking 'Find Related Pathways' button!"); + int[] rows = resultTable.getSelectedRows(); + + if (rows.length > 1 || rows.length == 0) { + JOptionPane + .showMessageDialog( + this, + "Please select ONE pathway among the search result", + "find related pathways...", + JOptionPane.INFORMATION_MESSAGE); + } else { + int viewRow = rows[0]; + int modelRow = sorter.modelIndex(viewRow); + + ResultRow t = tableModel.getRow(modelRow); + String temp = t.getProperty(ResultProperty.NAME) + "(" + + t.getProperty(ResultProperty.ID) + ")"; + + FindRelatedPwsDialog relatedPwsDialog = new FindRelatedPwsDialog( + mClient, "Find related pathways...", temp); + relatedPwsDialog.setVisible(true); + + } + + } + + private void ClearBtnActionPerformed(java.awt.event.ActionEvent evt) { + // SuperpathwaysPlugin spPlugin = SuperpathwaysPlugin.getInstance(); + // spPlugin.mWindow.setVisible(false); + // spPlugin.mWindow.dispose(); + searchText.setText(""); + /* + * availablePathwaysListModel.clear(); + * availablePathwaysList.setModel(availablePathwaysListModel); + */ + selectedPathwaysListModel.clear(); + selectedPathwaysList.setModel(selectedPathwaysListModel); + //anchorPathwayComboBox.setModel(new DefaultComboBoxModel()); + mSelectedPathwaysID.clear(); + mSelectedPathwayNameID.clear(); + + } + + private void CommonNodeViewBtnActionPerformed(java.awt.event.ActionEvent evt) { + + System.out.println("Display the selected pws' id:"); + for (int k = 0; k < mSelectedPathwaysID.size(); k++) { + System.out.println(mSelectedPathwaysID.get(k)); + } + + /* + * Object[] selectedPwNameId = selectedPathwaysListModel.toArray(); + * selectedPwsNameId = new ArrayList(); for (int i = 0; i < + * selectedPwNameId.length; i++) { selectedPwsNameId.add((String) + * selectedPwNameId[i]); } + */ + + commonNodeViewTask task = new commonNodeViewTask(mClient); + JTaskConfig config = new JTaskConfig(); + config.displayCancelButton(true); + // config.setModal(true); + config.setModal(false); + TaskManager.executeTask(task, config); + } + + private void searchHelpButtonActionPerformed(java.awt.event.ActionEvent evt) { + + candidatePathwaysSharingNodesTableModel = new javax.swing.table.DefaultTableModel(); + candidatePathwaysSharingNodesTableModel.addColumn("Pathway Name"); + candidatePathwaysSharingNodesTableModel.addColumn("ID"); + candidatePathwaysSharingNodesTableModel.addColumn("No. Shared Nodes"); + + candidatePathwaysSharingNodesTable + .setModel(candidatePathwaysSharingNodesTableModel); + setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + + // String anchorPwNameAndId = + // anchorPathwayComboBox.getSelectedItem().toString(); + int lowerBound = Integer.parseInt(lowerBoundSharingNodeNoComboBox + .getSelectedItem().toString()); + int upperBound = Integer.parseInt(upperBoundSharingNodeNoComboBox + .getSelectedItem().toString()); + + // mCandidatePwList = findCandidatePwBySharingNodes(lowerBound, + // upperBound); + + searchSharingNodePwsTask task = new searchSharingNodePwsTask( + lowerBound, upperBound); + + JTaskConfig config = new JTaskConfig(); + config.displayCancelButton(true); + // config.displayCloseButton(true); + // config.displayStatus(true); + config.setModal(true); + TaskManager.executeTask(task, config); + + // mCandidatePw is a list of string with elements in format "Pathway + // Name (pw id), sharing node number: a int" + + // System.out.println("We reach here 3!"); + // System.out.println(mCandidatePw.size()+""); + Iterator it = mCandidatePw.iterator(); + while (it.hasNext()) { + String temp = it.next(); + // candidatePathwaysSharingNodesListModel.addElement(temp); + + // System.out.println(temp); + // parse the string into three parts: pathway name, id, and No. + // Sharing Nodes + int index1 = temp.indexOf(","); + String temp1 = temp.substring(0, index1); + + int index2 = temp1.lastIndexOf("("); + int index3 = temp1.lastIndexOf(")"); + String pwName = temp1.substring(0, index2); + // System.out.println(pwName); + String pwId = temp1.substring(index2 + 1, index3); + // System.out.println(pwId); + + // String temp2 = temp.substring(index1+1); + int index4 = temp.indexOf(":"); + String NoSharingNode = temp.substring(index4 + 2); + // System.out.println(NoSharingNode); + + Object[] row = new Object[3]; + row[0] = (Object) pwName; + row[1] = (Object) pwId; + row[2] = (Object) NoSharingNode; + + candidatePathwaysSharingNodesTableModel.addRow(row); + + } + + sorter = new TableSorter(candidatePathwaysSharingNodesTableModel); + candidatePathwaysSharingNodesTable.setModel(sorter); + sorter.setTableHeader(candidatePathwaysSharingNodesTable + .getTableHeader()); + + // candidatePathwaysSharingNodesList.setModel(candidatePathwaysSharingNodesListModel); + setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + } + + private void backtoSearchButtonActionPerformed( + java.awt.event.ActionEvent evt) { + // System.out.println("Clicking the back to search button!"); + // superpathwayPanel.setSelectedIndex(0); + } + + private void anchorPathwayComboBoxActionPerformed( + java.awt.event.ActionEvent evt) { + String anchorPwNameId = anchorPathwayComboBox.getSelectedItem() + .toString(); + + if (anchorPwNameId.equalsIgnoreCase("choose one pathway")) { + + } else { + int index1 = anchorPwNameId.lastIndexOf("("); + int index2 = anchorPwNameId.lastIndexOf(")"); + String anchorPwID = anchorPwNameId.substring(index1 + 1, index2); + + // Create a client to the WikiPathways web service + WikiPathwaysClient client = mClient.getStub(); + + // Download these two pathways from WikiPathways by passing their id + WSPathway anchorPathway = new WSPathway(); + + try { + anchorPathway = client.getPathway(anchorPwID); + + } catch (RemoteException e) { + Logger.log.error( + "Unable to get the pathway due to the RemoteException", + e); + } catch (ConverterException e) { + Logger.log + .error( + "Unable to get the pathway due to the ConverterException", + e); + } + // Create two corresponding pathway objects + mAnchorPw = new Pathway(); + + try { + mAnchorPw = WikiPathwaysClient.toPathway(anchorPathway); + } catch (ConverterException e) { + Logger.log.error( + "Unable to get the pathway due to the RemoteException", + e); + } + + mNoGeneNode = 0; + for (PathwayElement pwElm : mAnchorPw.getDataObjects()) { + if (pwElm.getObjectType() == ObjectType.DATANODE) { + mNoGeneNode = mNoGeneNode + 1; + + } + } + + String[] temp = new String[mNoGeneNode]; + for (int i = 1; i <= mNoGeneNode; i++) { + temp[i - 1] = String.valueOf(i); + } + + upperBoundSharingNodeNoComboBox + .setModel(new javax.swing.DefaultComboBoxModel(temp)); + + } + } + + private void MergeBtnActionPerformed(java.awt.event.ActionEvent evt) { + // SimpleCaseMergeTest test=new SimpleCaseMergeTest(); + + WikiPathwaysClient client = mClient.getStub(); + SuperpathwaysPlugin spPlugin = SuperpathwaysPlugin.getInstance(); + MergeTask task = new MergeTask(spPlugin, client); + + // Configure JTask Dialog Pop-Up Box + final JTaskConfig jTaskConfig = new JTaskConfig(); + + jTaskConfig.displayCloseButton(true); + jTaskConfig.displayCancelButton(true); + jTaskConfig.displayStatus(true); + jTaskConfig.displayTimeElapsed(true); + + jTaskConfig.setAutoDispose(false); + // jTaskConfig.setModal(true); + jTaskConfig.setModal(false); + + // Execute Task in New Thread; pop open JTask Dialog Box. + TaskManager.executeTask(task, jTaskConfig); + if (task.isCancelled()) + return; + + } + + // the code above is generated in Netbean IDE + + protected void resetOrganisms() { + List organisms = new ArrayList(); + organisms.add(ORGANISM_ALL); + try { + organisms.addAll(Arrays.asList(mClient.listOrganisms())); + } catch (Exception e) { + Logger.log.error("Unable to get organisms for WikiPathways client", + e); + } + + organismCombo.setModel(new DefaultComboBoxModel(organisms.toArray())); + } + + public void searchActionPerformed(java.awt.event.ActionEvent evt) { + // String action = e.getActionCommand(); + // if(ACTION_SEARCH.equals(action)) { + FindPathwaysByTextParameters request = new FindPathwaysByTextParameters(); + request.query = searchText.getText(); + String org = organismCombo.getSelectedItem().toString(); + if (!ORGANISM_ALL.equals(org)) { + request.species = Organism.fromLatinName(org); + } + try { + WebServiceClientManager + .getCyWebServiceEventSupport() + .fireCyWebServiceEvent( + new CyWebServiceEvent( + mClient.getClientID(), + WSEventType.SEARCH_DATABASE, request)); + + } catch (CyWebServiceException ex) { + switch (ex.getErrorCode()) { + case NO_RESULT: + JOptionPane.showMessageDialog(this, + "The search didn't return any results", "No results", + JOptionPane.INFORMATION_MESSAGE); + break; + case OPERATION_NOT_SUPPORTED: + case REMOTE_EXEC_FAILED: + JOptionPane.showMessageDialog(this, "Error: " + + ex.getErrorCode() + ". See log for details", "Error", + JOptionPane.ERROR_MESSAGE); + break; + } + ex.printStackTrace(); + } + // } + } + + private void openNetwork(ResultRow mSelected) { + try { + GetPathwayParameters request = new GetPathwayParameters(); + WSSearchResult result = mSelected.getResult(); + request.id = result.getId(); + request.revision = Integer.parseInt(result.getRevision()); + WebServiceClientManager.getCyWebServiceEventSupport() + .fireCyWebServiceEvent( + new CyWebServiceEvent(mClient.getClientID(), + WSEventType.IMPORT_NETWORK, request)); + } catch (CyWebServiceException ex) { + JOptionPane.showMessageDialog(SuperpathwaysGui.this, "Error: " + + ex.getErrorCode() + ". See error log for details", + "Error", JOptionPane.ERROR_MESSAGE); + } + } + + public void setResults(WSSearchResult[] results) { + + tableModel = new ListWithPropertiesTableModel(); + if (results != null) { + tableModel.setColumns(new ResultProperty[] { ResultProperty.NAME, + ResultProperty.ID, ResultProperty.ORGANISM, }); + + resultTable.setModel(tableModel); + for (WSSearchResult r : results) { + tableModel.addRow(new ResultRow(r)); + } + } + + sorter = new TableSorter(tableModel); + resultTable.setModel(sorter); + sorter.setTableHeader(resultTable.getTableHeader()); + + // resultTable.setModel(tableModel); + System.out.println("Superpathways!"); + + } + + // private javax.swing.DefaultListModel availablePathwaysListModel; + // javax.swing.DefaultListModel availablePathwaysListModel; + + // private javax.swing.DefaultListModel selectedPathwaysListModel; + javax.swing.DefaultListModel selectedPathwaysListModel; + + private javax.swing.DefaultComboBoxModel anchorPathwayComboBoxModel; + + // private javax.swing.DefaultListModel + // candidatePathwaysSharingNodesListModel; + + private javax.swing.table.DefaultTableModel candidatePathwaysSharingNodesTableModel; + + private TableSorter sorter; + + private javax.swing.JButton ClearBtn; + + private javax.swing.JButton CommonNodeViewBtn; + + private javax.swing.JButton addBtn; + + private javax.swing.JButton addHelpButton; + + private javax.swing.JComboBox anchorPathwayComboBox; + + private javax.swing.JLabel anchorPathwayLabel; + + // private javax.swing.JLabel availablePathwaysLabel; + + // private javax.swing.JList availablePathwaysList; + // javax.swing.JList availablePathwaysList; + + // private javax.swing.JScrollPane availablePathwaysScrollPane; + + private javax.swing.JButton backToSearchButton; + + private javax.swing.JScrollPane candidatePathwaysSharingNodesScrollPane; + + // private javax.swing.JList candidatePathwaysSharingNodesList; + + private javax.swing.JLabel explainHelpLabel1; + + private javax.swing.JLabel explainHelpLabel2; + + private javax.swing.JPanel helpPanel; + + private javax.swing.JLabel hintLabel1; + + // private javax.swing.JButton leftButton; + + private javax.swing.JLabel lowerBoundLabel; + + private javax.swing.JComboBox lowerBoundSharingNodeNoComboBox; + + private javax.swing.JButton findRelatedPwsBtn; + + private javax.swing.JComboBox organismCombo; + + private javax.swing.JScrollPane resultScrolllPane1; + + private javax.swing.JTable resultTable; + + // private javax.swing.JButton rightButton; + // javax.swing.JButton rightButton; + + private javax.swing.JButton searchBtn; + + private javax.swing.JPanel searchPane; + + private javax.swing.JTextField searchText; + + private javax.swing.JPanel selectPanel; + + private javax.swing.JLabel selectedPathwaysLabel; + + // private javax.swing.JList selectedPathwaysList; + javax.swing.JList selectedPathwaysList; + + private javax.swing.JScrollPane selectedPathwaysScrollPane; + + private javax.swing.JLabel sharingNodeNoLabel; + + private javax.swing.JLabel stepLabel1; + + private javax.swing.JLabel stepLabel2; + + // private javax.swing.JTabbedPane superpathwayPanel; + + private javax.swing.JLabel upperBoundLabel; + + private javax.swing.JComboBox upperBoundSharingNodeNoComboBox; + + private javax.swing.JButton searchHelpButton; + + // private javax.swing.JButton helpButton; + + private javax.swing.JLabel lastLabel; + + private javax.swing.JTable candidatePathwaysSharingNodesTable; + + private javax.swing.JScrollPane jScrollPane2; + + private javax.swing.JButton MergeBtn; + + private javax.swing.JButton removeBtn; + + // private javax.swing.JList candidatePathwaysSharingNodesList; + + // End of variables declaration + ListWithPropertiesTableModel tableModel; + + class ResultRow implements RowWithProperties { + WSSearchResult result; + + public ResultRow(WSSearchResult result) { + this.result = result; + } + + public WSSearchResult getResult() { + return result; + } + + public String getProperty(ResultProperty prop) { + switch (prop) { + case NAME: + return result.getName(); + case ORGANISM: + return result.getSpecies(); + case SCORE: + return Double.toString(result.getScore()); + case URL: + return result.getUrl(); + // helen add + case ID: + return result.getId(); + } + return null; + } + } + + public class searchSharingNodePwsTask implements Task { + + TaskMonitor monitor; + + int lowerBound; + + int upperBound; + + public searchSharingNodePwsTask(int lb, int ub) { + lowerBound = lb; + upperBound = ub; + } + + /** + * Run the Task. + */ + public void run() { + + try { + mCandidatePw = new ArrayList(); + if (lowerBound > upperBound) { + JOptionPane.showMessageDialog(helpPanel, + "Please reset the range of sharing nodes number!"); + } else { + + Map sharingNodeNumberofPws = new HashMap(); + List geneIDList = new ArrayList(); + int percentComplete = 0; + int t = 0; + + // Create a client to the WikiPathways web service + WikiPathwaysClient client = mClient.getStub(); + + // the following code is get a map "mNodeIdToPwsSharingNode" + // with key of GeneID and value of a list of pathways which + // contain the GeneID + for (PathwayElement pwElm : mAnchorPw.getDataObjects()) { + // Only take elements with type DATANODE (genes, + // proteins, metabolites) + if (pwElm.getObjectType() == ObjectType.DATANODE) { + + percentComplete = (int) (((double) t / mNoGeneNode) * 98); + + // System.out.println(pwElm.getXref().toString()); + geneIDList.add(pwElm.getXref().toString()); + + try { + + WSSearchResult[] PwsSharingNode = client + .findPathwaysByXref(pwElm.getXref()); + // System.out.println("" + + // PwsSharingNode.length); + mNodeIdToPwsSharingNode.put(pwElm.getXref() + .toString(), PwsSharingNode); + + if (monitor != null) { + monitor + .setPercentCompleted(percentComplete); + } + + } catch (RemoteException e) { + Logger.log + .error( + "Unable to find the candidate pathways due to the RemoteException", + e); + } + } + t++; + + } + + // the following code is for converting the above map to + // another map "sharingNodeNumberofPws" with key of + // the name and id of a pathway, and value of the number of + // shared node of this pathway and the anchor pathway + for (int i = 0; i < mNoGeneNode; i++) { + WSSearchResult[] pwsArray = mNodeIdToPwsSharingNode + .get(geneIDList.get(i)); + + for (int j = 0; j < pwsArray.length; j++) { + WSSearchResult pw = pwsArray[j]; + ResultRow pwResultRow = new ResultRow(pw); + String onePwNameAndId = pwResultRow + .getProperty(ResultProperty.NAME) + + "(" + + pwResultRow + .getProperty(ResultProperty.ID) + + ")"; + + if (sharingNodeNumberofPws + .containsKey(onePwNameAndId)) { + Integer oldValue = sharingNodeNumberofPws + .get(onePwNameAndId); + Integer newValue = new Integer(oldValue + 1); + sharingNodeNumberofPws.put(onePwNameAndId, + newValue); + } else { + sharingNodeNumberofPws.put(onePwNameAndId, 1); + } + } + } + + // the following code is for displaying the result in the + // table of + // "Search Help" panel + Set sharingNodePwsSet = sharingNodeNumberofPws + .keySet(); + Iterator it = sharingNodePwsSet.iterator(); + while (it.hasNext()) { + String temp = it.next(); + Integer value = sharingNodeNumberofPws.get(temp); + if (value >= lowerBound && value <= upperBound) { + mCandidatePw.add(temp + ", sharing node number: " + + String.valueOf(value)); + } + } + + } + + if (monitor != null) { + monitor.setPercentCompleted(100); + } + // System.out.println("We reach here 2!"); + } catch (Exception e) { + Logger.log.error("Error while searching candidate pathways", e); + JOptionPane.showMessageDialog(mClient.getGUI(), "Error: " + + e.getMessage() + ". See log for details", "Error", + JOptionPane.ERROR_MESSAGE); + } + + } + + public void halt() { + } + + public void setTaskMonitor(TaskMonitor m) + throws IllegalThreadStateException { + monitor = m; + } + + public String getTitle() { + return new String( + "Searching candidate pathways with shared nodes..."); + } + } + + public class commonNodeViewTask implements Task { + + TaskMonitor monitor; + + boolean cancelled; + + // List selectedPwNameId; + SuperpathwaysClient client; + + public commonNodeViewTask(SuperpathwaysClient b) { + // selectedPwNameId=a; + client = b; + cancelled = false; + } + + public void run() { + try { + + cnViewObject = new CommonNodeView(mSelectedPathwaysID, + mSelectedPathwayNameID, client); + cnViewObject.drawCommonNodeView(); + + // the following code is for printing out the matched node pair + // by translation + System.out + .println("printing out the matched node pair by translation"); + Set s = cnViewObject.getNodePairByTranslation().keySet(); + Iterator it = s.iterator(); + while (it.hasNext()) { + Xref x1 = it.next(); + Xref x2 = cnViewObject.getNodePairByTranslation().get(x1); + System.out + .println(x1.toString() + "======" + x2.toString()); + } + + } catch (Exception e) { + Logger.log.error("Error while searching candidate pathways", e); + JOptionPane.showMessageDialog(mClient.getGUI(), "Error: " + + e.getMessage() + ". See log for details", "Error", + JOptionPane.ERROR_MESSAGE); + } + } + + public void halt() { + cancelled = true; + cnViewObject.interrupt(); + } + + public void setTaskMonitor(TaskMonitor m) + throws IllegalThreadStateException { + monitor = m; + } + + public String getTitle() { + return new String("Generating common node view..."); + } + + } + + class MergeTask implements Task { + + TaskMonitor monitor; + + boolean cancelled; + + // PathwaysMerge pMerge; + SuperpathwaysPlugin spPlugin; + + WikiPathwaysClient client; + + /** + * Constructor.
+ * + */ + public MergeTask(SuperpathwaysPlugin sp, WikiPathwaysClient c) { + cancelled = false; + spPlugin = sp; + client = c; + } + + public boolean isCancelled() { + return cancelled; + } + + public void run() { + + // if (cnViewObject==null){ + // here we need to re-run the CommonNodeView to get the correct + // NodePairByTranslation, and colorPool + + cnViewObject = new CommonNodeView(mSelectedPathwaysID, + mSelectedPathwayNameID, mClient); + + pMerge = new PathwaysMerge(null, cnViewObject + .getNodePairByTranslation(), null); + // here we call the method drawCommonNodeView(), because we want to + // make the correspondance of the color between the common node view + // and the merged network + + Map pwNameToColor = null; + if (!isCancelled()) { + try { + pwNameToColor = cnViewObject.drawCommonNodeView(); + } catch (Exception e) { + Logger.log.error("Unable to draw common node view", e); + } + + WSPathway wsPathway = new WSPathway(); + Pathway pathway = new Pathway(); + List listOfNetworks = new ArrayList(); + + for (int i = 0; i < selectedPathwaysListModel.getSize(); i++) { + + System.out.println("in for loop: " + i + ""); + String selectedOnePwNameID = (String) selectedPathwaysListModel + .get(i); + System.out.println(selectedOnePwNameID); + int index1 = selectedOnePwNameID.lastIndexOf("("); + int index2 = selectedOnePwNameID.lastIndexOf(")"); + String pwID = selectedOnePwNameID.substring(index1 + 1, + index2); + String pwName = selectedOnePwNameID.substring(0, index1); + // System.out.println(pwID); + // System.out.println(pwName); + + try { + wsPathway = client.getPathway(pwID); + pathway = WikiPathwaysClient.toPathway(wsPathway); + } catch (RemoteException e) { + Logger.log + .error( + "Unable to get the pathway due to the RemoteException", + e); + } catch (ConverterException e) { + Logger.log + .error( + "Unable to get the pathway due to the ConverterException", + e); + } + + CyNetwork net = spPlugin.load(pathway, true); + + // the following code is for coloring the nodes by default + if(pwNameToColor != null) applyGpmlVisualStyle(mClient.getPlugin().mGpmlHandler, + pwNameToColor, pwName, true, + superpathwaysVisualStyleCounter); + + listOfNetworks.add(net); + } + + // convert the array of type Color to an array of type String + String[] temp = new String[cnViewObject.getColorPool().size()]; + Object[] colors = cnViewObject.getColorPool().toArray(); + for (int s = 0; s < temp.length; s++) { + temp[s] = (String) colors[s]; + } + System.out.println("Problem is here2!"); + pMerge = new PathwaysMerge(listOfNetworks, cnViewObject + .getNodePairByTranslation(), temp); + + try { + pMerge.setTaskMonitor(monitor); + + CyNetwork mergedNetwork = pMerge.mergeNetwork( + "Merged Network", cnViewObject + .getNodePairByTranslation()); + CyNetworkView view = Cytoscape + .createNetworkView(mergedNetwork); + + superpathwaysVisualStyle vs = new superpathwaysVisualStyle( + "Merged Network", pwNameToColor, + superpathwaysVisualStyleCounter); + superpathwaysVisualStyleCounter++; + + } catch (Exception e) { + monitor.setException(e, "Network Merge Failed!"); + e.printStackTrace(); + } + + // the following code is for forcing detail rendering at any + // level of + // zoom + CyNetworkView currView = Cytoscape.getCurrentNetworkView(); + ding.view.DGraphView nv; + nv = (DGraphView) currView; + nv.setGraphLOD(new CyGraphAllLOD()); + } + + } + + public void halt() { + cancelled = true; + cnViewObject.interrupt(); + pMerge.interrupt(); + } + + public void setTaskMonitor(TaskMonitor taskMonitor) + throws IllegalThreadStateException { + this.monitor = taskMonitor; + } + + public String getTitle() { + return "Merging pathways"; + } + } + + public void applyGpmlVisualStyle(GpmlHandler gpmlHandler, + Map pwNameToColor, String t, + boolean coloringNodeInGpml, int version) { + + if (coloringNodeInGpml == true) { + VisualMappingManager vmm = Cytoscape.getVisualMappingManager(); + CalculatorCatalog catalog = vmm.getCalculatorCatalog(); + // the next code line is used for fix the bug (when doing several + // merges) + // catalog.removeVisualStyle(gpmlExtendVisualStyle.NAME); + + String styleName = gpmlExtendVisualStyle.NAME + "-" + + String.valueOf(version); + System.out.println("GPML-extention style name: " + styleName); + + VisualStyle gpmlExtensionStyle = catalog.getVisualStyle(styleName); + + if (gpmlExtensionStyle == null) { // Create the GPML visual style + Logger.log.trace("VisualStyle: creating GPML-extension style"); + System.out.println(pwNameToColor.size() + ""); + gpmlExtensionStyle = new gpmlExtendVisualStyle(gpmlHandler, + pwNameToColor, t, version); + + // set the background color + GlobalAppearanceCalculator gCalc = gpmlExtensionStyle + .getGlobalAppearanceCalculator(); + gCalc.setDefaultBackgroundColor(new Color(200, 200, 255)); + vmm.applyGlobalAppearances(); + + catalog.addVisualStyle(gpmlExtensionStyle); + } else { + System.out.println("gpml-extension style is not null!"); + Logger.log.trace("VisualStyle: reusing GPML-extension style"); + } + System.out.println("Problem is here1!"); + cytoscape.view.CyNetworkView networkView = Cytoscape + .getNetworkView(t); + networkView.setVisualStyle(gpmlExtensionStyle.getName()); + + // actually apply the visual style + vmm.setVisualStyle(gpmlExtensionStyle); + networkView.redrawGraph(true, true); + } + } } \ No newline at end of file diff --git a/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/SuperpathwaysPlugin.java b/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/SuperpathwaysPlugin.java index 67622d11..2171f862 100644 --- a/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/SuperpathwaysPlugin.java +++ b/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/SuperpathwaysPlugin.java @@ -1,245 +1,245 @@ -// PathVisio, -// a tool for data visualization and analysis using Biological Pathways -// Copyright 2006-2011 BiGCaT Bioinformatics -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package org.pathvisio.cytoscape.superpathways; - -import java.awt.Component; -import java.awt.event.ActionEvent; -import java.io.File; -import java.util.HashMap; -import java.util.Map; - -import javax.swing.JFileChooser; -import javax.swing.JFrame; -import javax.swing.JOptionPane; -import javax.swing.WindowConstants; - -import org.bridgedb.BridgeDb; -import org.bridgedb.IDMapper; -import org.bridgedb.IDMapperException; -import org.bridgedb.IDMapperStack; -import org.bridgedb.bio.BioDataSource; -import org.bridgedb.bio.Organism; -import org.pathvisio.core.debug.Logger; -import org.pathvisio.core.model.Pathway; -import org.pathvisio.core.preferences.GlobalPreference; -import org.pathvisio.cytoscape.GpmlConverter; -import org.pathvisio.cytoscape.GpmlHandler; - -import cytoscape.CyNetwork; -import cytoscape.Cytoscape; -import cytoscape.data.webservice.WebServiceClientManager; -import cytoscape.plugin.CytoscapePlugin; -import cytoscape.util.CytoscapeAction; -import cytoscape.view.CyMenus; -import cytoscape.view.CyNetworkView; -import cytoscape.view.CytoscapeDesktop; - -public class SuperpathwaysPlugin extends CytoscapePlugin { - //private static final int WINDOW_WIDTH = 400; - //private static final int WINDOW_HEIGHT = 500; - - GpmlHandler mGpmlHandler; - JFrame mWindow; - private static SuperpathwaysPlugin mInstance; - SuperpathwaysGui mSpGui; - - private String idmLocation = GlobalPreference.getDataDir().toString() - + "/gene databases/"; - private Map idMappers = new HashMap(); - - public static SuperpathwaysPlugin getInstance() { - return mInstance; - } - - public SuperpathwaysPlugin() { - BioDataSource.init(); - - if (mInstance != null) { - throw new RuntimeException( - "SuperpathwaysPlugin is already instantiated! Use static" - + " method getInstance instead!"); - } - - mInstance = this; - Logger.log.setLogLevel(true, false, true, true, true, true); - mGpmlHandler = new GpmlHandler(); - - - - SuperpathwaysPlugin spPlugin = SuperpathwaysPlugin.getInstance(); - SuperpathwaysClient spClient = new SuperpathwaysClient(spPlugin); - WebServiceClientManager.registerClient(spClient); - mSpGui = spClient.getGUI(); - //mSpGui.setLocationRelativeTo(Cytoscape.getDesktop()); - - mWindow = new JFrame("Superpathways Plugin"); - //mWindow.setSize(WINDOW_WIDTH, WINDOW_HEIGHT); - mWindow.add(mSpGui); - mWindow.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - - SuperpathwaysAction action = new SuperpathwaysAction(); - action.setPreferredMenu("Plugins"); - - CytoscapeDesktop desktop = Cytoscape.getDesktop(); - CyMenus menu = desktop.getCyMenus(); - menu.addAction(action); - - - } - - public IDMapper getIDMapper(Organism organism) throws ClassNotFoundException, IDMapperException { - Class.forName ("org.bridgedb.rdb.IDMapperRdb"); - - IDMapper idm = idMappers.get(organism); - if(idm == null) { - IDMapperStack idms = new IDMapperStack(); - idm = idms; - idMappers.put(organism, idm); - - //Try to find the available bridgedb databases, ask for location if necessary - File[] idmFiles = new File(idmLocation).listFiles(); - boolean speciesFound = false; - - if(idmFiles != null) for(int i = 0; i < idmFiles.length; i++) { - File file = idmFiles[i]; - if (file.isDirectory()) continue; // skip directories - String fileName = file.getName(); - int index = fileName.indexOf("_"); - if (index < 0) continue; // Skip this file, not the pgdb naming scheme - String prefix = fileName.substring(0, index); - // System.out.println(speciesOrMetabolite); - if (prefix.equals(organism.code())) { - Logger.log.info("Connecting to idmapper " + file); - idms.addIDMapper("idmapper-pgdb:" + file); - speciesFound = true; - } else if("metabolites".equals(prefix)) { - Logger.log.info("Connecting to idmapper " + file); - idms.addIDMapper("idmapper-pgdb:" + file); - } - } - - if (!speciesFound) { - JOptionPane - .showMessageDialog( - mWindow, - "Could not find bridgedb database for " + organism.latinName() + " in " + idmFiles + ". " + - "\nPlease download the database from http://bridgedb.org and " + - "point me to its location."); - - JFileChooser chooser = new JFileChooser(); - chooser.setCurrentDirectory(new java.io.File(".")); - chooser - .setDialogTitle("Choose the bridgedb database for " + organism.latinName()); - chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); - if (chooser.showOpenDialog(mWindow) == JFileChooser.APPROVE_OPTION) { - File file = chooser.getSelectedFile(); - if(file != null) { - Logger.log.info("Connecting to idmapper " + file); - idms.addIDMapper("idmapper-pgdb:" + file); - idmLocation = file.getParent(); - } - } - } - } - return idm; - } - - /* - * public GpmlHandler getGpmlHandler() { return mGpmlHandler; } - */ - - public CyNetwork load(Pathway p, boolean newNetwork) { - try { - GpmlConverter converter = new GpmlConverter(mGpmlHandler, p); - - // Get the nodes/edges indexes - int[] nodes = converter.getNodeIndicesArray(); - //System.out.println("There are " + nodes.length + " nodes in the pathway!"); - int[] edges = converter.getEdgeIndicesArray(); - //System.out.println("There are " + edges.length + " edges in the pathway!"); - - - // Get the current network, or create a new one, if none is - // available - CyNetwork network = Cytoscape.getCurrentNetwork(); - if (newNetwork || network == Cytoscape.getNullNetwork()) { - String title = converter.getPathway().getMappInfo() - .getMapInfoName(); - network = Cytoscape.createNetwork(title == null ? "new network" - : title, false); - } - - // Add all nodes and edges to the network - for (int nd : nodes) { - network.addNode(nd); - } - for (int ed : edges) - network.addEdge(ed); - - CyNetworkView view = Cytoscape.getNetworkView(network - .getIdentifier()); - if (view == Cytoscape.getNullNetworkView()) { - view = Cytoscape.createNetworkView(network); - Cytoscape.firePropertyChange( - CytoscapeDesktop.NETWORK_VIEW_FOCUS, null, view - .getIdentifier()); - } else { - view = Cytoscape.getCurrentNetworkView(); - } - converter.layout(view); - view.redrawGraph(true, false); - - return network; - } catch (Exception ex) { - Logger.log.error("Error while importing GPML", ex); - JOptionPane.showMessageDialog(Cytoscape.getDesktop(), - "Error while importing GPML: " + ex.getMessage(), "Error", - JOptionPane.ERROR_MESSAGE); - } - return null; - } - - public static double mToV(double m) { - return m; - } - - public static double vToM(double v) { - return v; - } - - /** - * This class gets attached to the menu item. - */ - public class SuperpathwaysAction extends CytoscapeAction { - - public SuperpathwaysAction() { - super("Superpathways"); - } - - public void actionPerformed(ActionEvent arg0) { - mWindow.add(mSpGui); - mWindow.setLocationRelativeTo(Cytoscape.getDesktop()); - mWindow.setVisible(true); - mWindow.pack(); - - - } - - } - -} +// PathVisio, +// a tool for data visualization and analysis using Biological Pathways +// Copyright 2006-2011 BiGCaT Bioinformatics +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +package org.pathvisio.cytoscape.superpathways; + +import java.awt.Component; +import java.awt.event.ActionEvent; +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JOptionPane; +import javax.swing.WindowConstants; + +import org.bridgedb.BridgeDb; +import org.bridgedb.IDMapper; +import org.bridgedb.IDMapperException; +import org.bridgedb.IDMapperStack; +import org.bridgedb.bio.BioDataSource; +import org.bridgedb.bio.Organism; +import org.pathvisio.core.debug.Logger; +import org.pathvisio.core.model.Pathway; +import org.pathvisio.core.preferences.GlobalPreference; +import org.pathvisio.cytoscape.GpmlConverter; +import org.pathvisio.cytoscape.GpmlHandler; + +import cytoscape.CyNetwork; +import cytoscape.Cytoscape; +import cytoscape.data.webservice.WebServiceClientManager; +import cytoscape.plugin.CytoscapePlugin; +import cytoscape.util.CytoscapeAction; +import cytoscape.view.CyMenus; +import cytoscape.view.CyNetworkView; +import cytoscape.view.CytoscapeDesktop; + +public class SuperpathwaysPlugin extends CytoscapePlugin { + //private static final int WINDOW_WIDTH = 400; + //private static final int WINDOW_HEIGHT = 500; + + GpmlHandler mGpmlHandler; + JFrame mWindow; + private static SuperpathwaysPlugin mInstance; + SuperpathwaysGui mSpGui; + + private String idmLocation = GlobalPreference.getDataDir().toString() + + "/gene databases/"; + private Map idMappers = new HashMap(); + + public static SuperpathwaysPlugin getInstance() { + return mInstance; + } + + public SuperpathwaysPlugin() { + BioDataSource.init(); + + if (mInstance != null) { + throw new RuntimeException( + "SuperpathwaysPlugin is already instantiated! Use static" + + " method getInstance instead!"); + } + + mInstance = this; + Logger.log.setLogLevel(true, false, true, true, true, true); + mGpmlHandler = new GpmlHandler(); + + + + SuperpathwaysPlugin spPlugin = SuperpathwaysPlugin.getInstance(); + SuperpathwaysClient spClient = new SuperpathwaysClient(spPlugin); + WebServiceClientManager.registerClient(spClient); + mSpGui = spClient.getGUI(); + //mSpGui.setLocationRelativeTo(Cytoscape.getDesktop()); + + mWindow = new JFrame("Superpathways Plugin"); + //mWindow.setSize(WINDOW_WIDTH, WINDOW_HEIGHT); + mWindow.add(mSpGui); + mWindow.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + + SuperpathwaysAction action = new SuperpathwaysAction(); + action.setPreferredMenu("Plugins"); + + CytoscapeDesktop desktop = Cytoscape.getDesktop(); + CyMenus menu = desktop.getCyMenus(); + menu.addAction(action); + + + } + + public IDMapper getIDMapper(Organism organism) throws ClassNotFoundException, IDMapperException { + Class.forName ("org.bridgedb.rdb.IDMapperRdb"); + + IDMapper idm = idMappers.get(organism); + if(idm == null) { + IDMapperStack idms = new IDMapperStack(); + idm = idms; + idMappers.put(organism, idm); + + //Try to find the available bridgedb databases, ask for location if necessary + File[] idmFiles = new File(idmLocation).listFiles(); + boolean speciesFound = false; + + if(idmFiles != null) for(int i = 0; i < idmFiles.length; i++) { + File file = idmFiles[i]; + if (file.isDirectory()) continue; // skip directories + String fileName = file.getName(); + int index = fileName.indexOf("_"); + if (index < 0) continue; // Skip this file, not the pgdb naming scheme + String prefix = fileName.substring(0, index); + // System.out.println(speciesOrMetabolite); + if (prefix.equals(organism.code())) { + Logger.log.info("Connecting to idmapper " + file); + idms.addIDMapper("idmapper-pgdb:" + file); + speciesFound = true; + } else if("metabolites".equals(prefix)) { + Logger.log.info("Connecting to idmapper " + file); + idms.addIDMapper("idmapper-pgdb:" + file); + } + } + + if (!speciesFound) { + JOptionPane + .showMessageDialog( + mWindow, + "Could not find bridgedb database for " + organism.latinName() + " in " + idmFiles + ". " + + "\nPlease download the database from http://bridgedb.org and " + + "point me to its location."); + + JFileChooser chooser = new JFileChooser(); + chooser.setCurrentDirectory(new java.io.File(".")); + chooser + .setDialogTitle("Choose the bridgedb database for " + organism.latinName()); + chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); + if (chooser.showOpenDialog(mWindow) == JFileChooser.APPROVE_OPTION) { + File file = chooser.getSelectedFile(); + if(file != null) { + Logger.log.info("Connecting to idmapper " + file); + idms.addIDMapper("idmapper-pgdb:" + file); + idmLocation = file.getParent(); + } + } + } + } + return idm; + } + + /* + * public GpmlHandler getGpmlHandler() { return mGpmlHandler; } + */ + + public CyNetwork load(Pathway p, boolean newNetwork) { + try { + GpmlConverter converter = new GpmlConverter(mGpmlHandler, p); + + // Get the nodes/edges indexes + int[] nodes = converter.getNodeIndicesArray(); + //System.out.println("There are " + nodes.length + " nodes in the pathway!"); + int[] edges = converter.getEdgeIndicesArray(); + //System.out.println("There are " + edges.length + " edges in the pathway!"); + + + // Get the current network, or create a new one, if none is + // available + CyNetwork network = Cytoscape.getCurrentNetwork(); + if (newNetwork || network == Cytoscape.getNullNetwork()) { + String title = converter.getPathway().getMappInfo() + .getMapInfoName(); + network = Cytoscape.createNetwork(title == null ? "new network" + : title, false); + } + + // Add all nodes and edges to the network + for (int nd : nodes) { + network.addNode(nd); + } + for (int ed : edges) + network.addEdge(ed); + + CyNetworkView view = Cytoscape.getNetworkView(network + .getIdentifier()); + if (view == Cytoscape.getNullNetworkView()) { + view = Cytoscape.createNetworkView(network); + Cytoscape.firePropertyChange( + CytoscapeDesktop.NETWORK_VIEW_FOCUS, null, view + .getIdentifier()); + } else { + view = Cytoscape.getCurrentNetworkView(); + } + converter.layout(view); + view.redrawGraph(true, false); + + return network; + } catch (Exception ex) { + Logger.log.error("Error while importing GPML", ex); + JOptionPane.showMessageDialog(Cytoscape.getDesktop(), + "Error while importing GPML: " + ex.getMessage(), "Error", + JOptionPane.ERROR_MESSAGE); + } + return null; + } + + public static double mToV(double m) { + return m; + } + + public static double vToM(double v) { + return v; + } + + /** + * This class gets attached to the menu item. + */ + public class SuperpathwaysAction extends CytoscapeAction { + + public SuperpathwaysAction() { + super("Superpathways"); + } + + public void actionPerformed(ActionEvent arg0) { + mWindow.add(mSpGui); + mWindow.setLocationRelativeTo(Cytoscape.getDesktop()); + mWindow.setVisible(true); + mWindow.pack(); + + + } + + } + +} diff --git a/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/TableSorter.java b/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/TableSorter.java index 54be38db..9b09dd0f 100644 --- a/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/TableSorter.java +++ b/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/TableSorter.java @@ -1,502 +1,502 @@ -// PathVisio, -// a tool for data visualization and analysis using Biological Pathways -// Copyright 2006-2011 BiGCaT Bioinformatics -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package org.pathvisio.cytoscape.superpathways; - -import java.awt.*; -import java.awt.event.*; -import java.util.*; -import java.util.List; - -import javax.swing.*; -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; -import javax.swing.table.*; - -/** -# * TableSorter is a decorator for TableModels; adding sorting -# * functionality to a supplied TableModel. TableSorter does -# * not store or copy the data in its TableModel; instead it maintains -# * a map from the row indexes of the view to the row indexes of the -# * model. As requests are made of the sorter (like getValueAt(row, col)) -# * they are passed to the underlying model after the row numbers -# * have been translated via the internal mapping array. This way, -# * the TableSorter appears to hold another copy of the table -# * with the rows in a different order. -# *

-# * TableSorter registers itself as a listener to the underlying model, -# * just as the JTable itself would. Events recieved from the model -# * are examined, sometimes manipulated (typically widened), and then -# * passed on to the TableSorter's listeners (typically the JTable). -# * If a change to the model has invalidated the order of TableSorter's -# * rows, a note of this is made and the sorter will resort the -# * rows the next time a value is requested. -# *

-# * When the tableHeader property is set, either by using the -# * setTableHeader() method or the two argument constructor, the -# * table header may be used as a complete UI for TableSorter. -# * The default renderer of the tableHeader is decorated with a renderer -# * that indicates the sorting status of each column. In addition, -# * a mouse listener is installed with the following behavior: -# *

    -# *
  • -# * Mouse-click: Clears the sorting status of all other columns -# * and advances the sorting status of that column through three -# * values: {NOT_SORTED, ASCENDING, DESCENDING} (then back to -# * NOT_SORTED again). -# *
  • -# * SHIFT-mouse-click: Clears the sorting status of all other columns -# * and cycles the sorting status of the column through the same -# * three values, in the opposite order: {NOT_SORTED, DESCENDING, ASCENDING}. -# *
  • -# * CONTROL-mouse-click and CONTROL-SHIFT-mouse-click: as above except -# * that the changes to the column do not cancel the statuses of columns -# * that are already sorting - giving a way to initiate a compound -# * sort. -# *
-# *

-# * This is a long overdue rewrite of a class of the same name that -# * first appeared in the swing table demos in 1997. -# * -# * @author Philip Milne -# * @author Brendon McLean -# * @author Dan van Enckevort -# * @author Parwinder Sekhon -# * @version 2.0 02/27/04 -# */ - -public class TableSorter extends AbstractTableModel { - protected TableModel tableModel; - - public static final int DESCENDING = -1; - public static final int NOT_SORTED = 0; - public static final int ASCENDING = 1; - - private static Directive EMPTY_DIRECTIVE = new Directive(-1, NOT_SORTED); - - public static final Comparator COMPARABLE_COMAPRATOR = new Comparator() { - public int compare(Object o1, Object o2) { - return ((Comparable) o1).compareTo(o2); - } - }; - public static final Comparator LEXICAL_COMPARATOR = new Comparator() { - public int compare(Object o1, Object o2) { - return o1.toString().compareTo(o2.toString()); - } - }; - - private Row[] viewToModel; - private int[] modelToView; - - private JTableHeader tableHeader; - private MouseListener mouseListener; - private TableModelListener tableModelListener; - private Map columnComparators = new HashMap(); - private List sortingColumns = new ArrayList(); - - public TableSorter() { - this.mouseListener = new MouseHandler(); - this.tableModelListener = new TableModelHandler(); - } - - public TableSorter(TableModel tableModel) { - this(); - setTableModel(tableModel); - } - - public TableSorter(TableModel tableModel, JTableHeader tableHeader) { - this(); - setTableHeader(tableHeader); - setTableModel(tableModel); - } - - private void clearSortingState() { - viewToModel = null; - modelToView = null; - } - - public TableModel getTableModel() { - return tableModel; - } - - public void setTableModel(TableModel tableModel) { - if (this.tableModel != null) { - this.tableModel.removeTableModelListener(tableModelListener); - } - - this.tableModel = tableModel; - if (this.tableModel != null) { - this.tableModel.addTableModelListener(tableModelListener); - } - - clearSortingState(); - fireTableStructureChanged(); - } - - public JTableHeader getTableHeader() { - return tableHeader; - } - - public void setTableHeader(JTableHeader tableHeader) { - if (this.tableHeader != null) { - this.tableHeader.removeMouseListener(mouseListener); - TableCellRenderer defaultRenderer = this.tableHeader.getDefaultRenderer(); - if (defaultRenderer instanceof SortableHeaderRenderer) { - this.tableHeader.setDefaultRenderer(((SortableHeaderRenderer) defaultRenderer).tableCellRenderer); - } - } - this.tableHeader = tableHeader; - if (this.tableHeader != null) { - this.tableHeader.addMouseListener(mouseListener); - this.tableHeader.setDefaultRenderer( - new SortableHeaderRenderer(this.tableHeader.getDefaultRenderer())); - } - } - - public boolean isSorting() { - return sortingColumns.size() != 0; - } - - private Directive getDirective(int column) { - for (int i = 0; i < sortingColumns.size(); i++) { - Directive directive = (Directive)sortingColumns.get(i); - if (directive.column == column) { - return directive; - } - } - return EMPTY_DIRECTIVE; - } - - public int getSortingStatus(int column) { - return getDirective(column).direction; - } - - private void sortingStatusChanged() { - clearSortingState(); - fireTableDataChanged(); - if (tableHeader != null) { - tableHeader.repaint(); - } - } - - public void setSortingStatus(int column, int status) { - Directive directive = getDirective(column); - if (directive != EMPTY_DIRECTIVE) { - sortingColumns.remove(directive); - } - if (status != NOT_SORTED) { - sortingColumns.add(new Directive(column, status)); - } - sortingStatusChanged(); - } - - protected Icon getHeaderRendererIcon(int column, int size) { - Directive directive = getDirective(column); - if (directive == EMPTY_DIRECTIVE) { - return null; - } - return new Arrow(directive.direction == DESCENDING, size, sortingColumns.indexOf(directive)); - } - - private void cancelSorting() { - sortingColumns.clear(); - sortingStatusChanged(); - } - - public void setColumnComparator(Class type, Comparator comparator) { - if (comparator == null) { - columnComparators.remove(type); - } else { - columnComparators.put(type, comparator); - } - } - - protected Comparator getComparator(int column) { - //System.out.println(column+""); - Class columnType = tableModel.getColumnClass(column); - //System.out.println(columnType+""); - Comparator comparator = (Comparator) columnComparators.get(columnType); - if (comparator != null) { - return comparator; - } - if (Comparable.class.isAssignableFrom(columnType)) { - return COMPARABLE_COMAPRATOR; - } - return LEXICAL_COMPARATOR; - } - - private Row[] getViewToModel() { - if (viewToModel == null) { - int tableModelRowCount = tableModel.getRowCount(); - viewToModel = new Row[tableModelRowCount]; - for (int row = 0; row < tableModelRowCount; row++) { - viewToModel[row] = new Row(row); - } - - if (isSorting()) { - Arrays.sort(viewToModel); - } - } - return viewToModel; - } - - public int modelIndex(int viewIndex) { - return getViewToModel()[viewIndex].modelIndex; - } - - private int[] getModelToView() { - if (modelToView == null) { - int n = getViewToModel().length; - modelToView = new int[n]; - for (int i = 0; i < n; i++) { - modelToView[modelIndex(i)] = i; - } - } - return modelToView; - } - - // TableModel interface methods - - public int getRowCount() { - return (tableModel == null) ? 0 : tableModel.getRowCount(); - } - - public int getColumnCount() { - return (tableModel == null) ? 0 : tableModel.getColumnCount(); - } - - public String getColumnName(int column) { - return tableModel.getColumnName(column); - } - - public Class getColumnClass(int column) { - return tableModel.getColumnClass(column); - } - - public boolean isCellEditable(int row, int column) { - return tableModel.isCellEditable(modelIndex(row), column); - } - - public Object getValueAt(int row, int column) { - return tableModel.getValueAt(modelIndex(row), column); - } - - public void setValueAt(Object aValue, int row, int column) { - tableModel.setValueAt(aValue, modelIndex(row), column); - } - - // Helper classes - - private class Row implements Comparable { - private int modelIndex; - - public Row(int index) { - this.modelIndex = index; - } - - public int compareTo(Object o) { - int row1 = modelIndex; - int row2 = ((Row) o).modelIndex; - - for (Iterator it = sortingColumns.iterator(); it.hasNext();) { - Directive directive = (Directive) it.next(); - int column = directive.column; - Object o1 = tableModel.getValueAt(row1, column); - Object o2 = tableModel.getValueAt(row2, column); - - int comparison = 0; - // Define null less than everything, except null. - if (o1 == null && o2 == null) { - comparison = 0; - } else if (o1 == null) { - comparison = -1; - } else if (o2 == null) { - comparison = 1; - } else { - comparison = getComparator(column).compare(o1, o2); - } - if (comparison != 0) { - return directive.direction == DESCENDING ? -comparison : comparison; - } - } - return 0; - } - } - - private class TableModelHandler implements TableModelListener { - public void tableChanged(TableModelEvent e) { - // If we're not sorting by anything, just pass the event along. - if (!isSorting()) { - clearSortingState(); - fireTableChanged(e); - return; - } - - // If the table structure has changed, cancel the sorting; the - // sorting columns may have been either moved or deleted from - // the model. - if (e.getFirstRow() == TableModelEvent.HEADER_ROW) { - cancelSorting(); - fireTableChanged(e); - return; - } - - // We can map a cell event through to the view without widening - // when the following conditions apply: - // - // a) all the changes are on one row (e.getFirstRow() == e.getLastRow()) and, - // b) all the changes are in one column (column != TableModelEvent.ALL_COLUMNS) and, - // c) we are not sorting on that column (getSortingStatus(column) == NOT_SORTED) and, - // d) a reverse lookup will not trigger a sort (modelToView != null) - // - // Note: INSERT and DELETE events fail this test as they have column == ALL_COLUMNS. - // - // The last check, for (modelToView != null) is to see if modelToView - // is already allocated. If we don't do this check; sorting can become - // a performance bottleneck for applications where cells - // change rapidly in different parts of the table. If cells - // change alternately in the sorting column and then outside of - // it this class can end up re-sorting on alternate cell updates - - // which can be a performance problem for large tables. The last - // clause avoids this problem. - int column = e.getColumn(); - if (e.getFirstRow() == e.getLastRow() - && column != TableModelEvent.ALL_COLUMNS - && getSortingStatus(column) == NOT_SORTED - && modelToView != null) { - int viewIndex = getModelToView()[e.getFirstRow()]; - fireTableChanged(new TableModelEvent(TableSorter.this, - viewIndex, viewIndex, - column, e.getType())); - return; - } - - // Something has happened to the data that may have invalidated the row order. - clearSortingState(); - fireTableDataChanged(); - return; - } - } - - private class MouseHandler extends MouseAdapter { - public void mouseClicked(MouseEvent e) { - JTableHeader h = (JTableHeader) e.getSource(); - TableColumnModel columnModel = h.getColumnModel(); - int viewColumn = columnModel.getColumnIndexAtX(e.getX()); - int column = columnModel.getColumn(viewColumn).getModelIndex(); - if (column != -1) { - int status = getSortingStatus(column); - if (!e.isControlDown()) { - cancelSorting(); - } - // Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} or - // {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is pressed. - status = status + (e.isShiftDown() ? -1 : 1); - status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1} - setSortingStatus(column, status); - } - } - } - - private static class Arrow implements Icon { - private boolean descending; - private int size; - private int priority; - - public Arrow(boolean descending, int size, int priority) { - this.descending = descending; - this.size = size; - this.priority = priority; - } - - public void paintIcon(Component c, Graphics g, int x, int y) { - Color color = c == null ? Color.GRAY : c.getBackground(); - // In a compound sort, make each succesive triangle 20% - // smaller than the previous one. - int dx = (int)(size/2*Math.pow(0.8, priority)); - int dy = descending ? dx : -dx; - // Align icon (roughly) with font baseline. - y = y + 5*size/6 + (descending ? -dy : 0); - int shift = descending ? 1 : -1; - g.translate(x, y); - - // Right diagonal. - g.setColor(color.darker()); - g.drawLine(dx / 2, dy, 0, 0); - g.drawLine(dx / 2, dy + shift, 0, shift); - - // Left diagonal. - g.setColor(color.brighter()); - g.drawLine(dx / 2, dy, dx, 0); - g.drawLine(dx / 2, dy + shift, dx, shift); - - // Horizontal line. - if (descending) { - g.setColor(color.darker().darker()); - } else { - g.setColor(color.brighter().brighter()); - } - g.drawLine(dx, 0, 0, 0); - - g.setColor(color); - g.translate(-x, -y); - } - - public int getIconWidth() { - return size; - } - - public int getIconHeight() { - return size; - } - } - - private class SortableHeaderRenderer implements TableCellRenderer { - private TableCellRenderer tableCellRenderer; - - public SortableHeaderRenderer(TableCellRenderer tableCellRenderer) { - this.tableCellRenderer = tableCellRenderer; - } - - public Component getTableCellRendererComponent(JTable table, - Object value, - boolean isSelected, - boolean hasFocus, - int row, - int column) { - Component c = tableCellRenderer.getTableCellRendererComponent(table, - value, isSelected, hasFocus, row, column); - if (c instanceof JLabel) { - JLabel l = (JLabel) c; - l.setHorizontalTextPosition(JLabel.LEFT); - int modelColumn = table.convertColumnIndexToModel(column); - l.setIcon(getHeaderRendererIcon(modelColumn, l.getFont().getSize())); - } - return c; - } - } - - private static class Directive { - private int column; - private int direction; - - public Directive(int column, int direction) { - this.column = column; - this.direction = direction; - } - } +// PathVisio, +// a tool for data visualization and analysis using Biological Pathways +// Copyright 2006-2011 BiGCaT Bioinformatics +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +package org.pathvisio.cytoscape.superpathways; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import java.util.List; + +import javax.swing.*; +import javax.swing.event.TableModelEvent; +import javax.swing.event.TableModelListener; +import javax.swing.table.*; + +/** +# * TableSorter is a decorator for TableModels; adding sorting +# * functionality to a supplied TableModel. TableSorter does +# * not store or copy the data in its TableModel; instead it maintains +# * a map from the row indexes of the view to the row indexes of the +# * model. As requests are made of the sorter (like getValueAt(row, col)) +# * they are passed to the underlying model after the row numbers +# * have been translated via the internal mapping array. This way, +# * the TableSorter appears to hold another copy of the table +# * with the rows in a different order. +# *

+# * TableSorter registers itself as a listener to the underlying model, +# * just as the JTable itself would. Events recieved from the model +# * are examined, sometimes manipulated (typically widened), and then +# * passed on to the TableSorter's listeners (typically the JTable). +# * If a change to the model has invalidated the order of TableSorter's +# * rows, a note of this is made and the sorter will resort the +# * rows the next time a value is requested. +# *

+# * When the tableHeader property is set, either by using the +# * setTableHeader() method or the two argument constructor, the +# * table header may be used as a complete UI for TableSorter. +# * The default renderer of the tableHeader is decorated with a renderer +# * that indicates the sorting status of each column. In addition, +# * a mouse listener is installed with the following behavior: +# *

    +# *
  • +# * Mouse-click: Clears the sorting status of all other columns +# * and advances the sorting status of that column through three +# * values: {NOT_SORTED, ASCENDING, DESCENDING} (then back to +# * NOT_SORTED again). +# *
  • +# * SHIFT-mouse-click: Clears the sorting status of all other columns +# * and cycles the sorting status of the column through the same +# * three values, in the opposite order: {NOT_SORTED, DESCENDING, ASCENDING}. +# *
  • +# * CONTROL-mouse-click and CONTROL-SHIFT-mouse-click: as above except +# * that the changes to the column do not cancel the statuses of columns +# * that are already sorting - giving a way to initiate a compound +# * sort. +# *
+# *

+# * This is a long overdue rewrite of a class of the same name that +# * first appeared in the swing table demos in 1997. +# * +# * @author Philip Milne +# * @author Brendon McLean +# * @author Dan van Enckevort +# * @author Parwinder Sekhon +# * @version 2.0 02/27/04 +# */ + +public class TableSorter extends AbstractTableModel { + protected TableModel tableModel; + + public static final int DESCENDING = -1; + public static final int NOT_SORTED = 0; + public static final int ASCENDING = 1; + + private static Directive EMPTY_DIRECTIVE = new Directive(-1, NOT_SORTED); + + public static final Comparator COMPARABLE_COMAPRATOR = new Comparator() { + public int compare(Object o1, Object o2) { + return ((Comparable) o1).compareTo(o2); + } + }; + public static final Comparator LEXICAL_COMPARATOR = new Comparator() { + public int compare(Object o1, Object o2) { + return o1.toString().compareTo(o2.toString()); + } + }; + + private Row[] viewToModel; + private int[] modelToView; + + private JTableHeader tableHeader; + private MouseListener mouseListener; + private TableModelListener tableModelListener; + private Map columnComparators = new HashMap(); + private List sortingColumns = new ArrayList(); + + public TableSorter() { + this.mouseListener = new MouseHandler(); + this.tableModelListener = new TableModelHandler(); + } + + public TableSorter(TableModel tableModel) { + this(); + setTableModel(tableModel); + } + + public TableSorter(TableModel tableModel, JTableHeader tableHeader) { + this(); + setTableHeader(tableHeader); + setTableModel(tableModel); + } + + private void clearSortingState() { + viewToModel = null; + modelToView = null; + } + + public TableModel getTableModel() { + return tableModel; + } + + public void setTableModel(TableModel tableModel) { + if (this.tableModel != null) { + this.tableModel.removeTableModelListener(tableModelListener); + } + + this.tableModel = tableModel; + if (this.tableModel != null) { + this.tableModel.addTableModelListener(tableModelListener); + } + + clearSortingState(); + fireTableStructureChanged(); + } + + public JTableHeader getTableHeader() { + return tableHeader; + } + + public void setTableHeader(JTableHeader tableHeader) { + if (this.tableHeader != null) { + this.tableHeader.removeMouseListener(mouseListener); + TableCellRenderer defaultRenderer = this.tableHeader.getDefaultRenderer(); + if (defaultRenderer instanceof SortableHeaderRenderer) { + this.tableHeader.setDefaultRenderer(((SortableHeaderRenderer) defaultRenderer).tableCellRenderer); + } + } + this.tableHeader = tableHeader; + if (this.tableHeader != null) { + this.tableHeader.addMouseListener(mouseListener); + this.tableHeader.setDefaultRenderer( + new SortableHeaderRenderer(this.tableHeader.getDefaultRenderer())); + } + } + + public boolean isSorting() { + return sortingColumns.size() != 0; + } + + private Directive getDirective(int column) { + for (int i = 0; i < sortingColumns.size(); i++) { + Directive directive = (Directive)sortingColumns.get(i); + if (directive.column == column) { + return directive; + } + } + return EMPTY_DIRECTIVE; + } + + public int getSortingStatus(int column) { + return getDirective(column).direction; + } + + private void sortingStatusChanged() { + clearSortingState(); + fireTableDataChanged(); + if (tableHeader != null) { + tableHeader.repaint(); + } + } + + public void setSortingStatus(int column, int status) { + Directive directive = getDirective(column); + if (directive != EMPTY_DIRECTIVE) { + sortingColumns.remove(directive); + } + if (status != NOT_SORTED) { + sortingColumns.add(new Directive(column, status)); + } + sortingStatusChanged(); + } + + protected Icon getHeaderRendererIcon(int column, int size) { + Directive directive = getDirective(column); + if (directive == EMPTY_DIRECTIVE) { + return null; + } + return new Arrow(directive.direction == DESCENDING, size, sortingColumns.indexOf(directive)); + } + + private void cancelSorting() { + sortingColumns.clear(); + sortingStatusChanged(); + } + + public void setColumnComparator(Class type, Comparator comparator) { + if (comparator == null) { + columnComparators.remove(type); + } else { + columnComparators.put(type, comparator); + } + } + + protected Comparator getComparator(int column) { + //System.out.println(column+""); + Class columnType = tableModel.getColumnClass(column); + //System.out.println(columnType+""); + Comparator comparator = (Comparator) columnComparators.get(columnType); + if (comparator != null) { + return comparator; + } + if (Comparable.class.isAssignableFrom(columnType)) { + return COMPARABLE_COMAPRATOR; + } + return LEXICAL_COMPARATOR; + } + + private Row[] getViewToModel() { + if (viewToModel == null) { + int tableModelRowCount = tableModel.getRowCount(); + viewToModel = new Row[tableModelRowCount]; + for (int row = 0; row < tableModelRowCount; row++) { + viewToModel[row] = new Row(row); + } + + if (isSorting()) { + Arrays.sort(viewToModel); + } + } + return viewToModel; + } + + public int modelIndex(int viewIndex) { + return getViewToModel()[viewIndex].modelIndex; + } + + private int[] getModelToView() { + if (modelToView == null) { + int n = getViewToModel().length; + modelToView = new int[n]; + for (int i = 0; i < n; i++) { + modelToView[modelIndex(i)] = i; + } + } + return modelToView; + } + + // TableModel interface methods + + public int getRowCount() { + return (tableModel == null) ? 0 : tableModel.getRowCount(); + } + + public int getColumnCount() { + return (tableModel == null) ? 0 : tableModel.getColumnCount(); + } + + public String getColumnName(int column) { + return tableModel.getColumnName(column); + } + + public Class getColumnClass(int column) { + return tableModel.getColumnClass(column); + } + + public boolean isCellEditable(int row, int column) { + return tableModel.isCellEditable(modelIndex(row), column); + } + + public Object getValueAt(int row, int column) { + return tableModel.getValueAt(modelIndex(row), column); + } + + public void setValueAt(Object aValue, int row, int column) { + tableModel.setValueAt(aValue, modelIndex(row), column); + } + + // Helper classes + + private class Row implements Comparable { + private int modelIndex; + + public Row(int index) { + this.modelIndex = index; + } + + public int compareTo(Object o) { + int row1 = modelIndex; + int row2 = ((Row) o).modelIndex; + + for (Iterator it = sortingColumns.iterator(); it.hasNext();) { + Directive directive = (Directive) it.next(); + int column = directive.column; + Object o1 = tableModel.getValueAt(row1, column); + Object o2 = tableModel.getValueAt(row2, column); + + int comparison = 0; + // Define null less than everything, except null. + if (o1 == null && o2 == null) { + comparison = 0; + } else if (o1 == null) { + comparison = -1; + } else if (o2 == null) { + comparison = 1; + } else { + comparison = getComparator(column).compare(o1, o2); + } + if (comparison != 0) { + return directive.direction == DESCENDING ? -comparison : comparison; + } + } + return 0; + } + } + + private class TableModelHandler implements TableModelListener { + public void tableChanged(TableModelEvent e) { + // If we're not sorting by anything, just pass the event along. + if (!isSorting()) { + clearSortingState(); + fireTableChanged(e); + return; + } + + // If the table structure has changed, cancel the sorting; the + // sorting columns may have been either moved or deleted from + // the model. + if (e.getFirstRow() == TableModelEvent.HEADER_ROW) { + cancelSorting(); + fireTableChanged(e); + return; + } + + // We can map a cell event through to the view without widening + // when the following conditions apply: + // + // a) all the changes are on one row (e.getFirstRow() == e.getLastRow()) and, + // b) all the changes are in one column (column != TableModelEvent.ALL_COLUMNS) and, + // c) we are not sorting on that column (getSortingStatus(column) == NOT_SORTED) and, + // d) a reverse lookup will not trigger a sort (modelToView != null) + // + // Note: INSERT and DELETE events fail this test as they have column == ALL_COLUMNS. + // + // The last check, for (modelToView != null) is to see if modelToView + // is already allocated. If we don't do this check; sorting can become + // a performance bottleneck for applications where cells + // change rapidly in different parts of the table. If cells + // change alternately in the sorting column and then outside of + // it this class can end up re-sorting on alternate cell updates - + // which can be a performance problem for large tables. The last + // clause avoids this problem. + int column = e.getColumn(); + if (e.getFirstRow() == e.getLastRow() + && column != TableModelEvent.ALL_COLUMNS + && getSortingStatus(column) == NOT_SORTED + && modelToView != null) { + int viewIndex = getModelToView()[e.getFirstRow()]; + fireTableChanged(new TableModelEvent(TableSorter.this, + viewIndex, viewIndex, + column, e.getType())); + return; + } + + // Something has happened to the data that may have invalidated the row order. + clearSortingState(); + fireTableDataChanged(); + return; + } + } + + private class MouseHandler extends MouseAdapter { + public void mouseClicked(MouseEvent e) { + JTableHeader h = (JTableHeader) e.getSource(); + TableColumnModel columnModel = h.getColumnModel(); + int viewColumn = columnModel.getColumnIndexAtX(e.getX()); + int column = columnModel.getColumn(viewColumn).getModelIndex(); + if (column != -1) { + int status = getSortingStatus(column); + if (!e.isControlDown()) { + cancelSorting(); + } + // Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} or + // {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is pressed. + status = status + (e.isShiftDown() ? -1 : 1); + status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1} + setSortingStatus(column, status); + } + } + } + + private static class Arrow implements Icon { + private boolean descending; + private int size; + private int priority; + + public Arrow(boolean descending, int size, int priority) { + this.descending = descending; + this.size = size; + this.priority = priority; + } + + public void paintIcon(Component c, Graphics g, int x, int y) { + Color color = c == null ? Color.GRAY : c.getBackground(); + // In a compound sort, make each succesive triangle 20% + // smaller than the previous one. + int dx = (int)(size/2*Math.pow(0.8, priority)); + int dy = descending ? dx : -dx; + // Align icon (roughly) with font baseline. + y = y + 5*size/6 + (descending ? -dy : 0); + int shift = descending ? 1 : -1; + g.translate(x, y); + + // Right diagonal. + g.setColor(color.darker()); + g.drawLine(dx / 2, dy, 0, 0); + g.drawLine(dx / 2, dy + shift, 0, shift); + + // Left diagonal. + g.setColor(color.brighter()); + g.drawLine(dx / 2, dy, dx, 0); + g.drawLine(dx / 2, dy + shift, dx, shift); + + // Horizontal line. + if (descending) { + g.setColor(color.darker().darker()); + } else { + g.setColor(color.brighter().brighter()); + } + g.drawLine(dx, 0, 0, 0); + + g.setColor(color); + g.translate(-x, -y); + } + + public int getIconWidth() { + return size; + } + + public int getIconHeight() { + return size; + } + } + + private class SortableHeaderRenderer implements TableCellRenderer { + private TableCellRenderer tableCellRenderer; + + public SortableHeaderRenderer(TableCellRenderer tableCellRenderer) { + this.tableCellRenderer = tableCellRenderer; + } + + public Component getTableCellRendererComponent(JTable table, + Object value, + boolean isSelected, + boolean hasFocus, + int row, + int column) { + Component c = tableCellRenderer.getTableCellRendererComponent(table, + value, isSelected, hasFocus, row, column); + if (c instanceof JLabel) { + JLabel l = (JLabel) c; + l.setHorizontalTextPosition(JLabel.LEFT); + int modelColumn = table.convertColumnIndexToModel(column); + l.setIcon(getHeaderRendererIcon(modelColumn, l.getFont().getSize())); + } + return c; + } + } + + private static class Directive { + private int column; + private int direction; + + public Directive(int column, int direction) { + this.column = column; + this.direction = direction; + } + } } \ No newline at end of file diff --git a/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/gpmlExtendVisualStyle.java b/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/gpmlExtendVisualStyle.java index 6191b61a..edd13692 100644 --- a/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/gpmlExtendVisualStyle.java +++ b/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/gpmlExtendVisualStyle.java @@ -1,322 +1,322 @@ -// PathVisio, -// a tool for data visualization and analysis using Biological Pathways -// Copyright 2006-2011 BiGCaT Bioinformatics -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -package org.pathvisio.cytoscape.superpathways; - -import java.awt.Color; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - -import org.pathvisio.core.model.LineStyle; -import org.pathvisio.core.model.LineType; -import org.pathvisio.core.model.ObjectType; -import org.pathvisio.core.model.StaticProperty; -import org.pathvisio.cytoscape.AttributeMapper; -import org.pathvisio.cytoscape.GpmlAnchorNode; -import org.pathvisio.cytoscape.GpmlHandler; -import org.pathvisio.cytoscape.GpmlNetworkElement; -import org.pathvisio.cytoscape.visualmapping.GpmlColorMapper; - -import cytoscape.CyNetwork; -import cytoscape.Cytoscape; -import cytoscape.visual.ArrowShape; -import cytoscape.visual.EdgeAppearanceCalculator; -import cytoscape.visual.GlobalAppearanceCalculator; -import cytoscape.visual.NodeAppearance; -import cytoscape.visual.NodeAppearanceCalculator; -import cytoscape.visual.NodeShape; -import cytoscape.visual.VisualMappingManager; -import cytoscape.visual.VisualPropertyType; -import cytoscape.visual.VisualStyle; -import cytoscape.visual.calculators.BasicCalculator; -import cytoscape.visual.calculators.Calculator; -import cytoscape.visual.mappings.DiscreteMapping; -import cytoscape.visual.mappings.ObjectMapping; -import cytoscape.visual.mappings.PassThroughMapping; - -public class gpmlExtendVisualStyle extends VisualStyle { - public static final String NAME = "GPML-extension"; - - GpmlHandler gpmlHandler; - AttributeMapper attrMapper; - - NodeAppearanceCalculator nac; - EdgeAppearanceCalculator eac; - - Map pwNameToColor; - String title; - - - public gpmlExtendVisualStyle(GpmlHandler gpmlHandler, VisualStyle toCopy, Map map, String t) { - super(toCopy); - setName(NAME); - init(gpmlHandler); - pwNameToColor=map; - title=t; - } - - public gpmlExtendVisualStyle(GpmlHandler gpmlHandler, Map map, String t, int version) { - super(NAME+"-"+String.valueOf(version)); - pwNameToColor=map; - title=t; - - init(gpmlHandler); - - } - - private void init(GpmlHandler gh) { - this.gpmlHandler = gh; - attrMapper = gpmlHandler.getAttributeMapper(); - - nac = getNodeAppearanceCalculator(); - eac = getEdgeAppearanceCalculator(); - - VisualMappingManager vm = Cytoscape.getVisualMappingManager(); - VisualStyle currentStyle = vm.getVisualStyle(); - - if(nac == null) { - nac = new NodeAppearanceCalculator(currentStyle.getNodeAppearanceCalculator()); - setNodeAppearanceCalculator(nac); - } - if(eac == null) { - eac = new EdgeAppearanceCalculator(currentStyle.getEdgeAppearanceCalculator()); - setEdgeAppearanceCalculator(eac); - } - - - setColorMapping(); - setLabelMapping(); - setTypeMapping(); - setArrowMapping(); - setLineTypeMapping(); - setNodeShapeMapping(); - setNodeColorMapping(title, pwNameToColor); - } - - void setNodeShapeMapping() { - getNodeAppearanceCalculator().setNodeSizeLocked(false); - NodeAppearance nd = nac.getDefaultAppearance(); - nd.set(VisualPropertyType.NODE_SHAPE, NodeShape.RECT); - nd.set(VisualPropertyType.NODE_WIDTH, 80); - nd.set(VisualPropertyType.NODE_HEIGHT, 20); - - DiscreteMapping widthMapping = new DiscreteMapping( - nac.getDefaultAppearance().get(VisualPropertyType.NODE_WIDTH), - GpmlNetworkElement.ATTR_TYPE, - ObjectMapping.NODE_MAPPING - ); - widthMapping.putMapValue(ObjectType.GROUP.ordinal(), 5); - widthMapping.putMapValue(GpmlAnchorNode.TYPE_ANCHOR, 5); - DiscreteMapping heightMapping = new DiscreteMapping( - nac.getDefaultAppearance().get(VisualPropertyType.NODE_HEIGHT), - GpmlNetworkElement.ATTR_TYPE, - ObjectMapping.NODE_MAPPING - ); - heightMapping.putMapValue(ObjectType.GROUP.ordinal(), 5); - heightMapping.putMapValue(GpmlAnchorNode.TYPE_ANCHOR, 5); - - nac.setCalculator( - new BasicCalculator("Node width", widthMapping, VisualPropertyType.NODE_WIDTH) - ); - nac.setCalculator( - new BasicCalculator("Node height", heightMapping, VisualPropertyType.NODE_HEIGHT) - ); - } - - void setLineTypeMapping() { - DiscreteMapping styleMapping = new DiscreteMapping( - nac.getDefaultAppearance().get(VisualPropertyType.EDGE_LINE_STYLE), - attrMapper.getMapping(StaticProperty.LINESTYLE), - ObjectMapping.EDGE_MAPPING - ); - styleMapping.putMapValue("" + LineStyle.SOLID, cytoscape.visual.LineStyle.SOLID); - styleMapping.putMapValue("" + LineStyle.DASHED, cytoscape.visual.LineStyle.LONG_DASH); - eac.setCalculator( - new BasicCalculator("GPML edge style", styleMapping, VisualPropertyType.EDGE_LINE_STYLE) - ); - } - - void setArrowMapping() { - DiscreteMapping srcMapping = new DiscreteMapping( - nac.getDefaultAppearance().get(VisualPropertyType.EDGE_SRCARROW_SHAPE), - attrMapper.getMapping(StaticProperty.STARTLINETYPE), - ObjectMapping.EDGE_MAPPING - ); - setArrowMappings(srcMapping); - eac.setCalculator( - new BasicCalculator("GPML edge source shape", srcMapping, VisualPropertyType.EDGE_SRCARROW_SHAPE) - ); - - DiscreteMapping tgtMapping = new DiscreteMapping( - nac.getDefaultAppearance().get(VisualPropertyType.EDGE_TGTARROW_SHAPE), - attrMapper.getMapping(StaticProperty.ENDLINETYPE), - ObjectMapping.EDGE_MAPPING - ); - setArrowMappings(tgtMapping); - eac.setCalculator( - new BasicCalculator("GPML edge target shape", tgtMapping, VisualPropertyType.EDGE_TGTARROW_SHAPE) - ); - - String colAttr = attrMapper.getMapping(StaticProperty.COLOR); - eac.setCalculator( - new BasicCalculator( - "GPML edge source color", - new GpmlColorMapper( - (Color)eac.getDefaultAppearance().get(VisualPropertyType.EDGE_SRCARROW_COLOR), colAttr - ), - VisualPropertyType.EDGE_SRCARROW_COLOR - ) - ); - eac.setCalculator( - new BasicCalculator( - "GPML edge target color", - new GpmlColorMapper( - (Color)eac.getDefaultAppearance().get(VisualPropertyType.EDGE_TGTARROW_COLOR), colAttr - ), - VisualPropertyType.EDGE_TGTARROW_COLOR - ) - ); - } - - private static Map attribute2arrow; - private static Map arrow2attribute; - - public static Map getAttributeToArrow() { - if(attribute2arrow == null) { - attribute2arrow = new HashMap(); - attribute2arrow.put(LineType.LINE.getName(), ArrowShape.NONE); - attribute2arrow.put(LineType.ARROW.getName(), ArrowShape.ARROW); - attribute2arrow.put(LineType.LIGAND_ROUND.getName(), ArrowShape.CIRCLE); - attribute2arrow.put(LineType.LIGAND_SQUARE.getName(), ArrowShape.DELTA); - attribute2arrow.put(LineType.RECEPTOR.getName(), ArrowShape.DELTA); - attribute2arrow.put(LineType.RECEPTOR_ROUND.getName(), ArrowShape.DELTA); - attribute2arrow.put(LineType.RECEPTOR_SQUARE.getName(), ArrowShape.DELTA); - attribute2arrow.put(LineType.TBAR.getName(), ArrowShape.T); - - attribute2arrow.put("mim-necessary-stimulation", ArrowShape.ARROW); - attribute2arrow.put("mim-binding", ArrowShape.ARROW); - attribute2arrow.put("mim-conversion", ArrowShape.ARROW); - attribute2arrow.put("mim-stimulation", ArrowShape.ARROW); - attribute2arrow.put("mim-catalysis", ArrowShape.ARROW); - attribute2arrow.put("mim-inhibition", ArrowShape.ARROW); - attribute2arrow.put("mim-cleavage", ArrowShape.ARROW); - } - return attribute2arrow; - } - - public static Map getArrowToAttribute() { - if(arrow2attribute == null) { - arrow2attribute = new HashMap(); - Map attribute2arrow = getAttributeToArrow(); - for(String attribute : attribute2arrow.keySet()) { - arrow2attribute.put(attribute2arrow.get(attribute), attribute); - } - } - return arrow2attribute; - } - - void setArrowMappings(DiscreteMapping mapping) { - Map attribute2arrow = getAttributeToArrow(); - for(String attribute : attribute2arrow.keySet()) { - mapping.putMapValue(attribute, attribute2arrow.get(attribute)); - } - } - - void setTypeMapping() { - DiscreteMapping typeMapping = new DiscreteMapping( - nac.getDefaultAppearance().get(VisualPropertyType.NODE_SIZE), - GpmlNetworkElement.ATTR_TYPE, - ObjectMapping.NODE_MAPPING - ); - typeMapping.putMapValue(ObjectType.GROUP.ordinal(), 5); - typeMapping.putMapValue(GpmlAnchorNode.TYPE_ANCHOR, 5); - - nac.setCalculator( - new BasicCalculator( - GpmlNetworkElement.ATTR_TYPE, - typeMapping, - VisualPropertyType.NODE_SIZE - ) - ); - } - - void setLabelMapping() { - nac.setCalculator( - new BasicCalculator( - "canonicalName", - new PassThroughMapping("", "canonicalName"), - VisualPropertyType.NODE_LABEL - ) - ); - } - - void setColorMapping() { - //Default node color is white and semi-transparent - nac.getDefaultAppearance().set(VisualPropertyType.NODE_FILL_COLOR, Color.WHITE); - nac.getDefaultAppearance().set(VisualPropertyType.NODE_OPACITY, 220); - - String colAttr = attrMapper.getMapping(StaticProperty.COLOR); - nac.setCalculator( - new BasicCalculator( - "GPML node border color", - new GpmlColorMapper( - (Color)nac.getDefaultAppearance().get(VisualPropertyType.NODE_BORDER_COLOR), colAttr - ), - VisualPropertyType.NODE_BORDER_COLOR - ) - ); - eac.setCalculator( - new BasicCalculator( - "GPML edge color", - new GpmlColorMapper( - (Color)eac.getDefaultAppearance().get(VisualPropertyType.EDGE_COLOR), colAttr - ), - VisualPropertyType.EDGE_COLOR - ) - ); - - } - - void setNodeColorMapping(String title, Map pwNameToColor){ - - CyNetwork network = Cytoscape.getNetwork(title); - -// Discrete Mapping - set node colors - DiscreteMapping disMapping = new DiscreteMapping(Color.WHITE, - ObjectMapping.NODE_MAPPING); - - disMapping - .setControllingAttributeName("Source Pathway", network, false); - - Set pwNames = pwNameToColor.keySet(); - Iterator it = pwNames.iterator(); - while (it.hasNext()) { - String name = it.next(); - disMapping.putMapValue(name, pwNameToColor.get(name)); - - } - - Calculator nodeColorCalculator = new BasicCalculator( - "Superpathways Node Color Calc", disMapping, - VisualPropertyType.NODE_FILL_COLOR); - - nac.setCalculator(nodeColorCalculator); - - } - -} +// PathVisio, +// a tool for data visualization and analysis using Biological Pathways +// Copyright 2006-2011 BiGCaT Bioinformatics +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +package org.pathvisio.cytoscape.superpathways; + +import java.awt.Color; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +import org.pathvisio.core.model.LineStyle; +import org.pathvisio.core.model.LineType; +import org.pathvisio.core.model.ObjectType; +import org.pathvisio.core.model.StaticProperty; +import org.pathvisio.cytoscape.AttributeMapper; +import org.pathvisio.cytoscape.GpmlAnchorNode; +import org.pathvisio.cytoscape.GpmlHandler; +import org.pathvisio.cytoscape.GpmlNetworkElement; +import org.pathvisio.cytoscape.visualmapping.GpmlColorMapper; + +import cytoscape.CyNetwork; +import cytoscape.Cytoscape; +import cytoscape.visual.ArrowShape; +import cytoscape.visual.EdgeAppearanceCalculator; +import cytoscape.visual.GlobalAppearanceCalculator; +import cytoscape.visual.NodeAppearance; +import cytoscape.visual.NodeAppearanceCalculator; +import cytoscape.visual.NodeShape; +import cytoscape.visual.VisualMappingManager; +import cytoscape.visual.VisualPropertyType; +import cytoscape.visual.VisualStyle; +import cytoscape.visual.calculators.BasicCalculator; +import cytoscape.visual.calculators.Calculator; +import cytoscape.visual.mappings.DiscreteMapping; +import cytoscape.visual.mappings.ObjectMapping; +import cytoscape.visual.mappings.PassThroughMapping; + +public class gpmlExtendVisualStyle extends VisualStyle { + public static final String NAME = "GPML-extension"; + + GpmlHandler gpmlHandler; + AttributeMapper attrMapper; + + NodeAppearanceCalculator nac; + EdgeAppearanceCalculator eac; + + Map pwNameToColor; + String title; + + + public gpmlExtendVisualStyle(GpmlHandler gpmlHandler, VisualStyle toCopy, Map map, String t) { + super(toCopy); + setName(NAME); + init(gpmlHandler); + pwNameToColor=map; + title=t; + } + + public gpmlExtendVisualStyle(GpmlHandler gpmlHandler, Map map, String t, int version) { + super(NAME+"-"+String.valueOf(version)); + pwNameToColor=map; + title=t; + + init(gpmlHandler); + + } + + private void init(GpmlHandler gh) { + this.gpmlHandler = gh; + attrMapper = gpmlHandler.getAttributeMapper(); + + nac = getNodeAppearanceCalculator(); + eac = getEdgeAppearanceCalculator(); + + VisualMappingManager vm = Cytoscape.getVisualMappingManager(); + VisualStyle currentStyle = vm.getVisualStyle(); + + if(nac == null) { + nac = new NodeAppearanceCalculator(currentStyle.getNodeAppearanceCalculator()); + setNodeAppearanceCalculator(nac); + } + if(eac == null) { + eac = new EdgeAppearanceCalculator(currentStyle.getEdgeAppearanceCalculator()); + setEdgeAppearanceCalculator(eac); + } + + + setColorMapping(); + setLabelMapping(); + setTypeMapping(); + setArrowMapping(); + setLineTypeMapping(); + setNodeShapeMapping(); + setNodeColorMapping(title, pwNameToColor); + } + + void setNodeShapeMapping() { + getNodeAppearanceCalculator().setNodeSizeLocked(false); + NodeAppearance nd = nac.getDefaultAppearance(); + nd.set(VisualPropertyType.NODE_SHAPE, NodeShape.RECT); + nd.set(VisualPropertyType.NODE_WIDTH, 80); + nd.set(VisualPropertyType.NODE_HEIGHT, 20); + + DiscreteMapping widthMapping = new DiscreteMapping( + nac.getDefaultAppearance().get(VisualPropertyType.NODE_WIDTH), + GpmlNetworkElement.ATTR_TYPE, + ObjectMapping.NODE_MAPPING + ); + widthMapping.putMapValue(ObjectType.GROUP.ordinal(), 5); + widthMapping.putMapValue(GpmlAnchorNode.TYPE_ANCHOR, 5); + DiscreteMapping heightMapping = new DiscreteMapping( + nac.getDefaultAppearance().get(VisualPropertyType.NODE_HEIGHT), + GpmlNetworkElement.ATTR_TYPE, + ObjectMapping.NODE_MAPPING + ); + heightMapping.putMapValue(ObjectType.GROUP.ordinal(), 5); + heightMapping.putMapValue(GpmlAnchorNode.TYPE_ANCHOR, 5); + + nac.setCalculator( + new BasicCalculator("Node width", widthMapping, VisualPropertyType.NODE_WIDTH) + ); + nac.setCalculator( + new BasicCalculator("Node height", heightMapping, VisualPropertyType.NODE_HEIGHT) + ); + } + + void setLineTypeMapping() { + DiscreteMapping styleMapping = new DiscreteMapping( + nac.getDefaultAppearance().get(VisualPropertyType.EDGE_LINE_STYLE), + attrMapper.getMapping(StaticProperty.LINESTYLE), + ObjectMapping.EDGE_MAPPING + ); + styleMapping.putMapValue("" + LineStyle.SOLID, cytoscape.visual.LineStyle.SOLID); + styleMapping.putMapValue("" + LineStyle.DASHED, cytoscape.visual.LineStyle.LONG_DASH); + eac.setCalculator( + new BasicCalculator("GPML edge style", styleMapping, VisualPropertyType.EDGE_LINE_STYLE) + ); + } + + void setArrowMapping() { + DiscreteMapping srcMapping = new DiscreteMapping( + nac.getDefaultAppearance().get(VisualPropertyType.EDGE_SRCARROW_SHAPE), + attrMapper.getMapping(StaticProperty.STARTLINETYPE), + ObjectMapping.EDGE_MAPPING + ); + setArrowMappings(srcMapping); + eac.setCalculator( + new BasicCalculator("GPML edge source shape", srcMapping, VisualPropertyType.EDGE_SRCARROW_SHAPE) + ); + + DiscreteMapping tgtMapping = new DiscreteMapping( + nac.getDefaultAppearance().get(VisualPropertyType.EDGE_TGTARROW_SHAPE), + attrMapper.getMapping(StaticProperty.ENDLINETYPE), + ObjectMapping.EDGE_MAPPING + ); + setArrowMappings(tgtMapping); + eac.setCalculator( + new BasicCalculator("GPML edge target shape", tgtMapping, VisualPropertyType.EDGE_TGTARROW_SHAPE) + ); + + String colAttr = attrMapper.getMapping(StaticProperty.COLOR); + eac.setCalculator( + new BasicCalculator( + "GPML edge source color", + new GpmlColorMapper( + (Color)eac.getDefaultAppearance().get(VisualPropertyType.EDGE_SRCARROW_COLOR), colAttr + ), + VisualPropertyType.EDGE_SRCARROW_COLOR + ) + ); + eac.setCalculator( + new BasicCalculator( + "GPML edge target color", + new GpmlColorMapper( + (Color)eac.getDefaultAppearance().get(VisualPropertyType.EDGE_TGTARROW_COLOR), colAttr + ), + VisualPropertyType.EDGE_TGTARROW_COLOR + ) + ); + } + + private static Map attribute2arrow; + private static Map arrow2attribute; + + public static Map getAttributeToArrow() { + if(attribute2arrow == null) { + attribute2arrow = new HashMap(); + attribute2arrow.put(LineType.LINE.getName(), ArrowShape.NONE); + attribute2arrow.put(LineType.ARROW.getName(), ArrowShape.ARROW); + attribute2arrow.put(LineType.LIGAND_ROUND.getName(), ArrowShape.CIRCLE); + attribute2arrow.put(LineType.LIGAND_SQUARE.getName(), ArrowShape.DELTA); + attribute2arrow.put(LineType.RECEPTOR.getName(), ArrowShape.DELTA); + attribute2arrow.put(LineType.RECEPTOR_ROUND.getName(), ArrowShape.DELTA); + attribute2arrow.put(LineType.RECEPTOR_SQUARE.getName(), ArrowShape.DELTA); + attribute2arrow.put(LineType.TBAR.getName(), ArrowShape.T); + + attribute2arrow.put("mim-necessary-stimulation", ArrowShape.ARROW); + attribute2arrow.put("mim-binding", ArrowShape.ARROW); + attribute2arrow.put("mim-conversion", ArrowShape.ARROW); + attribute2arrow.put("mim-stimulation", ArrowShape.ARROW); + attribute2arrow.put("mim-catalysis", ArrowShape.ARROW); + attribute2arrow.put("mim-inhibition", ArrowShape.ARROW); + attribute2arrow.put("mim-cleavage", ArrowShape.ARROW); + } + return attribute2arrow; + } + + public static Map getArrowToAttribute() { + if(arrow2attribute == null) { + arrow2attribute = new HashMap(); + Map attribute2arrow = getAttributeToArrow(); + for(String attribute : attribute2arrow.keySet()) { + arrow2attribute.put(attribute2arrow.get(attribute), attribute); + } + } + return arrow2attribute; + } + + void setArrowMappings(DiscreteMapping mapping) { + Map attribute2arrow = getAttributeToArrow(); + for(String attribute : attribute2arrow.keySet()) { + mapping.putMapValue(attribute, attribute2arrow.get(attribute)); + } + } + + void setTypeMapping() { + DiscreteMapping typeMapping = new DiscreteMapping( + nac.getDefaultAppearance().get(VisualPropertyType.NODE_SIZE), + GpmlNetworkElement.ATTR_TYPE, + ObjectMapping.NODE_MAPPING + ); + typeMapping.putMapValue(ObjectType.GROUP.ordinal(), 5); + typeMapping.putMapValue(GpmlAnchorNode.TYPE_ANCHOR, 5); + + nac.setCalculator( + new BasicCalculator( + GpmlNetworkElement.ATTR_TYPE, + typeMapping, + VisualPropertyType.NODE_SIZE + ) + ); + } + + void setLabelMapping() { + nac.setCalculator( + new BasicCalculator( + "canonicalName", + new PassThroughMapping("", "canonicalName"), + VisualPropertyType.NODE_LABEL + ) + ); + } + + void setColorMapping() { + //Default node color is white and semi-transparent + nac.getDefaultAppearance().set(VisualPropertyType.NODE_FILL_COLOR, Color.WHITE); + nac.getDefaultAppearance().set(VisualPropertyType.NODE_OPACITY, 220); + + String colAttr = attrMapper.getMapping(StaticProperty.COLOR); + nac.setCalculator( + new BasicCalculator( + "GPML node border color", + new GpmlColorMapper( + (Color)nac.getDefaultAppearance().get(VisualPropertyType.NODE_BORDER_COLOR), colAttr + ), + VisualPropertyType.NODE_BORDER_COLOR + ) + ); + eac.setCalculator( + new BasicCalculator( + "GPML edge color", + new GpmlColorMapper( + (Color)eac.getDefaultAppearance().get(VisualPropertyType.EDGE_COLOR), colAttr + ), + VisualPropertyType.EDGE_COLOR + ) + ); + + } + + void setNodeColorMapping(String title, Map pwNameToColor){ + + CyNetwork network = Cytoscape.getNetwork(title); + +// Discrete Mapping - set node colors + DiscreteMapping disMapping = new DiscreteMapping(Color.WHITE, + ObjectMapping.NODE_MAPPING); + + disMapping + .setControllingAttributeName("Source Pathway", network, false); + + Set pwNames = pwNameToColor.keySet(); + Iterator it = pwNames.iterator(); + while (it.hasNext()) { + String name = it.next(); + disMapping.putMapValue(name, pwNameToColor.get(name)); + + } + + Calculator nodeColorCalculator = new BasicCalculator( + "Superpathways Node Color Calc", disMapping, + VisualPropertyType.NODE_FILL_COLOR); + + nac.setCalculator(nodeColorCalculator); + + } + +} diff --git a/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/superpathwaysVisualStyle.java b/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/superpathwaysVisualStyle.java index 0140f2e4..55159415 100644 --- a/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/superpathwaysVisualStyle.java +++ b/tools/superpathways/src/org/pathvisio/cytoscape/superpathways/superpathwaysVisualStyle.java @@ -1,135 +1,135 @@ -// PathVisio, -// a tool for data visualization and analysis using Biological Pathways -// Copyright 2006-2011 BiGCaT Bioinformatics -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package org.pathvisio.cytoscape.superpathways; - -import java.awt.Color; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - -import org.pathvisio.core.model.PropertyType; -import org.pathvisio.cytoscape.visualmapping.GpmlColorMapper; - -import cytoscape.CyNetwork; -import cytoscape.Cytoscape; -import cytoscape.visual.CalculatorCatalog; -import cytoscape.visual.EdgeAppearance; -import cytoscape.visual.EdgeAppearanceCalculator; -import cytoscape.visual.GlobalAppearance; -import cytoscape.visual.GlobalAppearanceCalculator; -import cytoscape.visual.NodeAppearance; -import cytoscape.visual.NodeAppearanceCalculator; -import cytoscape.visual.NodeShape; -import cytoscape.visual.VisualMappingManager; -import cytoscape.visual.VisualPropertyType; -import cytoscape.visual.VisualStyle; -import cytoscape.visual.calculators.BasicCalculator; -import cytoscape.visual.calculators.Calculator; -import cytoscape.visual.mappings.DiscreteMapping; -import cytoscape.visual.mappings.ObjectMapping; -import cytoscape.visual.mappings.PassThroughMapping; - -public class superpathwaysVisualStyle { - - public static final String vsName = "Superpathways Visual Style"; - - int styleCount; - - public superpathwaysVisualStyle(String title, - Map pwNameToColor, int i) { - // get the network view - CyNetwork network = Cytoscape.getNetwork(title); - cytoscape.view.CyNetworkView networkView = Cytoscape - .getNetworkView(title); - - // get the VisualMappingManager and CalculatorCatalog - VisualMappingManager manager = Cytoscape.getVisualMappingManager(); - CalculatorCatalog catalog = manager.getCalculatorCatalog(); - - //the next code line is used for fix the bug (when doing several merges) - //catalog.removeVisualStyle(vsName); - styleCount=i; - String styleName=vsName+"-"+String.valueOf(i); - // check to see if a visual style with this name already exists - VisualStyle vs = catalog.getVisualStyle(styleName); - - if (vs == null) { - // if not, create it and add it to the catalog - // vs = createVisualStyle(network, title, c); - vs = createVisualStyle(network, pwNameToColor, styleName); - catalog.addVisualStyle(vs); - }else{ - System.out.println("Superpathway style is not null!"); - } - - networkView.setVisualStyle(vs.getName()); // not strictly necessary - - // actually apply the visual style - manager.setVisualStyle(vs); - networkView.redrawGraph(true, true); - } - - VisualStyle createVisualStyle(CyNetwork network, Map pwNameToColor, String StyleName) { - - VisualMappingManager vm = Cytoscape.getVisualMappingManager(); - VisualStyle currentStyle = vm.getVisualStyle(); - NodeAppearanceCalculator nodeAppCalc = new NodeAppearanceCalculator(currentStyle.getNodeAppearanceCalculator()); - EdgeAppearanceCalculator edgeAppCalc = new EdgeAppearanceCalculator(currentStyle.getEdgeAppearanceCalculator()); - GlobalAppearanceCalculator globalAppCalc = new GlobalAppearanceCalculator(); - - //set default value for the following property - globalAppCalc.setDefaultBackgroundColor(new Color(200, 200, 255)); - nodeAppCalc.getDefaultAppearance().set(VisualPropertyType.NODE_SHAPE, NodeShape.ELLIPSE); - edgeAppCalc.getDefaultAppearance().set(VisualPropertyType.EDGE_COLOR, new Color(0,0, 255)); - edgeAppCalc.getDefaultAppearance().set(VisualPropertyType.EDGE_LINE_WIDTH, 1.5); - - // Passthrough Mapping - set node label - PassThroughMapping pm = new PassThroughMapping(new String(), "canonicalName"); - Calculator nlc = new BasicCalculator("Superpathways Node Label Calc", - pm, VisualPropertyType.NODE_LABEL); - nodeAppCalc.setCalculator(nlc); - - - // Discrete Mapping - set node colors - DiscreteMapping disMapping = new DiscreteMapping(Color.WHITE, - ObjectMapping.NODE_MAPPING); - - disMapping - .setControllingAttributeName("Source Pathway", network, false); - - Set pwNames = pwNameToColor.keySet(); - Iterator it = pwNames.iterator(); - while (it.hasNext()) { - String name = it.next(); - disMapping.putMapValue(name, pwNameToColor.get(name)); - - } - - Calculator nodeColorCalculator = new BasicCalculator( - "Superpathways Node Color Calc", disMapping, - VisualPropertyType.NODE_FILL_COLOR); - - nodeAppCalc.setCalculator(nodeColorCalculator); - - // Create the visual style - VisualStyle visualStyle = new VisualStyle(StyleName, nodeAppCalc, edgeAppCalc, - globalAppCalc); - - return visualStyle; - } -} +// PathVisio, +// a tool for data visualization and analysis using Biological Pathways +// Copyright 2006-2011 BiGCaT Bioinformatics +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +package org.pathvisio.cytoscape.superpathways; + +import java.awt.Color; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +import org.pathvisio.core.model.PropertyType; +import org.pathvisio.cytoscape.visualmapping.GpmlColorMapper; + +import cytoscape.CyNetwork; +import cytoscape.Cytoscape; +import cytoscape.visual.CalculatorCatalog; +import cytoscape.visual.EdgeAppearance; +import cytoscape.visual.EdgeAppearanceCalculator; +import cytoscape.visual.GlobalAppearance; +import cytoscape.visual.GlobalAppearanceCalculator; +import cytoscape.visual.NodeAppearance; +import cytoscape.visual.NodeAppearanceCalculator; +import cytoscape.visual.NodeShape; +import cytoscape.visual.VisualMappingManager; +import cytoscape.visual.VisualPropertyType; +import cytoscape.visual.VisualStyle; +import cytoscape.visual.calculators.BasicCalculator; +import cytoscape.visual.calculators.Calculator; +import cytoscape.visual.mappings.DiscreteMapping; +import cytoscape.visual.mappings.ObjectMapping; +import cytoscape.visual.mappings.PassThroughMapping; + +public class superpathwaysVisualStyle { + + public static final String vsName = "Superpathways Visual Style"; + + int styleCount; + + public superpathwaysVisualStyle(String title, + Map pwNameToColor, int i) { + // get the network view + CyNetwork network = Cytoscape.getNetwork(title); + cytoscape.view.CyNetworkView networkView = Cytoscape + .getNetworkView(title); + + // get the VisualMappingManager and CalculatorCatalog + VisualMappingManager manager = Cytoscape.getVisualMappingManager(); + CalculatorCatalog catalog = manager.getCalculatorCatalog(); + + //the next code line is used for fix the bug (when doing several merges) + //catalog.removeVisualStyle(vsName); + styleCount=i; + String styleName=vsName+"-"+String.valueOf(i); + // check to see if a visual style with this name already exists + VisualStyle vs = catalog.getVisualStyle(styleName); + + if (vs == null) { + // if not, create it and add it to the catalog + // vs = createVisualStyle(network, title, c); + vs = createVisualStyle(network, pwNameToColor, styleName); + catalog.addVisualStyle(vs); + }else{ + System.out.println("Superpathway style is not null!"); + } + + networkView.setVisualStyle(vs.getName()); // not strictly necessary + + // actually apply the visual style + manager.setVisualStyle(vs); + networkView.redrawGraph(true, true); + } + + VisualStyle createVisualStyle(CyNetwork network, Map pwNameToColor, String StyleName) { + + VisualMappingManager vm = Cytoscape.getVisualMappingManager(); + VisualStyle currentStyle = vm.getVisualStyle(); + NodeAppearanceCalculator nodeAppCalc = new NodeAppearanceCalculator(currentStyle.getNodeAppearanceCalculator()); + EdgeAppearanceCalculator edgeAppCalc = new EdgeAppearanceCalculator(currentStyle.getEdgeAppearanceCalculator()); + GlobalAppearanceCalculator globalAppCalc = new GlobalAppearanceCalculator(); + + //set default value for the following property + globalAppCalc.setDefaultBackgroundColor(new Color(200, 200, 255)); + nodeAppCalc.getDefaultAppearance().set(VisualPropertyType.NODE_SHAPE, NodeShape.ELLIPSE); + edgeAppCalc.getDefaultAppearance().set(VisualPropertyType.EDGE_COLOR, new Color(0,0, 255)); + edgeAppCalc.getDefaultAppearance().set(VisualPropertyType.EDGE_LINE_WIDTH, 1.5); + + // Passthrough Mapping - set node label + PassThroughMapping pm = new PassThroughMapping(new String(), "canonicalName"); + Calculator nlc = new BasicCalculator("Superpathways Node Label Calc", + pm, VisualPropertyType.NODE_LABEL); + nodeAppCalc.setCalculator(nlc); + + + // Discrete Mapping - set node colors + DiscreteMapping disMapping = new DiscreteMapping(Color.WHITE, + ObjectMapping.NODE_MAPPING); + + disMapping + .setControllingAttributeName("Source Pathway", network, false); + + Set pwNames = pwNameToColor.keySet(); + Iterator it = pwNames.iterator(); + while (it.hasNext()) { + String name = it.next(); + disMapping.putMapValue(name, pwNameToColor.get(name)); + + } + + Calculator nodeColorCalculator = new BasicCalculator( + "Superpathways Node Color Calc", disMapping, + VisualPropertyType.NODE_FILL_COLOR); + + nodeAppCalc.setCalculator(nodeColorCalculator); + + // Create the visual style + VisualStyle visualStyle = new VisualStyle(StyleName, nodeAppCalc, edgeAppCalc, + globalAppCalc); + + return visualStyle; + } +} diff --git a/www/index.html b/www/index.html index 3915c1f8..8a9f0594 100644 --- a/www/index.html +++ b/www/index.html @@ -1,11 +1,11 @@ - - - - - -

-This page had moved. If your browser doesn't automatically redirect to its new location, click -here. -
- + + + + + +
+This page had moved. If your browser doesn't automatically redirect to its new location, click +here. +
+ \ No newline at end of file