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…
-pspecies that fragments (or templates) will be counted instead of reads. This is only applicable for paired-end reads.-Oassigns reads to all their overlapping meta-features.-Tspecifies the number (n) of threads to be used.-ais the genome annotation file (example_genome_annotation.gtf).-ospecifies the name of the output file, which includes the read counts (example_featureCounts_output.txt).sorted_example_alignment.bamis 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
-sspecifies strand-specific read counting.0for unstranded reads,1for stranded reads and2for reversely stranded reads. This depends on the library used in the sequencing protocol.
Further reading
- The
subreaduser guide: http://bioinf.wehi.edu.au/subread-package/SubreadUsersGuide.pdf - The
featureCountspaper: https://doi.org/10.1093/bioinformatics/btt656