Question: Re: [Galaxy-Dev] Tool Integration: Soapaligner/Soap2
0
Kelly Vincent • 340 wrote:
Branden,
Are you currently calling a script file (Python Perl, etc.) in your
command tag, or calling the tool directly? If you are running it only
with an XML file, you cannot do what you want here. The command that
will be run is generated by converting the variable values you put in
the <command> tag to the names of the actual input and output files
that Galaxy creates when the tool is run.
However, this is not particularly difficult if you are calling a
script in the <command> tag, though it's a little convoluted. There
are several tools that deal with this situation (the NGS tools again,
in particular). There are a couple of basic situations. If you just
need to have a single file with a certain extension, simply create a
temp file with the extension specified (in Python
"tempfile.mkstemp( suffix='.ext' )" will do it). It's slightly more
complicated if you need associated files in the same directory (for
instance, Samtools expects a fasta file like "hg19.fa" plus its index
"hg19.fa.fai" to be in the same place. When you call the indexing
command with the name of the fasta file, it automatically creates the
index file with that name plus ".fai"). In this case, you should
symlink the original file to a temp file (with or without a specified
extension, as appropriate) and then get the name of that temp file.
The name of the other file is that name PLUS the appropriate
extension. For example, sam_to_bam.py does this in lines 73 through
76.
Note that the reason for symlinking to a temp file is that otherwise
the tool will create a new file in a database/files subdirectory,
which is not the right way to do things. So in the Samtools case, if
the uploaded fasta file is "database/files/000/dataset_23.dat", a new
file "database/files/000/dataset_23.dat.fai" will be created, but the
database won't know about it and it will not be deleted after the tool
finishes (but it still won't be available to future use, either).
The paster.log contains the command as generated by the <command> tag,
but it's not possible to print to that log from a tool script. You can
simply print the relevant command to sdtout or stderr from the script
and when you run it in the browser, you will see it in the info
section.
Hopefully this makes sense--let us know if you need further
assistance.
Regards,
Kelly