No retraction, correction or concern found when last checked on Oct 15, 2026.
Analysing high-throughput sequencing data in Python with HTSeq 2.0
Givanna H Putri, Simon Anders, Paul Theodor Pyl and 2 more
Bioinformatics · 2022 · CC BY
doi:10.1093/bioinformatics/btac166
Abstract
Summary. HTSeq 2.0 provides a more extensive application programming interface including a new representation for sparse genomic data, enhancements for htseq-count to suit single-cell omics, a new script for data using cell and molecular barcodes, improved documentation, testing and deployment, bug fixes and Python 3 support.
Availability and implementation. HTSeq 2.0 is released as an open-source software under the GNU General Public License and is available from the Python Package Index at https://pypi.python.org/pypi/HTSeq. The source code is available on Github at https://github.com/htseq/htseq.
Supplementary information. Supplementary data are available at Bioinformatics online.
Full text
From PubMed Central, U.S. National Library of Medicine, as current on Oct 15, 2026. Paragraph numbers are ours, so an answer can point at one.
Single-cell omics have exploded in popularity over the last few years, spearheaded by single cell transcriptomics. While commercial software solutions from manufacturers such as 10X Genomics and BD Biosciences provide standardized pipelines (e.g. cellranger) for analysing single-cell omics data, numerous experimental approaches rely on open source software to align reads and subsequently to quantify biological phenomena such as gene expression, chromatin accessibility, transcription factor binding affinities, and 3D chromatin conformation. HTSeq was initially developed as a general purpose tool to analyse high-throughput sequencing data in Python. In parallel, the htseq-count script was designed to count the number of reads or read pairs attributable to distinct genes in bulk RNA-Seq experiments. At that time, single-cell approaches were limited to specialized biotechnology laboratories. In this application note, we report the development of HTSeq 2.0, which improves the general-purpose application programming interface (API) and specifically htseq-count to encompass diverse omics analyses, including single-cell RNA sequencing (scRNA-Seq).
First, we have improved htseq-count, a popular script used to quantify gene expression in bulk and scRNA-Seq experiments (Fig. 1A–C). Multiple BAM files can now be processed with a single call of the script, which results in a counts table with either each row or column representing the counts from a separate BAM file. This is not only convenient but also faster because genomic features are loaded only once from the Gene transfer format (GTF) file, which can take as long as processing the reads for a typical plate-based single-cell experiment (Supplementary Fig. S1A and B). If multiple cores are available on the machine, htseq-count is now able to parallelize the quantification by allocating distinct input BAM files to each core (Fig. 1A, Supplementary Fig. S1A and B). The script also supports more output formats: compressed sparse matrices via scipy, mtx files in the style of cellranger, h5-like file formats such as h5ad, and loom (http://loompy.org) (Fig. 1A). These output formats make it easier for users to import the counts table into downstream analysis libraries, especially single-cell ones such as scanpy and singlet (https://github.com/iosonofabio/singlet). We also added support for storing additional metadata for each genomic feature. This has two clear applications: (i) Tracking additional gene information such as chromosome or aliases, which is useful for downstream analyses (e.g. for excluding sex chromosomes), and (ii) Collecting disaggregated exon-level counts, which provides a simple yet powerful approach to quantifying differential isoform expression (Fig. 1B). To encourage users to customize their analysis pipeline, we also restructured the key steps of htseq-count into well-documented functions and added a tutorial that explains the feature counting step by step. In addition, through a new script called htseq-count-barcodes, we support quantification of features in data multiplexed via cell barcodes and unique molecular identifiers (UMIs). Among other applications, the new script enables custom re-analysis of BAM files produced by cellranger using different parameters. Pearson correlation between cellranger and htseq-count-barcodes with default parameters is 0.985, with uniformly high correlation across cells (Supplementary Fig. S1C).
One of the key data structures in HTSeq is StepVector, an efficient sparse representation for piecewise-constant values on a 1D discrete space (typically a chromosome) (Fig. 1D). As an example, it can be used to store overlaps between gene bodies, critical for removing ambiguities in downstream gene expression analyses. However, genomic data is sometimes characterized by a distinct type of sparsity whereby the data appears as dense ‘islands of knowledge’ in a sea of missing data. This type of sparsity is apparent in the read coverage produced by amplicon sequencing or Chromatin Immunoprecipitation Sequencing (ChIP-Seq) where most of the genome is uncovered, but non-zero rapidly fluctuating coverage, down to a single nucleotide resolution (e.g. due to single nucleotide polymorphisms), are present only around specific kilobase-long stretches. To represent this type of sparsity efficiently, we created a new data structure called StretchVector. At its core, a StretchVector is a collection of stretches implemented via dense numpy arrays, each with associated start-end coordinates (Fig. 1E). Each stretch represents an island of data, while the rest of the genome is not stored. We implemented functions for stretch extension, trimming, resetting, shifting, views or slices, copy and conversion to and from monolithic arrays for simple data ingestion/extraction. Separately from StretchVector, we also improved the support for custom ChIP-Seq and chromatin conformation capture (Hi-C) analyses by adding parsers for bedGraph and BigWig files via pyBigWig and by writing new dedicated tutorials.
Finally, we improved the API of HTSeq as a whole and made architectural changes to the package to ensure its compatibility with current software development standards. Among other things, we (i) modernized the codebase to Python 3, (ii) added provisions for continuous integration and development including automatic binary releases on multiple architectures, (iii) established unit tests and test suites, (iv) fixed bugs and (v) added support for improved dependency infrastructure such as autodetection of SAM/BAM/CRAM file type via HTSlib. All aforementioned changes were carried out without compromising the efficiency of HTSeq, which stems from a cross-language design via Cython and SWIG.
In conclusion, HTSeq 2.0 is a fast and reliable Python library for not only analysing high-throughput sequencing data, but also for quantifying gene expression from bulk and single-cell RNA-Seq experiments. Compared with the previous implementation, we added specific support for single-cell experiments and a richer API including a new data structure for managing ‘islands-of-data’ sparsity, improved API documentation and tutorials, fixed a number of bugs, established a robust testing and deployment framework to ensure scientific reproducibility, and enable continuous code integration. We believe these improvements will make HTSeq 2.0 a convenient tool for exploring and quantifying high-throughput sequencing experiment results across multiple omic modalities.
References 10
- 1.
- 2.
Beazley D.M. (2003 ) Automated scientific software scripting with SWIG. Fut. Generat. Comput. Syst. FGCS, 19, 599–609.
Not in our library
- 3.
Behnel S. et al (2011 ) Cython: the best of both worlds. Comput. Sci. Eng., 13, 31–39.
Not in our library
- 4.
- 5.
- 6.
Picelli S. et al (2013 ) Smart-seq2 for sensitive full-length transcriptome profiling in single cells. Nat. Methods, 10, 1096–1098.
Not in our library10.1038/nmeth.2639
- 7.
Ryan D. et al; asellappenIBM. (2021 ) deeptools/pyBigWig: 0.3.18. https://doi.org/10.5281/zenodo.4515486.
Not in our library
- 8.
- 9.
- 10.
Cited by papers we hold 8
- Characterization of single neurons reprogrammed by pancreatic cancer · 2025No notice
- Chromosomal instability drives convergent and divergent evolution toward advantageous inherited traits in mammalian CHO bioproduction lineages · 2022Not checked
- Comparative transcriptome profiling of the early infection of wheat roots by Gaeumannomyces graminis var. tritici. · 2015Not checked
- The outer mucus layer hosts a distinct intestinal microbial niche · 2015No notice
- Starvation promotes concerted modulation of appetitive olfactory behavior via parallel neuromodulatory circuits · 2015No notice
- ngs.plot: Quick mining and visualization of next-generation sequencing data by integrating genomic databases · 2014No notice
- In Vitro Generation of Neuromesodermal Progenitors Reveals Distinct Roles for Wnt Signalling in the Specification of Spinal Cord and Paraxial Mesoderm Identity · 2014No notice
- Differential expression analysis for sequence count data · 2010No notice
Reads
Read by people on this page
None yet.
Checked or read by AI through naulon
None yet.
A person counts once a day per paper. We keep no cookie and no address: a reader is a hash that changes every day. Any month under five reads shows no number.
Are you an author?
Is this your paper?
Claim it to add your note and be paid when agents cite it. Free.