Syntax issue for adding new tool
Hi all, I am having trouble with what looked to me at first to be a "simple" syntactical issue with writing the XML wrapper for a new Galaxy tool. I had thought this would be easy, but perhaps I am missing something incredibly simple, as I am having no success at all. The relevant parts look something like this: <command interpreter="sh"> mycommand.sh -i $input #if $param_file.use_params == "true"# -p $params #end if </command> <inputs> <param format="fasta" name="input" type="data" label="Source File"/> <conditional name="param_file"> <param name="use_params" type="select" label="Use custom parameter file?"> <option value="true">Yes</option> <option value="false" selected="true">No</option> </param> <when value="true"> <param format="text" name="params" type="data" label="Parameter File" value=""/> </when> </conditional> </inputs> It's very simple, I just want the line "-p $params" to appear in the command line when the parameter "use_params" parameter is set to true. However, when building the command line statement to run, I get this error: ---------------------- Traceback (most recent call last): File "/Users/jrl909/Galaxy/galaxy-dist/lib/galaxy/jobs/runners/local.py", line 59, in run_job job_wrapper.prepare() File "/Users/jrl909/Galaxy/galaxy-dist/lib/galaxy/jobs/__init__.py", line 424, in prepare self.command_line = self.tool.build_command_line( param_dict ) File "/Users/jrl909/Galaxy/galaxy-dist/lib/galaxy/tools/__init__.py", line 1827, in build_command_line command_line = fill_template( self.command, context=param_dict ) File "/Users/jrl909/Galaxy/galaxy-dist/lib/galaxy/util/template.py", line 9, in fill_template return str( Template( source=template_text, searchList=[context] ) ) File "/Users/jrl909/Galaxy/galaxy-dist/eggs/Cheetah-2.2.2-py2.7-macosx-10.6-intel-ucs2.egg/Cheetah/Template.py", line 1004, in __str__ return getattr(self, mainMethName)() File "cheetah_DynamicallyCompiledCheetahTemplate_1328561167_73_97196.py", line 84, in respond NotFound: cannot find 'use_params' while searching for 'param_file.use_params' ------------------- As far as I can tell, the syntax I've used here is the same as that found in the example file suggested by the Galaxy documentation: interval2maf.xml (what I see as the "relevant" sections being reproduced below): --------------- <command interpreter="python"> #if $maf_source_type.maf_source == "user" #interval2maf.py --dbkey=${input1.dbkey} --chromCol=${input1.metadata.chromCol} --startCol=${input1.metadata.startCol} --endCol=${input1.metadata.endCol} --strandCol=${input1.metadata.strandCol} --mafFile=$maf_source_type.mafFile --mafIndex=$maf_source_type.mafFile.metadata.maf_index --interval_file=$input1 --output_file=$out_file1 --mafIndexFile=${GALAXY_DATA_INDEX_DIR}/maf_index.loc --species=$maf_source_type.species #else #interval2maf.py --dbkey=${input1.dbkey} --chromCol=${input1.metadata.chromCol} --startCol=${input1.metadata.startCol} --endCol=${input1.metadata.endCol} --strandCol=${input1.metadata.strandCol} --mafType=$maf_source_type.mafType --interval_file=$input1 --output_file=$out_file1 --mafIndexFile=${GALAXY_DATA_INDEX_DIR}/maf_index.loc --species=$maf_source_type.species #end if# --split_blocks_by_species=$split_blocks_by_species_selector.split_blocks_by_species #if $split_blocks_by_species_selector.split_blocks_by_species == "split_blocks_by_species"# --remove_all_gap_columns=$split_blocks_by_species_selector.remove_all_gap_columns #end if </command> <inputs> ... blahblahblah ... <conditional name="split_blocks_by_species_selector"> <param name="split_blocks_by_species" type="select" label="Split blocks by species" help="Not usually applicable. See help below for more information."> <option value="split_blocks_by_species">Split by species</option> <option value="dont_split_blocks_by_species" selected="true">Do not split</option> </param> <when value="dont_split_blocks_by_species"> <!-- do nothing here --> </when> <when value="split_blocks_by_species"> <param name="remove_all_gap_columns" type="select" label="Collapse empty alignment columns"> <option value="remove_all_gap_columns" selected="true">Collapse empty columns</option> <option value="do_not_remove_all_gap_columns">Do not collapse</ option> </param> </when> </conditional> </inputs> ------------------- As you can see, the field 'split_blocks_by_species' is referenced in an #if-block in the command specification the same way my 'use_params' field is. I would like very much to know the apparently crucial difference that I'm missing! Thanks, -Jeff
Hello, I'm not sure this will fix the issue but you might have to use -p $param_file.params instead of -p $params in your command line. Best, L-A Le 06/02/2012 22:15, Jeffrey Long a écrit :
Hi all, I am having trouble with what looked to me at first to be a "simple" syntactical issue with writing the XML wrapper for a new Galaxy tool. I had thought this would be easy, but perhaps I am missing something incredibly simple, as I am having no success at all. The relevant parts look something like this:
<command interpreter="sh"> mycommand.sh -i $input #if $param_file.use_params == "true"# -p $params #end if </command> <inputs> <param format="fasta" name="input" type="data" label="Source File"/> <conditional name="param_file"> <param name="use_params" type="select" label="Use custom parameter file?"> <option value="true">Yes</option> <option value="false" selected="true">No</option> </param> <when value="true"> <param format="text" name="params" type="data" label="Parameter File" value=""/> </when> </conditional> </inputs>
It's very simple, I just want the line "-p $params" to appear in the command line when the parameter "use_params" parameter is set to true.
However, when building the command line statement to run, I get this error:
---------------------- Traceback (most recent call last): File "/Users/jrl909/Galaxy/galaxy-dist/lib/galaxy/jobs/runners/local.py", line 59, in run_job job_wrapper.prepare() File "/Users/jrl909/Galaxy/galaxy-dist/lib/galaxy/jobs/__init__.py", line 424, in prepare self.command_line = self.tool.build_command_line( param_dict ) File "/Users/jrl909/Galaxy/galaxy-dist/lib/galaxy/tools/__init__.py", line 1827, in build_command_line command_line = fill_template( self.command, context=param_dict ) File "/Users/jrl909/Galaxy/galaxy-dist/lib/galaxy/util/template.py", line 9, in fill_template return str( Template( source=template_text, searchList=[context] ) ) File "/Users/jrl909/Galaxy/galaxy-dist/eggs/Cheetah-2.2.2-py2.7-macosx-10.6-intel-ucs2.egg/Cheetah/Template.py", line 1004, in __str__ return getattr(self, mainMethName)() File "cheetah_DynamicallyCompiledCheetahTemplate_1328561167_73_97196.py", line 84, in respond NotFound: cannot find 'use_params' while searching for 'param_file.use_params' michael -------------------
As far as I can tell, the syntax I've used here is the same as that found in the example file suggested by the Galaxy documentation: interval2maf.xml (what I see as the "relevant" sections being reproduced below):
---------------
<command interpreter="python">
#if $maf_source_type.maf_source == "user" #interval2maf.py --dbkey=${input1.dbkey} --chromCol=${input1.metadata.chromCol} --startCol=${input1.metadata.startCol} --endCol=${input1.metadata.endCol} --strandCol=${input1.metadata.strandCol} --mafFile=$maf_source_type.mafFile --mafIndex=$maf_source_type.mafFile.metadata.maf_index --interval_file=$input1 --output_file=$out_file1 --mafIndexFile=${GALAXY_DATA_INDEX_DIR}/maf_index.loc --species=$maf_source_type.species
#else #interval2maf.py --dbkey=${input1.dbkey} --chromCol=${input1.metadata.chromCol} --startCol=${input1.metadata.startCol} --endCol=${input1.metadata.endCol} --strandCol=${input1.metadata.strandCol} --mafType=$maf_source_type.mafType --interval_file=$input1 --output_file=$out_file1 --mafIndexFile=${GALAXY_DATA_INDEX_DIR}/maf_index.loc --species=$maf_source_type.species
#end if# --split_blocks_by_species=$split_blocks_by_species_selector.split_blocks_by_species
#if $split_blocks_by_species_selector.split_blocks_by_species == "split_blocks_by_species"#
--remove_all_gap_columns=$split_blocks_by_species_selector.remove_all_gap_columns
#end if
</command>
<inputs>
...
blahblahblah
...
<conditional name="split_blocks_by_species_selector">
<param name="split_blocks_by_species"type="select"label="Split blocks by species"help="Not usually applicable. See help below for more information.">
<option value="split_blocks_by_species">Split by species</option>
<option value="dont_split_blocks_by_species" selected="true">Do not split</option>
</param>
<when value="dont_split_blocks_by_species">
<!-- do nothing here -->
</when>
<when value="split_blocks_by_species">
<param name="remove_all_gap_columns"type="select"label="Collapse empty alignment columns">
<option value="remove_all_gap_columns" selected="true">Collapse empty columns</option>
<option value="do_not_remove_all_gap_columns">Do not collapse</option>
</param>
</when>
</conditional>
</inputs>
------------------- As you can see, the field 'split_blocks_by_species' is referenced in an #if-block in the command specification the same way my 'use_params' field is.
I would like very much to know the apparently crucial difference that I'm missing!
Thanks, -Jeff
___________________________________________________________ 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 (2)
-
Jeffrey Long
-
Louise-Amélie Schmitt