# HG changeset patch
# User bgruening
# Date 1376552354 14400
# Node ID fe542273784fb7fbd514c7e5c6f6c5a8f4b2ac5f
Uploaded
diff -r 000000000000 -r fe542273784f mds_plot.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mds_plot.py Thu Aug 15 03:39:14 2013 -0400
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+
+import argparse
+import os
+import sklearn.manifold
+import numpy
+import math
+import pylab
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser(
+ description="""2D multidimenisnal scaling of NxN matrices with scatter plot"""
+ )
+
+ parser.add_argument("-i", "--input", dest="sm",
+ required=True,
+ help="Path to the input file.")
+ parser.add_argument("--oformat", default='png', help="Output format (png, svg)")
+ parser.add_argument("-o", "--output", dest="output_path",
+ help="Path to the output file.")
+
+ args = parser.parse_args()
+ mds = sklearn.manifold.MDS( n_components=2, max_iter=300, eps=1e-6, dissimilarity='precomputed' )
+ data = numpy.fromfile( args.sm )
+ d = math.sqrt( len(data) )
+ sm = numpy.reshape( data, ( d,d ))
+ pos = mds.fit( sm ).embedding_
+ pylab.scatter( pos[:,0],pos[:,1] )
+ pylab.savefig( args.output_path, format=args.oformat )
diff -r 000000000000 -r fe542273784f mds_plot.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mds_plot.xml Thu Aug 15 03:39:14 2013 -0400
@@ -0,0 +1,52 @@
+
+ of molecule similarity
+
+ scikit_learn
+ matplotlib
+
+
+ mds_plot.py
+ -i $infile
+ --oformat $oformat
+ -o $outfile
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+**Note**. You need an NxN similarity matrix as input. Use the NxN Clustering tool to generate one.
+
+**What it does**
+
+Scatter plot of similarity matrix after embeding in 2D coordinates using Multidimensional Scaling (MDS).
+
+-----
+
+**Example**
+
+* input::
+ Similarity Matrix
+
+* output::
+
+ Scatter plot
+
+.. image:: $PATH_TO_IMAGES/mds_plot.png
+
+
+
+
diff -r 000000000000 -r fe542273784f static/images/mds_plot.png
Binary file static/images/mds_plot.png has changed
diff -r 000000000000 -r fe542273784f test_data/mds_plot_on_sm_dat.png
Binary file test_data/mds_plot_on_sm_dat.png has changed
diff -r 000000000000 -r fe542273784f test_data/sm.dat
Binary file test_data/sm.dat has changed
diff -r 000000000000 -r fe542273784f tool_dependencies.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_dependencies.xml Thu Aug 15 03:39:14 2013 -0400
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+