Python API
Profet’s functionality is accessed mainly through the profet.Fetcher
class documented below. Lower level functionality for each database in profet
can be accessed through the profet.alphafold.Alphafold_DB
and
profet.pdb.PDB_DB
classes.
- class profet.Fetcher(main_db: str = 'pdb')
The main class in profet to fetch protein structures from the PDB and alphafold databases.
- check_db(uniprot_id: str) list
Checks which database contains the searched ID.
- Parameters:
uniprot_id – ID from Uniprot
- Returns:
The list of the databases where the id is available
- file_from_db(prot_id: str, filetype: str = 'pdb', filesave: bool = False, db: str = 'pdb') tuple
Returns the file from the correspondent database.
- Parameters:
uniprot_id – ID from Uniprot.
filetype – File type to be retrieved: cif, pdb.
filesave – Option to save into a file.
db – database from which to retrieve the file.
- Returns:
Tuple containing the filename and file from the database
- get_default_db() str
- Returns:
The default database.
- get_file(uniprot_id: str, filetype: str = 'pdb', filesave: bool = False, db: str = 'pdb') tuple
Returns the file from an available database, starting with the default that the user provided.
- Parameters:
uniprot_id – ID from Uniprot.
filetype – File type to be retrieved: cif, pdb.
filesave – Option to save into a file.
db – database from which to retrieve the file.
- Returns:
File name of the saved file
File from the database, or None if it is not available in any database.
- Return type:
A tuple containing
- search_history() dict
- Returns:
The search history of the fetcher.
- set_default_db(db: str)
Set the default database.
- Parameters:
db – The default db (pdb or alphafold)
- set_directory(new_dir: str)
Set the saving directory.
- Parameters:
new_dir – The directory to save data
- class profet.alphafold.Alphafold_DB
A class to represent the Alphafold database
- check_structure(uniprot_id: str) bool
Check whether a structure is present in the AlphaFold database
- Parameters:
uniprot_id – The uniprot id of the protein
- Returns:
Is the protein in the Alphafold database (True/False)
- get_file_url(uniprot_id: str, filetype: str = 'pdb') str
Get file url relative to an id from the the Alphafold entry page
- Parameters:
uniprot_id – The uniprot id of the protein
filetype – The type of file to download (pdb or cif)
- Returns:
The URL of the file to download
- get_pdb(uniprot_id: str, filetype: str = 'pdb', filesave: bool = False, filedir: str = 'default') tuple
Returns pdb/cif as strings, saves to file if requested.
- Parameters:
uniprot_id – ID from Uniprot
filetype – File type to be retrieved: cif, pdb
filesave – Option to save into a file
filedir – The directory to save the data
- Returns:
Tuple containing the filename and file from the database
- make_url(uniprot_id: str, filetype: str = 'pdb') str
Make the URL for the protein
- Parameters:
uniprot_id – The uniprot id of the protein
filetype – The type of file to download (pdb or cif)
- Returns:
The URL of the file to download
- class profet.pdb.PDB_DB
A class to represent the PDB database
- check_structure(uniprot_id: str) bool
Check if a protein is contained within the PDB
- Parameters:
uniprot_id – The uniprot id of the protein
- Returns:
Is the protein in the PDB (True/False)
- get_pdb(uniprot_id: str, filetype: str = 'pdb', filesave: bool = False, filedir: str = 'default') tuple
Returns pdb/cif as strings, saves to file if requested
- Parameters:
uniprot_id – ID from Uniprot
filetype – File type to be retrieved: cif, pdb
filesave – Option to save into a file
filedir – The directory to save the data
- Returns:
Tuple containing the filename and file from the database