comparison featurecounts.xml @ 0:cada2d2f0a7c draft

Uploaded
author yhoogstrate
date Wed, 26 Mar 2014 09:12:30 -0400
parents
children 9fcffbe6c206
comparison
equal deleted inserted replaced
-1:000000000000 0:cada2d2f0a7c
1 <?xml version="1.0" encoding="UTF-8"?>
2 <tool id="featurecounts" name="featureCounts">
3 <description>Measure gene expression in RNA-Seq experiments from SAM or BAM files.</description>
4 <requirements>
5 <requirement type="package" version="1.4.4">featurecounts</requirement>
6 <requirement type="package" version="1.0.0">featurecounts2bed</requirement>
7 </requirements>
8 <command>
9 <!--
10 The following script is written in the "Cheetah" language:
11 http://www.cheetahtemplate.org/docs/users_guide_html_multipage/contents.html
12 -->
13
14 <!-- Check 01: do the alignments have a dbkey and is the option set to using it? -->
15 #if $reference_gene_sets_source.source_select == "attribute" and len({ alignment.metadata.dbkey:True for alignment in $alignments }.keys()) != 1
16 echo "Invalid number of dbkeys are found: ${ len({ alignment.metadata.dbkey:True for alignment in $alignments }.keys()) }, while only one should be used. Make sure that the alignments are done on the same reference genome and that 'tool-data/gene_sets.loc' is configured properly!" >&amp;2
17 #else
18 <!-- Check 02: are all alignments from the same type (bam || sam) -->
19 #if len({ alignment.extension:True for alignment in $alignments }.keys()) != 1
20 echo "Either all files must be SAM or all files must be BAM, no mixture is allowed." >&amp;2
21 #else
22 featureCounts
23 -a
24 #if $reference_gene_sets_source.source_select == "indexed_filtered"
25 "$reference_gene_sets_source.reference_gene_sets"
26 #else if $reference_gene_sets_source.source_select == "indexed_all"
27 "$reference_gene_sets_source.reference_gene_sets"
28 #else if $reference_gene_sets_source.source_select == "history"
29 "$reference_gene_sets_source.reference_gene_sets"
30 #else
31 <!--
32 This is a workaround to obtain the "genome.fa" file that
33 corresponds to the dbkey of the alignments.
34 Because this file is "calculated" during run-time, it can
35 be used in a workflow.
36 -->
37 "${ filter( lambda x: str( x[0] ) == str( { alignment.metadata.dbkey:True for alignment in $alignments }.keys()[0] ), $__app__.tool_data_tables[ 'gene_sets' ].get_fields() )[0][2] }"
38 #end if
39
40 -o "$output"
41 -T $threads
42
43 #if $extended_parameters.parameters == "extended"
44 -t $extended_parameters.gff_feature_type
45 -g $extended_parameters.gff_feature_attribute
46 $extended_parameters.summarization_level
47 $extended_parameters.contribute_to_multiple_features
48 $extended_parameters.protocol
49 $extended_parameters.multimapping_counts
50 -Q $extended_parameters.mapping_quality
51 $extended_parameters.fragment_counting
52 $extended_parameters.check_distance
53 -d $extended_parameters.minimum_fragment_length
54 -D $extended_parameters.maximum_fragment_length
55 $extended_parameters.only_both_ends
56 $extended_parameters.exclude_chimerics
57 $extended_parameters.namesort
58 #end if
59
60 #for $alignment in $alignments
61 ${alignment}
62 #end for
63
64 2>&amp;1
65
66 #if $format == "tabdel_default" or $format.value == "tabdel_default"
67 ; cp $output tmp.txt
68 ; egrep -v "^#" tmp.txt > tmp2.txt
69 ; cut -f 1,7 tmp2.txt > tmp_left.txt
70 ; cut -f 6 tmp2.txt > tmp_right.txt
71 ; paste tmp_left.txt tmp_right.txt > $output
72 #elif $format == "tabdel_short" or $format.value == "tabdel_short"
73 ; cp $output tmp.txt
74 ; egrep -v "^#" tmp.txt | cut -f 1,7 > $output
75 #end if
76
77 ## For every alignment, replace its filename for: "hid: sample name"
78 #for $alignment in $alignments
79 #set $alignment_escaped = str($alignment).replace('/', '\/').replace('.', '\.')
80 #set $alignment_name_escaped = str(alignment.hid)+": "+str($alignment.name).replace('\t',' ').replace('\\','\\\\').replace("'","\\'").replace('/','\/')
81
82 #if $format.value == "tabdel_default" or $format.value == "tabdel_short"
83 ; sed -e '1 s/$alignment_escaped/${alignment_name_escaped}/g' $output > tmp.txt
84 #elif $format.value == "bed":
85 ; featurecounts2bed.sh -f "$output" > tmp.txt
86 #else
87 ; sed -e '1,2 s/$alignment_escaped/${alignment_name_escaped}/g' $output > tmp.txt
88 #end if
89
90 ; mv tmp.txt $output
91 #end for
92 #end if
93 #end if
94 </command>
95
96 <inputs>
97 <param name="alignments" type="data" format="bam,sam" label="Alignment file" help="The input alignment file(s) where the gene expression has to be counted. The file can have a SAM or BAM format; but ALL files in the series must be in THE SAME format." multiple="true" />
98
99 <!-- Find out how to access the the GTF/GFF file(s) -->
100 <conditional name="reference_gene_sets_source">
101 <param name="source_select" type="select" label="GFF/GTF Source">
102 <option value="indexed_filtered">Use a built-in index (which fits your reference)</option>
103 <option value="history">Use reference from the history</option>
104 <option value="indexed_all">Use a built-in index (entire list) - avoid this option if possible; only useful if you design a workflow</option>
105 <option value="attribute">Use a built-in index based on the 'metadata.dbkey' attribute; ideal in workflows</option>
106 </param>
107 <when value="indexed_filtered">
108 <param name="reference_gene_sets" type="select" label="Reference Gene Sets used during alignment (GFF/GTF)" >
109 <options from_data_table="gene_sets"><!-- replaces 'from_file="gene_sets"' - more strict -->
110 <column name="name" index="0"/>
111 <column name="dbkey" index="1"/>
112 <column name="value" index="2"/>
113 <filter type="data_meta" ref="alignments" multiple="false" key="dbkey" column="1" />
114 <validator type="no_options" message="No indexes are available for the selected input dataset" />
115 </options>
116 </param>
117 </when>
118 <when value="history">
119 <param name="reference_gene_sets" format="gff" type="data" label="Gene annotation file" help="The program assumes that the provided annotation file is in GTF format. Make sure that the gene annotaiton file corresponds to the same reference genome as used for the alignment." />
120 </when>
121 <when value="indexed_all">
122 <param name="reference_gene_sets" type="select" label="Reference Gene Sets used during alignment (GFF/GTF)" >
123 <options from_data_table="gene_sets"><!-- replaces 'from_file="gene_sets"' - more strict -->
124 <column name="name" index="0"/>
125 <column name="dbkey" index="1"/>
126 <column name="value" index="2"/>
127 <validator type="no_options" message="No indexes are available for the selected input dataset" />
128 </options>
129 </param>
130 </when>
131 <when value="attribute">
132 <!-- Do nothing, determine GTF/GFF file at runtime -->
133 </when>
134 </conditional>
135
136 <param name="format" type="select" label="Output format">
137 <option value="complex">featureCounts 1.4.0+ default (extensive; complex)</option>
138 <option value="tabdel_default" selected="true">Gene-name "\t" gene-count "\t" gene-length (tab-delimited)</option>
139 <option value="tabdel_short">Gene-name "\t" gene-count (tab-delimited)</option>
140 <option value="bed">BED format (line per exon): chr "\t" start "\t" stop "\t" description "\t" readcount (tab-delimited)</option>
141 </param>
142
143 <param name="threads" type="integer" value="2" min="1" label="Number of the CPU threads. Higher numbers only make sense with a higher number of samples." />
144
145 <conditional name="extended_parameters">
146 <param name="parameters" type="select" label="featureCounts parameters" help="For more advanced featureCounts settings.">
147 <option value="default">Default settings</option>
148 <option value="extended">Extended settings</option>
149 </param>
150 <when value="default">
151 </when>
152 <when value="extended">
153 <param name="gff_feature_type" type="text" value="exon" label="GFF feature type filter" help="Specify the feature type. Only rows which have the matched matched feature type in the provided GTF annotation file will be included for read counting. `exon' by default." />
154
155 <param name="gff_feature_attribute" type="text" value="gene_id" label="GFF gene identifier" help="Specify the attribute type used to group features (eg. exons) into meta-features (eg. genes), when GTF annotation is provided. `gene_id' by default. This attribute type is usually the gene identifier. This argument is useful for the meta-feature level summarization." />
156
157 <param name ="summarization_level" type="boolean" truevalue=" -f" falsevalue="" label="On feature level" help="If specified, read summarization will be performed at the feature level. By default (-f is not specified), the read summarization is performed at the meta-feature level." />
158
159 <param name ="contribute_to_multiple_features" type="boolean" truevalue=" -O" falsevalue="" label="Allow read to contribute to multiple features" help="If specified, reads (or fragments if -p is specified) will be allowed to be assigned to more than one matched meta- feature (or matched feature if -f is specified)" />
160
161 <param name="protocol" type="select" label="Strand specific protocol" help="Indicate if strand-specific read counting should be performed. It has three possible values: 0 (unstranded), 1 (stranded) and 2 (reversely stranded). 0 by default.">
162 <option value=" -s 0" selected="true">Unstranded</option>
163 <option value=" -s 1">Stranded (forwards)</option>
164 <option value=" -s 2">Stranded (reverse)</option>
165 </param>
166
167 <param name="multimapping_counts" type="boolean" truevalue=" -M" falsevalue="" label="Count multi-mapping reads/fragments" help="If specified, multi-mapping reads/fragments will be counted (ie. a multi-mapping read will be counted up to N times if it has N reported mapping locations). The program uses the `NH' tag to find multi-mapping reads." />
168
169 <param name="mapping_quality" type="integer" value="0" label="Minimum read quality" help="The minimum mapping quality score a read must satisfy in order to be counted. For paired-end reads, at least one end should satisfy this criteria. 0 by default." />
170
171 <param name="fragment_counting" type="boolean" truevalue=" -p" falsevalue="" label="PE: Count fragments instead of reads" help="Paired-end specific: If specified, fragments (or templates) will be counted instead of reads. The two reads from the same fragment must be adjacent to each other in the provided SAM/BAM file. If SAM/BAM input does not meet this requirement, the -S (sorting) option should be provided as well." />
172
173 <param name="check_distance" type="boolean" truevalue=" -P" falsevalue="" label="PE: Check paired-end distance" help="Paired-end specific: If specified, paired-end distance will be checked when assigning fragments to meta-features or features. This option is only applicable when -p (Count fragments instead of reads) is specified. The distance thresholds should be specified using -d and -D (minimum and maximum fragment/template length) options." />
174
175 <param name="minimum_fragment_length" type="integer" value="50" label="PE: Minimum fragment/template length." />
176 <param name="maximum_fragment_length" type="integer" value="600" label="PE: Maximum fragment/template length." />
177
178 <param name="only_both_ends" type="boolean" truevalue=" -B" falsevalue="" label="PE: only allow fragments with both reads aligned" help="Paired-end specific: If specified, only fragments that have both ends successfully aligned will be considered for summarization. This option is only applicable for paired-end reads." />
179
180 <param name="exclude_chimerics" type="boolean" truevalue=" -C" falsevalue="" label="PE: Exclude chimeric fragments" help="Paired-end specific: If specified, the chimeric fragments (those fragments that have their two ends aligned to different chromosomes) will NOT be included for summarization. This option is only applicable for paired-end read data." />
181
182 <param name="namesort" type="boolean" truevalue=" -S" falsevalue="" label="PE: Name-sort reads (slow!)" help="Paired-end specific: If specified, the program will reorder input reads according to their names and make reads from the same pair be adjacent to each other. This option should be provided when reads from the same pair are not adjacent to each other in input SAM/BAM files (for instance sorting reads by chromosomal locations could decouple reads from the same pair)." />
183 </when>
184 </conditional>
185 </inputs>
186
187 <outputs>
188 <data format="tabular" name="output" label="${tool.name} on ${', '.join([ str(a.hid)+': '+a.name for a in $alignments ])}" />
189 </outputs>
190
191 <help>
192 featureCounts::
193 **Overview**
194
195 FeatureCounts is a light-weight read counting program written entirely in the C programming language. It can be used to count both gDNA-seq and RNA-seq reads for genomic features in in SAM/BAM files.
196 It has a variety of advanced parameters but its major strength is its outstanding performance: analysis of a 10GB BAM file takes about 7 minutes on a single average CPU (Homo Sapiens genome)!
197 Liao Y, Smyth GK and Shi W. featureCounts: an efficient general-purpose program for assigning sequence reads to genomic features. Bioinformatics, Advance Access, accepted on Nov 7, 2013
198
199 featureCounts is part of a bigger analysis suite called subread:
200 http://subread.sourceforge.net/
201 Liao Y, Smyth GK and Shi W. The Subread aligner: fast, accurate and scalable read mapping by seed-and-vote. Nucleic Acids Research, 41(10):e108, 2013
202
203 **Input formats**
204
205 Alignments should be provided in either:
206 * SAM format - hhttp://samtools.sourceforge.net/samtools.shtml#5
207 * BAM format
208
209 Gene regions should be provided in the GFF/GTF format:
210 * http://genome.ucsc.edu/FAQ/FAQformat.html#format3
211 * http://www.ensembl.org/info/website/upload/gff.html
212
213 **Installation**
214
215 1) Make sure you have proper GFF/GTF files (corresponding to your reference genome used for the aligment) uploaded to your history.
216
217 2) Make sure that your gene_sets.loc is configured properly as data table. This is generally done by copying the right information into: tool_data_table_conf.xml.
218 https://wiki.galaxyproject.org/Admin/Tools/Data%20Tables
219
220 **Examples**
221
222 **License**
223
224 * featureCounts / subread: GNU General Public License version 3.0 (GPLv3)
225
226 **Contact**
227
228 The tool wrapper has been written by Youri Hoogstrate from the Erasmus Medical Center (Rotterdam, Netherlands) on behalf of the Translational Research IT (TraIT) project:
229 http://www.ctmm.nl/en/programmas/infrastructuren/traitprojecttranslationeleresearch
230
231 I want to thank the Marius van den Beek for his contribution as well.
232
233 More tools by the Translational Research IT (TraIT) project can be found in the following repository:
234 http://toolshed.dtls.nl/
235
236 </help>
237 </tool>