#To obtain introns, we simply need the gene and exonic coordinates;
#by subtracting the exonic regions from the genic region, we have the intronic region.
gunzip -c genome_file.gtf.gz |
awk 'BEGIN{OFS="\t";} $3=="gene" {print $1,$4-1,$5}' |
bedtools sort |
bedtools subtract -a stdin -b my_exon.bed.gz |
gzip > my_intron.bed.gz