Hi,

  I am trying to integrate a tool into galaxy. The tool runs in two parts -
1) Computes correlation and provides an ouput 'txt' file (Java)      2)
Takes the previously ouput txt file and outputs a 'pdf' file. (Python)

I am having trouble with the second tool. If I provide a sample 'txt' file
as input, it's working fine. But if I run it in galaxy, it is not working
(for some reason it is not reading the 'txt' file from the previous
output).  Below is the code.


#!/usr/bin/python

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

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

print 'Number of arguments:', len(sys.argv), 'arguments.'
print 'Argument List:', str(sys.argv)

txt_in = input_file + '.txt'
mydata = np.loadtxt(txt_in)
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")
pdf_out = output_file + '.pdf'
plt.savefig(pdf_out)

data = file(pdf_out, 'rb').read()
fp = open(output_file, 'wb')
fp.write(data)
fp.close()
os.remove(txt_in)
os.remove(pdf_out)

Below is the xml code.

<tool id="archtex_massdata_extraction" name="Extract mass data">
  <description> for the given BAM file </description>

  <command>                              java -jar Extraction.jar
$input_bam_file   $ref_filename   $ref_filetype $output1
</command>
  <command interpreter="python">       plot.py   $output1    $out_file1

                  </command>

  <inputs>
<param name="input_bam_file" type="data" format="BAM" label="Input BAM
file" help="Choose an input BAM file"/>
<param name="ref_filename" type="data" format="gen,txt,gtf,bed"
label="Reference/Coordination
file" help="Choose a reference file"/>
<param name="ref_filetype" type="select" label="Choose the reference file
type">
<option value="custom">Custom</option>
<option value="refgene">refGene</option>
<option value="GFF">GFF</option>
<option value="bed">BED</option>
</param>
  </inputs>
  <outputs>
               <data name="output1" format="txt" />
              <data name="out_file1" format="pdf" />
  </outputs>
</tool>

I am forcing the input to be 'tx't and the output to be 'pdf' in the python
script. When I run the code, it is not showing any errors but it's not
showing any output either. I am able to download the first output 'txt'
file but there is no download button option in the right pane of galaxy for
the second part.

Any help is appreciated!

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