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