This is a test version of Biostars. For the public version, visit https://www.biostars.org.
make a BED file with exons only

I made a BED file with only exons (hg19) using UCSC table browser (https://genome.ucsc.edu/cgi-bin/hgTables).

But in my file I've found this regions, for example:

chr 1 146310551-146334210

chr 7 9229189-9229487

chr 14 76666574-76669131

chr 17 41341930-41342793

chr 21 19935632-19935690

Do you recognize them as exons? Because they seem to me to be intronic sequences. What can it be the problem?

vcf exons exon bed

What makes you think they are intronic regions? Did you search them into a Genome Browser?

Yes, I used NCBI Variation Viewer.

I asked because maybe I couldn't interpretate well the data on the genome browser.

For example this is what I get for the first interval:

enter image description here

The first interval span is about 23K bp, a bit big for an exon if you ask me. If you want to make a bed file containing the exon coordinates of the human genome, I will recommend you to download the GTF file, extract the exon lines, and convert it to bed format.

Does that file refer to hg19? I'm working with that reference

2 answers

You can download the hg19 GTF, for example here: https://www.gencodegenes.org/human/release_19.html

And after this, select only the lines with the word "exon" and extract the coordinates:

grep exon gencode.v19.chr_patch_hapl_scaff.annotation.gtf | cut -f1,4,5 > Human_exons.gtf

Also, you can add "sort -u" to remove duplicate exons

grep exon gencode.v19.chr_patch_hapl_scaff.annotation.gtf | cut -f1,4,5 | sort -u > Human_unique_exons.gtf

Also if you are not working with Linux or a Command Line, you can download them from Biomart https://www.ensembl.org/biomart/martview/0f2873b6b31d9a0aaf1e8f3122bdae0f

I hope it helps! :)

Remember that a BED file is 0-based while a GTF is 1-based coordinate system.

True, however note the question is tagged "vcf" so I assume OP wants to filter a VCF file using the BED. In such case OP can use bcftools which will accept a tab-delimited file with 1-based coordinates, such as the one produced by this answer ;) Just make sure it has a different file suffix than .bed (I usually use .tsv or .tab).

As a side note - with many small regions (such as exons), using e.g. bcftools view -T filter.bed is much much faster than bcftools view -R filter.bed, which is better suited for filtering a few larger regions. The -T flag will also let you invert the filter with ^.

You can upload a list of gene ids to the table browser, select the output format as BED and you will see an option to download only exons/introns related to those genes.

Log in to answer this question.