rotifer.db.uniprot.webapi.idmapping#

Map database identifiers using UniProt’s ID mapping REST service.

The lower-level functions in this module (submit_id_mapping through get_id_mapping_results_stream) are adapted from the client script UniProt publishes alongside its ID mapping REST API documentation and implement the submit/poll/fetch job workflow used by that service. genbank_to_uniprot(), AF_link() and af_to_seq() are rotifer-specific wrappers built on top of them to cross-reference GenBank/RefSeq proteins with AlphaFold and PDB structures through UniProt.

Note#

This module makes live network requests; none of its examples are executed as doctests.

Functions

AF_link([id_list])

Build AlphaFold and PDB download URLs for a list of protein accessions.

af_to_seq(seqobj)

Attach AlphaFold structures to a rotifer sequence object.

check_id_mapping_results_ready(job_id)

Block until a submitted ID mapping job finishes.

check_response(response)

Raise for HTTP errors, printing the JSON error body first.

combine_batches(all_results, batch_results, ...)

Append one results page to the accumulated results.

decode_results(response, file_format, compressed)

Decode a results response body according to its file format.

genbank_to_uniprot([from_db, to_db, ids])

Map protein accessions to UniProt entries and their PDB/AlphaFold cross-references.

get_batch(batch_response, file_format, ...)

Iterate over the remaining pages of a paginated results response.

get_data_frame_from_tsv_results(tsv_results)

Parse TSV-formatted ID mapping results into a dataframe.

get_id_mapping_results_link(job_id)

Fetch the results URL of a finished ID mapping job.

get_id_mapping_results_search(url)

Fetch all pages of a finished ID mapping job through the search endpoint.

get_id_mapping_results_stream(url)

Fetch a finished ID mapping job through the streaming endpoint.

get_next_link(headers)

Extract the URL of the next results page from a Link header.

get_xml_namespace(element)

Extract the XML namespace URI from an element's tag.

merge_xml_results(xml_results)

Merge the entry elements of several UniProt XML pages.

print_progress_batches(batch_index, size, total)

Print a one-line progress message for a fetched results page.

submit_id_mapping(from_db, to_db, ids)

Submit an identifier mapping job to UniProt.

Classes

MappingCursor(*args, **kwargs)

Translate identifiers through UniProt's entry cross-references.