Python3 client API for ConsurfDB
Project description
Description from GitHub
readme.md
:
Python3 client API for ConsurfDB
Consurf-DB is a web server developed by the group of Prof. Nir Ben-Tal which provides PDB structures with the b-factors remapped to residue conservation scores as determined by their rate4site.
This unofficial Python3 module queries this server and performs several operations.
This was formerly a part of the Venus backend (:octocat: michelanglo-protein), but I (MF) moved it out as it may be useful for others.
PS. Like all APIs, especially the unofficial ones, do not abuse the server...
Usage
Get and parse consurfDB data.
from consurfDB import ConsurfDB
cp = ConsurfDB.from_web('1UBQ', 'A')
The grades
file data is in cp.data
and can be made into a pandas dataframe:
It takes ~1.7 seconds to fetch a grades file off the web.
Do simply ignore the unsafe SSL warning
(changing ConsurfDB.REQUEST_VERIFY_SETTING
to True
, will result in failure).
One can also run it from a grades file:
from consurfDB import ConsurfDB
cp = ConsurfDB.from_filename('grades.txt')
Data is in self.data
, which is a dict of MET1:A
to dict of values.
See the type dictionary ResidueDataType
for details.
from consurfDB import ResidueDataType
help(ResidueDataType)
One can make a pandas dataframe from it.
grades : pd.DataFrame = cp.to_pandas()
If a residue appears in SEQPOS but no ATOM records are present, they will be like cp.data['___1:A']
.
The key is the 3LATOM
field, this is ATOM numbering, while POS is the SEQPOS numbering.
apply_offset_from_swissmodel
uses the latter and makes both Uniprot numbering.
Also can add a consurf conservation to a PyRosetta pose in place.
pose : pyrosetta.Pose = ... # noqa
cp.add_bfactor_to_pose(pose)
Or a pymol object
also, if chain number differs, e.g. V in consurf grades file and A in pose:
cp.remap_chains({'B': 'A'})
Likewise with offset.
If the Uniprot id is known, the offset can be taken from Swissmodel
cp.apply_offset_from_swissmodel(uniprot, code, chain)
Potentially support multi-chain operations, but not tested.
cp = ConsurfDB.merge([cp1, cp2, cp3]) # noqa
Dump of attributes and methods:
Consurf.REQUEST_VERIFY_SETTING
Consurf.ResidueDataType
Consurf.add_bfactor_to_pose
Consurf.add_bfactor_to_pymol
Consurf.add_bfactor_via_pymol
Consurf.align
Consurf.apply_offset_by_alignment
Consurf.apply_offset_from_swissmodel
Consurf.assert_reply
Consurf.fetch
Consurf.from_filename
Consurf.from_web
Consurf.get_color
Consurf.get_conscore
Consurf.get_consurf_chain
Consurf.get_key
Consurf.get_offset_by_alignment
Consurf.get_offset_from_swissmodel
Consurf.get_offset_vector_by_alignment
Consurf.get_residue_chain
Consurf.get_residue_index
Consurf.get_residue_name
Consurf.get_variety
Consurf.keys
Consurf.log
Consurf.merge
Consurf.offset_atom
Consurf.offset_seqpos
Consurf.parse
Consurf.read
Consurf.remap_chains
Consurf.sequence
Consurf.to_pandas
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ConsurfDB-client-API-1.0.tar.gz
.
File metadata
- Download URL: ConsurfDB-client-API-1.0.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.27.1 setuptools/49.2.0.post20200714 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1caaf288ccea898977fa3bd3ed74e50f0a1be508b2bbb248dc12da9bbe63bc7 |
|
MD5 | 8b92b07ce441bf3b645f99d50b4620cf |
|
BLAKE2b-256 | df5900528eb991fd5b573c606228b264aa7f9502e87d3dbd55cc680f57723384 |
File details
Details for the file ConsurfDB_client_API-1.0-py3-none-any.whl
.
File metadata
- Download URL: ConsurfDB_client_API-1.0-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.27.1 setuptools/49.2.0.post20200714 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | de5f5b0003a8328355320cd8fa04a93472dae3680116b05717c59a323f37bc00 |
|
MD5 | 6c7954ca216a2712af4f1f5fc262073b |
|
BLAKE2b-256 | 95d82460deede201b90872bd29d644b0e85ea1aeeacaf762529355246cb4f87e |