Is there a way to generate a BED file of a list of gene symbols for a given genome?
2 Answers
$\begingroup$
$\endgroup$
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