<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>

CC BY-SA 4.0
2022-10-16T17:02:43.453Z
Thanks so much for the detailed answer!
Michael Dunne
CC BY-SA 4.0
2022-10-18T17:05:56.603Z
@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).
user172818
CC BY-SA 4.0
2022-10-16T12:21:30.777Z
2022-10-16T13:46:04.170Z
2022-10-16T13:46:04.170Z
terdon
<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>

CC BY-SA 4.0
2022-10-17T13:02:09.167Z
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).
Community
CC BY-SA 4.0
2022-10-18T08:29:41.743Z
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.
terdon
CC BY-SA 4.0
2022-10-17T09:44:25.730Z
2022-10-17T09:44:25.730Z
notACruiser
<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>

CC BY-SA 4.0
2022-10-15T08:47:59.257Z
You have asked for a 'programmatic' solution; what programming language?
gringer
CC BY-SA 4.0
2022-10-16T09:21:36.030Z
I'll be using Python, but anything using the UniProt/GenBank/etc. REST APIs would work.
Michael Dunne
CC BY-SA 4.0
2022-10-16T09:22:10.633Z
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
Michael Dunne
CC BY-SA 4.0
2022-10-18T17:15:34.380Z
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).
user172818
<uniprot><genbank><sequence-annotation>
Get genome coordinates from UniProt entry?
# 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:

You also need the gene name, ZEAMMB73_Zm00001d029604 in this case, available further up on the page in the "Names & Taxonomy" section:

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:
#!/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**: @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).  

---

### 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.  

---

