Answers.Body: <p>The <a href="https://www.gencodegenes.org/human/" rel="nofollow noreferrer">current release</a> of Gencode for <code>hg38</code> is v38. This is one way you could get a list of Gencode gene annotations:</p>
  <pre><code>$ wget -qO- ftp://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_38/gencode.v38.annotation.gff3.gz \
      | gunzip --stdout - \
      | awk '$3 == &quot;gene&quot;' - \
      | convert2bed -i gff - \
      &gt; genes.bed
  </code></pre>
  <p>To get <code>convert2bed</code>, you could install a toolkit called BEDOPS, which is available via <a href="https://github.com/bedops/bedops" rel="nofollow noreferrer">Github</a> or package managers. Refer to the <a href="https://bedops.readthedocs.io/en/latest/content/installation.html" rel="nofollow noreferrer">installation instructions</a> for more detail.</p>
  <p>Once you have <code>genes.bed</code>, you don't need to make it again, unless Gencode publishes a new set of annotations.</p>
  <p>You could create a text file called <code>genes_of_interest.txt</code> that contains your HGNC names of interest, e.g.:</p>
  <pre><code>$ cat &gt; genes_of_interest.txt
  CASZ1
  MTHFR
  ST7L
  </code></pre>
  <p>Press <kbd>Ctrl</kbd> + <kbd>D</kbd> at the end to close the file.</p>
  <p>To search <code>genes.bed</code> for entries where there are matches to your genes of interest, you can use <code>grep</code>:</p>
  <pre><code>$ 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
  </code></pre>
  <p>The above is just sample output. Your result may differ.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-10-25T13:35:08.463Z
Answers.LastActivityDate: 2021-10-25T13:35:08.463Z
Answers.UserDisplayName: Alex Reynolds
Body: <p>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.</p>
  <p>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 <a href="https://genome.ucsc.edu/cgi-bin/hgTables" rel="nofollow noreferrer">https://genome.ucsc.edu/cgi-bin/hgTables</a>. As an example, suppose I click &quot;paste list&quot; and just type the following two lines:</p>
  <pre><code>CASZ1
  MTHFR
  </code></pre>
  <p>Here's a screenshot of the output (click to see full sized image):</p>
  <p><a href="https://ibb.co/MZthX6N" rel="nofollow noreferrer"><img src="https://i.ibb.co/4KXfQdN/temp.jpg" alt="" /></a></p>
  <p>I think this page is generally intended to go the opposite direction (genomic coordinates -&gt; genes)?</p>
  <p>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.</p>
  <pre><code>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
  </code></pre>
  <p>I obtained these by searching through genome.ucsc.edu one by one manually.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-10-20T10:39:57.157Z
Comments.Text: 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?
Comments.UserDisplayName: terdon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-10-20T12:26:08.473Z
Comments.Text: @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 https://www.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?
Comments.UserDisplayName: J.D.
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-10-20T12:36:48.930Z
Comments.Text: 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.
Comments.UserDisplayName: terdon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-10-20T13:12:23.547Z
Comments.Text: Does this answer your question? [Create BED file from list with gene symbols](https://bioinformatics.stackexchange.com/questions/17647/create-bed-file-from-list-with-gene-symbols)
Comments.UserDisplayName: user324810
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-10-21T03:54:13.830Z
Comments.Text: @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
Comments.UserDisplayName: J.D.
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-10-24T02:04:06.147Z
Comments.Text: @user324810 Regarding your answer in that question link you posted, yes, that's the webpage I tried. As I wrote in my question though, it returns a long output page when I input just 2 symbols, which seems not right. Even stranger is why it provides the option of specifying gene position, when the goal is to find the gene position!
  
  I'll add some more clarification to my question.
Comments.UserDisplayName: J.D.
Tags: <genome>
Title: How to Find List of Genomic Coordinates from List of Genes using UCSC Website?
ThreadText: # How to Find List of Genomic Coordinates from List of Genes using UCSC Website?
  
  (Asked by: username_0 on 2021-10-20)
  
  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:
  
  ```
  CASZ1
  MTHFR
  
  ```
  
  Here's a screenshot of the output (click to see full sized image):
  
  [![](https://i.ibb.co/4KXfQdN/temp.jpg)](https://ibb.co/MZthX6N)
  
  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.
  
  **Tags:** genome
  
  > **Comments:**
  > **username_1**: 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?  
  > **username_0**: @username_1 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 https://www.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?  
  > **username_1**: 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.  
  > **username_2**: Does this answer your question? [Create BED file from list with gene symbols](https://bioinformatics.stackexchange.com/questions/17647/create-bed-file-from-list-with-gene-symbols)  
  > **username_0**: @username_1 Ok, I have updated the question. Just taking a quick look at username_2 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  
  > **username_0**: @username_2 Regarding your answer in that question link you posted, yes, that's the webpage I tried. As I wrote in my question though, it returns a long output page when I input just 2 symbols, which seems not right. Even stranger is why it provides the option of specifying gene position, when the goal is to find the gene position!  I'll add some more clarification to my question.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2021-10-25. Score: 1
  
  The [current release](https://www.gencodegenes.org/human/) 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](https://github.com/bedops/bedops) or package managers. Refer to the [installation instructions](https://bedops.readthedocs.io/en/latest/content/installation.html) 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
  CASZ1
  MTHFR
  ST7L
  
  ```
  
  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.
  
  
  ---
  
  