Skip to content

How to use featureCounts on your own RNA-seq data

Oak
Studio-lit feathered reptile specimen on a black pedestal, its feathers arranged in columns with each quill holding a single amber glow.

featureCounts takes aligned reads (a BAM file) and an annotation (a GTF or SAF file) and returns a table of integer counts per gene. It is the quantification step you want when your downstream analysis is differential expression with DESeq2, edgeR, or limma-voom. Those methods expect raw integer counts rather than normalized abundances. It is part of the Subread package and runs in a few minutes on a typical human RNA-seq sample. Its default behavior is conservative: one read, one gene, and reads that are ambiguous get thrown away 1. The cost of that conservatism is that it does not resolve isoforms and it undercounts genes that overlap other genes.

This page covers what featureCounts is doing mechanically and the flags that change your numbers. It also covers how it compares to transcript-level tools like Salmon and kallisto, and the specific ways a run can look fine and still be wrong.

What featureCounts counts, and what a “feature” is

featureCounts distinguishes features from meta-features. A feature is a single row in your annotation, typically an exon. A meta-feature is a group of features sharing an identifier, typically all exons belonging to one gene. By default the tool counts at the meta-feature level using -t exon -g gene_id, so every read that lands in any exon of a gene is credited to that gene once.

The assignment rule is the part worth internalizing. A read is assigned to a meta-feature if it overlaps that meta-feature by at least one base. If a read overlaps two different genes, it is ambiguous and discarded by default. This is why featureCounts is fast: it does not estimate anything, it does interval lookups against a hashed, sorted representation of the annotation 1. There is no expectation-maximization step and no model of transcript structure.

That design has a direct consequence for interpretation. A gene-level count from featureCounts is “reads that unambiguously fell inside this gene’s exonic footprint,” not “molecules of this gene’s mRNA.” The union of all exons across all isoforms defines that footprint, so a gene with many annotated isoforms has a larger effective target than its dominant transcript.

The command you should start with

For a standard paired-end, unstranded-unknown human RNA-seq library, this is where we begin:

featureCounts \
  -a gencode.v44.primary_assembly.annotation.gtf \
  -o counts.txt \
  -T 8 \
  -p --countReadPairs \
  -s 2 \
  -t exon -g gene_id \
  -Q 10 \
  sample1.bam sample2.bam

A few of these matter more than the rest. -p tells featureCounts the data are paired-end, and since Subread 2.0.2 you must add --countReadPairs to count fragments rather than individual reads. Older tutorials omit it because -p alone used to imply fragment counting. If you skip it on modern versions, your counts roughly double and your library sizes look wrong.

-s sets strandedness: 0 unstranded, 1 forward-stranded, 2 reverse-stranded. Most current Illumina kits (TruSeq Stranded mRNA, for example) are reverse-stranded, so -s 2 is the usual answer. Do not guess. Run featureCounts three times with -s 0, -s 1, and -s 2 on one BAM and read the summary file. The correct setting gives the highest assignment rate, and the wrong one usually gives something near 5 percent.

-T is threads. -Q 10 drops reads below mapping quality 10, which for most aligners removes the bulk of multi-mapped alignments before the counting logic ever sees them. --primary is an alternative that keeps only the primary alignment of each read.

Flags that change your biology and not only your speed

Four options alter what the numbers mean, and we recommend leaving three of them alone.

-M counts multi-mapping reads, assigning each read to every feature it maps to. --fraction splits the credit, giving each of n targets 1/n of a count. Together, -M --fraction is the right choice for one specific class of question: quantifying repetitive elements, paralog families, and transposons, where discarding multi-mappers removes most of the signal by construction 2. For ordinary protein-coding gene analysis, leave -M off. Turning it on inflates counts for gene families and makes dispersion estimates noisier.

-O allows a read overlapping multiple meta-features to be counted in all of them instead of being discarded. This is tempting when you notice that antisense and nested genes are losing reads, but it breaks the independence assumption behind count-based tests and creates correlated inflation across overlapping loci. We leave it off and accept the loss.

--minOverlap and --fracOverlap set how much of a read must fall inside a feature. The default minimum overlap of one base is loose. Raising --fracOverlap to 0.5 or so makes assignment stricter at exon boundaries, which mostly matters for short features and small RNA annotations.

-f switches to feature-level counting, giving you per-exon counts. That is what you want as input to exon-level differential usage with DEXSeq. It is not a substitute for isoform quantification.

featureCounts versus Salmon, kallisto, and RSEM

The real decision is not which counter to run but which model of the data you want. featureCounts requires alignment to the genome first, usually with STAR or HISAT2 or Subread’s own align. The Rsubread pipeline of align plus featureCounts is faster and lighter on memory than STAR-based alternatives while producing comparable gene-level counts 3. If you are working on a laptop or a modest cloud instance, that combination is a reasonable default.

Transcript-level quantifiers (Salmon, kallisto, RSEM) assign reads probabilistically across isoforms and report estimated counts and TPM. They recover isoform-level structure that featureCounts cannot, and they handle multi-mapping within a gene family gracefully. Benchmarks on long non-coding RNAs, which are lowly expressed and heavily overlapping, found that the choice of quantifier is one of the larger sources of variation in the results 4. For lncRNA work we would use a transcript-aware tool.

Pipeline comparisons also show that swapping quantification tools changes the set of genes called differentially expressed, even when the aligner and the annotation are held constant 5. The practical lesson is to pick one pipeline, record its version, and not mix outputs across versions in the same analysis.

