acore.io.uniprot package

acore.io.uniprot package#

Uniprot API user functions for fetching annotations for UniProt IDs and providing the results as a pandas.DataFrame.

fetch_annotations(ids: Index | list, fields: str = 'accession,go_p,go_c,go_f') DataFrame[source]#

Fetch annotations for UniProt IDs. Combines several calls to the API of UniProt’s knowledgebase (KB).

Parameters:
  • ids (pd.Index | list) – Iterable of UniProt IDs. Fetches annotations as speecified by the specified fields.

  • fields (str, optional) – Fields to fetch, by default “accession,go_p,go_c. See for availble fields: https://www.uniprot.org/help/return_fields

Returns:

DataFrame with annotations of the UniProt IDs.

Return type:

pd.DataFrame

process_annotations(annotations: DataFrame, fields: str) DataFrame[source]#

Process annotations fetched from UniProt API.

Parameters:
  • annotations (pd.DataFrame) – DataFrame with annotations fetched from UniProt API.

  • fields (str) – Fields that were fetched from the API. Comma-separated string. Fields needs to match number of columns in annotations.

Returns:

Processed DataFrame with annotations in long-format.

Return type:

pd.DataFrame

Submodules#