Package: uniprot-id-mapper
UniProtMapperA Python wrapper for UniProt'sRetrieve/ID MappingRESTful API. This package supports the following functionalities:Map (almost) any UniProtcross-referenced IDsto other identifiers & vice-versa;Programmatically  retrieve any of the supportedreturn fieldsfrom both UniProt-SwissProt and UniProt-TrEMBL (unreviewed) databases;For these, checkExample 1andExample 2below. Both functionalities can also be accessed through the CLI. For more information, checkCLI.InstallationFrom PyPI:python-mpipinstalluniprot-id-mapperDirectly from GitHub:python-mpipinstallgit+https://github.com/David-Araripe/UniProtMapper.gitFrom source:gitclonehttps://github.com/David-Araripe/UniProtMappercdUniProtMapper
python-mpipinstall.UsageExample 1: Mapping IDsTo map IDs, the user can either call the object directly or use thegetmethod to obtain the response. The different identifiers that are used by the API are designated by thefrom_dbandto_dbparameters. For example:fromUniProtMapperimportProtMappermapper=ProtMapper()result,failed=mapper.get(ids=["P30542","Q16678","Q02880"],from_db="UniProtKB_AC-ID",to_db="Ensembl")result,failed=mapper(ids=["P30542","Q16678","Q02880"],from_db="UniProtKB_AC-ID",to_db="Ensembl")Where failed corresponds to a list of the identifiers that failed to be mapped and result is the following pandas DataFrame:UniProtKB_AC-IDEnsembl0P30542ENSG00000163485.171Q16678ENSG00000138061.122Q02880ENSG00000077097.17Example 2: Retrieving informationThe supportedreturn fieldsare both accessible through UniProt's website or by the property.fields_table. For example:fromUniProtMapperimportProtMappermapper=ProtMapper()df=mapper.fields_tabledf.head()LabelLegacy Returned FieldReturned FieldField Type0EntryidaccessionNames & Taxonomy1Entry Nameentry nameidNames & Taxonomy2Gene Namesgenesgene_namesNames & Taxonomy3Gene Names (primary)genes(PREFERRED)gene_primaryNames & Taxonomy4Gene Names (synonym)genes(ALTERNATIVE)gene_synonymNames & TaxonomyTo retrieve information, the user can either call the object directly or use thegetmethod to obtain the response. For example:result,failed=mapper.get(["Q02880"])>>>Fetched:1/1result,failed=mapper(["Q02880"])>>>Fetched:1/1Custom returned fields can be retrieved by passing a list of fields to thefieldsparameter. These fields need to be withinUniProtRetriever.fields_table["Returned_Field"]and will be returned with columns named as their respectiveLabel.The object already has a list of default fields underself.default_fields, but these are ignored if the parameterfieldsis passed.fields=["accession","organism_name","structure_3d"]result,failed=mapper.get(["Q02880"],fields=fields)CLIThe package also comes with a CLI that can be used to map IDs and retrieve information. To map IDs, the user can use theprotmapcommand, accessible after installation. Here is a list of the available arguments, shown byprotmap -h:usage: UniProtMapper [-h] -i [IDS ...] [-r [RETURN_FIELDS ...]] [--default-fields] [-o OUTPUT]
                     [-from FROM_DB] [-to TO_DB] [-over] [-pf]

Retrieve data from UniProt using UniProt's RESTful API. For a list of all available fields, see: https://www.uniprot.org/help/return_fields 

Alternatively, use the --print-fields argument to print the available fields and exit the program.

optional arguments:
  -h, --help            show this help message and exit
  -i [IDS ...], --ids [IDS ...]
                        List of UniProt IDs to retrieve information from. Values must be
                        separated by spaces.
  -r [RETURN_FIELDS ...], --return-fields [RETURN_FIELDS ...]
                        If not defined, will pass `None`, returning all available fields.
                        Else, values should be fields to be returned separated by spaces. See
                        --print-fields for available options.
  --default-fields, -def
                        This option will override the --return-fields option. Returns only the
                        default fields stored in: <pkg_path>/resources/cli_return_fields.txt
  -o OUTPUT, --output OUTPUT
                        Path to the output file to write the returned fields. If not provided,
                        will write to stdout.
  -from FROM_DB, --from-db FROM_DB
                        The database from which the IDs are. For the available cross
                        references, see: <pkg_path>/resources/uniprot_mapping_dbs.json
  -to TO_DB, --to-db TO_DB
                        The database to which the IDs will be mapped. For the available cross
                        references, see: <pkg_path>/resources/uniprot_mapping_dbs.json
  -over, --overwrite    If desired to overwrite an existing file when using -o/--output
  -pf, --print-fields   Prints the available return fields and exits the program.Usage example, retrieving default fields from<pkg_path>/resources/cli_return_fields.txt: