19 Fractional counting

–fraction Assign fractional counts to features. This option must be used together with ‘-M’ or ‘-O’ or both. When ‘-M’ is specified, each reported alignment from a multi-mapping read (identified via ‘NH’ tag) will carry a fractional count of 1/x, instead of 1 (one), where x is the total number of alignments reported for the same read. When ‘-O’ is specified, each overlapping feature will receive a fractional count of 1/y, where y is the total number of features overlapping with the read. When both ‘-M’ and ‘-O’ are specified, each alignment will carry a fractional count of 1/(x*y). # Overlap between reads and features

-O Assign reads to all their overlapping meta-features (or features if -f is specified). # Level of summarization

-f Perform read counting at feature level (eg. counting reads for exons rather than genes).


cd ~/Documents/RProjects/genomics/RNA-genomics/FASTQ
source $HOME/miniconda3/bin/activate
conda activate rnaseq

featureCounts -a r64/Saccharomyces_cerevisiae.R64-1-1.96.gtf.gz -M --fraction -o ../counts.txt ../BAM/*.bam

We can run all of these commands by creating a shell script. You should find this script in your RNA-genomics directory called “subreadMapping.sh”. Copy this file to the FASTQ directory. Let’s have a look at it. To run this ‘shell script’ you will need to open your terminal. Navigate to the FASTQ directory by typing cd ~/Documents/RProjects/genomics/RNA-genomics/FASTQ. You need to change permissions on your computer so that you can run a shell script by typing: ‘chmod 777 subreadMapping.sh’ (without the quotes) at the terminal prompt. Then type ‘./subreadMapping.sh’ or ‘sh subreadMapping.sh’ (without the quotes) at the prompt. This will run fastqc, the indexing, the alignment, and multiqc. Then you’re done! A file called ‘counts.txt’ should appear in your RNA-genomics directory.

Let’s try running it now.


cd ~/Documents/RProjects/genomics/RNA-genomics/FASTQ


chmod 777 subreadMapping.sh


sh subreadMapping.sh

Now let’s go look at our counts.summary file