Skip to main content

Contact Molecular Surface calculation for protein design — a Python port of Longxing Cao's C++ implementation

Project description

Longxing Cao's Contact Molecular Surface has been ported to python to allow the next generation of protein designers to use it with ease. Contact Molecular Surface (contact ms) is based on Lawrence and Colman's 1993 paper where they calculate Shape Complementarity. The difference is that instead of returning a singular value denoting the shape complementarity, contact ms instead returns a distance-weighted surface area of the target molecule.

At it's core, contact ms is based on the following formula: contact_ms = area * exp( -0.5 * distance**2)

Where area is the interfacial area on the target and distance is the distance between the binder and the target (from the molecular surfaces) at that point.

Perhaps the coolest new thing the python version brings is per-atom contact ms! I always thought this was a dubious idea but it actually turns out its very straightforward based on the math.

Here's an image from my PhD explaining why contact ms is better than SASA or Shape Complementarity: image

(Look up Brian Coventry Dissertation if you want the full story about it's pros and cons)

In terms of using this library, there are really only two functions you need:

from py_contact_ms import calculate_contact_ms, get_radii_from_names

# You'll have to figure out how to generate the following arrays
binder_xyz = xyz of binder heavy-atoms (non-hydrogen)
binder_res_names = list of residue name3 for each xyz (so like [ARG, ARG, ARG, LYS])
binder_atom_names = list of atom names for each xyz, stripped (so like [N, CA, C, O])
target_xyz = ...
target_res_names = ...
target_atom_names = ...

# Do not supply your own radii! CMS requires specific radii
binder_radii = get_radii_from_names(binder_res_names, binder_atom_names)
target_radii = get_radii_from_names(target_res_names, target_atom_names)

# Remember, contact_ms is only on the target side by convention
contact_ms, per_target_atom_cms, calc = calculate_contact_ms(binder_xyz, binder_radii, target_xyz, target_radii)

# If you also want the binder-side, you can do this (avoids recomputing everything)
binder_cms, per_binder_atom_cms = calc.calc_contact_molecular_surface(target_side=False)

# If you are doing small-molecule design, you may also want to know the maximum CMS possible (basically the surface area)
from py_contact_ms import calculate_maximum_possible_contact_ms
max_target_cms, max_target_cms_per_atom = calculate_maximum_possible_contact_ms(target_xyz, target_radii)

Many thanks the Claude and ChatGPT for making this herculean effort possible (in like 20 hours which is insane)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_contact_ms-0.1.0.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_contact_ms-0.1.0-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file py_contact_ms-0.1.0.tar.gz.

File metadata

  • Download URL: py_contact_ms-0.1.0.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for py_contact_ms-0.1.0.tar.gz
Algorithm Hash digest
SHA256 246d00c4b97cf24c96e28133d6659db4c01f8b0a2065a8cf04ff2b6f558901b4
MD5 2ecd030c0d1009757227a21a6a4b0459
BLAKE2b-256 fd7cf6be4b1c6405f18ad492aafb78914d306ab05d356234de4243a2ab68bdfe

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_contact_ms-0.1.0.tar.gz:

Publisher: publish.yml on ullahsamee/py_contact_ms

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_contact_ms-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: py_contact_ms-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for py_contact_ms-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5658080c660407bb66f5e2da55ac2248983a16ce4827ff8b023cafe262f6022
MD5 a85491076bae7d9d705484e69718190f
BLAKE2b-256 9730606d25d4975b77643ef03361866c84851f58680cbbd2be935dda30142717

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_contact_ms-0.1.0-py3-none-any.whl:

Publisher: publish.yml on ullahsamee/py_contact_ms

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page