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