HTSeq¶
HTSeq is a Python package for processing high-throughput sequencing data. Its most
used part is htseq-count, which counts how many aligned reads overlap each gene in
a GTF or GFF annotation. The resulting count tables are used as input for
differential expression analysis, for example with DESeq2.
License¶
Free to use and open source under GNU GPLv3.
Available¶
- Roihu-CPU: 2.0.3 and 2.1.2 (module
py-htseq), via thebio-appsmodule.
Usage¶
HTSeq is part of the bio-apps collection on Roihu. Load the bio-apps module tree and then the HTSeq module:
The module provides the htseq-count, htseq-count-barcodes and htseq-qa
commands, and the HTSeq Python library.
For example, count the reads of a position-sorted BAM file from an unstranded library per gene:
Check these options before you run htseq-count:
-s: strandedness of the library. The default isyes. Usenofor unstranded libraries andreversefor reverse-stranded ones, such as dUTP-based kits. A wrong setting silently leaves many reads uncounted.-r: sort order of paired-end data. The default isname. Useposfor BAM files sorted by position, which is the default ofsamtools sort.-tand-i: the feature type to count (defaultexon) and the attribute that groups features into genes (defaultgene_id). The defaults suit Ensembl GTF files.
The counts are written to the file given with -c, or to standard output if you
leave it out. The last rows (__no_feature, __ambiguous and so on) show how many
reads were not counted and why.
Example batch script¶
htseq-count can process several BAM files at once, one core per file, and writes
one count column per file. Set the number of processes with -n:
#!/bin/bash
#SBATCH --job-name=htseq
#SBATCH --account=<project>
#SBATCH --output=output_%j.txt
#SBATCH --error=errors_%j.txt
#SBATCH --partition=small
#SBATCH --time=04:00:00
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=4
#SBATCH --mem=16G
module load bio-apps/v202603
module load py-htseq/2.1.2
htseq-count -s no -r pos -n $SLURM_CPUS_PER_TASK -c counts.tsv \
sample1.bam sample2.bam sample3.bam sample4.bam genes.gtf
Replace <project> with your CSC project (for example project_2001234).
See creating a batch job script for Roihu for more information about running batch jobs.
Support¶
More information¶
- HTSeq documentation
- htseq-count documentation
- HTSeq GitHub repository
- Putri, G. et al. (2022). Analysing high-throughput sequencing data in Python with HTSeq 2.0. Bioinformatics 38, 2943–2945