Skip to main content

FlashABB: modelling antibody structures at the speed of language

Project description

FlashABB: modelling antibody structures at the speed of language

Inference speed comparison

Installation:

pip install flash-abb

Or from source:

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.3.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.3-py3-none-any.whl (78.7 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flash_abb-0.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 506012a30feada90961911d29d3b4485b3089df97d2279e58a3f64cea06376a9
MD5 626fbcdaf3d6c86c1b2c0b798c94a2fd
BLAKE2b-256 63c4718f7f4ce79148e871a60736a2e2071e6264c610fce320110bad1ab6a324

See more details on using hashes here.

Provenance

The following attestation bundles were made for flash_abb-0.0.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: flash_abb-0.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 517bd1057c39d727c548433a37580597631cb24d7cbdce410fe2e9b6f151ab49
MD5 cc8590bb3698a2eec420cc26c98914e9
BLAKE2b-256 2b521d4a389b49f2a49997c88b58a42ddcc96d79087c71f576972a637ad28844

See more details on using hashes here.

Provenance

The following attestation bundles were made for flash_abb-0.0.3-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