This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Obtaining .bed list of exons of chr17

I would like to download/build a simple .bed file with all the exon regions oh chr17. Can anyone help me with that?

Thank you in advance.

bed exon

1 answer

Via BEDOPS convert2bed:

$ wget -qO- ftp://ftp.sanger.ac.uk/pub/gencode/Gencode_human/release_26/GRCh37_mapping/gencode.v26lift37.annotation.gff3.gz \
    | gunzip --stdout - \
    | awk '$3 == "exon"' - \
    | convert2bed -i gff - \
    > exons.bed

Then you can use BEDOPS bedextract to quickly get a subset:

$ bedextract chr17 exons.bed > exons.chr17.bed

This does a binary search through the sorted exons.bed file to get the chromosome you want, and will work much faster than a naive, linear walk through the file.

If you really just want chr17 and don't care about the rest:

$ wget -qO- ftp://ftp.sanger.ac.uk/pub/gencode/Gencode_human/release_26/GRCh37_mapping/gencode.v26lift37.annotation.gff3.gz \
    | gunzip --stdout - \
    | awk '($3 == "exon") && ($1 == "chr17")' - \
    | convert2bed -i gff - \
    > exons.chr17.bed

Log in to answer this question.