FeatureCounts
featureCounts
is a program that counts how many reads map to genomic features, such as genes, exon, promoter and genomic bins.
Counting how many reads align to each gene in a genome annotation using featureCounts
featureCounts
can be used to count how many reads align to genes as follows:
$ featureCounts -p -O -T n -a example_genome_annotation.gtf -o example_featureCounts_output.txt sorted_example_alignment.bam
In this command…
-p
species that fragments (or templates) will be counted instead of reads. This is only applicable for paired-end reads.-O
assigns reads to all their overlapping meta-features.-T
specifies the number (n
) of threads to be used.-a
is the genome annotation file (example_genome_annotation.gtf
).-o
specifies the name of the output file, which includes the read counts (example_featureCounts_output.txt
).sorted_example_alignment.bam
is an alignment file: in this file, the reads we want to count are aligned to the same genome as the annotation file.
Demonstration
In this video, featureCounts
is used to assign reads in an alignment file (sorted_example_alignment.bam
) to genes in a genome annotation file (example_genome_annotation.gtf
).
More important options for featureCounts
-s
specifies strand-specific read counting.0
for unstranded reads,1
for stranded reads and2
for reversely stranded reads. This depends on the library used in the sequencing protocol.
Further reading
- The
subread
user guide: http://bioinf.wehi.edu.au/subread-package/SubreadUsersGuide.pdf - The
featureCounts
paper: https://doi.org/10.1093/bioinformatics/btt656