featureCounts remains the standard for gene-level differential expression at scale. Large uniformly processed resources rely on it precisely because it is deterministic and cheap: the eQTL Catalogue quantifies gene expression with featureCounts across hundreds of datasets 6, and recount3 exposes gene and exon counts for over 700,000 human and mouse samples 7.

Failure modes that produce plausible-looking garbage

The summary file that featureCounts writes next to your counts (counts.txt.summary) is the first thing to read, before the counts themselves. It reports assigned, unassigned-ambiguity, unassigned-nofeatures, unassigned-multimapping, and unassigned-mappingquality. A healthy poly-A human library usually lands somewhere in the 60 to 85 percent assigned range.

Low assignment has a short list of causes. Wrong -s is the most common. Chromosome naming mismatch is the second: a BAM aligned to UCSC-style chr1 against an Ensembl GTF using 1 assigns essentially nothing, and featureCounts will not complain loudly. Check with samtools idxstats and cut -f1 annotation.gtf | sort -u. A high nofeatures fraction with correct naming often means genomic DNA contamination or intron retention. In that case the software is often not the problem.

Two more traps are subtler. First, single-cell or UMI data should not go through featureCounts as-is, because PCR duplicates are counted as separate reads. Second, the Length column in the output is the union-exon length of the meta-feature, so dividing by it gives a gene-level FPKM or TPM that is not the same quantity a transcript-aware tool reports. Tools built specifically for that conversion compute effective lengths differently 8. If you need TPM for a published gene signature, use the same normalization the signature was derived with, since signatures are sensitive to the quantification used 9.

Questions people also ask

Does featureCounts need a sorted BAM? No. It handles unsorted, coordinate-sorted, and name-sorted input. For paired-end data it does its own read-pair reordering internally. Coordinate-sorted BAMs are fine and are what you probably have from STAR.

Can I run it from R instead of the command line? Yes. The Rsubread package exposes featureCounts() with the same arguments and returns a list containing the count matrix, the annotation, and the summary statistics 3. This is convenient if the rest of your analysis is in R.

Should I use -M for my experiment? Only if your question is about repeats, paralogs, or transposable elements. In those cases unique-mapping-only counting discards most of the relevant reads 2. For protein-coding differential expression, leave it off.

What annotation should I use? Pick one release of GENCODE or Ensembl and stay on it. Comparing counts generated against different annotation versions introduces differences that have nothing to do with your samples.

Can featureCounts tell me which isoform is expressed? No. Use Salmon, kallisto, or RSEM for isoform-level estimates. Treat featureCounts output as gene-level only. Interpreting any of these numbers as a statement about your health requires a clinician.

Footnotes

  1. Yang Liao, Gordon K. Smyth, Wei Shi. featureCounts: an efficient general purpose program for assigning sequence reads to genomic features. Bioinformatics, 2013. https://doi.org/10.1093/bioinformatics/btt656 ↩ ↩2

  2. Aurélie Teissandier, Nicolas Servant, Emmanuel Barillot, et al. Tools and best practices for retrotransposon analysis using high-throughput sequencing data. Mobile DNA, 2019. https://doi.org/10.1186/s13100-019-0192-1 ↩ ↩2

  3. Yang Liao, Gordon K Smyth, Wei Shi. The R package Rsubread is easier, faster, cheaper and better for alignment and quantification of RNA sequencing reads. Nucleic Acids Research, 2019. https://doi.org/10.1093/nar/gkz114 ↩ ↩2

  4. Hong Zheng, Kevin Brennan, Mikel Hernaez, et al. Benchmark of long non-coding RNA quantification for RNA sequencing of cancer samples. GigaScience, 2019. https://doi.org/10.1093/gigascience/giz145 ↩

  5. Louisa Wessels Perelo, Gisela Gabernet, Daniel Straub, et al. How tool combinations in different pipeline versions affect the outcome in RNA-seq analysis. NAR Genomics and Bioinformatics, 2024. https://doi.org/10.1093/nargab/lqae020 ↩

  6. Nurlan Kerimov, James D. Hayhurst, Kateryna Peikova, et al. A compendium of uniformly processed human gene expression and splicing quantitative trait loci. Nature Genetics, 2021. https://doi.org/10.1038/s41588-021-00924-w ↩

  7. Christopher Wilks, Shijie C. Zheng, Feng Yong Chen, et al. recount3: summaries and queries for large-scale RNA-seq expression and splicing. Genome Biology, 2021. https://doi.org/10.1186/s13059-021-02533-6 ↩

  8. Roberto Vera Alvarez, Lorinc Sandor Pongor, Leonardo Mariño-Ramírez, et al. TPMCalculator: one-step software to quantify mRNA abundance of genomic features. Bioinformatics, 2018. https://doi.org/10.1093/bioinformatics/bty896 ↩

  9. Steven A. Buechler, Melissa T. Stephens, Amanda B. Hummon, et al. ColoType: a forty gene signature for consensus molecular subtyping of colorectal cancer tumors using whole-genome assay or targeted RNA-sequencing. Scientific Reports, 2020. https://doi.org/10.1038/s41598-020-69083-y ↩

Pothos builds longitudinal molecular profiles of individuals: whole-genome sequencing, single-cell RNA sequencing, and plasma proteomics, delivered as a detailed report, every data file, and stored cells. Build your profile.