<p>If downloading the complete database is not an option, you may able to use the instructions from this help page (based on the gff format for any given query):</p>
<p><a href="https://www.uniprot.org/help/download_subsequences" rel="nofollow noreferrer">https://www.uniprot.org/help/download_subsequences</a></p>

CC BY-SA 4.0
2021-03-08T08:36:09.570Z
2021-03-08T08:36:09.570Z
Elisabeth.Gasteiger
<p>I know how to generally pull down information for a UniProt entry using the REST API, for example:</p>
<p><a href="https://www.uniprot.org/uniprot/?query=id:Q9UJL9&amp;sort=score&amp;columns=id,go(molecular%20function)&amp;format=tab" rel="nofollow noreferrer">https://www.uniprot.org/uniprot/?query=id:Q9UJL9&amp;sort=score&amp;columns=id,go(molecular%20function)&amp;format=tab</a></p>
<p>I'm looking at <a href="https://www.uniprot.org/uniprot/Q9UBU3" rel="nofollow noreferrer">this</a> entry as an example. I'm able to pull down most of the attributes I want with a variation of the API query above, however, I'm stuck on one part.</p>
<p>For all human proteins, I want to pull down the peptide sequences that come from that protein.</p>
<p>In the example above, it would be the sequences of the peptides associated with this section:</p>
<p><a href="https://i.sstatic.net/HcDzq.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/HcDzq.png" alt="enter image description here" /></a></p>
<p>Can this be done with the API or do I have to come with a scraping method for all human proteins where I (1) get the protein sequence of each entry, (2) get this table, (3) calculate where the peptides start and end from the sequence in step 1?
I feel like this alternative will be much slower, so I want to check I'm not missing anything obvious.</p>

CC BY-SA 4.0
2021-02-03T12:17:46.270Z
Downloading the whole of Uniprot and filtering for humans is probably a nicer solution. It is in XML format, which is a bit of a pain, but is a goldmine of data, which you may need —totally depends on your plans and how they may _evolve_. E.g. I have written [my own Python XML Uniprot parser](https://github.com/matteoferla/MichelaNGLo-protein-module/blob/master/michelanglo_protein/generate/_protein_uniprot_mixin.py) due to my needs and I have [a human scraped dataset](https://github.com/matteoferla/MichelaNGLo-human-protein-data) that is heavily focused on my project which expanded with time.
Matteo Ferla
<uniprot><api>
How to extract all peptide sequences for a UniProt protein entry with an API?
# How to extract all peptide sequences for a UniProt protein entry with an API?

(Asked by: username_0 on 2021-01-29)

I know how to generally pull down information for a UniProt entry using the REST API, for example:

<https://www.uniprot.org/uniprot/?query=id:Q9UJL9&sort=score&columns=id,go(molecular%20function)&format=tab>

I'm looking at [this](https://www.uniprot.org/uniprot/Q9UBU3) entry as an example. I'm able to pull down most of the attributes I want with a variation of the API query above, however, I'm stuck on one part.

For all human proteins, I want to pull down the peptide sequences that come from that protein.

In the example above, it would be the sequences of the peptides associated with this section:

[![enter image description here](https://i.sstatic.net/HcDzq.png)](https://i.sstatic.net/HcDzq.png)

Can this be done with the API or do I have to come with a scraping method for all human proteins where I (1) get the protein sequence of each entry, (2) get this table, (3) calculate where the peptides start and end from the sequence in step 1?
I feel like this alternative will be much slower, so I want to check I'm not missing anything obvious.

**Tags:** uniprot, api
> **Comments:**
> **username_1**: Downloading the whole of Uniprot and filtering for humans is probably a nicer solution. It is in XML format, which is a bit of a pain, but is a goldmine of data, which you may need —totally depends on your plans and how they may _evolve_. E.g. I have written [my own Python XML Uniprot parser](https://github.com/matteoferla/MichelaNGLo-protein-module/blob/master/michelanglo_protein/generate/_protein_uniprot_mixin.py) due to my needs and I have [a human scraped dataset](https://github.com/matteoferla/MichelaNGLo-human-protein-data) that is heavily focused on my project which expanded with time.  

---

## 1 answers

### Answer by username_2 on 2021-03-08. Score: 1

If downloading the complete database is not an option, you may able to use the instructions from this help page (based on the gff format for any given query):

<https://www.uniprot.org/help/download_subsequences>


---

