Skip to content

webservices.uniprot

Protein information from UniProt.

from pymetadata.webservices.uniprot import UniprotQuery

info = UniprotQuery.query("P69905")

See https://www.uniprot.org/.

UniprotQuery

Queries against the UniProt web service.

Responses are cached on disk for CACHE_DURATION_ONTOLOGY hours, see pymetadata.CACHE_USE. If UniProt cannot be reached, cached content is used however old it is.

query staticmethod

query(accession, cache=None, cache_path=None)

Query the information of a protein.

Parameters:

Name Type Description Default
accession str

accession of UniProt, e.g., P69905

required
cache bool | None

cache the response, defaults to pymetadata.CACHE_USE

None
cache_path Path | None

directory for cached responses, defaults to pymetadata.CACHE_PATH

None

Returns:

Type Description
dict[str, Any]

The protein information, empty if the accession is invalid, unknown

dict[str, Any]

or inactive, or if UniProt cannot be reached and nothing is cached.