Hi,

  I am writing a python script that will take in two parameters (an input
file and an ouput file name) , plot a graph and output it to the filename
specified.

PYTHON SCRIPT

#!/usr/bin/python

import sys
import numpy as np
import matplotlib.pyplot as plt

input_file = sys.argv[1]
output_file = sys.argv[2]

mydata = np.loadtxt(input_file)
plt.figure(1)
plt.plot(mydata[:,0],mydata[:,1],label = "Feature");
plt.plot(mydata[:,0],mydata[:,2], label = "Variance");
plt.xlabel('Distance from feature(bp)');
plt.ylabel('Score');
plt.title(sys.argv[1]);
plt.legend(loc="best")
plt.savefig(output_file)


SAMPLE COMMAND :

<command interpreter="python"> plot.py    $ref_filename    $out_file1
 </command>
<inputs>
                  <param name="ref_filename"   type="data"
format="gen,txt,gtf,bed"   label="Reference/Coordination file" help="Choose
a reference file"/>
</inputs>
<outputs>
                 <data name="out_file1"   format="pdf" />
</outputs>

When I run this, I am getting the following error.


  File 
"/panfs/panfs.ccr.buffalo.edu/projects/mjbuck/galaxy/CistromeAP/tools/ArchTex/plot.py",
line 22, in <module>
    plt.savefig(output_file)
  File "/data/apps/python/lib/python2.6/site-packages/matplotlib/pyplot.py",
line 345, in savefig
    return fig.savefig(*args, **kwargs)
  File "/data/apps/python/lib/python2.6/site-packages/matplotlib/figure.py",
line 990, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File 
"/data/apps/python/lib/python2.6/site-packages/matplotlib/backend_bases.py",
line 1399, in print_figure
    '%s.' % (format, ', '.join(formats)))
ValueError: Format "dat" is not supported.
Supported formats: emf, eps, pdf, png, ps, raw, rgba, svg, svgz.


I don't know how to make the script extract    ".pdf"    from the   ".dat"

Thanks,
VJ.
___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/

Reply via email to