Using in Python Scripts#
Once installed, you’re all set to start mapping and exploring entry-level and residue-level correspondences between UniProt and PDB entries; no additional setup required!
Using in Python Scripts#
Importing within a Python script
from unipdb_mapper import IDMapper
ID mapping from UniProt to PDB
id_cls = IDMapper('P19339', 'UniProt')
print(id_cls.mapped)
ID mapping from PDB to UniProt
id_cls = IDMapper('1b7f', 'PDB')
print(id_cls.mapped)
Save results to a file
from unipdb_mapper import utilities as utils
outfile = utils.output_writer('output_unipdb.csv', id_cls.mapped)
The ID mapping process results in a list of tuples where each tuple is formatted as follows:
[(UniProt_ID, UniProt_start_position, UniProt_end_position, PDB_ID, PDB_chain, PDB_start_position, PDB_end_position)]
where, the *start_position and *last_position are the first and last residue position available in the mapped structure, respectively.
Residue Mapping#
Importing the classes within a Python script
from unipdb_mapper import IDMapper
from unipdb_mapper import ResidueMapper
Residue Mapping from UniProt to PDB
id_cls = IDMapper('P19339', 'UniProt')
query_pdbs = [x[3] for x in id_cls.mapped]
mapped_residues = []
for query in query_pdbs:
res_cls = ResiduesMapper('P19339', ['222'], 'UniProt')
mapped_residues.append(res_cls.resmapper(query))
results = [item for sublist in mapped_residues for item in sublist]
print(results)
Residue Mapping from PDB to UniProt
res_cls = ResiduesMapper('1B7F', ['222'], 'PDB')
results = res_cls.resmapper('1B7F')
print(results)
Save results to a file
from unipdb_mapper import utilities as utils
outfile = utils.output_writer('output_unipdb.csv', results)