Suppose I have a list of genes and I want to find their genomic coordinates. To be specific and to keep things consistent with the rest of my project, I'm using hg38 on the website genome.ucsc.edu. So far, I've been typing one gene symbol at a time into the gene browser and clicking the correct match. This sends me to the gene's page, which shows me the start and end genome coordinates for the gene's transcript and coding region. That's what I'm looking for.

This is a tedious process when I have hundreds of genes to go through, so I was wondering if I can input a list and get out a list instead. I know about the page https://genome.ucsc.edu/cgi-bin/hgTables. As an example, suppose I click "paste list" and just type the following two lines:


Here's a screenshot of the output (click to see full sized image):

I think this page is generally intended to go the opposite direction (genomic coordinates -> genes)?

Edit: Ok, here's an example of what I want. I'd like to just enter the gene symbols and get the transcript and coding regions shown.

CASZ1, Transcript chr1:10,636,604-10,796,646, Coding Region chr1:10,638,942-10,693,889
MTHFR, Transcript chr1:11,785,723-11,805,964, Coding Region chr1:11,790,680-11,803,116
ST7L, Transcript chr1:112,525,883-112,618,928, Coding Region chr1:112,526,013-112,598,043

I obtained these by searching through genome.ucsc.edu one by one manually.

  • $\begingroup$ Does it have to be from the UCSC browser? It isn't the best tool for this sort of thing. Are you open to other tools? $\endgroup$
    – terdon
    Commented Oct 20, 2021 at 10:39
  • $\begingroup$ @terdon I prefer UCSC browser because I used it for gene mapping earlier in this project. Redoing everything after that step is too costly at this point. So if I switch to another website, I'll probably have to accept some inconsistency. For instance, I tried looking up a few genomic coordinates on ncbi.nlm.nih.gov/datasets/tables/genes. Coordinates are roughly similar to UCSC's transcript coordinates, but a little bit different. Unless there's a tool that can recover exactly what UCSC would have given me? $\endgroup$
    – J.D.
    Commented Oct 20, 2021 at 12:26
  • $\begingroup$ Yes, you can get the data directly from the UCSC database. I just wouldn't use the browser for this. Can you give us some input data that we can use to test any solution? Just edit your question and show us a few lines of what you have (different IDs would require different approaches). Also, please clarify if you want the location of the gene (depending on your definition, this can include promoters and other regulatory sequences) or just the gene's various transcripts. $\endgroup$
    – terdon
    Commented Oct 20, 2021 at 12:36
  • 3
    $\begingroup$ Does this answer your question? Create BED file from list with gene symbols $\endgroup$
    – user324810
    Commented Oct 20, 2021 at 13:12
  • $\begingroup$ @terdon Ok, I have updated the question. Just taking a quick look at user324810 link though, it seems to assume familiarity with something that I haven't seen before; so I'll have to look into how to use that. Thanks $\endgroup$
    – J.D.
    Commented Oct 21, 2021 at 3:54

1 Answer 1


The current release of Gencode for hg38 is v38. This is one way you could get a list of Gencode gene annotations:

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

To get convert2bed, you could install a toolkit called BEDOPS, which is available via Github or package managers. Refer to the installation instructions for more detail.

Once you have genes.bed, you don't need to make it again, unless Gencode publishes a new set of annotations.

You could create a text file called genes_of_interest.txt that contains your HGNC names of interest, e.g.:

$ cat > genes_of_interest.txt

Press Ctrl + D at the end to close the file.

To search genes.bed for entries where there are matches to your genes of interest, you can use grep:

$ grep -Fwf genes_of_interest.txt genes.bed
chr1    10636603    10796650    ENSG00000130940.14  .   -   HAVANA  gene    .   ID=ENSG00000130940.14;gene_id=ENSG00000130940.14;gene_type=protein_coding;gene_name=CASZ1;level=1;havana_gene=OTTHUMG00000002035.5
chr1    11785722    11806920    ENSG00000177000.11  .   -   HAVANA  gene    .   ID=ENSG00000177000.11;gene_id=ENSG00000177000.11;gene_type=protein_coding;gene_name=MTHFR;level=2;havana_gene=OTTHUMG00000002277.5
chr1    112523517   112620825   ENSG00000007341.18  .   -   HAVANA  gene    .   ID=ENSG00000007341.18;gene_id=ENSG00000007341.18;gene_type=protein_coding;gene_name=ST7L;level=2;havana_gene=OTTHUMG00000011753.7

The above is just sample output. Your result may differ.


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.