Hi,

How to create ribosomal RNA Interval list for to be used with picard CollectRNASeqMetrics?

I have mapped reads to Drosophila_melanogaster Ensembl Genome with Ensembl GTF. I need to identify the percent of reads mapping to ribosomal RNA? Is there a way to create interval list from GTF file?

Thanks!
<p><a href="http://samtools.github.io/htsjdk/javadoc/htsjdk/htsjdk/samtools/util/IntervalList.html">The documentation for the IntervalList format</a> is somewhat hard to find. From the linked page:</p>

<p><em>Represents a list of intervals against a reference sequence that can be written to and read from a file. The file format is relatively simple and reflects the SAM alignment format to a degree. A SAM style header must be present in the file which lists the sequence records against which the intervals are described. After the header the file then contains records one per line in text format with the following values tab-separated: Sequence name, Start position (1-based), End position (1-based, end inclusive), Strand (either + or -), Interval name (an, ideally unique, name for the interval),</em></p>

<p>So the first thing you need to do is get the header from your SAM/BAM file:</p>

<p><code>samtools view -H [your.bam] &gt; intervalList.txt</code></p>

<p>If your GTF file is standard and we assume that it contains only ribosomal intervals, then we need the first, fourth, fifth, seventh, and ninth fields from the file. We can append them onto our text file which contains the header:</p>

<p><code>cut -s -f 1,4,5,7,9 [your.gtf] &gt;&gt; intervalListBody.txt</code></p>

<p>This is a very basic approach and you&#39;ll probably want to modify it somewhat for your specific needs, but hopefully it&#39;s a good start.</p>
