Skip to main content

Predict Affinity against SARS-CoV-2 HR2 peptide

Project description

Overview

AbAffinity is a Python package designed to predict binding affinity of scFv antibody sequence against SARS-CoV-2 HR2 peptide .

AbAffinity

PyPI version License Python Versions

Overview

AbAffinity is a Python package designed to predict binding affinity of scFv antibody sequence against SARS-CoV-2 HR2 peptide. It takes input of antibody heavy and light chain sequence, and predicts the binding affinity against a peptide in SARS-CoV-2 HR2 peptide. This peptide is common in all the variants of SARS-CoV-2.

Key Features

  • make scFv sequence: Given heavy and light chain sequence of antibody, the model will concat them to make scFv seqeunce.
  • Predict Binding Affinity: Given the input antiobdy seqeunce, predict binding affinity
  • Antibody Representation: Given the input antiobdy seqeunce, provide embedding of the antibody. The model gives both residue level representation and sequence level representation.
  • Attention Contact Map: Given the input antibody sequence, AbAffinity will give residue-residue attention maps of the antibody.

Installation

You can install AbAffinity from PyPI:

pip install AbAffinity

Usage

Here's a quick example to get started:

from AbAffinity import AbAffinity

# Example usage
abmodel=AbAffinity() 


#The model takes complete scFv sequences as input. Heavy and Light chain are connected with a linker sequence. Use make_scFv() method from the model to get the complete scFv seqeunce from heavy chain and light chain sequence.

heavy_seq = 'EVQLVESGAEVKKPGASVKVSCKASGYTFTSYGISWVRQAPGQGLEWMGWISAYNGNTNYAQKLQGRVTMTTDTSTSTAYMELRSLRSDDTAVYYCARVGRGVIDHWGQGTLVTVSS' 
light_seq = 'SSELTQDPAVSVALGQTVRITCEGDSLDYYYANWYQQKPGQAPILVIYGKNNRPSGIADRFSGSNSGDTSSLIITGAQAEDEADYYCSSRDSSGFEVTFGAGTKLTVL'

scFv_seq = abmodel.make_scFv(heavy_seq, light_seq) 
print(scFv_seq)  # Output: EVQLVESGAEVKKPGASVKVSCKASGYTFTSYGISWVRQAPGQGLEWMGWISAYNGNTNYAQKLQGRVTMTTDTSTSTAYMELRSLRSDDTAVYYCARVGRGVIDHWGQGTLVTVSSGGGGSGGGGSGGGGSSSELTQDPAVSVALGQTVRITCEGDSLDYYYANWYQQKPGQAPILVIYGKNNRPSGIADRFSGSNSGDTSSLIITGAQAEDEADYYCSSRDSSGFEVTFGAGTKLTVL

#Use `get_affinity()` method to get the predicted binding affinity of the antibody sequence. 
#You can pass a list of sequences to get embeddings for all. Make sure that you have enough memory to process the sequences altogether. You can tune the batch size for this purpose. Example: `model.get_affinity(list_sequences, batch_size=16)`. Default batch_size is 4. 

pred_affinity = abmodel.get_affinity(scFv_seq)
print(pred_affinity) # Output: tensor([3.1595]) 


# Use `get_embeddings()` method to get the embeddings for input sequences. Use `mode='res'` to get residue wise embeddings, and `mode='seq'` will give seqeunce embedding. 
# You can pass a list of sequences to get embeddings for all. Make sure that you have enough memory to process the sequences altogether. You can tune the batch size for this purpose. Example: `model.get_embeddings(list_sequences, mode='seq', batch_size=16)`. Default batch_size is 4.

res_emb = abmodel.get_embeddings(scFv_seq, mode='res')
print(res_emb.shape)  # Output: torch.Size([258, 1280])
 
seq_emb = abmodel.get_embeddings(scFv_seq, mode='seq')
print(seq_emb.shape) # Output: torch.Size([1280]) 

# Use  `get_contact_map()` method to get the contact maps of the given antibody sequence. It will return a matrix of shape `L x L` where `L` is the length of input sequence. Each value in the matrix represents the contact weight between two residue in the sequence.  
# Use `mode='VH-VL'` if you want to plot the contacts for heavy chain and light chain separately, and `mode='scFv'` to plot single contacts for the entire scFv sequence. 

contacts = abmodel.get_contact_map(scFv_seq, mode = 'scFv')
print(contacts.shape) # Output: contact map figure,  (240, 240)

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

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

AbAffinity-0.1.2.tar.gz (21.5 kB view details)

Uploaded Source

Built Distribution

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

AbAffinity-0.1.2-py3-none-any.whl (43.9 kB view details)

Uploaded Python 3

File details

Details for the file AbAffinity-0.1.2.tar.gz.

File metadata

  • Download URL: AbAffinity-0.1.2.tar.gz
  • Upload date:
  • Size: 21.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for AbAffinity-0.1.2.tar.gz
Algorithm Hash digest
SHA256 759b5f18c46139600e3ec11b1bf72be57cf34b3ffb269c16f30b1acf07116d94
MD5 06e60f23eb8e2c82ab22f172c8db0d6f
BLAKE2b-256 782266408116d67589a3c306f3d6ad4448538a2c26e9fbe4828f9e32a5372b1e

See more details on using hashes here.

File details

Details for the file AbAffinity-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: AbAffinity-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 43.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for AbAffinity-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 632f75f0d2409dfddaef0eea79489c0a2db17fedd91cfdd8130df9e4869fa0cb
MD5 ad202e4668e3adee3d6e3b5d9ad13151
BLAKE2b-256 7d4bf8489cc55b8f636c9f092623915b31541ea286806b9bfdbe66b3ed15a5b7

See more details on using hashes here.

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