#For the intergenic region, we will require the size of the chromosomes.
wget http://xxx.chrom.sizes
cat xxx.chrom.sizes | sed 's/^chr//' | sed 's/Cp/Pt/' > tmp
mv tmp xxx.chrom.sizes
gunzip -c genome_file.gtf.gz |
awk 'BEGIN{OFS="\t";} $3=="gene" {print $1,$4-1,$5}' |
bedtools sort -g xxx.chrom.sizes |
bedtools complement -i stdin -g xxx.chrom.sizes |
gzip > my_intergenic.bed.gz