mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merged in jmchilton/galaxy-central-multi-input-tool-fixes-2 (pull request #129)
Implement Macro Engine to Reduce Tool Config XML Duplication
This commit is contained in:
@@ -17,6 +17,7 @@ from galaxy.util.bunch import Bunch
|
||||
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 @@ class ToolBox( object ):
|
||||
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,104 @@ class ToolBox( object ):
|
||||
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)
|
||||
|
||||
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 = 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)
|
||||
self._xml_replace(expand_el, macro_def, parent_map)
|
||||
|
||||
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
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
@@ -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 @@ alignments (number of reads divided by average depth of coverage)" help="0.0 to
|
||||
<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 @@ alignments (number of reads divided by average depth of coverage)" help="0.0 to
|
||||
<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 @@ alignments (number of reads divided by average depth of coverage)" help="0.0 to
|
||||
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user