avilella / SPACE2

Tool for rapid clustering of antibody models by the structure of their CDRs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Structural Profiling of Antibodies to Cluster by Epitope 2 (SPACE2)

The SPACE2 algorithm is a method that rapidly clusters antibodies by the similarity of structural models and accurately groups antibodies that bind the same epitop.

SPACE2 requires structural models of antibodies as an input, these can be generated with ImmuneBuilder. Antibodies are then clustered in three main steps. Initially, the models are split into groups of identical CDR lengths. Models in each group are then structurally aligned on the Cα of residues in framework regions and a pairwise distance matrix is computed of the Cα RMSDs of CDR loop residues. The antibodies are then clustered based on these distances.

Install

To download and install:

$ git clone https://github.com/fspoendlin/SPACE2.git
$ pip install SPACE2/

Usage

To run the clustering you will need antibody models which are IMGT numbered, these can be obtained from ImmuneBuilder.

Once you have a directory with antibody models you can cluster them using SPACE2. We recommend using the agglomerative clustering method with an RMSD threshold of 1.25 Å and default selection and anchors parameters. This will use the length of all six CDRs to group the antibodies and RMSDs will be calculated across all six CDRs after alignment on both heavy and light chain framework regions.

import glob
import SPACE2

antibody_models = glob.glob("path/to/antibody/models/*.pdb")

clustered_dataframe = SPACE2.agglomerative_clustering(antibody_models, cutoff=1.25)

Alternatively a greedy clustering algorithm is implemented:

clustered_dataframe = SPACE2.greedy_clustering(antibody_models, cutoff=1.25)

or a custom clustering aglorithm can be used. The clustering algorithm should be a class and follow the syntax of scikit-learn. The class must have a self.fit(X) method that takes a distance matrix as an input and store cluster labels in a self.labels_ attribute.

algorithm = CustomClusteringAlgorithm(*args, **kwargs)
clustered_dataframe = SPACE2.cluster_with_algorithm(algorithm, antibody_models)

CDRs considered during the initial step of grouping by length as well as CDRs for RMSD calculation and frameworks to be used for structural alignment can be modified with selection and anchor arguments. Here is an example of how to restict SPACE2 to only consider the length and RMSDs of heavy chain CDRs and align on the heavy chain framework.

from SPACE2 import reg_def

cdr_selection = [reg_def['CDRH1'], reg_def['CDRH2'], reg_def['CDRH3']]
fw_selection = [reg_def['fwH']]

clustered_dataframe = SPACE2.agglomerative_clustering(antibody_models, selection=cdr_selection, anchors=fw_selection, cutoff=1.25)

Output

SPACE2 outputs a pandas dataframe containing the assigned structural cluster for each antibody. The output is formatted as below with columns indicating the antibody name (ID), the length of all CDRs considered during clustering in order H1-3 and L1-3 (cluster_by_length) and a representative of the assigned structural cluster (cluster_by_rmsd).

ID cluster_by_length cluster_by_rmsd
0 BD56-1450.pdb 15_9_12_11_8_8 BD56-1450.pdb
1 BD55-6240.pdb 15_9_12_11_8_8 BD56-1450.pdb
2 BD55-1117.pdb 13_10_13_13_8_11 BD55-1117.pdb
... ... ... ...

Stats

SPACE2 clusters 10,000 antibodies in approximately 2 min when parallelised over 12 CPUs. The algorithm scales roughly at O(n1.5) with the number of antibodies (n).

Citation

@article{Spoendlin2023,
	title = {Improved computational epitope profiling using structural models identifies a broader diversity of antibodies that bind the same epitope},
	author = {Fabian C. Spoendlin, Brennan Abanades, Matthew I. J. Raybould, Wing Ki Wong, Guy Georges, and Charlotte M. Deane},
	journal = {bioRxiv},
	doi = {10.1101/2023.06.09.543890},
	URL = {https://www.biorxiv.org/content/10.1101/2023.06.09.543890v1},
	year = {2023},
}

About

Tool for rapid clustering of antibody models by the structure of their CDRs.

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Python 100.0%