Display names accessible from Tool XML?
I'm building a tool that needs the "display name" of a file inside the output of the tool. To clarify, I have a tool that merges gene expression result from cufflinks for many samples. It generates a "matrix" tab-delimited file that provides the results with genes or transcript down one axis and samples across the other with intensity values in the cells of the matrix. I have already built into my galaxy server the ability to carry meaningful sample names from the original input file all the way through to the output of the final output of the cufflinks step of my workflow (this is functionality I've already offered up to the galaxy team to include, and can explain at a later date). Okay, so the problem I have is from the XML, I want to be able to pass my command-line script both the physical file names so the files can be parsed, but I also want to be able to pass the script the "display name" to use as the sample names for the columns in the file. Is there a way using the metadata to grab this from the input? I see that I can do something like input.metadata.dbkey and get the database key, but I can't find a way to do anything like input.metadata.name or input.metadata.display_name to give me what I want. My example XML file is below. Thanks, Dave <tool id="cuff_exp_2_matrix" name="Merge Cufflinks Exp Files to Matrix(files as sample names)" version="1.1.1"> <description>merges multiple cufflinks expression output files (gene or transcript) into a single matrix formatted file (id by sample, with intensity values)</description> <command interpreter="python"> cuff_exp_2_matrix_new.py $input1.metadata.display_name $input1 $output1 #for $i in $inputs ${i.input.metadata.display_name} ${i.input} #end for </command> <inputs> <param name="input1" label="First file" type="data" format="tabular" help="Need to add more files? Use controls below."/> <repeat name="inputs" title="Input Files"> <param name="input" label="Add file" type="data" format="tabular" /> </repeat> </inputs> <outputs> <data format="tabular" name="output1" label="${tool.name} on ${on_string}: Expression matrix" /> </outputs> <help> **What it does** This is a Jackson Laboratory custom tool for taking the output for several runs of cufflinks, where each run represents a sample, and merging these results into a file that contains a matrix of gene/transcript id by sample, with the cells of the matrix filled with the intensity values. The end result is a file that is easily imported into R or other tools for expression analysis. </help> </tool>
I figured it out! The mistake I was making was assuming that I needed to use the "metadata" attribute. I found in the "Data" base class that there is a display_name method. So instead in my xml I just used the syntax $input.display_name and I got exactly what I was looking for. Are things like this documented somewhere? I couldn't find it in the wiki, and it took digging into the code and quite a bit of trial and error to figure it out. Thanks, Dave On 6/16/11 9:08 AM, "Dave Walton" <dave.walton@jax.org> wrote:
I'm building a tool that needs the "display name" of a file inside the output of the tool.
To clarify, I have a tool that merges gene expression result from cufflinks for many samples. It generates a "matrix" tab-delimited file that provides the results with genes or transcript down one axis and samples across the other with intensity values in the cells of the matrix.
I have already built into my galaxy server the ability to carry meaningful sample names from the original input file all the way through to the output of the final output of the cufflinks step of my workflow (this is functionality I've already offered up to the galaxy team to include, and can explain at a later date).
Okay, so the problem I have is from the XML, I want to be able to pass my command-line script both the physical file names so the files can be parsed, but I also want to be able to pass the script the "display name" to use as the sample names for the columns in the file.
Is there a way using the metadata to grab this from the input? I see that I can do something like input.metadata.dbkey and get the database key, but I can't find a way to do anything like input.metadata.name or input.metadata.display_name to give me what I want.
My example XML file is below.
Thanks,
Dave
<tool id="cuff_exp_2_matrix" name="Merge Cufflinks Exp Files to Matrix(files as sample names)" version="1.1.1"> <description>merges multiple cufflinks expression output files (gene or transcript) into a single matrix formatted file (id by sample, with intensity values)</description> <command interpreter="python"> cuff_exp_2_matrix_new.py $input1.metadata.display_name $input1 $output1 #for $i in $inputs ${i.input.metadata.display_name} ${i.input} #end for </command> <inputs> <param name="input1" label="First file" type="data" format="tabular" help="Need to add more files? Use controls below."/> <repeat name="inputs" title="Input Files"> <param name="input" label="Add file" type="data" format="tabular" /> </repeat> </inputs> <outputs> <data format="tabular" name="output1" label="${tool.name} on ${on_string}: Expression matrix" /> </outputs> <help>
**What it does**
This is a Jackson Laboratory custom tool for taking the output for several runs of cufflinks, where each run represents a sample, and merging these results into a file that contains a matrix of gene/transcript id by sample, with the cells of the matrix filled with the intensity values. The end result is a file that is easily imported into R or other tools for expression analysis.
</help> </tool>
___________________________________________________________ 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:
participants (1)
-
Dave Walton