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