# Extract mapping coverage from GTF files

I am doing paired end RNA-seq analysis. I used STAR mapper and then StringTie for getting quantification of my data. After successfully running StringTie, I got .gtf files which will give me information about genes, their coverage along with TPM and FPKM values. It also produced some more .ctab files.

I want to know how what percentage of my reads mapped to reference genome. I know this can be done with BAM or BED files produced after STAR alignment. However, I want to know if this can be done with output files generated by StringTie?

I just want to clarify my question after reading comments and answers I am getting. I want to know if this can be done with .gtf files of StringTie. As I mentioned before, I already know how to achieve this with BAM files. This is little bit weird situation because, I have deleted my BAM files to get more space on my hard drive. So I could just run entire analysis again, but wanted to know if it is possible without redoing whole analysis. Apologies for the confusion.

So consider this, you know how many reads map to each of your genes (1). Does that tell you anything about (2) the number of reads that mapped against non-gene regions (3) the number of reads that did not map against the genome at all?

If you only use the gtf files, you know the number of (1) but not of (2) and (3). To me it sounds like you would want to do something as described in this post.

What it boils down to is:

Finding out how many (unique) reads are mapped, counting pairs once

samtools view -F 0x4 foo.sorted.bam | cut -f 1 | sort | uniq | wc -l


Counting how many total reads you have. Since you have paired-end data the number of forward reads suffice:

cat forward_reads.fastq | grep '@' | wc -l


The percentage is then simply mapped_reads/total_reads

• @terdon sorry about that, I updated my answer – Jvstonebridge Jul 26 '19 at 10:56
• Perfect! Thank you and welcome aboard! – terdon Jul 26 '19 at 11:28

I want to know how what percentage of my reads mapped to reference genome.

And the Log.final.out file from STAR doesn't tell you that?