Mercurial > repos > lparsons > htseq_count
annotate htseq-count.xml @ 8:5bfb7a651fac
Uploaded to attempt to reset metadata
author | lparsons |
---|---|
date | Fri, 21 Sep 2012 17:57:47 -0400 |
parents | 8a5d43b21c6e |
children | 971e20519fb8 |
rev | line source |
---|---|
8 | 1 <tool id="htseq_count" name="htseq-count" version="0.2.1"> |
0 | 2 <description> - Count aligned reads in a BAM file that overlap features in a GFF file</description> |
3 <version_command>htseq-count -h | grep version | sed 's/^\(.*\)*\(version .*\)\./\2/'</version_command> | |
4 <requirements> | |
4
14bec14f4290
Added tool_dependencies.xml back, dependency installation requires Galaxy changeset 7621:108cda898646
Lance Parsons <lparsons@princeton.edu>
parents:
3
diff
changeset
|
5 <requirement type="package" version="1.6.2">numpy</requirement> |
0 | 6 <requirement type="package" version="0.5.3p9">htseq</requirement> |
7 <requirement type="package" version="0.1.18">samtools</requirement> | |
8 </requirements> | |
9 <command> | |
10 ##set up input files | |
11 #set $reference_fasta_filename = "localref.fa" | |
12 #if $samout_conditional.samout: | |
13 #if str( $samout_conditional.reference_source.reference_source_selector ) == "history": | |
14 ln -s "${samout_conditional.reference_source.ref_file}" "${reference_fasta_filename}" && | |
15 samtools faidx "${reference_fasta_filename}" 2>&1 || echo "Error running samtools faidx for htseq-count" >&2 && | |
16 #else: | |
17 #set $reference_fasta_filename = str( $samout_conditional.reference_source.ref_file.fields.path ) | |
18 #end if | |
19 #end if | |
20 | |
21 #if $samfile.extension == "bam": | |
22 samtools view $samfile | | |
23 #end if | |
24 htseq-count | |
25 --mode=$mode | |
26 --stranded=$stranded | |
27 --minaqual=$minaqual | |
8 | 28 --type=$featuretype |
0 | 29 --idattr=$idattr |
30 #if $samout_conditional.samout: | |
31 --samout=$__new_file_path__/${samoutfile.id}_tmp | |
32 #end if | |
33 #if $samfile.extension == "bam": | |
34 - | |
35 #else | |
36 $samfile | |
37 #end if | |
38 $gfffile | |
3
f7a5b54a8d4f
Split feature and non-feature counts, removed tool_dependencies.xml (for now)
Lance Parsons <lparsons@princeton.edu>
parents:
0
diff
changeset
|
39 | awk '{if ($1 ~ "no_feature|ambiguous|too_low_aQual|not_aligned|alignment_not_unique") print $0 | "cat 1>&2"; else print $0}' > $counts 2>$othercounts |
0 | 40 #if $samout_conditional.samout: |
41 && samtools view -Su -t ${reference_fasta_filename}.fai $__new_file_path__/${samoutfile.id}_tmp | samtools sort -o - sorted > $samoutfile | |
42 #end if</command> | |
43 <inputs> | |
5
8a5d43b21c6e
Improved error handling
Lance Parsons <lparsons@princeton.edu>
parents:
4
diff
changeset
|
44 <param format="sam, bam" name="samfile" type="data" label="Aligned SAM/BAM File"> |
8 | 45 <help>Paired-End data MUST be sorted by QUERY NAME, use "NGS: Picard - Paired Read Mate Fixer" to sort by QUERY NAME and output to SAM (not BAM) before using this tool on paired data.</help> |
0 | 46 </param> |
47 <param format="gff" name="gfffile" type="data" label="GFF File"/> | |
48 <param name="mode" type="select" label="Mode"> | |
49 <help>Mode to handle reads overlapping more than one feature.</help> | |
50 <option value="union" selected="true">Union</option> | |
51 <option value="intersection-strict">Intersection (strict)</option> | |
52 <option value="intersection-nonempty">Intersection (nonempty)</option> | |
53 </param> | |
54 <param name="stranded" type="select" label="Stranded"> | |
55 <help>Specify whether the data is from a strand-specific assay. 'Reverse' means yes with reversed strand interpretation.</help> | |
56 <option value="yes" selected="true">Yes</option> | |
57 <option value="no">No</option> | |
58 <option value="reverse">Reverse</option> | |
59 </param> | |
60 <param name="minaqual" type="integer" value="0" label="Minimum alignment quality"> | |
61 <help>Skip all reads with alignment quality lower than the given minimum value</help> | |
62 </param> | |
8 | 63 <param name="featuretype" type="text" value="exon" label="Feature type"> |
0 | 64 <help>Feature type (3rd column in GFF file) to be used. All features of other types are ignored. The default, suitable for RNA-Seq and Ensembl GTF files, is exon.</help> |
65 </param> | |
66 <param name="idattr" type="text" value="gene_id" label="ID Attribute"> | |
5
8a5d43b21c6e
Improved error handling
Lance Parsons <lparsons@princeton.edu>
parents:
4
diff
changeset
|
67 <help>GFF attribute to be used as feature ID. Several GFF lines with the same feature ID will be considered as parts of the same feature. The feature ID is used to identity the counts in the output table. All features of the specified type MUST have a value for this attribute. The default, suitable for RNA-SEq and Ensembl GTF files, is gene_id.</help> |
0 | 68 </param> |
69 <conditional name="samout_conditional"> | |
70 <param name="samout" type="boolean" value="False" truevalue="True" falsevalue="False" label="Additional BAM Output"> | |
71 <help>Write out all SAM alignment records into an output BAM file, annotating each line with its assignment to a feature or a special counter (as an optional field with tag ‘XF’).</help> | |
72 </param> | |
73 <when value="True"> | |
74 <conditional name="reference_source"> | |
75 <param name="reference_source_selector" type="select" label="Choose the source for the reference list"> | |
76 <option value="cached">Locally cached</option> | |
77 <option value="history">History</option> | |
78 </param> | |
79 <when value="cached"> | |
80 <param name="ref_file" type="select" label="Using reference genome"> | |
81 <options from_data_table="sam_fa_indexes"> | |
82 <filter type="data_meta" key="dbkey" ref="samfile" column="3"/> | |
83 </options> | |
84 <validator type="no_options" message="A built-in reference genome is not available for the build associated with the selected input file"/> | |
85 </param> | |
86 </when> | |
87 <when value="history"> <!-- FIX ME!!!! --> | |
88 <param name="ref_file" type="data" format="fasta" label="Using reference file" /> | |
89 </when> | |
90 </conditional> | |
91 </when> | |
92 </conditional> | |
93 </inputs> | |
94 | |
95 <outputs> | |
96 <data format="tabular" name="counts" label="${tool.name} on ${on_string}"/> | |
3
f7a5b54a8d4f
Split feature and non-feature counts, removed tool_dependencies.xml (for now)
Lance Parsons <lparsons@princeton.edu>
parents:
0
diff
changeset
|
97 <data format="tabular" name="othercounts" label="${tool.name} on ${on_string} (no feature)"/> |
0 | 98 <data format="bam" name="samoutfile" label="${tool.name} on ${on_string} (BAM)"> |
99 <filter>samout_conditional['samout']</filter> | |
100 </data> | |
101 </outputs> | |
102 | |
103 <stdio> | |
104 <exit_code range="1:" level="fatal" description="Unknown error occurred" /> | |
5
8a5d43b21c6e
Improved error handling
Lance Parsons <lparsons@princeton.edu>
parents:
4
diff
changeset
|
105 <regex match="htseq-count: command not found" source="stderr" level="fatal" description="The HTSeq python package is not properly installed, contact Galaxy administrators" /> |
8a5d43b21c6e
Improved error handling
Lance Parsons <lparsons@princeton.edu>
parents:
4
diff
changeset
|
106 <regex match="samtools: command not found" source="stderr" level="fatal" description="The samtools package is not properly installed, contact Galaxy administrators" /> |
8a5d43b21c6e
Improved error handling
Lance Parsons <lparsons@princeton.edu>
parents:
4
diff
changeset
|
107 <regex match="Error: Feature (.+) does not contain a '(.+)' attribute" source="both" level="fatal" description="Error parsing the GFF file, at least one feature of the specified 'Feature type' does not have a value for the specified 'ID Attribute'" /> |
8a5d43b21c6e
Improved error handling
Lance Parsons <lparsons@princeton.edu>
parents:
4
diff
changeset
|
108 <regex match="Error occured in line (\d+) of file" source="stderr" level="fatal" description="Unknown error parsing the GFF file" /> |
8 | 109 <regex match="Error" source="stderr" level="fatal" description="Unknown error occured" /> |
0 | 110 </stdio> |
111 | |
112 <tests> | |
113 <test> | |
114 <param name="samfile" value="htseq-test.sam" /> | |
115 <param name="gfffile" value="htseq-test.gff" /> | |
116 <param name="samout" value="False" /> | |
117 <output name="counts" file="htseq-test_counts.tsv" /> | |
3
f7a5b54a8d4f
Split feature and non-feature counts, removed tool_dependencies.xml (for now)
Lance Parsons <lparsons@princeton.edu>
parents:
0
diff
changeset
|
118 <output name="othercounts" file="htseq-test_othercounts.tsv" /> |
0 | 119 </test> |
120 <test> | |
121 <param name="samfile" value="htseq-test.bam" /> | |
122 <param name="gfffile" value="htseq-test.gff" /> | |
123 <param name="samout" value="False" /> | |
124 <output name="counts" file="htseq-test_counts.tsv" /> | |
3
f7a5b54a8d4f
Split feature and non-feature counts, removed tool_dependencies.xml (for now)
Lance Parsons <lparsons@princeton.edu>
parents:
0
diff
changeset
|
125 <output name="othercounts" file="htseq-test_othercounts.tsv" /> |
0 | 126 </test> |
127 <!-- Seems to be an issue setting the $reference_fasta_filename variable during test | |
128 <test> | |
129 <param name="samfile" value="htseq-test.sam" /> | |
130 <param name="gfffile" value="htseq-test.gff" /> | |
131 <param name="samout" value="True" /> | |
132 <param name="reference_source_selector" value="history" /> | |
133 <param name="ref_file" value="htseq-test_reference.fasta" /> | |
134 <output name="counts" file="htseq-test_counts.tsv" /> | |
3
f7a5b54a8d4f
Split feature and non-feature counts, removed tool_dependencies.xml (for now)
Lance Parsons <lparsons@princeton.edu>
parents:
0
diff
changeset
|
135 <output name="othercounts" file="htseq-test_othercounts.tsv" /> |
0 | 136 <output name="samoutfile" file="htseq-test_samout.bam" /> |
137 </test> | |
138 --> | |
139 </tests> | |
140 | |
141 <help> | |
142 Overview | |
143 -------- | |
144 | |
145 This tool takes an alignment file in SAM or BAM format and feature file in GFF format | |
146 and calculates the number of reads mapping to each feature. It uses the *htseq-count* | |
147 script that is part of the HTSeq python module. See | |
148 http://www-huber.embl.de/users/anders/HTSeq/doc/count.html for details. | |
149 | |
150 A feature is an interval (i.e., a range of positions) on a chromosome or a union of | |
151 such intervals. In the case of RNA-Seq, the features are typically genes, where | |
152 each gene is considered here as the union of all its exons. One may also consider | |
153 each exon as a feature, e.g., in order to check for alternative splicing. For | |
154 comparative ChIP-Seq, the features might be binding regions from a pre-determined | |
155 list. | |
156 | |
157 **Paired-end Data MUST be sorted by QUERY NAME first** | |
158 | |
159 This tool requires that paired-end data be sorted by query name, which is NOT the default for Galaxy. Using the Picard Paired Read Mate Fixer with Query name sort FIRST is required for paired end data. | |
160 | |
161 | |
162 Overlap Modes | |
163 ------------- | |
164 | |
165 Special care must be taken to decide how to deal with reads that overlap more than one feature. | |
166 | |
167 The htseq-count script allows to choose between three modes: *union*, *intersection-strict*, and *intersection-nonempty*. | |
168 | |
169 The following figure illustrates the effect of these three modes: | |
170 | |
171 .. image:: /static/images/count_modes.png | |
172 :width: 500 | |
173 | |
174 Strandedness | |
175 ------------ | |
176 | |
177 **Important**: The default for strandedness is yes. If your RNA-Seq data has not been made with a strand-specific protocol, this causes half of the reads to be lost. Hence, make sure to set the option Stranded to 'No' unless you have strand-specific data! | |
178 | |
179 Output | |
180 ------ | |
181 | |
182 The script outputs a table with counts for each feature, followed by the special counters, which count reads that were not counted for any feature for various reasons, namely | |
183 | |
184 - *no_feature*: reads which could not be assigned to any feature (set S as described above was empty). | |
185 | |
186 - *ambiguous*: reads which could have been assigned to more than one feature and hence were not counted for any of these (set S had mroe than one element). | |
187 | |
188 - *too_low_aQual*: reads which were not counted due to the -a option, see below | |
189 | |
190 - *not_aligned*: reads in the SAM file without alignment | |
191 | |
192 - *alignment_not_unique*: reads with more than one reported alignment. These reads are recognized from the NH optional SAM field tag. (If the aligner does not set this field, multiply aligned reads will be counted multiple times.) | |
193 | |
194 | |
195 Options Summary | |
196 --------------- | |
197 | |
198 Usage: htseq-count [options] sam_file gff_file | |
199 | |
200 This script takes an alignment file in SAM format and a feature file in GFF | |
201 format and calculates for each feature the number of reads mapping to it. See | |
202 http://www-huber.embl.de/users/anders/HTSeq/doc/count.html for details. | |
203 | |
204 Options: | |
205 -h, --help show this help message and exit | |
206 -m MODE, --mode=MODE mode to handle reads overlapping more than one | |
207 feature(choices: union, intersection-strict, | |
208 intersection-nonempty; default: union) | |
209 -s STRANDED, --stranded=STRANDED | |
210 whether the data is from a strand-specific assay. | |
211 Specify 'yes', 'no', or 'reverse' (default: yes). | |
212 'reverse' means 'yes' with reversed strand | |
213 interpretation | |
214 -a MINAQUAL, --minaqual=MINAQUAL | |
215 skip all reads with alignment quality lower than the | |
216 given minimum value (default: 0) | |
217 -t FEATURETYPE, --type=FEATURETYPE | |
218 feature type (3rd column in GFF file) to be used, all | |
219 features of other type are ignored (default, suitable | |
220 for Ensembl GTF files: exon) | |
221 -i IDATTR, --idattr=IDATTR | |
222 GFF attribute to be used as feature ID (default, | |
223 suitable for Ensembl GTF files: gene_id) | |
224 -o SAMOUT, --samout=SAMOUT | |
225 write out all SAM alignment records into an output SAM | |
226 file called SAMOUT, annotating each line with its | |
227 feature assignment (as an optional field with tag | |
228 'XF') | |
229 -q, --quiet suppress progress report and warnings | |
230 | |
231 Written by Simon Anders (sanders@fs.tum.de), European Molecular Biology | |
232 Laboratory (EMBL). (c) 2010. Released under the terms of the GNU General | |
233 Public License v3. Part of the 'HTSeq' framework. | |
234 </help> | |
235 </tool> |