Skip to main content

Flash-ABB: modelling antibody structures at the speed of language

Project description

FlashABB: modelling antibody structures at the speed of language

Inference speed comparison

Installation:

PyPi coming soon

git clone git@github.com:oxpig/FlashABB.git
cd FlashABB
pip install .

Structure prediction

The following is also in example.py and can be used to create the structures in sample_preds.

from flash_abb import pretrained
import torch

flabb = pretrained(device='cuda')

# Sequences in heavy|light format
seqs = [
    'EVQLLESGGEVKKPGASVKVSCRASGYTFRNYGLTWVRQAPGQGLEWMGWISAYNGNTNYAQKFQGRVTLTTDTSTSTAYMELRSLRSDDTAVYFCARDVPGHGAAFMDVWGTGTTVTVSS|DIQLTQSPLSLPVTLGQPASISCRSSQSLEASDTNIYLSWFQQRPGQSPRRLIYKISNRDSGVPDRFSGSGSGTHFTLRISRVEADDVAVYYCMQGTHWPPAFGQGTKVDIK',
    'EVQLLESGGEVKKPGASVKVSCRASGYTFRNYGLTWVRQAPGQGLEWMGWISAYNGNTNYAQKFQGRVTLTTDTSTSTAYMELRSLRSDDTAVYFCARDVPGHGAAFMDVWGTGTTVTVS|DIQLTQSPLSLPVTLGQPASISCRSSQSLEASDTNIYLSWFQQRPGQSPRRLIYKISNRDSGVPDRFSGSGSGTHFTLRISRVEADDVAVYYCMQGTHWPPAFGQGTKVDIK',
]

with torch.no_grad():
    result = flabb(seqs)

print(result.coords.shape)          # (2, n_residues, 37, 3)
print(result.bb_coords.shape)       # (2, n_residues, 4, 3)

result.to_pdbs(['ab1', 'ab2'], pdb_dir='sample_preds')

Developability scoring (FlashTAP)

FlashTAP predicts four TAP developability scores: PSH, PPC, PNC, and SFvCSP.

from flash_abb import pretrained_tap

tap = pretrained_tap(device='cuda')

seqs = [
    'EVQLLESGGEVKKPGASVKVSCRASGYTFRNYGLTWVRQAPGQGLEWMGWISAYNGNTNYAQKFQGRVTLTTDTSTSTAYMELRSLRSDDTAVYFCARDVPGHGAAFMDVWGTGTTVTVSS|DIQLTQSPLSLPVTLGQPASISCRSSQSLEASDTNIYLSWFQQRPGQSPRRLIYKISNRDSGVPDRFSGSGSGTHFTLRISRVEADDVAVYYCMQGTHWPPAFGQGTKVDIK',
]

result = tap(seqs)
print(result.scores)        # [{'PSH': ..., 'PPC': ..., 'PNC': ..., 'SFvCSP': ...}]
print(result.tensor)        # (1, 4) raw score tensor
print(result.flag_probs)    # [{'PSH': 0.12, 'PPC': 0.03, 'PNC': 0.05, 'SFvCSP': 0.41}]
print(result.any_flag_prob) # [0.47]

Structure-aware embeddings (FlashABB-SSS)

FlashABB-SSS (seq2struct2seq) produces per-residue embeddings that combine sequence and predicted 3D structure. These can be used as features for downstream tasks.

from flash_abb import pretrained_sss

sss = pretrained_sss(device='cuda')

seqs = [
    'EVQLLESGGEVKKPGASVKVSCRASGYTFRNYGLTWVRQAPGQGLEWMGWISAYNGNTNYAQKFQGRVTLTTDTSTSTAYMELRSLRSDDTAVYFCARDVPGHGAAFMDVWGTGTTVTVSS|DIQLTQSPLSLPVTLGQPASISCRSSQSLEASDTNIYLSWFQQRPGQSPRRLIYKISNRDSGVPDRFSGSGSGTHFTLRISRVEADDVAVYYCMQGTHWPPAFGQGTKVDIK',
]

result = sss(seqs)
print(result.embeddings.shape)  # (1, n_residues, 128)
print(result.mask.shape)        # (1, n_residues)

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

flash_abb-0.0.2.tar.gz (78.7 MB view details)

Uploaded Source

Built Distribution

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

flash_abb-0.0.2-py3-none-any.whl (78.7 MB view details)

Uploaded Python 3

File details

Details for the file flash_abb-0.0.2.tar.gz.

File metadata

  • Download URL: flash_abb-0.0.2.tar.gz
  • Upload date:
  • Size: 78.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for flash_abb-0.0.2.tar.gz
Algorithm Hash digest
SHA256 0604e4c65e85a5923743d1928bf59095d35d5b8ff39b55e420e4d5e41bbafe6e
MD5 3e5dea1ef11631e0e847ffc7173950a6
BLAKE2b-256 a0ec689f70b53dd6425635273cb6155108c69c88c32b35a84b2c7d54ccedc196

See more details on using hashes here.

Provenance

The following attestation bundles were made for flash_abb-0.0.2.tar.gz:

Publisher: publish.yml on oxpig/FlashABB

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

File details

Details for the file flash_abb-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: flash_abb-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 78.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for flash_abb-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8b5a7c000c4266b855878dc2ffa3e8e8aa00176ec9c1ce9743a1a69350578e72
MD5 e68e828a7a46c6b26e15017016a209f4
BLAKE2b-256 bac92f4cb88080193ee29f46d4b95eb3b7019d08b153b15198a37df95d6ebe1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for flash_abb-0.0.2-py3-none-any.whl:

Publisher: publish.yml on oxpig/FlashABB

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