Answers.Body: <p>You don't want the EU968504, that's the mRNA not the genome sequence. You want <a href="https://www.ncbi.nlm.nih.gov/nuccore/CM007647" rel="nofollow noreferrer">https://www.ncbi.nlm.nih.gov/nuccore/CM007647</a>, also linked to from the UniProt page, just under the link to EU968504:</p>
  <p><a href="https://i.sstatic.net/WFaDX.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/WFaDX.png" alt="Screenshot of the UniProt page with the link" /></a></p>
  <p>You also need the gene name, <code>ZEAMMB73_Zm00001d029604</code> in this case, available further up on the page in the &quot;Names &amp; Taxonomy&quot; section:</p>
  <p><a href="https://i.sstatic.net/7NOIt.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/7NOIt.png" alt="Screenshot of UniProt page showing the relevant section" /></a></p>
  <p>Next, we can download the GenBank file for the relevant chromosomal contig  using NCBI's entrez API:</p>
  <pre><code>curl &quot;https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nuccore&amp;id=CM007647&amp;rettype=gbwithparts&amp;retmode=text&quot; &gt; CM007647
  </code></pre>
  <p>This will take a few minutes. Once that is done, you can parse the file and extract the start and end coordinates using something like this:</p>
  <pre class="lang-py prettyprint-override"><code>#!/usr/bin/env python3
  from Bio import SeqIO
  import sys
  
  gb_record=SeqIO.read(open(sys.argv[1],&quot;r&quot;), &quot;genbank&quot;)
  
  for feature in gb_record.features:
      if feature.type == &quot;gene&quot; and sys.argv[2] in feature.qualifiers['locus_tag']:
          if feature.location.strand == 1:
              strand = &quot;+&quot;
          elif feature.location.strand == -1:
              strand = &quot;-&quot;
          else:
              print(&quot;Unknown strand: &quot;, feature.location.strand)
              sys.exit(1)
              
          print(&quot;%s\t%s\t%s\t%s\t%s\t%s\t%s\t.\t.&quot; % (gb_record.id, &quot;GenBank&quot;,
                                                      feature.type, feature.location.start,
                                                      feature.location.end, &quot;.&quot;, strand))
  </code></pre>
  <p>You pass the GenBank file and gene name as arguments, and this is the result:</p>
  <pre><code>$ foo.py CM007647  ZEAMMB73_Zm00001d029604
  CM007647.1  GenBank gene    78770080    78773320    .   +   .   .
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-10-16T17:02:43.453Z
Answers.Text: Thanks so much for the detailed answer!
Answers.UserDisplayName: Michael Dunne
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-10-18T17:05:56.603Z
Answers.Text: @MichaelDunne CM007647 comes from GRAMENE-4.0, not the latest NAM-5.0 maize genome. On NAM-5.0, this gene is located at [1:77,982,020-77,986,746](https://plants.ensembl.org/Zea_mays/Location/View?db=;g=Zm00001eb020790;r=1:77981786-77986512;t=Zm00001eb020790_T001).
Answers.UserDisplayName: user172818
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-10-16T12:21:30.777Z
Answers.LastActivityDate: 2022-10-16T13:46:04.170Z
Answers.LastEditDate: 2022-10-16T13:46:04.170Z
Answers.UserDisplayName: terdon
Answers.Body: <p>You could align back the peptide sequence to the genome, respecting splicing, for example using <a href="https://github.com/lh3/miniprot" rel="nofollow noreferrer">miniprot</a> from Heng Li.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-10-17T13:02:09.167Z
Answers.Text: As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Answers.UserDisplayName: Community
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-10-18T08:29:41.743Z
Answers.Text: Hi and welcome to the site! We like answers to be a bit more comprehensive here. Could you expand your answer to explain how to use `miniprot` to do what the OP asks for? Also, you would need to explain how to go from a protein accession to its fasta sequence to then use that to align to the genome, as well as how to figure out which genome to align to and how to differentiate between homologs.
Answers.UserDisplayName: terdon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-10-17T09:44:25.730Z
Answers.LastActivityDate: 2022-10-17T09:44:25.730Z
Answers.UserDisplayName: notACruiser
Body: <p>I'm trying to get genome coordinate information programmatically for multiple genes.</p>
  <p>As an example, I'd like to get the annotation (list of exons and their chromosomes, starts, and ends) for this UniProt entry: <a href="https://www.uniprot.org/uniprotkb/B6TU39/entry" rel="nofollow noreferrer">https://www.uniprot.org/uniprotkb/B6TU39/entry</a>.</p>
  <p>There is a corresponding GenBank entry, which gives the CDS (<a href="https://www.ncbi.nlm.nih.gov/nuccore/EU968504" rel="nofollow noreferrer">https://www.ncbi.nlm.nih.gov/nuccore/EU968504</a>) but I can't see anywhere how to extract the genome coordinates. How can I do this?</p>
  <p>Thanks!</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-10-15T08:47:59.257Z
Comments.Text: You have asked for a 'programmatic' solution; what programming language?
Comments.UserDisplayName: gringer
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-10-16T09:21:36.030Z
Comments.Text: I'll be using Python, but anything using the UniProt/GenBank/etc. REST APIs would work.
Comments.UserDisplayName: Michael Dunne
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-10-16T09:22:10.633Z
Comments.Text: In the first instance it'd be useful just to know how to do it using the website GUIs, as that's likely to give enough clues
Comments.UserDisplayName: Michael Dunne
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-10-18T17:15:34.380Z
Comments.Text: Talking of web GUIs, you can use [Ensembl plants](https://plants.ensembl.org/index.html). Put the uniprot accession in the search box and you will find the [gene page](https://plants.ensembl.org/Zea_mays/Location/View?db=;g=Zm00001eb020790;r=1:77981786-77986512;t=Zm00001eb020790_T001).
Comments.UserDisplayName: user172818
Tags: <uniprot><genbank><sequence-annotation>
Title: Get genome coordinates from UniProt entry?
ThreadText: # Get genome coordinates from UniProt entry?
  
  (Asked by: username_0 on 2022-10-14)
  
  I'm trying to get genome coordinate information programmatically for multiple genes.
  
  As an example, I'd like to get the annotation (list of exons and their chromosomes, starts, and ends) for this UniProt entry: <https://www.uniprot.org/uniprotkb/B6TU39/entry>.
  
  There is a corresponding GenBank entry, which gives the CDS (<https://www.ncbi.nlm.nih.gov/nuccore/EU968504>) but I can't see anywhere how to extract the genome coordinates. How can I do this?
  
  Thanks!
  
  **Tags:** uniprot, genbank, sequence-annotation
  
  > **Comments:**
  > **username_1**: You have asked for a 'programmatic' solution; what programming language?  
  > **username_0**: I'll be using Python, but anything using the UniProt/GenBank/etc. REST APIs would work.  
  > **username_0**: In the first instance it'd be useful just to know how to do it using the website GUIs, as that's likely to give enough clues  
  > **username_2**: Talking of web GUIs, you can use [Ensembl plants](https://plants.ensembl.org/index.html). Put the uniprot accession in the search box and you will find the [gene page](https://plants.ensembl.org/Zea_mays/Location/View?db=;g=Zm00001eb020790;r=1:77981786-77986512;t=Zm00001eb020790_T001).  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2022-10-16. Score: 2 | Accepted answer
  
  You don't want the EU968504, that's the mRNA not the genome sequence. You want <https://www.ncbi.nlm.nih.gov/nuccore/CM007647>, also linked to from the UniProt page, just under the link to EU968504:
  
  [![Screenshot of the UniProt page with the link](https://i.sstatic.net/WFaDX.png)](https://i.sstatic.net/WFaDX.png)
  
  You also need the gene name, `ZEAMMB73_Zm00001d029604` in this case, available further up on the page in the "Names & Taxonomy" section:
  
  [![Screenshot of UniProt page showing the relevant section](https://i.sstatic.net/7NOIt.png)](https://i.sstatic.net/7NOIt.png)
  
  Next, we can download the GenBank file for the relevant chromosomal contig using NCBI's entrez API:
  
  ```
  curl "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nuccore&id=CM007647&rettype=gbwithparts&retmode=text" > CM007647
  
  ```
  
  This will take a few minutes. Once that is done, you can parse the file and extract the start and end coordinates using something like this:
  
  ```py
  #!/usr/bin/env python3
  from Bio import SeqIO
  import sys
  
  gb_record=SeqIO.read(open(sys.argv[1],"r"), "genbank")
  
  for feature in gb_record.features:
      if feature.type == "gene" and sys.argv[2] in feature.qualifiers['locus_tag']:
          if feature.location.strand == 1:
              strand = "+"
          elif feature.location.strand == -1:
              strand = "-"
          else:
              print("Unknown strand: ", feature.location.strand)
              sys.exit(1)
              
          print("%s\t%s\t%s\t%s\t%s\t%s\t%s\t.\t." % (gb_record.id, "GenBank",
                                                      feature.type, feature.location.start,
                                                      feature.location.end, ".", strand))
  
  ```
  
  You pass the GenBank file and gene name as arguments, and this is the result:
  
  ```
  $ foo.py CM007647  ZEAMMB73_Zm00001d029604
  CM007647.1  GenBank gene    78770080    78773320    .   +   .   .
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks so much for the detailed answer!  
  > **username_2**: @username_0 CM007647 comes from GRAMENE-4.0, not the latest NAM-5.0 maize genome. On NAM-5.0, this gene is located at [1:77,982,020-77,986,746](https://plants.ensembl.org/Zea_mays/Location/View?db=;g=Zm00001eb020790;r=1:77981786-77986512;t=Zm00001eb020790_T001).  
  
  ---
  
  ### Answer by username_4 on 2022-10-17. Score: 0
  
  You could align back the peptide sequence to the genome, respecting splicing, for example using [miniprot](https://github.com/lh3/miniprot) from Heng Li.
  
  > **Comments:**
  > **username_5**: As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer).  
  > **username_3**: Hi and welcome to the site! We like answers to be a bit more comprehensive here. Could you expand your answer to explain how to use `miniprot` to do what the OP asks for? Also, you would need to explain how to go from a protein accession to its fasta sequence to then use that to align to the genome, as well as how to figure out which genome to align to and how to differentiate between homologs.  
  
  ---
  
  