3.5 years ago by
Since featureCounts gives you a matrix of reads counts with genomic feature as the row name and sample as the column name, you can calculate the number of reads that have been mapped to the features defined in your annotation by calculating the sum of your matrix.
fc <- featureCounts(files=bam_files,
reads_in_gtf_features <- sum(fc$counts)
It's well worth throughly reading the documentation for featureCounts since there are a lot of parameters and how you specify these will make a big difference to your end result.