Is there a way to generate a BED file of a list of gene symbols for a given genome?


2 Answers 2


Via Gencode and BEDOPS convert2bed:

$ wget -qO- ftp://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_28/gencode.v28.annotation.gff3.gz \
    | gunzip --stdout - \
    | awk '$3 == "gene"' - \
    | convert2bed -i gff - \
    > genes.bed

Replace the FTP path with that needed for your genome of interest. Feel free to edit your question if you need help with that, by specifying your given genome.

You can modify the awk statement to get exons, by replacing gene with exon.

BEDOPS: https://github.com/bedops/bedops

Once you have the genes in BED format, you can grep the file for them, using a text file of matches:

$ grep -Fwf genes_of_interest.txt genes.bed > genes_of_interest.bed

You could also get your genes from UCSC. Here's how:

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.