commit/galaxy-central: 5 new changesets
5 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/f46c9a707af8/ changeset: f46c9a707af8 user: jmchilton date: 2013-02-23 21:09:53 summary: Implement macro mechanism for tool config XML. This should allow for a drastic reduction in 'code' duplication across XML files in a tool repository or inside of an XML file (repeated blocks in different when statements for instance). affected #: 1 file diff -r fa34924860aaa282fe3c3021a257f2523848a6e6 -r f46c9a707af8ae9256b762cf7ef26c38da69c3a2 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -17,6 +17,7 @@ from galaxy.util.template import fill_template from galaxy import util, jobs, model from galaxy.jobs import ParallelismInfo +from copy import deepcopy from elementtree import ElementTree from parameters import * from parameters.grouping import * @@ -520,7 +521,7 @@ def load_tool( self, config_file, guid=None, **kwds ): """Load a single tool from the file named by `config_file` and return an instance of `Tool`.""" # Parse XML configuration file and get the root element - tree = util.parse_xml( config_file ) + tree = self._load_and_preprocess_tool_xml( config_file ) root = tree.getroot() # Allow specifying a different tool subclass to instantiate if root.find( "type" ) is not None: @@ -704,7 +705,86 @@ rval = tools return rval - + + def _load_and_preprocess_tool_xml(self, config_file): + tree = util.parse_xml(config_file) + root = tree.getroot() + macros_el = root.find('macros') + if not macros_el: + return tree + tool_dir = os.path.dirname(config_file) + macros = self._load_macros(macros_el, tool_dir) + # HACK for elementtree, newer implementations (etree/lxml) won't + # require this parent_map data structure but elementtree does not + # track parents or recongnize .find('..'). + parent_map = dict((c, p) for p in tree.getiterator() for c in p) + for expand_el in root.findall('.//expand'): + macro_name = expand_el.get('macro') + macro_def = macros[macro_name] + self._xml_replace(expand_el, macro_def, parent_map) + return tree + + def _load_macros(self, macros_el, tool_dir): + macros = {} + # Import macros from external files. + macros.update(self._load_imported_macros(macros_el, tool_dir)) + # Load all directly defined macros. + macros.update(self._load_embedded_macros(macros_el, tool_dir)) + return macros + + def _load_embedded_macros(self, macros_el, tool_dir): + macros = {} + + macro_els = [] + if macros_el: + macro_els = macros_el.findall("macro") + for macro in macro_els: + macro_name = macro.get("name") + macros[macro_name] = self._load_macro_def(macro) + + return macros + + def _load_imported_macros(self, macros_el, tool_dir): + macros = {} + + macro_import_els = [] + if macros_el: + macro_import_els = macros_el.findall("import") + for macro_import_el in macro_import_els: + raw_import_path = macro_import_el.text + tool_relative_import_path = \ + os.path.basename(raw_import_path) # Sanitize this + import_path = \ + os.path.join(tool_dir, tool_relative_import_path) + file_macros = self._load_macro_file(import_path, tool_dir) + macros.update(file_macros) + + return macros + + def _load_macro_file(self, path, tool_dir): + tree = util.parse_xml(path) + root = tree.getroot() + return self._load_macros(root, tool_dir) + + def _load_macro_def(self, macro): + return list(macro.getchildren()) + + def _xml_replace(self, query, targets, parent_map): + #parent_el = query.find('..') ## Something like this would be better with newer xml library + parent_el = parent_map[query] + matching_index = -1 + #for index, el in enumerate(parent_el.iter('.')): ## Something like this for newer implementation + for index, el in enumerate(parent_el.getchildren()): + if el == query: + matching_index = index + break + assert matching_index >= 0 + current_index = matching_index + for target in targets: + current_index += 1 + parent_el.insert(current_index, deepcopy(target)) + parent_el.remove(query) + class ToolSection( object ): """ A group of tools with similar type/purpose that will be displayed as a https://bitbucket.org/galaxy/galaxy-central/commits/7ae831ebb4aa/ changeset: 7ae831ebb4aa user: jmchilton date: 2013-02-23 21:09:53 summary: Extend tool config macro engine so that macros may be rendered inside other macros. affected #: 1 file diff -r f46c9a707af8ae9256b762cf7ef26c38da69c3a2 -r 7ae831ebb4aad4989cbf6ecba0e8128413a28403 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -714,16 +714,24 @@ return tree tool_dir = os.path.dirname(config_file) macros = self._load_macros(macros_el, tool_dir) - # HACK for elementtree, newer implementations (etree/lxml) won't - # require this parent_map data structure but elementtree does not - # track parents or recongnize .find('..'). - parent_map = dict((c, p) for p in tree.getiterator() for c in p) - for expand_el in root.findall('.//expand'): - macro_name = expand_el.get('macro') - macro_def = macros[macro_name] - self._xml_replace(expand_el, macro_def, parent_map) + + self._expand_macros([root], macros) return tree + def _expand_macros(self, elements, macros): + for element in elements: + # HACK for elementtree, newer implementations (etree/lxml) won't + # require this parent_map data structure but elementtree does not + # track parents or recongnize .find('..'). + parent_map = dict((c, p) for p in element.getiterator() for c in p) + for expand_el in element.findall('.//expand'): + macro_name = expand_el.get('macro') + macro_def = macros[macro_name] + + # Recursively expand contained macros. + self._expand_macros(macro_def, macros) + self._xml_replace(expand_el, macro_def, parent_map) + def _load_macros(self, macros_el, tool_dir): macros = {} # Import macros from external files. @@ -785,6 +793,7 @@ parent_el.insert(current_index, deepcopy(target)) parent_el.remove(query) + class ToolSection( object ): """ A group of tools with similar type/purpose that will be displayed as a https://bitbucket.org/galaxy/galaxy-central/commits/0d78c9da2cc8/ changeset: 0d78c9da2cc8 user: jmchilton date: 2013-02-23 21:09:53 summary: Add ability to pass sub-blocks of XML to macros and corresponding ability to render those (via the new <yield /> tag) from macros. affected #: 1 file diff -r 7ae831ebb4aad4989cbf6ecba0e8128413a28403 -r 0d78c9da2cc82c25f919f1850be39774b46fbb57 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -726,7 +726,16 @@ parent_map = dict((c, p) for p in element.getiterator() for c in p) for expand_el in element.findall('.//expand'): macro_name = expand_el.get('macro') - macro_def = macros[macro_name] + macro_def = deepcopy(macros[macro_name]) # deepcopy needed? + + yield_els = [yield_el for macro_def_el in macro_def for yield_el in macro_def_el.findall('.//yield')] + + expand_el_children = expand_el.getchildren() + macro_def_parent_map = \ + dict((c, p) for macro_def_el in macro_def for p in macro_def_el.getiterator() for c in p) + + for yield_el in yield_els: + self._xml_replace(yield_el, expand_el_children, macro_def_parent_map) # Recursively expand contained macros. self._expand_macros(macro_def, macros) https://bitbucket.org/galaxy/galaxy-central/commits/f522eea2d4c1/ changeset: f522eea2d4c1 user: jmchilton date: 2013-02-23 21:09:53 summary: Rework some duplication out tophat wrappers using macros. This dmeonstrates how macros can reduce duplication inside a file (e.g. the dbKeyActions macro) and between files (e.g. the own_junctionsConditional macro). affected #: 4 files diff -r 0d78c9da2cc82c25f919f1850be39774b46fbb57 -r f522eea2d4c19d7c7c24209afc1a4dee5bd71aa3 tools/ngs_rna/tophat2_wrapper.xml --- a/tools/ngs_rna/tophat2_wrapper.xml +++ b/tools/ngs_rna/tophat2_wrapper.xml @@ -143,23 +143,12 @@ </param></when></conditional> - <conditional name="refGenomeSource"> - <param name="genomeSource" type="select" label="Use a built in reference genome or own from your history" help="Built-in genomes were created using default options"> - <option value="indexed" selected="True">Use a built-in genome</option> - <option value="history">Use a genome from history</option> - </param> - <when value="indexed"> - <param name="index" type="select" label="Select a reference genome" help="If your genome of interest is not listed, contact the Galaxy team"> - <options from_data_table="tophat2_indexes"> - <filter type="sort_by" column="2"/> - <validator type="no_options" message="No genomes are available for the selected input dataset"/> - </options> - </param> - </when> - <when value="history"> - <param name="ownFile" type="data" format="fasta" metadata_name="dbkey" label="Select the reference genome" /> - </when><!-- history --> - </conditional><!-- refGenomeSource --> + <expand macro="refGenomeSourceConditional"> + <options from_data_table="tophat2_indexes"> + <filter type="sort_by" column="2"/> + <validator type="no_options" message="No genomes are available for the selected input dataset"/> + </options> + </expand><conditional name="params"><param name="settingsType" type="select" label="TopHat settings to use" help="You can use the default settings or set custom values for any of Tophat's parameters."><option value="preSet">Use Defaults</option> @@ -182,17 +171,7 @@ <param name="splice_mismatches" type="integer" value="0" label="Maximum number of mismatches that can appear in the anchor region of spliced alignment" /><param name="min_intron_length" type="integer" value="70" label="The minimum intron length" help="TopHat will ignore donor/acceptor pairs closer than this many bases apart." /><param name="max_intron_length" type="integer" value="500000" label="The maximum intron length" help="When searching for junctions ab initio, TopHat will ignore donor/acceptor pairs farther than this many bases apart, except when such a pair is supported by a split segment alignment of a long read." /> - <conditional name="indel_search"> - <param name="allow_indel_search" type="select" label="Allow indel search"> - <option value="Yes">Yes</option> - <option value="No">No</option> - </param> - <when value="No"/> - <when value="Yes"> - <param name="max_insertion_length" type="integer" value="3" label="Max insertion length." help="The maximum insertion length." /> - <param name="max_deletion_length" type="integer" value="3" label="Max deletion length." help="The maximum deletion length." /> - </when> - </conditional> + <expand macro="indel_searchConditional" /> alignments (number of reads divided by average depth of coverage)" help="0.0 to 1.0 (0 to turn off)" /><param name="max_multihits" type="integer" value="20" label="Maximum number of alignments to be allowed" /><param name="min_segment_intron" type="integer" value="50" label="Minimum intron length that may be found during split-segment (default) search" /> @@ -201,40 +180,7 @@ <param name="seg_length" type="integer" value="25" label="Minimum length of read segments" /><!-- Options for supplying own junctions. --> - <conditional name="own_junctions"> - <param name="use_junctions" type="select" label="Use Own Junctions"> - <option value="No">No</option> - <option value="Yes">Yes</option> - </param> - <when value="Yes"> - <conditional name="gene_model_ann"> - <param name="use_annotations" type="select" label="Use Gene Annotation Model"> - <option value="No">No</option> - <option value="Yes">Yes</option> - </param> - <when value="No" /> - <when value="Yes"> - <param format="gtf,gff3" name="gene_annotation_model" type="data" label="Gene Model Annotations" help="TopHat will use the exon records in this file to build a set of known splice junctions for each gene, and will attempt to align reads to these junctions even if they would not normally be covered by the initial mapping."/> - </when> - </conditional> - <conditional name="raw_juncs"> - <param name="use_juncs" type="select" label="Use Raw Junctions"> - <option value="No">No</option> - <option value="Yes">Yes</option> - </param> - <when value="No" /> - <when value="Yes"> - <param format="interval" name="raw_juncs" type="data" label="Raw Junctions" help="Supply TopHat with a list of raw junctions. Junctions are specified one per line, in a tab-delimited format. Records look like: [chrom] [left] [right] [+/-] left and right are zero-based coordinates, and specify the last character of the left sequenced to be spliced to the first character of the right sequence, inclusive."/> - </when> - </conditional> - <param name="no_novel_juncs" type="select" label="Only look for supplied junctions"> - <option value="No">No</option> - <option value="Yes">Yes</option> - </param> - </when> - <when value="No" /> - </conditional><!-- /own_junctions --> - + <expand macro="own_junctionsConditional" /><!-- Coverage search. --><conditional name="coverage_search"><param name="use_search" type="select" label="Use Coverage Search" help="Enables the coverage based search for junctions. Use when coverage search is disabled by default (such as for reads 75bp or longer), for maximum sensitivity."> @@ -319,83 +265,40 @@ <filter>(params['settingsType'] == 'full' and params['fusion_search']['do_search'] == 'Yes')</filter></data><data format="bed" name="insertions" label="${tool.name} on ${on_string}: insertions" from_work_dir="tophat_out/insertions.bed"> - <actions> - <conditional name="refGenomeSource.genomeSource"> - <when value="indexed"> - <action type="metadata" name="dbkey"> - <option type="from_data_table" name="tophat2_indexes" column="1" offset="0"> - <filter type="param_value" column="0" value="#" compare="startswith" keep="False"/> - <filter type="param_value" ref="refGenomeSource.index" column="0"/> - </option> - </action> - </when> - <when value="history"> - <action type="metadata" name="dbkey"> - <option type="from_param" name="refGenomeSource.ownFile" param_attribute="dbkey" /> - </action> - </when> - </conditional> - </actions> + <expand macro="dbKeyActions" /></data><data format="bed" name="deletions" label="${tool.name} on ${on_string}: deletions" from_work_dir="tophat_out/deletions.bed"> - <actions> - <conditional name="refGenomeSource.genomeSource"> - <when value="indexed"> - <action type="metadata" name="dbkey"> - <option type="from_data_table" name="tophat2_indexes" column="1" offset="0"> - <filter type="param_value" column="0" value="#" compare="startswith" keep="False"/> - <filter type="param_value" ref="refGenomeSource.index" column="0"/> - </option> - </action> - </when> - <when value="history"> - <action type="metadata" name="dbkey"> - <option type="from_param" name="refGenomeSource.ownFile" param_attribute="dbkey" /> - </action> - </when> - </conditional> - </actions> + <expand macro="dbKeyActions" /></data><data format="bed" name="junctions" label="${tool.name} on ${on_string}: splice junctions" from_work_dir="tophat_out/junctions.bed"> - <actions> - <conditional name="refGenomeSource.genomeSource"> - <when value="indexed"> - <action type="metadata" name="dbkey"> - <option type="from_data_table" name="tophat2_indexes" column="1" offset="0"> - <filter type="param_value" column="0" value="#" compare="startswith" keep="False"/> - <filter type="param_value" ref="refGenomeSource.index" column="0"/> - </option> - </action> - </when> - <when value="history"> - <action type="metadata" name="dbkey"> - <option type="from_param" name="refGenomeSource.ownFile" param_attribute="dbkey" /> - </action> - </when> - </conditional> - </actions> + <expand macro="dbKeyActions" /></data><data format="bam" name="accepted_hits" label="${tool.name} on ${on_string}: accepted_hits" from_work_dir="tophat_out/accepted_hits.bam"> - <actions> - <conditional name="refGenomeSource.genomeSource"> - <when value="indexed"> - <action type="metadata" name="dbkey"> - <option type="from_data_table" name="tophat2_indexes" column="1" offset="0"> - <filter type="param_value" column="0" value="#" compare="startswith" keep="False"/> - <filter type="param_value" ref="refGenomeSource.index" column="0"/> - </option> - </action> - </when> - <when value="history"> - <action type="metadata" name="dbkey"> - <option type="from_param" name="refGenomeSource.ownFile" param_attribute="dbkey" /> - </action> - </when> - </conditional> - </actions> + <expand macro="dbKeyActions" /></data></outputs> - + <macros> + <import>tophat_macros.xml</import> + <macro name="dbKeyActions"> + <actions> + <conditional name="refGenomeSource.genomeSource"> + <when value="indexed"> + <action type="metadata" name="dbkey"> + <option type="from_data_table" name="tophat2_indexes" column="1" offset="0"> + <filter type="param_value" column="0" value="#" compare="startswith" keep="False"/> + <filter type="param_value" ref="refGenomeSource.index" column="0"/> + </option> + </action> + </when> + <when value="history"> + <action type="metadata" name="dbkey"> + <option type="from_param" name="refGenomeSource.ownFile" param_attribute="dbkey" /> + </action> + </when> + </conditional> + </actions> + </macro> + </macros><tests><!-- Test base-space single-end reads with pre-built index and preset parameters --><test> diff -r 0d78c9da2cc82c25f919f1850be39774b46fbb57 -r f522eea2d4c19d7c7c24209afc1a4dee5bd71aa3 tools/ngs_rna/tophat_color_wrapper.xml --- a/tools/ngs_rna/tophat_color_wrapper.xml +++ b/tools/ngs_rna/tophat_color_wrapper.xml @@ -154,23 +154,12 @@ </command><inputs><param format="fastqcssanger" name="input1" type="data" label="RNA-Seq FASTQ file" help="Color-space: Must have Sanger-scaled quality values with ASCII offset 33" /> - <conditional name="refGenomeSource"> - <param name="genomeSource" type="select" label="Will you select a reference genome from your history or use a built-in index?" help="Built-ins were indexed using default options"> - <option value="indexed">Use a built-in index</option> - <option value="history">Use one from the history</option> - </param> - <when value="indexed"> - <param name="index" type="select" label="Select a reference genome" help="If your genome of interest is not listed, contact the Galaxy team"> - <options from_data_table="tophat_indexes_color"> - <filter type="sort_by" column="2"/> - <validator type="no_options" message="No indexes are available for the selected input dataset"/> - </options> - </param> - </when> - <when value="history"> - <param name="ownFile" type="data" format="fasta" metadata_name="dbkey" label="Select the reference genome" /> - </when><!-- history --> - </conditional><!-- refGenomeSource --> + <expand macro="refGenomeSourceConditional"> + <options from_data_table="tophat_indexes_color"> + <filter type="sort_by" column="2"/> + <validator type="no_options" message="No indexes are available for the selected input dataset"/> + </options> + </expand><conditional name="singlePaired"><param name="sPaired" type="select" label="Is this library mate-paired?"><option value="single">Single-end</option> @@ -194,17 +183,7 @@ <param name="splice_mismatches" type="integer" value="0" label="Maximum number of mismatches that can appear in the anchor region of spliced alignment" /><param name="min_intron_length" type="integer" value="70" label="The minimum intron length" help="TopHat will ignore donor/acceptor pairs closer than this many bases apart." /><param name="max_intron_length" type="integer" value="500000" label="The maximum intron length" help="When searching for junctions ab initio, TopHat will ignore donor/acceptor pairs farther than this many bases apart, except when such a pair is supported by a split segment alignment of a long read." /> - <conditional name="indel_search"> - <param name="allow_indel_search" type="select" label="Allow indel search"> - <option value="Yes">Yes</option> - <option value="No">No</option> - </param> - <when value="No"/> - <when value="Yes"> - <param name="max_insertion_length" type="integer" value="3" label="Max insertion length." help="The maximum insertion length." /> - <param name="max_deletion_length" type="integer" value="3" label="Max deletion length." help="The maximum deletion length." /> - </when> - </conditional> + <expand macro="indel_searchConditional" /><param name="junction_filter" type="float" value="0.15" label="Minimum isoform fraction: filter out junctions supported by too few alignments (number of reads divided by average depth of coverage)" help="0.0 to 1.0 (0 to turn off)" /><param name="max_multihits" type="integer" value="40" label="Maximum number of alignments to be allowed" /><param name="min_segment_intron" type="integer" value="50" label="Minimum intron length that may be found during split-segment (default) search" /> @@ -230,20 +209,8 @@ <param format="gtf" name="gene_annotation_model" type="data" label="Gene Model Annotations" help="TopHat will use the exon records in this file to build a set of known splice junctions for each gene, and will attempt to align reads to these junctions even if they would not normally be covered by the initial mapping."/></when></conditional> - <conditional name="raw_juncs"> - <param name="use_juncs" type="select" label="Use Raw Junctions"> - <option value="No">No</option> - <option value="Yes">Yes</option> - </param> - <when value="No" /> - <when value="Yes"> - <param format="interval" name="raw_juncs" type="data" label="Raw Junctions" help="Supply TopHat with a list of raw junctions. Junctions are specified one per line, in a tab-delimited format. Records look like: [chrom] [left] [right] [+/-] left and right are zero-based coordinates, and specify the last character of the left sequenced to be spliced to the first character of the right sequence, inclusive."/> - </when> - </conditional> - <param name="no_novel_juncs" type="select" label="Only look for supplied junctions"> - <option value="No">No</option> - <option value="Yes">Yes</option> - </param> + <expand macro="raw_juncsConditional" /> + <expand macro="no_novel_juncsParam" /></when><when value="No" /></conditional><!-- /own_junctions --> @@ -301,17 +268,7 @@ <param name="splice_mismatches" type="integer" value="0" label="Maximum number of mismatches that can appear in the anchor region of spliced alignment" /><param name="min_intron_length" type="integer" value="70" label="The minimum intron length" help="TopHat will ignore donor/acceptor pairs closer than this many bases apart." /><param name="max_intron_length" type="integer" value="500000" label="The maximum intron length" help="When searching for junctions ab initio, TopHat will ignore donor/acceptor pairs farther than this many bases apart, except when such a pair is supported by a split segment alignment of a long read." /> - <conditional name="indel_search"> - <param name="allow_indel_search" type="select" label="Allow indel search"> - <option value="Yes">Yes</option> - <option value="No">No</option> - </param> - <when value="No"/> - <when value="Yes"> - <param name="max_insertion_length" type="integer" value="3" label="Max insertion length." help="The maximum insertion length." /> - <param name="max_deletion_length" type="integer" value="3" label="Max deletion length." help="The maximum deletion length." /> - </when> - </conditional> + <expand macro="indel_searchConditional" /><param name="junction_filter" type="float" value="0.15" label="Minimum isoform fraction: filter out junctions supported by too few alignments (number of reads divided by average depth of coverage)" help="0.0 to 1.0 (0 to turn off)" /><param name="max_multihits" type="integer" value="40" label="Maximum number of alignments to be allowed" /><param name="min_segment_intron" type="integer" value="50" label="Minimum intron length that may be found during split-segment (default) search" /> @@ -399,90 +356,50 @@ ( singlePaired['pParams']['indel_search']['allow_indel_search'] == 'Yes' ) ) ) </filter> - <actions> - <conditional name="refGenomeSource.genomeSource"> - <when value="indexed"> - <action type="metadata" name="dbkey"> - <option type="from_data_table" name="tophat_indexes_color" column="1" offset="0"> - <filter type="param_value" column="0" value="#" compare="startswith" keep="False"/> - <filter type="param_value" ref="refGenomeSource.index" column="0"/> - </option> - </action> - </when> - <when value="history"> - <action type="metadata" name="dbkey"> - <option type="from_param" name="refGenomeSource.ownFile" param_attribute="dbkey" /> - </action> - </when> - </conditional> - </actions> + <expand macro="dbKeyActions" /></data><data format="bed" name="deletions" label="${tool.name} on ${on_string}: deletions" from_work_dir="tophat_out/deletions.bed"> - <filter> + <expand macro="dbKeyActions" /> + </data> + <data format="bed" name="junctions" label="${tool.name} on ${on_string}: splice junctions"> + <expand macro="dbKeyActions" /> + </data> + <data format="bam" name="accepted_hits" label="${tool.name} on ${on_string}: accepted_hits"> + <expand macro="dbKeyActions" /> + </data> + </outputs> + <macros> + <import>tophat_macros.xml</import> + <macro name="bedFilter"> + <filter> ( ( ( 'sParams' in singlePaired ) and ( 'indel_search' in singlePaired['sParams'] ) and ( singlePaired['sParams']['indel_search']['allow_indel_search'] == 'Yes' ) ) or ( ( 'pParams' in singlePaired ) and ( 'indel_search' in singlePaired['pParams'] ) and ( singlePaired['pParams']['indel_search']['allow_indel_search'] == 'Yes' ) ) ) - </filter> - <actions> - <conditional name="refGenomeSource.genomeSource"> - <when value="indexed"> - <action type="metadata" name="dbkey"> - <option type="from_data_table" name="tophat_indexes_color" column="1" offset="0"> - <filter type="param_value" column="0" value="#" compare="startswith" keep="False"/> - <filter type="param_value" ref="refGenomeSource.index" column="0"/> - </option> - </action> - </when> - <when value="history"> - <action type="metadata" name="dbkey"> - <option type="from_param" name="refGenomeSource.ownFile" param_attribute="dbkey" /> - </action> - </when> - </conditional> - </actions> - </data> - <data format="bed" name="junctions" label="${tool.name} on ${on_string}: splice junctions"> - <actions> - <conditional name="refGenomeSource.genomeSource"> - <when value="indexed"> - <action type="metadata" name="dbkey"> - <option type="from_data_table" name="tophat_indexes_color" column="1" offset="0"> - <filter type="param_value" column="0" value="#" compare="startswith" keep="False"/> - <filter type="param_value" ref="refGenomeSource.index" column="0"/> - </option> - </action> - </when> - <when value="history"> - <action type="metadata" name="dbkey"> - <option type="from_param" name="refGenomeSource.ownFile" param_attribute="dbkey" /> - </action> - </when> - </conditional> - </actions> - </data> - <data format="bam" name="accepted_hits" label="${tool.name} on ${on_string}: accepted_hits"> - <actions> - <conditional name="refGenomeSource.genomeSource"> - <when value="indexed"> - <action type="metadata" name="dbkey"> - <option type="from_data_table" name="tophat_indexes_color" column="1" offset="0"> - <filter type="param_value" column="0" value="#" compare="startswith" keep="False"/> - <filter type="param_value" ref="refGenomeSource.index" column="0"/> - </option> - </action> - </when> - <when value="history"> - <action type="metadata" name="dbkey"> - <option type="from_param" name="refGenomeSource.ownFile" param_attribute="dbkey" /> - </action> - </when> - </conditional> - </actions> - </data> - </outputs> + </filter> + </macro> + <macro name="dbKeyActions"> + <actions> + <conditional name="refGenomeSource.genomeSource"> + <when value="indexed"> + <action type="metadata" name="dbkey"> + <option type="from_data_table" name="tophat_indexes_color" column="1" offset="0"> + <filter type="param_value" column="0" value="#" compare="startswith" keep="False"/> + <filter type="param_value" ref="refGenomeSource.index" column="0"/> + </option> + </action> + </when> + <when value="history"> + <action type="metadata" name="dbkey"> + <option type="from_param" name="refGenomeSource.ownFile" param_attribute="dbkey" /> + </action> + </when> + </conditional> + </actions> + </macro> + </macros><tests><!-- Test color-space single-end reads with user-supplied reference fasta and preset parameters --><test> diff -r 0d78c9da2cc82c25f919f1850be39774b46fbb57 -r f522eea2d4c19d7c7c24209afc1a4dee5bd71aa3 tools/ngs_rna/tophat_macros.xml --- /dev/null +++ b/tools/ngs_rna/tophat_macros.xml @@ -0,0 +1,72 @@ +<macros> + <macro name="refGenomeSourceConditional"> + <conditional name="refGenomeSource"> + <param name="genomeSource" type="select" label="Use a built in reference genome or own from your history" help="Built-ins genomes were created using default options"> + <option value="indexed" selected="True">Use a built-in genome</option> + <option value="history">Use a genome from history</option> + </param> + <when value="indexed"> + <param name="index" type="select" label="Select a reference genome" help="If your genome of interest is not listed, contact the Galaxy team"> + <yield /> + </param> + </when> + <when value="history"> + <param name="ownFile" type="data" format="fasta" metadata_name="dbkey" label="Select the reference genome" /> + </when><!-- history --> + </conditional><!-- refGenomeSource --> + </macro> + <macro name="indel_searchConditional"> + <conditional name="indel_search"> + <param name="allow_indel_search" type="select" label="Allow indel search"> + <option value="Yes">Yes</option> + <option value="No">No</option> + </param> + <when value="No"/> + <when value="Yes"> + <param name="max_insertion_length" type="integer" value="3" label="Max insertion length." help="The maximum insertion length." /> + <param name="max_deletion_length" type="integer" value="3" label="Max deletion length." help="The maximum deletion length." /> + </when> + </conditional> + </macro> + <macro name="own_junctionsConditional"> + <conditional name="own_junctions"> + <param name="use_junctions" type="select" label="Use Own Junctions"> + <option value="No">No</option> + <option value="Yes">Yes</option> + </param> + <when value="Yes"> + <conditional name="gene_model_ann"> + <param name="use_annotations" type="select" label="Use Gene Annotation Model"> + <option value="No">No</option> + <option value="Yes">Yes</option> + </param> + <when value="No" /> + <when value="Yes"> + <param format="gtf,gff3" name="gene_annotation_model" type="data" label="Gene Model Annotations" help="TopHat will use the exon records in this file to build a set of known splice junctions for each gene, and will attempt to align reads to these junctions even if they would not normally be covered by the initial mapping."/> + </when> + </conditional> + <expand macro="raw_juncsConditional" /> + <expand macro="no_novel_juncsParam" /> + </when> + <when value="No" /> + </conditional><!-- /own_junctions --> + </macro> + <macro name="raw_juncsConditional"> + <conditional name="raw_juncs"> + <param name="use_juncs" type="select" label="Use Raw Junctions"> + <option value="No">No</option> + <option value="Yes">Yes</option> + </param> + <when value="No" /> + <when value="Yes"> + <param format="interval" name="raw_juncs" type="data" label="Raw Junctions" help="Supply TopHat with a list of raw junctions. Junctions are specified one per line, in a tab-delimited format. Records look like: [chrom] [left] [right] [+/-] left and right are zero-based coordinates, and specify the last character of the left sequenced to be spliced to the first character of the right sequence, inclusive."/> + </when> + </conditional> + </macro> + <macro name="no_novel_juncsParam"> + <param name="no_novel_juncs" type="select" label="Only look for supplied junctions"> + <option value="No">No</option> + <option value="Yes">Yes</option> + </param> + </macro> +</macros> diff -r 0d78c9da2cc82c25f919f1850be39774b46fbb57 -r f522eea2d4c19d7c7c24209afc1a4dee5bd71aa3 tools/ngs_rna/tophat_wrapper.xml --- a/tools/ngs_rna/tophat_wrapper.xml +++ b/tools/ngs_rna/tophat_wrapper.xml @@ -151,23 +151,12 @@ </command><inputs><param format="fastqsanger" name="input1" type="data" label="RNA-Seq FASTQ file" help="Nucleotide-space: Must have Sanger-scaled quality values with ASCII offset 33" /> - <conditional name="refGenomeSource"> - <param name="genomeSource" type="select" label="Use a built in reference genome or own from your history" help="Built-ins genomes were created using default options"> - <option value="indexed" selected="True">Use a built-in genome</option> - <option value="history">Use a genome from history</option> - </param> - <when value="indexed"> - <param name="index" type="select" label="Select a reference genome" help="If your genome of interest is not listed, contact the Galaxy team"> - <options from_data_table="tophat_indexes"> - <filter type="sort_by" column="2"/> - <validator type="no_options" message="No genomes are available for the selected input dataset"/> - </options> - </param> - </when> - <when value="history"> - <param name="ownFile" type="data" format="fasta" metadata_name="dbkey" label="Select the reference genome" /> - </when><!-- history --> - </conditional><!-- refGenomeSource --> + <expand macro="refGenomeSourceConditional"> + <options from_data_table="tophat_indexes"> + <filter type="sort_by" column="2"/> + <validator type="no_options" message="No genomes are available for the selected input dataset"/> + </options> + </expand><conditional name="singlePaired"><param name="sPaired" type="select" label="Is this library mate-paired?"><option value="single">Single-end</option> @@ -298,17 +287,7 @@ <param name="splice_mismatches" type="integer" value="0" label="Maximum number of mismatches that can appear in the anchor region of spliced alignment" /><param name="min_intron_length" type="integer" value="70" label="The minimum intron length" help="TopHat will ignore donor/acceptor pairs closer than this many bases apart." /><param name="max_intron_length" type="integer" value="500000" label="The maximum intron length" help="When searching for junctions ab initio, TopHat will ignore donor/acceptor pairs farther than this many bases apart, except when such a pair is supported by a split segment alignment of a long read." /> - <conditional name="indel_search"> - <param name="allow_indel_search" type="select" label="Allow indel search"> - <option value="Yes">Yes</option> - <option value="No">No</option> - </param> - <when value="No"/> - <when value="Yes"> - <param name="max_insertion_length" type="integer" value="3" label="Max insertion length." help="The maximum insertion length." /> - <param name="max_deletion_length" type="integer" value="3" label="Max deletion length." help="The maximum deletion length." /> - </when> - </conditional> + <expand macro="indel_searchConditional" /><param name="max_multihits" type="integer" value="20" label="Maximum number of alignments to be allowed" /><param name="min_segment_intron" type="integer" value="50" label="Minimum intron length that may be found during split-segment (default) search" /><param name="max_segment_intron" type="integer" value="500000" label="Maximum intron length that may be found during split-segment (default) search" /> @@ -316,40 +295,7 @@ <param name="seg_mismatches" type="integer" min="0" max="3" value="2" label="Number of mismatches allowed in each segment alignment for reads mapped independently" /><param name="seg_length" type="integer" value="25" label="Minimum length of read segments" /><!-- Options for supplying own junctions. --> - <conditional name="own_junctions"> - <param name="use_junctions" type="select" label="Use Own Junctions"> - <option value="No">No</option> - <option value="Yes">Yes</option> - </param> - <when value="Yes"> - <conditional name="gene_model_ann"> - <param name="use_annotations" type="select" label="Use Gene Annotation Model"> - <option value="No">No</option> - <option value="Yes">Yes</option> - </param> - <when value="No" /> - <when value="Yes"> - <param format="gtf" name="gene_annotation_model" type="data" label="Gene Model Annotations" help="TopHat will use the exon records in this file to build a set of known splice junctions for each gene, and will attempt to align reads to these junctions even if they would not normally be covered by the initial mapping."/> - </when> - </conditional> - <conditional name="raw_juncs"> - <param name="use_juncs" type="select" label="Use Raw Junctions"> - <option value="No">No</option> - <option value="Yes">Yes</option> - </param> - <when value="No" /> - <when value="Yes"> - <param format="interval" name="raw_juncs" type="data" label="Raw Junctions" help="Supply TopHat with a list of raw junctions. Junctions are specified one per line, in a tab-delimited format. Records look like: [chrom] [left] [right] [+/-] left and right are zero-based coordinates, and specify the last character of the left sequenced to be spliced to the first character of the right sequence, inclusive."/> - </when> - </conditional> - <param name="no_novel_juncs" type="select" label="Only look for supplied junctions"> - <option value="No">No</option> - <option value="Yes">Yes</option> - </param> - </when> - <when value="No" /> - </conditional><!-- /own_junctions --> - + <expand macro="own_junctionsConditional" /><!-- Closure search. --><conditional name="closure_search"><param name="use_search" type="select" label="Use Closure Search"> @@ -387,83 +333,40 @@ <outputs><data format="bed" name="insertions" label="${tool.name} on ${on_string}: insertions" from_work_dir="tophat_out/insertions.bed"> - <actions> - <conditional name="refGenomeSource.genomeSource"> - <when value="indexed"> - <action type="metadata" name="dbkey"> - <option type="from_data_table" name="tophat_indexes" column="1" offset="0"> - <filter type="param_value" column="0" value="#" compare="startswith" keep="False"/> - <filter type="param_value" ref="refGenomeSource.index" column="0"/> - </option> - </action> - </when> - <when value="history"> - <action type="metadata" name="dbkey"> - <option type="from_param" name="refGenomeSource.ownFile" param_attribute="dbkey" /> - </action> - </when> - </conditional> - </actions> + <expand macro="dbKeyActions" /></data><data format="bed" name="deletions" label="${tool.name} on ${on_string}: deletions" from_work_dir="tophat_out/deletions.bed"> - <actions> - <conditional name="refGenomeSource.genomeSource"> - <when value="indexed"> - <action type="metadata" name="dbkey"> - <option type="from_data_table" name="tophat_indexes" column="1" offset="0"> - <filter type="param_value" column="0" value="#" compare="startswith" keep="False"/> - <filter type="param_value" ref="refGenomeSource.index" column="0"/> - </option> - </action> - </when> - <when value="history"> - <action type="metadata" name="dbkey"> - <option type="from_param" name="refGenomeSource.ownFile" param_attribute="dbkey" /> - </action> - </when> - </conditional> - </actions> + <expand macro="dbKeyActions" /></data><data format="bed" name="junctions" label="${tool.name} on ${on_string}: splice junctions" from_work_dir="tophat_out/junctions.bed"> - <actions> - <conditional name="refGenomeSource.genomeSource"> - <when value="indexed"> - <action type="metadata" name="dbkey"> - <option type="from_data_table" name="tophat_indexes" column="1" offset="0"> - <filter type="param_value" column="0" value="#" compare="startswith" keep="False"/> - <filter type="param_value" ref="refGenomeSource.index" column="0"/> - </option> - </action> - </when> - <when value="history"> - <action type="metadata" name="dbkey"> - <option type="from_param" name="refGenomeSource.ownFile" param_attribute="dbkey" /> - </action> - </when> - </conditional> - </actions> + <expand macro="dbKeyActions" /></data><data format="bam" name="accepted_hits" label="${tool.name} on ${on_string}: accepted_hits" from_work_dir="tophat_out/accepted_hits.bam"> - <actions> - <conditional name="refGenomeSource.genomeSource"> - <when value="indexed"> - <action type="metadata" name="dbkey"> - <option type="from_data_table" name="tophat_indexes" column="1" offset="0"> - <filter type="param_value" column="0" value="#" compare="startswith" keep="False"/> - <filter type="param_value" ref="refGenomeSource.index" column="0"/> - </option> - </action> - </when> - <when value="history"> - <action type="metadata" name="dbkey"> - <option type="from_param" name="refGenomeSource.ownFile" param_attribute="dbkey" /> - </action> - </when> - </conditional> - </actions> + <expand macro="dbKeyActions" /></data></outputs> - + <macros> + <import>tophat_macros.xml</import> + <macro name="dbKeyActions"> + <actions> + <conditional name="refGenomeSource.genomeSource"> + <when value="indexed"> + <action type="metadata" name="dbkey"> + <option type="from_data_table" name="tophat_indexes" column="1" offset="0"> + <filter type="param_value" column="0" value="#" compare="startswith" keep="False"/> + <filter type="param_value" ref="refGenomeSource.index" column="0"/> + </option> + </action> + </when> + <when value="history"> + <action type="metadata" name="dbkey"> + <option type="from_param" name="refGenomeSource.ownFile" param_attribute="dbkey" /> + </action> + </when> + </conditional> + </actions> + </macro> + </macros><tests><!-- Test base-space single-end reads with pre-built index and preset parameters --><test> https://bitbucket.org/galaxy/galaxy-central/commits/22aaf90bc420/ changeset: 22aaf90bc420 user: jgoecks date: 2013-02-27 21:21:30 summary: Merged in jmchilton/galaxy-central-multi-input-tool-fixes-2 (pull request #129) Implement Macro Engine to Reduce Tool Config XML Duplication affected #: 5 files Diff not available. Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org