mikessh commited on
Commit
ea50f0c
·
verified ·
1 Parent(s): d6855de

cleanup: remove notebooks/figures/analysis-tables from cpl/ (structures + descriptions only)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. cpl/notebooks_cleanup/.ipynb_checkpoints/1e6_contacts_clean-checkpoint.ipynb +0 -0
  2. cpl/notebooks_cleanup/.ipynb_checkpoints/4c6_contacts_clean-checkpoint.ipynb +0 -0
  3. cpl/notebooks_cleanup/.ipynb_checkpoints/DockQ_output_clean-checkpoint.ipynb +0 -0
  4. cpl/notebooks_cleanup/.ipynb_checkpoints/Structures_copying-checkpoint.ipynb +0 -6
  5. cpl/notebooks_cleanup/.ipynb_checkpoints/content-checkpoint.md +0 -15
  6. cpl/notebooks_cleanup/.ipynb_checkpoints/ila1_contacts_clean-checkpoint.ipynb +0 -0
  7. cpl/notebooks_cleanup/.ipynb_checkpoints/mel5_contacts_clean-checkpoint.ipynb +0 -866
  8. cpl/notebooks_cleanup/.ipynb_checkpoints/mel8_contcats_clean-checkpoint.ipynb +0 -0
  9. cpl/notebooks_cleanup/.ipynb_checkpoints/tcr_vdb_cleaned-checkpoint.ipynb +0 -0
  10. cpl/notebooks_cleanup/01_05_2025_TCRvdb.csv +0 -0
  11. cpl/notebooks_cleanup/1E6/figures/cpl_entropy_heatmap.svg +0 -292
  12. cpl/notebooks_cleanup/1E6/figures/heatmap_CDR1_alpha.svg +0 -594
  13. cpl/notebooks_cleanup/1E6/figures/heatmap_CDR1_beta.svg +0 -524
  14. cpl/notebooks_cleanup/1E6/figures/heatmap_CDR2_beta.svg +0 -594
  15. cpl/notebooks_cleanup/1E6/figures/heatmap_CDR3_alpha.svg +0 -1084
  16. cpl/notebooks_cleanup/1E6/figures/heatmap_CDR3_beta.svg +0 -1294
  17. cpl/notebooks_cleanup/1E6/figures/heatmap_MHC.svg +0 -0
  18. cpl/notebooks_cleanup/1E6/figures/heatmap_MHC_total_contacts.svg +0 -507
  19. cpl/notebooks_cleanup/1E6/figures/index_peptide_mip1b_heatmap.svg +0 -322
  20. cpl/notebooks_cleanup/1E6/figures/logo_best_peptides.svg +0 -1258
  21. cpl/notebooks_cleanup/1E6/figures/logo_worst_peptides.svg +0 -1234
  22. cpl/notebooks_cleanup/1E6/figures/tcren_box_best_vs_worst_per_structure.svg +0 -216
  23. cpl/notebooks_cleanup/1E6/tables/1e6_contacts_freqs_for_heatmap.tsv +0 -11
  24. cpl/notebooks_cleanup/1E6/tables/1e6_potentials.tsv +0 -146
  25. cpl/notebooks_cleanup/1E6/tables/all_peptides_contacts_best.tsv +0 -0
  26. cpl/notebooks_cleanup/1E6/tables/all_peptides_contacts_worst.tsv +0 -0
  27. cpl/notebooks_cleanup/1E6/tables/all_tcr_mhc_contacts_best.tsv +0 -0
  28. cpl/notebooks_cleanup/1E6/tables/contacts_for_tcren_best.tsv +0 -1
  29. cpl/notebooks_cleanup/1E6/tables/contacts_for_tcren_worst.tsv +0 -0
  30. cpl/notebooks_cleanup/1E6/tables/cpl_entropy.tsv +0 -11
  31. cpl/notebooks_cleanup/1E6/tables/index_peptide_mip1b.tsv +0 -11
  32. cpl/notebooks_cleanup/1e6_contacts_clean.ipynb +0 -0
  33. cpl/notebooks_cleanup/4C6/figures/cpl_entropy_heatmap.svg +0 -276
  34. cpl/notebooks_cleanup/4C6/figures/heatmap_CDR1_alpha.svg +0 -548
  35. cpl/notebooks_cleanup/4C6/figures/heatmap_CDR1_beta.svg +0 -484
  36. cpl/notebooks_cleanup/4C6/figures/heatmap_CDR2_alpha.svg +0 -594
  37. cpl/notebooks_cleanup/4C6/figures/heatmap_CDR2_beta.svg +0 -548
  38. cpl/notebooks_cleanup/4C6/figures/heatmap_CDR3_alpha.svg +0 -996
  39. cpl/notebooks_cleanup/4C6/figures/heatmap_CDR3_beta.svg +0 -868
  40. cpl/notebooks_cleanup/4C6/figures/heatmap_MHC.svg +0 -0
  41. cpl/notebooks_cleanup/4C6/figures/heatmap_MHC_total_contacts.svg +0 -299
  42. cpl/notebooks_cleanup/4C6/figures/logo_best_peptides.svg +0 -560
  43. cpl/notebooks_cleanup/4C6/figures/logo_worst_peptides.svg +0 -882
  44. cpl/notebooks_cleanup/4C6/figures/original_peptide_mip1b_heatmap.svg +0 -305
  45. cpl/notebooks_cleanup/4C6/figures/tcren_box_best_vs_worst_per_contact.svg +0 -408
  46. cpl/notebooks_cleanup/4C6/figures/tcren_box_best_vs_worst_per_structure.svg +0 -273
  47. cpl/notebooks_cleanup/4C6/tables/.ipynb_checkpoints/4c6_potentials-checkpoint.tsv +0 -320
  48. cpl/notebooks_cleanup/4C6/tables/.ipynb_checkpoints/all_peptides_contacts_native-checkpoint.tsv +0 -0
  49. cpl/notebooks_cleanup/4C6/tables/.ipynb_checkpoints/all_tcr_mhc_contacts_native-checkpoint.tsv +0 -0
  50. cpl/notebooks_cleanup/4C6/tables/.ipynb_checkpoints/contacts_for_tcren_best-checkpoint.tsv +0 -0
cpl/notebooks_cleanup/.ipynb_checkpoints/1e6_contacts_clean-checkpoint.ipynb DELETED
The diff for this file is too large to render. See raw diff
 
cpl/notebooks_cleanup/.ipynb_checkpoints/4c6_contacts_clean-checkpoint.ipynb DELETED
The diff for this file is too large to render. See raw diff
 
cpl/notebooks_cleanup/.ipynb_checkpoints/DockQ_output_clean-checkpoint.ipynb DELETED
The diff for this file is too large to render. See raw diff
 
cpl/notebooks_cleanup/.ipynb_checkpoints/Structures_copying-checkpoint.ipynb DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "cells": [],
3
- "metadata": {},
4
- "nbformat": 4,
5
- "nbformat_minor": 5
6
- }
 
 
 
 
 
 
 
cpl/notebooks_cleanup/.ipynb_checkpoints/content-checkpoint.md DELETED
@@ -1,15 +0,0 @@
1
- ## Statistical potentials, CPL, etc.
2
-
3
- This repository contains the structures and notebooks for structures data processing.
4
-
5
- Folder `pdb_cpl` contains TCRmodel2 generated TCR:pMHC structures for the 1e6, 4c6, ila1, mel5, and mel8 TCRs with their best and worst peptides. Additionally these folders contains .tsv tables with TCRmodel2 inputs.
6
-
7
- The folder `notebooks_cleanup` contains cleaned up notebooks for structure processing allong with folders with corresponding tables and .svg figures.
8
-
9
- `notebooks_cleanup/[1e6, 4c6, ila1, mel5, mel8]_contacts_clean.ipynb` - notebooks for structures processing. Corresponding folders - `1E6`, `4C6`, `ILA1`, `MEL5`, and `MEL8` contains svg figures and intermediate tables. Absolute paths to data were avoided if it was possible.
10
-
11
- `dockq_folder.sh` - bash script for running DockQ on folder with .pdb files.
12
-
13
- `DockQ_output_clean.ipynb` - notebook for DockQ results parsinng and processing.
14
-
15
- `tcr_vdb_cleaned.ipynb` - notebook for tcr_vdb structures processing.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cpl/notebooks_cleanup/.ipynb_checkpoints/ila1_contacts_clean-checkpoint.ipynb DELETED
The diff for this file is too large to render. See raw diff
 
cpl/notebooks_cleanup/.ipynb_checkpoints/mel5_contacts_clean-checkpoint.ipynb DELETED
@@ -1,866 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "id": "fc1a0487",
5
- "metadata": {},
6
- "source": [
7
- "# MEL5 TCR\u2013pMHC contact analysis\n",
8
- "\n",
9
- "Pipeline for the **MEL5** TCR (HLA-A*02:01 restricted, 10-mer peptides; index\n",
10
- "epitope `ELAGIGILTV`). It analyses TCR\u2013peptide\u2013MHC contacts across the\n",
11
- "AlphaFold-modelled best- and worst-binding peptide-swap structures.\n",
12
- "\n",
13
- "**Outputs.** Everything this notebook saves is written under a single `mel5/` folder:\n",
14
- "\n",
15
- "- `mel5/figures/` \u2014 every figure, saved as **SVG**\n",
16
- "- `mel5/tables/` \u2014 important intermediate tables (TSV)\n",
17
- "\n",
18
- "Two helpers, `save_fig(name)` and `save_table(df, name)` (defined in the setup\n",
19
- "section), handle all saving. Paths that begin with `/projects/...` or\n",
20
- "`/home/dluppov/...` point at the original input data and may need adjusting."
21
- ],
22
- "cell_type": "markdown"
23
- },
24
- {
25
- "id": "0939e0ec",
26
- "metadata": {},
27
- "source": [
28
- "## 1. Setup and configuration"
29
- ],
30
- "cell_type": "markdown"
31
- },
32
- {
33
- "id": "bbcee98a",
34
- "metadata": {},
35
- "source": [
36
- "import os\n",
37
- "from pathlib import Path\n",
38
- "from collections import defaultdict\n",
39
- "import itertools\n",
40
- "import random\n",
41
- "\n",
42
- "import numpy as np\n",
43
- "import pandas as pd\n",
44
- "import matplotlib.pyplot as plt\n",
45
- "import seaborn as sns\n",
46
- "\n",
47
- "import tqdm\n",
48
- "import logomaker\n",
49
- "\n",
50
- "from Bio import PDB\n",
51
- "from Bio.PDB import PDBParser\n",
52
- "from Bio.SeqUtils import seq1\n",
53
- "\n",
54
- "from scipy.stats import mannwhitneyu, ttest_ind\n",
55
- "from sklearn.metrics import roc_auc_score\n",
56
- "\n",
57
- "# Monospace font keeps single-letter residue labels aligned in the figures.\n",
58
- "plt.rcParams[\"font.family\"] = \"monospace\"\n",
59
- "plt.rcParams[\"font.monospace\"] = [\"Courier New\"] + plt.rcParams[\"font.monospace\"]"
60
- ],
61
- "cell_type": "code",
62
- "execution_count": null,
63
- "outputs": []
64
- },
65
- {
66
- "id": "4119768c",
67
- "metadata": {},
68
- "source": [
69
- "# ---------------------------------------------------------------------------\n",
70
- "# All outputs from this notebook are written under a single project folder.\n",
71
- "# ---------------------------------------------------------------------------\n",
72
- "OUTPUT_DIR = Path(\"mel5\")\n",
73
- "FIG_DIR = OUTPUT_DIR / \"figures\" # all figures, saved as SVG\n",
74
- "TABLE_DIR = OUTPUT_DIR / \"tables\" # important intermediate tables (TSV)\n",
75
- "\n",
76
- "for _d in (FIG_DIR, TABLE_DIR):\n",
77
- " _d.mkdir(parents=True, exist_ok=True)\n",
78
- "\n",
79
- "\n",
80
- "def save_fig(name, fig=None, dpi=300):\n",
81
- " \"\"\"Save the current (or given) matplotlib figure as SVG into mel5/figures.\"\"\"\n",
82
- " fig = fig if fig is not None else plt.gcf()\n",
83
- " path = FIG_DIR / f\"{name}.svg\"\n",
84
- " fig.savefig(path, format=\"svg\", bbox_inches=\"tight\", transparent=True, dpi=dpi)\n",
85
- " print(f\"Saved figure: {path}\")\n",
86
- " return path\n",
87
- "\n",
88
- "\n",
89
- "def save_table(df, name, index=True):\n",
90
- " \"\"\"Save an important intermediate table as TSV into mel5/tables.\"\"\"\n",
91
- " path = TABLE_DIR / f\"{name}.tsv\"\n",
92
- " df.to_csv(path, sep=\"\\t\", index=index)\n",
93
- " print(f\"Saved table: {path}\")\n",
94
- " return path"
95
- ],
96
- "cell_type": "code",
97
- "execution_count": null,
98
- "outputs": []
99
- },
100
- {
101
- "id": "8e2a7217",
102
- "metadata": {},
103
- "source": [
104
- "## 2. Core functions"
105
- ],
106
- "cell_type": "markdown"
107
- },
108
- {
109
- "id": "cc36dd65",
110
- "metadata": {},
111
- "source": [
112
- "def extract_coords_from_pdb_by_dict(pdb_file, seq_dict):\n",
113
- " \"\"\"Extract CA and all-atom coordinates for the sequences listed in ``seq_dict``.\n",
114
- "\n",
115
- " ``seq_dict`` maps an amino-acid sequence (as found in the PDB) to the label\n",
116
- " used for that segment, e.g. ``{\"CAVNVAGKSTF\": \"CDR3_alpha\", ...}``.\n",
117
- " \"\"\"\n",
118
- " parser = PDBParser(QUIET=True)\n",
119
- " structure = parser.get_structure(\"protein\", pdb_file)\n",
120
- "\n",
121
- " coords_ca = {}\n",
122
- " coords_all = {}\n",
123
- " atom_to_ca_map = {}\n",
124
- "\n",
125
- " for model in structure:\n",
126
- " for chain in model.get_chains():\n",
127
- " residues = [res for res in chain if PDB.Polypeptide.is_aa(res)]\n",
128
- " pdb_sequence = \"\".join(seq1(res.get_resname()) for res in residues)\n",
129
- "\n",
130
- " for seq, label in seq_dict.items():\n",
131
- " if seq not in pdb_sequence:\n",
132
- " continue\n",
133
- " start_idx = pdb_sequence.find(seq)\n",
134
- " for res in residues[start_idx:start_idx + len(seq)]:\n",
135
- " res_name = seq1(res.get_resname())\n",
136
- " res_num = res.id[1]\n",
137
- "\n",
138
- " if \"CA\" in res:\n",
139
- " ca_key = (label, res_name, res_num)\n",
140
- " coords_ca[ca_key] = res[\"CA\"].coord.tolist()\n",
141
- " else:\n",
142
- " ca_key = None\n",
143
- "\n",
144
- " for atom in res.get_atoms():\n",
145
- " atom_key = (label, res_name, res_num, atom.get_name())\n",
146
- " coords_all[atom_key] = atom.coord.tolist()\n",
147
- " if ca_key is not None:\n",
148
- " atom_to_ca_map[atom_key] = ca_key\n",
149
- "\n",
150
- " return coords_ca, coords_all, atom_to_ca_map\n",
151
- "\n",
152
- "\n",
153
- "def calculate_3d_distance(coord1, coord2):\n",
154
- " return np.linalg.norm(np.array(coord1) - np.array(coord2))\n",
155
- "\n",
156
- "\n",
157
- "def find_atomic_contacts(coords_all, atom_to_ca_map, max_distance=5.0,\n",
158
- " pdb_filename=None, save_dir=None):\n",
159
- " \"\"\"Find inter-chain atomic contacts within ``max_distance`` (Angstrom).\n",
160
- "\n",
161
- " Returns the list of contacting atom pairs (residues in 1-letter code), the\n",
162
- " number of residue (CA) pairs in contact and the number of atom pairs in\n",
163
- " contact. If ``pdb_filename`` is given, the contact list is also written out.\n",
164
- " \"\"\"\n",
165
- " atom_contacts_seen = set()\n",
166
- " ca_contacts_seen = set()\n",
167
- " atomic_contacts = []\n",
168
- "\n",
169
- " keys_all = list(coords_all.keys())\n",
170
- " for i, (atom_key_i, coord_i) in enumerate(coords_all.items()):\n",
171
- " ca_i = atom_to_ca_map.get(atom_key_i)\n",
172
- " if ca_i is None:\n",
173
- " continue\n",
174
- " for j in range(i + 1, len(keys_all)):\n",
175
- " atom_key_j = keys_all[j]\n",
176
- " ca_j = atom_to_ca_map.get(atom_key_j)\n",
177
- " if ca_j is None or ca_i == ca_j:\n",
178
- " continue\n",
179
- " if ca_i[0] == ca_j[0]: # same chain -> not an inter-chain contact\n",
180
- " continue\n",
181
- " if calculate_3d_distance(coord_i, coords_all[atom_key_j]) <= max_distance:\n",
182
- " ca_contacts_seen.add(frozenset((ca_i, ca_j)))\n",
183
- " atom_pair = frozenset((atom_key_i, atom_key_j))\n",
184
- " if atom_pair not in atom_contacts_seen:\n",
185
- " atom_contacts_seen.add(atom_pair)\n",
186
- " atom_info_i = (atom_key_i[0], ca_i[1], atom_key_i[2], atom_key_i[3])\n",
187
- " atom_info_j = (atom_key_j[0], ca_j[1], atom_key_j[2], atom_key_j[3])\n",
188
- " atomic_contacts.append((atom_info_i, atom_info_j))\n",
189
- "\n",
190
- " if pdb_filename:\n",
191
- " base_name = os.path.splitext(os.path.basename(pdb_filename))[0]\n",
192
- " contacts_filename = base_name + \"_contacts.txt\"\n",
193
- " if save_dir:\n",
194
- " os.makedirs(save_dir, exist_ok=True)\n",
195
- " contacts_filename = os.path.join(save_dir, contacts_filename)\n",
196
- " with open(contacts_filename, \"w\") as f:\n",
197
- " for a1, a2 in atomic_contacts:\n",
198
- " f.write(f\"{a1} - {a2}\\n\")\n",
199
- " print(f\"Saved atomic-contact list: {contacts_filename}\")\n",
200
- "\n",
201
- " return atomic_contacts, len(ca_contacts_seen), len(atom_contacts_seen)"
202
- ],
203
- "cell_type": "code",
204
- "execution_count": null,
205
- "outputs": []
206
- },
207
- {
208
- "id": "7f77771a",
209
- "metadata": {},
210
- "source": [
211
- "def get_peptides_contacts(atomic_contacts):\n",
212
- " \"\"\"Collapse atomic contacts into per-peptide-residue contact sets (1-letter codes).\"\"\"\n",
213
- " peptide_contacts = [c for c in atomic_contacts\n",
214
- " if c[0][0] == \"peptide\" or c[1][0] == \"peptide\"]\n",
215
- " if not peptide_contacts:\n",
216
- " return pd.DataFrame(columns=[\"chain_from\", \"aa_from\", \"aa_num_from\", \"contacts\"])\n",
217
- "\n",
218
- " contacts_dict = defaultdict(set)\n",
219
- " for contact in peptide_contacts:\n",
220
- " peptide_atom = contacting_atom = None\n",
221
- " for atom in contact:\n",
222
- " if atom[0] == \"peptide\":\n",
223
- " peptide_atom = atom\n",
224
- " else:\n",
225
- " contacting_atom = atom\n",
226
- " contacts_dict[peptide_atom[:-1]].add(contacting_atom[:-1])\n",
227
- "\n",
228
- " res_df_i = pd.Series(contacts_dict).reset_index()\n",
229
- " res_df_i.columns = [\"chain_from\", \"aa_from\", \"aa_num_from\", \"contacts\"]\n",
230
- " res_df_i.sort_values(\"aa_num_from\", inplace=True)\n",
231
- " return res_df_i\n",
232
- "\n",
233
- "\n",
234
- "def get_tcr_mhc_contacts(atomic_contacts):\n",
235
- " \"\"\"Collect CDR<->MHC atomic contacts as a tidy table (1-letter codes).\"\"\"\n",
236
- " cols = [\"chain_from\", \"aa_from\", \"aa_num_from\", \"chain_to\", \"aa_to\", \"aa_num_to\"]\n",
237
- " pairs = [c for c in atomic_contacts\n",
238
- " if (\"CDR\" in c[0][0] or \"CDR\" in c[1][0]) and \"MHC\" in (c[0][0], c[1][0])]\n",
239
- " if not pairs:\n",
240
- " return pd.DataFrame(columns=cols)\n",
241
- "\n",
242
- " df = pd.DataFrame(pairs)\n",
243
- " df[\"chain_from\"] = df[0].apply(lambda x: x[0])\n",
244
- " df[\"aa_from\"] = df[0].apply(lambda x: x[1])\n",
245
- " df[\"aa_num_from\"] = df[0].apply(lambda x: x[2])\n",
246
- " df[\"chain_to\"] = df[1].apply(lambda x: x[0])\n",
247
- " df[\"aa_to\"] = df[1].apply(lambda x: x[1])\n",
248
- " df[\"aa_num_to\"] = df[1].apply(lambda x: x[2])\n",
249
- "\n",
250
- " df = df[cols].drop_duplicates()\n",
251
- " df.sort_values(by=[\"chain_from\", \"aa_num_from\"], inplace=True)\n",
252
- " return df\n",
253
- "\n",
254
- "\n",
255
- "def add_abscent_contacts(res_df_i):\n",
256
- " \"\"\"Add empty-contact rows for peptide positions that make no contacts.\"\"\"\n",
257
- " peptide = res_df_i.iloc[0].peptide\n",
258
- " pdb_path = res_df_i.iloc[0].pdb_path\n",
259
- " present = set(res_df_i.aa_num_from)\n",
260
- "\n",
261
- " absent = []\n",
262
- " for i, letter in enumerate(peptide):\n",
263
- " pos = i + 1\n",
264
- " if pos not in present:\n",
265
- " absent.append(pd.Series({\n",
266
- " \"chain_from\": \"peptide\",\n",
267
- " \"aa_from\": letter,\n",
268
- " \"aa_num_from\": pos,\n",
269
- " \"contacts\": set(),\n",
270
- " \"peptide\": peptide,\n",
271
- " \"pdb_path\": pdb_path,\n",
272
- " }))\n",
273
- "\n",
274
- " if absent:\n",
275
- " res_df_i = pd.concat([pd.concat(absent, axis=1).T, res_df_i]).sort_values(\"aa_num_from\")\n",
276
- " return res_df_i"
277
- ],
278
- "cell_type": "code",
279
- "execution_count": null,
280
- "outputs": []
281
- },
282
- {
283
- "id": "30d2a9cd",
284
- "metadata": {},
285
- "source": [
286
- "## 3. Sequence definitions"
287
- ],
288
- "cell_type": "markdown"
289
- },
290
- {
291
- "id": "c9e49761",
292
- "metadata": {},
293
- "source": [
294
- "# Index (native) epitope and MHC restriction.\n",
295
- "INDEX_PEPTIDES = [\"ELAGIGILTV\"]\n",
296
- "PEPTIDE_LEN = 10\n",
297
- "\n",
298
- "# MEL5 CDR loops used for contact extraction, and the HLA-A*02:01 alpha-chain sequence.\n",
299
- "cdr3a = \"CAVNVAGKSTF\"\n",
300
- "cdr3b = \"CAWSETGLGTGELFF\"\n",
301
- "cdr1a, cdr2a = \"DRGSQS\", \"IYSNGD\"\n",
302
- "cdr1b, cdr2b = \"GTSNPN\", \"SVGIG\"\n",
303
- "mhc_seq = \"GSHSMRYFFTSVSRPGRGEPRFIAVGYVDDTQFVRFDSDAASQRMEPRAPWIEQEGPEYWDGETRKVKAHSQTHRVDLGTLRGYYNQSEAGSHTVQRMYGCDVGSDWRFLRGYHQYAYDGKDYIALKEDLRSWTAADMAAQTTKHKWEAAHVAEQLRAYLEGTCVEWLRRYLENGKETLQ\"\n",
304
- "\n",
305
- "\n",
306
- "def build_seq_dict(peptide):\n",
307
- " \"\"\"sequence -> label map consumed by extract_coords_from_pdb_by_dict.\"\"\"\n",
308
- " return {\n",
309
- " cdr3a: \"CDR3_alpha\",\n",
310
- " cdr3b: \"CDR3_beta\",\n",
311
- " cdr1a: \"CDR1_alpha\",\n",
312
- " cdr2a: \"CDR2_alpha\",\n",
313
- " cdr1b: \"CDR1_beta\",\n",
314
- " cdr2b: \"CDR2_beta\",\n",
315
- " mhc_seq: \"MHC\",\n",
316
- " peptide: \"peptide\",\n",
317
- " }\n",
318
- "\n",
319
- "\n",
320
- "# Chain label -> sequence, and the residue number at which each segment starts in the PDB.\n",
321
- "chain_seqs = {\n",
322
- " \"CDR3_alpha\": cdr3a,\n",
323
- " \"CDR3_beta\": cdr3b,\n",
324
- " \"CDR1_alpha\": cdr1a,\n",
325
- " \"CDR2_alpha\": cdr2a,\n",
326
- " \"CDR1_beta\": cdr1b,\n",
327
- " \"CDR2_beta\": cdr2b,\n",
328
- " \"MHC\": mhc_seq,\n",
329
- "}\n",
330
- "start_dicts = {\"CDR3_alpha\": 88, \"CDR3_beta\": 91, \"CDR1_alpha\": 26,\n",
331
- " \"CDR2_alpha\": 49, \"CDR1_beta\": 26, \"CDR2_beta\": 47, \"MHC\": 0}"
332
- ],
333
- "cell_type": "code",
334
- "execution_count": null,
335
- "outputs": []
336
- },
337
- {
338
- "id": "60df3387",
339
- "metadata": {},
340
- "source": [
341
- "## 4. Single-structure example (sanity check)"
342
- ],
343
- "cell_type": "markdown"
344
- },
345
- {
346
- "id": "b68519b7",
347
- "metadata": {},
348
- "source": [
349
- "# Worked example on a single modelled structure: extract coordinates and find contacts.\n",
350
- "example_dir = \"/projects/structures/peptide_swap_mel5\"\n",
351
- "example_peptide = sorted(os.listdir(example_dir))[0]\n",
352
- "example_pdb = f\"{example_dir}/{example_peptide}/{example_peptide}_pmhc_oc/ranked_0.pdb\"\n",
353
- "\n",
354
- "_, coords_all, atom_to_ca_map = extract_coords_from_pdb_by_dict(example_pdb, build_seq_dict(example_peptide))\n",
355
- "atomic_contacts, n_ca, n_atom = find_atomic_contacts(coords_all, atom_to_ca_map, max_distance=5.0)\n",
356
- "\n",
357
- "print(f\"{example_peptide}: {n_ca} residue contacts, {n_atom} atomic contacts\")\n",
358
- "get_peptides_contacts(atomic_contacts).head()"
359
- ],
360
- "cell_type": "code",
361
- "execution_count": null,
362
- "outputs": []
363
- },
364
- {
365
- "id": "8b2a9b6f",
366
- "metadata": {},
367
- "source": [
368
- "## 5. Batch contact extraction \u2014 best peptides"
369
- ],
370
- "cell_type": "markdown"
371
- },
372
- {
373
- "id": "c8f25536",
374
- "metadata": {},
375
- "source": [
376
- "def extract_contacts_for_dir(structures_dir):\n",
377
- " \"\"\"Extract peptide contacts and CDR<->MHC contacts for every structure in a directory.\"\"\"\n",
378
- " res_list, tcr_mhc_list = [], []\n",
379
- " for peptide in tqdm.tqdm(os.listdir(structures_dir)):\n",
380
- " pdb_path = f\"{structures_dir}/{peptide}/{peptide}_pmhc_oc/ranked_0.pdb\"\n",
381
- " if not os.path.exists(pdb_path):\n",
382
- " print(\"missing:\", pdb_path)\n",
383
- " continue\n",
384
- "\n",
385
- " seq_dict_local = build_seq_dict(peptide)\n",
386
- " _, coords_all, atom_to_ca_map = extract_coords_from_pdb_by_dict(pdb_path, seq_dict_local)\n",
387
- " atomic_contacts, _, _ = find_atomic_contacts(coords_all, atom_to_ca_map, max_distance=5.0)\n",
388
- "\n",
389
- " res_df_i = get_peptides_contacts(atomic_contacts)\n",
390
- " if len(res_df_i):\n",
391
- " res_df_i[\"peptide\"] = peptide\n",
392
- " res_df_i[\"pdb_path\"] = pdb_path\n",
393
- " res_df_i = add_abscent_contacts(res_df_i)\n",
394
- " res_df_i = res_df_i[[\"chain_from\", \"aa_from\", \"aa_num_from\", \"peptide\", \"pdb_path\", \"contacts\"]]\n",
395
- " res_list.append(res_df_i)\n",
396
- "\n",
397
- " tcr_mhc_contacts = get_tcr_mhc_contacts(atomic_contacts)\n",
398
- " if len(tcr_mhc_contacts):\n",
399
- " tcr_mhc_contacts[\"peptide\"] = peptide\n",
400
- " tcr_mhc_contacts[\"pdb_path\"] = pdb_path\n",
401
- " tcr_mhc_list.append(tcr_mhc_contacts)\n",
402
- " return res_list, tcr_mhc_list\n",
403
- "\n",
404
- "\n",
405
- "def explode_contacts(res_list):\n",
406
- " \"\"\"Concatenate per-structure contact frames and explode them to one row per contact.\"\"\"\n",
407
- " res_df = pd.concat(res_list).reset_index(drop=True)\n",
408
- " res_df.contacts = res_df.contacts.apply(list)\n",
409
- " exploded = res_df.explode(\"contacts\").dropna(subset=[\"contacts\"])\n",
410
- " exploded[\"chain_to\"] = exploded.contacts.apply(lambda x: x[0])\n",
411
- " exploded[\"aa_to\"] = exploded.contacts.apply(lambda x: x[1])\n",
412
- " exploded[\"aa_num_to\"] = exploded.contacts.apply(lambda x: x[2])\n",
413
- " exploded = exploded.reset_index(drop=True)\n",
414
- " exploded.index.name = \"index\"\n",
415
- " return exploded"
416
- ],
417
- "cell_type": "code",
418
- "execution_count": null,
419
- "outputs": []
420
- },
421
- {
422
- "id": "265eb33e",
423
- "metadata": {},
424
- "source": [
425
- "# Extract contacts for the best-binding modelled structures.\n",
426
- "res_list, tcr_mhc_list = extract_contacts_for_dir(\"/projects/structures/peptide_swap_mel5\")\n",
427
- "\n",
428
- "best_contacts = explode_contacts(res_list)\n",
429
- "best_contacts[\"is_native\"] = best_contacts.peptide.isin(INDEX_PEPTIDES)\n",
430
- "save_table(best_contacts, \"all_peptides_contacts_best\")\n",
431
- "best_contacts.head()"
432
- ],
433
- "cell_type": "code",
434
- "execution_count": null,
435
- "outputs": []
436
- },
437
- {
438
- "id": "ab62c11a",
439
- "metadata": {},
440
- "source": [
441
- "# CDR<->MHC contacts table for the best-binding peptides.\n",
442
- "tcr_mhc_best = pd.concat(tcr_mhc_list).reset_index(drop=True)\n",
443
- "tcr_mhc_best[\"is_native\"] = tcr_mhc_best.peptide.isin(INDEX_PEPTIDES)\n",
444
- "tcr_mhc_best = tcr_mhc_best[\n",
445
- " [\"chain_from\", \"aa_from\", \"aa_num_from\", \"peptide\", \"is_native\",\n",
446
- " \"pdb_path\", \"chain_to\", \"aa_to\", \"aa_num_to\"]\n",
447
- "]\n",
448
- "tcr_mhc_best.index.name = \"index\"\n",
449
- "save_table(tcr_mhc_best, \"all_tcr_mhc_contacts_best\")\n",
450
- "tcr_mhc_best.head()"
451
- ],
452
- "cell_type": "code",
453
- "execution_count": null,
454
- "outputs": []
455
- },
456
- {
457
- "id": "42f31824",
458
- "metadata": {},
459
- "source": [
460
- "## 6. Contact heatmaps \u2014 best peptides"
461
- ],
462
- "cell_type": "markdown"
463
- },
464
- {
465
- "id": "5320fe7a",
466
- "metadata": {},
467
- "source": [
468
- "def plot_contacts_heatmap(cur_chain, contacts, starts, n_pep,\n",
469
- " peptide_len=PEPTIDE_LEN, name_prefix=\"\", save=True):\n",
470
- " \"\"\"Contact-frequency heatmap (peptide position x chain position) for one chain.\"\"\"\n",
471
- " cur_seq = chain_seqs[cur_chain]\n",
472
- " chain_start = starts[cur_chain]\n",
473
- "\n",
474
- " contacts_cur = contacts[contacts.chain_to == cur_chain].copy()\n",
475
- " contacts_cur[\"aa_num_to_adj\"] = contacts_cur.aa_num_to - chain_start\n",
476
- " contacts_cur[\"contacting_pair\"] = (\n",
477
- " contacts_cur.aa_num_from.astype(str) + \"-\" + contacts_cur.aa_num_to_adj.astype(str)\n",
478
- " )\n",
479
- "\n",
480
- " contacts_df = contacts_cur.contacting_pair.value_counts().reset_index()\n",
481
- " contacts_df.columns = [\"contacting_pair\", \"count\"]\n",
482
- " contacts_df[\"num_from\"] = contacts_df.contacting_pair.apply(lambda s: int(s.split(\"-\")[0]))\n",
483
- " contacts_df[\"num_to\"] = contacts_df.contacting_pair.apply(lambda s: int(s.split(\"-\")[1]))\n",
484
- " contacts_df.contacting_pair = list(zip(contacts_df.num_from, contacts_df.num_to))\n",
485
- "\n",
486
- " # Fill in every position pair that was never observed with a count of 0.\n",
487
- " all_pairs = set(itertools.product(range(1, peptide_len + 1), range(1, len(cur_seq) + 1)))\n",
488
- " missing = all_pairs.difference(contacts_df.contacting_pair)\n",
489
- " missing_df = pd.DataFrame(\n",
490
- " [{\"contacting_pair\": p, \"count\": 0, \"num_from\": p[0], \"num_to\": p[1]} for p in missing]\n",
491
- " )\n",
492
- " full_df = pd.concat([contacts_df, missing_df], ignore_index=True)\n",
493
- "\n",
494
- " pivoted_df = full_df.pivot(index=\"num_to\", columns=\"num_from\", values=\"count\") / n_pep\n",
495
- "\n",
496
- " plt.figure(figsize=(len(cur_seq) / 2, 9 / 2))\n",
497
- " sns.heatmap(pivoted_df.T, cbar_kws={\"label\": \"frequency\", \"shrink\": 0.5}, square=True,\n",
498
- " cbar=False, vmin=0, vmax=1, cmap=\"gray_r\", linewidths=0.5, linecolor=\"lightgray\")\n",
499
- " plt.ylabel(\"Peptide position\")\n",
500
- " plt.xlabel(\"Chain position\")\n",
501
- " plt.title(cur_chain.replace(\"_\", \" \"))\n",
502
- " if save:\n",
503
- " save_fig(f\"heatmap_{name_prefix}{cur_chain}\")\n",
504
- " plt.show()\n",
505
- " return pivoted_df"
506
- ],
507
- "cell_type": "code",
508
- "execution_count": null,
509
- "outputs": []
510
- },
511
- {
512
- "id": "3f70d4ab",
513
- "metadata": {},
514
- "source": [
515
- "n_peptide_best = best_contacts.peptide.nunique()\n",
516
- "\n",
517
- "# Plot each chain and collect the per-chain contact-frequency matrices (CDRs only).\n",
518
- "contacts_freqs = []\n",
519
- "for chain in chain_seqs:\n",
520
- " pivoted = plot_contacts_heatmap(chain, best_contacts, start_dicts, n_peptide_best)\n",
521
- " if chain != \"MHC\":\n",
522
- " df = pivoted.T\n",
523
- " df.columns = [f\"{col}_{chain}\" for col in df.columns]\n",
524
- " contacts_freqs.append(df.copy())\n",
525
- "\n",
526
- "contacts_freqs_df = pd.concat(contacts_freqs, axis=1)\n",
527
- "save_table(contacts_freqs_df, \"mel5_contacts_freqs_for_heatmap\")\n",
528
- "contacts_freqs_df"
529
- ],
530
- "cell_type": "code",
531
- "execution_count": null,
532
- "outputs": []
533
- },
534
- {
535
- "id": "3831b6bd",
536
- "metadata": {},
537
- "source": [
538
- "## 7. MHC total contacts"
539
- ],
540
- "cell_type": "markdown"
541
- },
542
- {
543
- "id": "9ed51a5b",
544
- "metadata": {},
545
- "source": [
546
- "# Total (summed) MHC contacts per peptide position, max-normalised.\n",
547
- "cur_chain = \"MHC\"\n",
548
- "cur_seq = chain_seqs[cur_chain]\n",
549
- "chain_start = start_dicts[cur_chain]\n",
550
- "\n",
551
- "contacts_cur = best_contacts[best_contacts.chain_to == cur_chain].copy()\n",
552
- "contacts_cur[\"aa_num_to_adj\"] = contacts_cur.aa_num_to - chain_start\n",
553
- "contacts_cur[\"contacting_pair\"] = (\n",
554
- " contacts_cur.aa_num_from.astype(str) + \"-\" + contacts_cur.aa_num_to_adj.astype(str)\n",
555
- ")\n",
556
- "\n",
557
- "contacts_df = contacts_cur.contacting_pair.value_counts().reset_index()\n",
558
- "contacts_df.columns = [\"contacting_pair\", \"count\"]\n",
559
- "contacts_df[\"num_from\"] = contacts_df.contacting_pair.apply(lambda s: int(s.split(\"-\")[0]))\n",
560
- "contacts_df[\"num_to\"] = contacts_df.contacting_pair.apply(lambda s: int(s.split(\"-\")[1]))\n",
561
- "contacts_df.contacting_pair = list(zip(contacts_df.num_from, contacts_df.num_to))\n",
562
- "\n",
563
- "all_pairs = set(itertools.product(range(1, PEPTIDE_LEN + 1), range(1, len(cur_seq) + 1)))\n",
564
- "missing = all_pairs.difference(contacts_df.contacting_pair)\n",
565
- "missing_df = pd.DataFrame(\n",
566
- " [{\"contacting_pair\": p, \"count\": 0, \"num_from\": p[0], \"num_to\": p[1]} for p in missing]\n",
567
- ")\n",
568
- "full_df = pd.concat([contacts_df, missing_df], ignore_index=True)\n",
569
- "pivoted_df = full_df.pivot(index=\"num_to\", columns=\"num_from\", values=\"count\")\n",
570
- "\n",
571
- "total_per_position = pd.DataFrame(pivoted_df.sum()) / pivoted_df.sum().max()\n",
572
- "\n",
573
- "plt.figure(figsize=(1 / 2, PEPTIDE_LEN / 2))\n",
574
- "sns.heatmap(total_per_position,\n",
575
- " cbar_kws={\"label\": \"Total contacts, max normalized\", \"pad\": 0.3, \"shrink\": 3},\n",
576
- " square=True, cmap=\"gray_r\", linewidths=0.5, linecolor=\"lightgray\", vmin=0, vmax=1)\n",
577
- "plt.ylabel(\"peptide position\")\n",
578
- "plt.xlabel(\"Total contacts\")\n",
579
- "plt.xticks([], [])\n",
580
- "plt.title(cur_chain)\n",
581
- "save_fig(\"heatmap_MHC_total_contacts\")\n",
582
- "plt.show()"
583
- ],
584
- "cell_type": "code",
585
- "execution_count": null,
586
- "outputs": []
587
- },
588
- {
589
- "id": "e542b435",
590
- "metadata": {},
591
- "source": [
592
- "## 8. CPL entropy\n",
593
- "\n",
594
- "Loads the CPL (combinatorial peptide library) readout for MEL5. The original\n",
595
- "notebook never defined ``data_cpl`` here, so this load was added; verify the\n",
596
- "column name matches your spreadsheet."
597
- ],
598
- "cell_type": "markdown"
599
- },
600
- {
601
- "id": "ba421267",
602
- "metadata": {},
603
- "source": [
604
- "# CPL MIP-1beta readout for MEL5, pivoted to position x residue.\n",
605
- "TCR_COLUMN = \"MEL5 MIP1\ud835\udf37\"\n",
606
- "data_raw = pd.read_excel(\"./CPL MEL8 1E6 MEL5 and 4C6.xlsx\")\n",
607
- "data_raw[\"residue\"] = data_raw.SubLibrary.apply(lambda x: x[-1])\n",
608
- "data_raw[\"position\"] = data_raw.SubLibrary.apply(lambda x: int(x[0]) if len(x) == 2 else int(x[:2]))\n",
609
- "data_cpl = data_raw.pivot(index=\"position\", columns=\"residue\", values=TCR_COLUMN)\n",
610
- "data_cpl"
611
- ],
612
- "cell_type": "code",
613
- "execution_count": null,
614
- "outputs": []
615
- },
616
- {
617
- "id": "174cc7d1",
618
- "metadata": {},
619
- "source": [
620
- "# CPL data (residue x position); negative readings clipped to zero.\n",
621
- "cpl_data = data_cpl.T\n",
622
- "cpl_data = cpl_data.applymap(lambda x: 0 if x < 0 else x)\n",
623
- "\n",
624
- "p_cpl = cpl_data / cpl_data.sum()\n",
625
- "entropy = p_cpl.applymap(lambda x: -x * np.log(x) if x > 0 else 0).sum()\n",
626
- "save_table(entropy.to_frame(\"entropy\"), \"cpl_entropy\")\n",
627
- "\n",
628
- "plt.figure(figsize=(1 / 2, 9 / 2))\n",
629
- "sns.heatmap(pd.DataFrame(entropy), cbar_kws={\"label\": \"Entropy\", \"shrink\": 0.5},\n",
630
- " square=True, vmin=0, cmap=\"gray\", linewidths=0.5, linecolor=\"lightgray\")\n",
631
- "plt.xlabel(\"Entropy\")\n",
632
- "plt.xticks([], [])\n",
633
- "plt.ylabel(\"Peptide position\")\n",
634
- "save_fig(\"cpl_entropy_heatmap\")\n",
635
- "plt.show()"
636
- ],
637
- "cell_type": "code",
638
- "execution_count": null,
639
- "outputs": []
640
- },
641
- {
642
- "id": "222d0d18",
643
- "metadata": {},
644
- "source": [
645
- "## 9. Index peptide MIP-1\u03b2 profile"
646
- ],
647
- "cell_type": "markdown"
648
- },
649
- {
650
- "id": "75727e48",
651
- "metadata": {},
652
- "source": [
653
- "index_pept = INDEX_PEPTIDES[0] # ELAGIGILTV\n",
654
- "\n",
655
- "# Per-position MIP-1beta for the index peptide's residue, max-normalised.\n",
656
- "res_dict = {}\n",
657
- "for pos_num, (_, pos) in enumerate(data_cpl.iterrows(), start=1):\n",
658
- " res_dict[pos_num] = pos[index_pept[pos_num - 1]] / pos.max()\n",
659
- "res_ser = pd.Series(res_dict).apply(lambda x: 0 if x < 0 else x)\n",
660
- "save_table(res_ser.to_frame(\"mip1b_norm\"), \"index_peptide_mip1b\")\n",
661
- "\n",
662
- "plt.figure(figsize=(1 / 2, 10 / 2))\n",
663
- "sns.heatmap(pd.DataFrame(res_ser), cbar_kws={\"label\": \"MIP-1\\u03b2 values, max normalized\", \"shrink\": 0.5},\n",
664
- " square=True, vmin=0, cmap=\"gray_r\", linewidths=0.5, linecolor=\"lightgray\")\n",
665
- "plt.xlabel(\"MIP-1\\u03b2 values\")\n",
666
- "plt.xticks([], [])\n",
667
- "ticks = [0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5][::-1]\n",
668
- "labels = [f\"{i + 1}\\n{index_pept[i]}\" for i in range(len(index_pept))][::-1]\n",
669
- "plt.yticks(ticks, labels)\n",
670
- "plt.ylabel(\"Peptide position\")\n",
671
- "save_fig(\"index_peptide_mip1b_heatmap\")\n",
672
- "plt.show()"
673
- ],
674
- "cell_type": "code",
675
- "execution_count": null,
676
- "outputs": []
677
- },
678
- {
679
- "id": "563fed3f",
680
- "metadata": {},
681
- "source": [
682
- "## 10. Batch contact extraction \u2014 worst peptides"
683
- ],
684
- "cell_type": "markdown"
685
- },
686
- {
687
- "id": "248a60c5",
688
- "metadata": {},
689
- "source": [
690
- "# Extract contacts for the worst-binding modelled structures.\n",
691
- "res_list_worst, tcr_mhc_list_worst = extract_contacts_for_dir(\"/projects/structures/peptide_swap_mel5_worst\")\n",
692
- "\n",
693
- "worst_contacts = explode_contacts(res_list_worst)\n",
694
- "save_table(worst_contacts, \"all_peptides_contacts_worst\")\n",
695
- "print(worst_contacts.pdb_path.nunique(), \"worst structures\")\n",
696
- "worst_contacts.head()"
697
- ],
698
- "cell_type": "code",
699
- "execution_count": null,
700
- "outputs": []
701
- },
702
- {
703
- "id": "22a3b606",
704
- "metadata": {},
705
- "source": [
706
- "## 11. TCRen: best vs worst contacting"
707
- ],
708
- "cell_type": "markdown"
709
- },
710
- {
711
- "id": "8ebb5366",
712
- "metadata": {},
713
- "source": [
714
- "tcren_potentials = pd.read_csv(\"/home/dluppov/tcren-ms/tcren_potentials_mine.csv\")\n",
715
- "\n",
716
- "\n",
717
- "def tcren_potential(aa_from, aa_to):\n",
718
- " \"\"\"TCRen statistical potential for a (peptide aa, TCR aa) contact.\"\"\"\n",
719
- " hit = tcren_potentials[\n",
720
- " (tcren_potentials[\"residue.aa.from\"] == aa_to)\n",
721
- " & (tcren_potentials[\"residue.aa.to\"] == aa_from)\n",
722
- " ].TCRen\n",
723
- " return hit.iloc[0] if len(hit) else np.nan\n",
724
- "\n",
725
- "\n",
726
- "# TCRen is computed only for peptide<->TCR contacts (exclude MHC).\n",
727
- "contacts_for_tcren = best_contacts[best_contacts.chain_to != \"MHC\"].reset_index(drop=True)\n",
728
- "contacts_for_tcren_worst = worst_contacts[worst_contacts.chain_to != \"MHC\"].reset_index(drop=True)\n",
729
- "\n",
730
- "contacts_for_tcren[\"tcren_potential\"] = [\n",
731
- " tcren_potential(r.aa_from, r.aa_to) for r in contacts_for_tcren.itertuples()\n",
732
- "]\n",
733
- "contacts_for_tcren_worst[\"tcren_potential\"] = [\n",
734
- " tcren_potential(r.aa_from, r.aa_to) for r in contacts_for_tcren_worst.itertuples()\n",
735
- "]\n",
736
- "save_table(contacts_for_tcren, \"contacts_for_tcren_best\")\n",
737
- "save_table(contacts_for_tcren_worst, \"contacts_for_tcren_worst\")"
738
- ],
739
- "cell_type": "code",
740
- "execution_count": null,
741
- "outputs": []
742
- },
743
- {
744
- "id": "0deb29e3",
745
- "metadata": {},
746
- "source": [
747
- "tcren_res = contacts_for_tcren.groupby(\"peptide\").tcren_potential.sum()\n",
748
- "tcren_res_worst = contacts_for_tcren_worst.groupby(\"peptide\").tcren_potential.sum()\n",
749
- "\n",
750
- "best = pd.DataFrame(tcren_res); best[\"is_best\"] = 1\n",
751
- "worst = pd.DataFrame(tcren_res_worst); worst[\"is_best\"] = 0\n",
752
- "potentials = pd.concat([best, worst])\n",
753
- "save_table(potentials, \"mel5_potentials\")\n",
754
- "print(len(tcren_res), \"best peptides;\", len(tcren_res_worst), \"worst peptides\")"
755
- ],
756
- "cell_type": "code",
757
- "execution_count": null,
758
- "outputs": []
759
- },
760
- {
761
- "id": "68fdb697",
762
- "metadata": {},
763
- "source": [
764
- "# Per-structure potentials: best vs worst.\n",
765
- "original = list(tcren_res)\n",
766
- "generated = list(tcren_res_worst)\n",
767
- "data = pd.DataFrame({\n",
768
- " \"value\": original + generated,\n",
769
- " \"category\": [f\"Best contacting\\nn={len(original)}\"] * len(original)\n",
770
- " + [f\"Worst contacting\\nn={len(generated)}\"] * len(generated),\n",
771
- "})\n",
772
- "plt.figure(figsize=(8, 6))\n",
773
- "sns.boxplot(data=data, x=\"category\", y=\"value\", palette=\"pastel\")\n",
774
- "plt.xlabel(\"\")\n",
775
- "plt.ylabel(\"TCRen potential\")\n",
776
- "p_val = mannwhitneyu(original, generated).pvalue\n",
777
- "plt.title(f\"Per structure potentials,\\np={p_val:.2e}\")\n",
778
- "save_fig(\"tcren_box_best_vs_worst_per_structure\")\n",
779
- "plt.show()"
780
- ],
781
- "cell_type": "code",
782
- "execution_count": null,
783
- "outputs": []
784
- },
785
- {
786
- "id": "e0ccf9e1",
787
- "metadata": {},
788
- "source": [
789
- "print(\"t-test:\", ttest_ind(list(tcren_res), list(tcren_res_worst)))\n",
790
- "\n",
791
- "data2auc = pd.concat([\n",
792
- " pd.DataFrame(list(tcren_res), columns=[\"potential\"]).assign(is_best=1),\n",
793
- " pd.DataFrame(list(tcren_res_worst), columns=[\"potential\"]).assign(is_best=0),\n",
794
- "])\n",
795
- "auc = roc_auc_score(data2auc[\"is_best\"], -data2auc[\"potential\"])\n",
796
- "print(f\"ROC AUC = {auc:.4f}\")"
797
- ],
798
- "cell_type": "code",
799
- "execution_count": null,
800
- "outputs": []
801
- },
802
- {
803
- "id": "39b47bf9",
804
- "metadata": {},
805
- "source": [
806
- "## 12. Sequence logos"
807
- ],
808
- "cell_type": "markdown"
809
- },
810
- {
811
- "id": "cf4494a7",
812
- "metadata": {},
813
- "source": [
814
- "clones = list(tcren_res.index)\n",
815
- "mat_df = logomaker.alignment_to_matrix(clones)\n",
816
- "logomaker.Logo(mat_df, color_scheme=\"skylign_protein\")\n",
817
- "plt.title(\"Best peptides\", fontsize=20)\n",
818
- "plt.ylabel(\"Count\")\n",
819
- "plt.xticks(range(0, 10), range(1, 11))\n",
820
- "save_fig(\"logo_best_peptides\")\n",
821
- "plt.show()"
822
- ],
823
- "cell_type": "code",
824
- "execution_count": null,
825
- "outputs": []
826
- },
827
- {
828
- "id": "8bf2a7a5",
829
- "metadata": {},
830
- "source": [
831
- "clones = list(tcren_res_worst.index)\n",
832
- "mat_df = logomaker.alignment_to_matrix(clones)\n",
833
- "logomaker.Logo(mat_df, color_scheme=\"skylign_protein\")\n",
834
- "plt.title(\"Worst peptides\", fontsize=20)\n",
835
- "plt.ylabel(\"Count\")\n",
836
- "plt.xticks(range(0, 10), range(1, 11))\n",
837
- "save_fig(\"logo_worst_peptides\")\n",
838
- "plt.show()"
839
- ],
840
- "cell_type": "code",
841
- "execution_count": null,
842
- "outputs": []
843
- }
844
- ],
845
- "metadata": {
846
- "kernelspec": {
847
- "display_name": "Python [conda env:.conda-new_analysis_env]",
848
- "language": "python",
849
- "name": "conda-env-.conda-new_analysis_env-py"
850
- },
851
- "language_info": {
852
- "codemirror_mode": {
853
- "name": "ipython",
854
- "version": 3
855
- },
856
- "file_extension": ".py",
857
- "mimetype": "text/x-python",
858
- "name": "python",
859
- "nbconvert_exporter": "python",
860
- "pygments_lexer": "ipython3",
861
- "version": "3.11.11"
862
- }
863
- },
864
- "nbformat": 4,
865
- "nbformat_minor": 5
866
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cpl/notebooks_cleanup/.ipynb_checkpoints/mel8_contcats_clean-checkpoint.ipynb DELETED
The diff for this file is too large to render. See raw diff
 
cpl/notebooks_cleanup/.ipynb_checkpoints/tcr_vdb_cleaned-checkpoint.ipynb DELETED
The diff for this file is too large to render. See raw diff
 
cpl/notebooks_cleanup/01_05_2025_TCRvdb.csv DELETED
The diff for this file is too large to render. See raw diff
 
cpl/notebooks_cleanup/1E6/figures/cpl_entropy_heatmap.svg DELETED
cpl/notebooks_cleanup/1E6/figures/heatmap_CDR1_alpha.svg DELETED
cpl/notebooks_cleanup/1E6/figures/heatmap_CDR1_beta.svg DELETED
cpl/notebooks_cleanup/1E6/figures/heatmap_CDR2_beta.svg DELETED
cpl/notebooks_cleanup/1E6/figures/heatmap_CDR3_alpha.svg DELETED
cpl/notebooks_cleanup/1E6/figures/heatmap_CDR3_beta.svg DELETED
cpl/notebooks_cleanup/1E6/figures/heatmap_MHC.svg DELETED
cpl/notebooks_cleanup/1E6/figures/heatmap_MHC_total_contacts.svg DELETED
cpl/notebooks_cleanup/1E6/figures/index_peptide_mip1b_heatmap.svg DELETED
cpl/notebooks_cleanup/1E6/figures/logo_best_peptides.svg DELETED
cpl/notebooks_cleanup/1E6/figures/logo_worst_peptides.svg DELETED
cpl/notebooks_cleanup/1E6/figures/tcren_box_best_vs_worst_per_structure.svg DELETED
cpl/notebooks_cleanup/1E6/tables/1e6_contacts_freqs_for_heatmap.tsv DELETED
@@ -1,11 +0,0 @@
1
- num_from 1_CDR3_alpha 2_CDR3_alpha 3_CDR3_alpha 4_CDR3_alpha 5_CDR3_alpha 6_CDR3_alpha 7_CDR3_alpha 8_CDR3_alpha 9_CDR3_alpha 10_CDR3_alpha 11_CDR3_alpha 12_CDR3_alpha 13_CDR3_alpha 1_CDR3_beta 2_CDR3_beta 3_CDR3_beta 4_CDR3_beta 5_CDR3_beta 6_CDR3_beta 7_CDR3_beta 8_CDR3_beta 9_CDR3_beta 10_CDR3_beta 11_CDR3_beta 12_CDR3_beta 13_CDR3_beta 14_CDR3_beta 15_CDR3_beta 16_CDR3_beta 1_CDR1_alpha 2_CDR1_alpha 3_CDR1_alpha 4_CDR1_alpha 5_CDR1_alpha 6_CDR1_alpha 1_CDR1_beta 2_CDR1_beta 3_CDR1_beta 4_CDR1_beta 5_CDR1_beta 1_CDR2_beta 2_CDR2_beta 3_CDR2_beta 4_CDR2_beta 5_CDR2_beta 6_CDR2_beta
2
- 1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
3
- 2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
4
- 3 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
5
- 4 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
6
- 5 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
7
- 6 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
8
- 7 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
9
- 8 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
10
- 9 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
11
- 10 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
 
 
 
 
 
 
 
 
 
 
 
 
cpl/notebooks_cleanup/1E6/tables/1e6_potentials.tsv DELETED
@@ -1,146 +0,0 @@
1
- peptide tcren_potential is_best
2
- PIDEIHGCVH 2.4217027493580394 0
3
- PIDEIQGCVE 3.683395658418914 0
4
- PIDETHNCVE 3.3507766427432615 0
5
- PIDETHNDVE 1.18601314892187 0
6
- PIDETHNDVH 3.5823692485439986 0
7
- PIDETQGCVE 5.0524486153285295 0
8
- PIDETQGCVH 4.96961223452746 0
9
- PIDETQGDVE 5.620770296072169 0
10
- PIDVIHGDVE 2.939117432742732 0
11
- PIDVIHNCVE 1.4227879580260236 0
12
- PIDVIHNDVE 3.439065812757903 0
13
- PIDVIQGCVE 3.238193676661705 0
14
- PIDVTQGCVE 5.023703854930251 0
15
- PIDVTQNDVE 3.514256665078716 0
16
- PIKEIHGCVE -0.3508725596133602 0
17
- PIKETQGDVE 1.1922250171950934 0
18
- PIKETQGDVH 1.3571629495217683 0
19
- PIKETQNCVE -1.4651834448782406 0
20
- PIKETQNCVH -1.4359345386821278 0
21
- PIKVIHGCVE 2.6067560936466414 0
22
- PIKVIQNCVE 3.561681856269784 0
23
- PIKVIQNDVE 2.6569541707807693 0
24
- PIKVTHNCVH 0.7208021846795598 0
25
- PIKVTQGCVH 1.7631769416595384 0
26
- PIKVTQGDVE 1.4620821014950194 0
27
- PIKVTQNCVE 1.8176919412263581 0
28
- PLDEIHGCVE 2.9963659493276276 0
29
- PLDEIHNCVE 1.67293274232086 0
30
- PLDEIHNCVH 1.5079948099941851 0
31
- PLDEIHNDVH 2.2949014018018024 0
32
- PLDETHGCVH 2.933438226452563 0
33
- PLDETHNCVH 2.8308562416217575 0
34
- PLDVIHGDVH 3.922230325715385 0
35
- PLDVIQGDVE 5.871870612525463 0
36
- PLDVIQGDVH 4.1444033558276185 0
37
- PLDVIQNCVH 2.895285362565613 0
38
- PLDVIQNDVE 3.9744573101934093 0
39
- PLDVTHGCVH 3.8497280683872135 0
40
- PLDVTHGDVH 3.157912107034939 0
41
- PLDVTHNCVH 3.143884347802661 0
42
- PLDVTQNDVE 2.586603634051376 0
43
- PLKEIQGCVH 0.7704583087636465 0
44
- PLKEIQNDVH 0.2664217375618066 0
45
- PLKETHGCVH 1.61618175363069 0
46
- PLKETQGCVH 1.0338744874234191 0
47
- PLKVIHNDVH 0.29700758841577574 0
48
- PLKVIQGCVH 1.9338952328382057 0
49
- PLKVIQGDVE 3.7285810929596366 0
50
- PLKVIQNCVE -0.05485791824507996 0
51
- PLKVTHNCVE 2.0642213917936414 0
52
- PLKVTQNCVH -0.039491066614363024 0
53
- PMDEIQGCVE 3.6535993341296207 0
54
- PMDETQGCVH 4.918611999261196 0
55
- PMDETQGDVH 5.0454800392522285 0
56
- PMDVIHNCVH 1.619187739853329 0
57
- PMDVIHNDVH 1.5042699528609709 0
58
- PMDVIQNDVE 2.7972093265057545 0
59
- PMDVIQNDVH 2.684018117351437 0
60
- PMDVTHGDVH 1.9362421630228783 0
61
- PMDVTHNCVH 3.0187734668097237 0
62
- PMDVTQGDVH 5.02449893351979 0
63
- PMDVTQNDVE 2.652637693132908 0
64
- PMKEIHNCVE 0.4045872444256977 0
65
- PMKEIQGCVE 0.024197181010331414 0
66
- PMKEIQNCVH -0.13008497628818022 0
67
- PMKETHNCVH -0.3438453681322597 0
68
- PMKETHNDVH -0.23144890060305368 0
69
- PMKVIHGDVE 2.692785645207289 0
70
- PMKVIHGDVH 0.09780611265182039 0
71
- PMKVIHNCVH 1.3996376091374636 0
72
- PMKVIHNDVE 0.3295083040860316 0
73
- PMKVIQNDVE -0.11503223693171359 0
74
- PMKVTHNDVH 0.2562840416768547 0
75
- PMKVTQGCVE 1.6872362196490653 0
76
- PMKVTQGDVH 1.9917779178888744 0
77
- QIDEIHGCVE 3.04197023990714 0
78
- QIDEIHNCVE 1.16664918636756 0
79
- QIDEIHNCVH 1.0390830151753319 0
80
- QIDEIHNDVE 1.4065535096391024 0
81
- QIDEIQGCVH 3.4750640983834207 0
82
- QIDETHNCVE 2.9662407121745122 0
83
- QIDETHNCVH 2.6686725923814123 0
84
- QIDETQGDVE 5.18841840138324 0
85
- QIDETQNDVE 4.453984289337388 0
86
- QIDVIQNCVE 1.8476730751007835 0
87
- QIDVTHGCVE 5.398030665205182 0
88
- QIDVTHGDVE 3.959530826457527 0
89
- QIDVTHNDVE 2.412677869328042 0
90
- QIDVTQNDVH 2.4490605734096467 0
91
- QIKEIHGCVH 0.11059210912627289 0
92
- QIKEIHNCVE -0.7906303608217574 0
93
- QIKEIHNCVH 1.3985616871936721 0
94
- QIKETHGDVE 1.4381821380664448 0
95
- QIKETHNDVH 1.2879778025539361 0
96
- QIKETQGDVE 1.3499071898038228 0
97
- QIKETQNCVH -1.4502225150582055 0
98
- QIKVIHGDVE 1.144700848921102 0
99
- QIKVIHNCVE 3.8615012237825814 0
100
- QIKVIHNCVH -0.21054219770174115 0
101
- QIKVIQGCVH 1.5245147830012729 0
102
- QIKVIQNDVH -0.3209132665643869 0
103
- QIKVTHGCVE 2.015492395867177 0
104
- QIKVTQGDVH 2.5954443784638683 0
105
- QIKVTQNDVH 0.3921488342815513 0
106
- QLDEIHGDVH 1.1683736522483938 0
107
- QLDEIHNCVH 1.9737055809439448 0
108
- QLDETHGDVE 5.271413577260525 0
109
- QLDETQGDVE 6.181203311482637 0
110
- QLDETQNCVE 4.39971745522595 0
111
- QLDETQNDVH 3.5728143253777533 0
112
- QLDVIHGCVH 3.9035846006015253 0
113
- QLDVIQGDVE 4.966545452647522 0
114
- QLDVIQNCVH 2.9153544008919114 0
115
- QLDVIQNDVE 4.258888888530427 0
116
- QLDVTHGDVH 4.919422401999158 0
117
- QLDVTHNCVE 3.610262440192716 0
118
- QLKEIHGDVE 0.03584363160047073 0
119
- QLKETHGCVH 2.5940639149005715 0
120
- QLKETHNDVH 1.5293939994903343 0
121
- QLKVIHNCVH 1.8984173914779345 0
122
- QLKVIQGDVE 2.688451347352709 0
123
- QLKVIQNDVH -0.4867698213376626 0
124
- QLKVTHGCVH 2.8634872227004666 0
125
- QLKVTHNDVE 1.0383423050549125 0
126
- QMDEIHGCVE 2.728087268787391 0
127
- QMDEIHGDVH 1.1683736522483938 0
128
- QMDEIQGCVH 3.3461193626020918 0
129
- QMDEIQGDVH 4.383822337271904 0
130
- QMDETHGCVE 5.284281675435734 0
131
- QMDETHNCVE 3.0770684122376575 0
132
- QMDETQNDVE 3.728308929360309 0
133
- QMDVIHNDVE 1.977000668762165 0
134
- QMDVIQGCVH 2.7391280844068704 0
135
- QMDVIQNCVE 3.071764611318037 0
136
- QMDVTHNDVH 2.5976140658632185 0
137
- QMKEIHNCVE 1.0034451524330514 0
138
- QMKETHGCVH 2.155563750584206 0
139
- QMKETHGDVE 1.6664551009618773 0
140
- QMKETHGDVH 1.8530436854083951 0
141
- QMKVIHGCVE 1.6729581081307288 0
142
- QMKVIHGCVH 1.6597275158477454 0
143
- QMKVIHNCVH 0.3778754522875994 0
144
- QMKVIHNDVE 1.0965634187945552 0
145
- QMKVTHGCVE 3.8994798086809714 0
146
- QMKVTQGCVH 2.293732754197879 0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cpl/notebooks_cleanup/1E6/tables/all_peptides_contacts_best.tsv DELETED
The diff for this file is too large to render. See raw diff
 
cpl/notebooks_cleanup/1E6/tables/all_peptides_contacts_worst.tsv DELETED
The diff for this file is too large to render. See raw diff
 
cpl/notebooks_cleanup/1E6/tables/all_tcr_mhc_contacts_best.tsv DELETED
The diff for this file is too large to render. See raw diff
 
cpl/notebooks_cleanup/1E6/tables/contacts_for_tcren_best.tsv DELETED
@@ -1 +0,0 @@
1
- chain_from aa_from aa_num_from peptide is_native pdb_path chain_to aa_to aa_num_to tcren_potential
 
 
cpl/notebooks_cleanup/1E6/tables/contacts_for_tcren_worst.tsv DELETED
The diff for this file is too large to render. See raw diff
 
cpl/notebooks_cleanup/1E6/tables/cpl_entropy.tsv DELETED
@@ -1,11 +0,0 @@
1
- position entropy
2
- 1 2.407471641196575
3
- 2 1.6510143491044356
4
- 3 1.7002128156721832
5
- 4 0.3932386634534798
6
- 5 0.7836237553922625
7
- 6 1.110147305477272
8
- 7 1.481531706796957
9
- 8 1.731924383602427
10
- 9 2.4784140195836883
11
- 10 1.4733252403646113
 
 
 
 
 
 
 
 
 
 
 
 
cpl/notebooks_cleanup/1E6/tables/index_peptide_mip1b.tsv DELETED
@@ -1,11 +0,0 @@
1
- mip1b_norm
2
- 1 0.16247139578300668
3
- 2 0.3915118031075733
4
- 3 0.82196162034519
5
- 4 1.0
6
- 5 1.0
7
- 6 1.0
8
- 7 0.0
9
- 8 0.0
10
- 9 0.34621643610579267
11
- 10 0.0
 
 
 
 
 
 
 
 
 
 
 
 
cpl/notebooks_cleanup/1e6_contacts_clean.ipynb DELETED
The diff for this file is too large to render. See raw diff
 
cpl/notebooks_cleanup/4C6/figures/cpl_entropy_heatmap.svg DELETED
cpl/notebooks_cleanup/4C6/figures/heatmap_CDR1_alpha.svg DELETED
cpl/notebooks_cleanup/4C6/figures/heatmap_CDR1_beta.svg DELETED
cpl/notebooks_cleanup/4C6/figures/heatmap_CDR2_alpha.svg DELETED
cpl/notebooks_cleanup/4C6/figures/heatmap_CDR2_beta.svg DELETED
cpl/notebooks_cleanup/4C6/figures/heatmap_CDR3_alpha.svg DELETED
cpl/notebooks_cleanup/4C6/figures/heatmap_CDR3_beta.svg DELETED
cpl/notebooks_cleanup/4C6/figures/heatmap_MHC.svg DELETED
cpl/notebooks_cleanup/4C6/figures/heatmap_MHC_total_contacts.svg DELETED
cpl/notebooks_cleanup/4C6/figures/logo_best_peptides.svg DELETED
cpl/notebooks_cleanup/4C6/figures/logo_worst_peptides.svg DELETED
cpl/notebooks_cleanup/4C6/figures/original_peptide_mip1b_heatmap.svg DELETED
cpl/notebooks_cleanup/4C6/figures/tcren_box_best_vs_worst_per_contact.svg DELETED
cpl/notebooks_cleanup/4C6/figures/tcren_box_best_vs_worst_per_structure.svg DELETED
cpl/notebooks_cleanup/4C6/tables/.ipynb_checkpoints/4c6_potentials-checkpoint.tsv DELETED
@@ -1,320 +0,0 @@
1
- peptide tcren_potential is_best
2
- LWLPLAGIA 2.274011493240409 1
3
- LWLPLAGIL 2.1469456496459105 1
4
- LWLPLAGIM 2.1386479665260314 1
5
- LWLPLAGIV 2.1386479665260314 1
6
- LWLPLAGIW 2.1386479665260314 1
7
- LWLPLAGLA 2.228195321300239 1
8
- LWLPLAGLL 1.5803074278951503 1
9
- LWLPLAGLM 2.228195321300239 1
10
- LWLPLAGLV 3.2058851403929634 1
11
- LWLPLAGLW 0.9743304301056991 1
12
- LWLPLAPIA 2.127499426155844 1
13
- LWLPLAPIL 2.983526104404297 1
14
- LWLPLAPIM 2.135797109275723 1
15
- LWLPLAPIV 2.1975533719239175 1
16
- LWLPLAPIW 2.127499426155844 1
17
- LWLPLAPLA 2.2253444640499302 1
18
- LWLPLAPLL 1.6873114272490577 1
19
- LWLPLAPLM 2.2253444640499302 1
20
- LWLPLAPLV 1.3870332667474368 1
21
- LWLPLAPLW 1.023320248474045 1
22
- LWLPLFGIA 1.9350777011864897 1
23
- LWLPLFGIL 1.7405677357804255 1
24
- LWLPLFGIM 1.9971095674964834 1
25
- LWLPLFGIV 1.7405677357804255 1
26
- LWLPLFGIW 2.3829354707682793 1
27
- LWLPLFGLA 1.8220930110965532 1
28
- LWLPLFGLL 1.1742051176914647 1
29
- LWLPLFGLM 1.7030492469601337 1
30
- LWLPLFGLV 2.318704642903043 1
31
- LWLPLFGLW 1.7549770421141986 1
32
- LWLPLFPIA 1.5619940662369332 1
33
- LWLPLFPIL 1.5702917493568123 1
34
- LWLPLFPIM 1.792218280970481 1
35
- LWLPLFPIV 1.8090578440799 1
36
- LWLPLFPIW 1.5619940662369332 1
37
- LWLPLFPLA 1.5814874752430672 1
38
- LWLPLFPLL 1.0298530741131156 1
39
- LWLPLFPLM 0.933599581837979 1
40
- LWLPLFPLV 1.003653527606052 1
41
- LWLPLFPLW 1.645745658932107 1
42
- LWLRLAGIA 1.6427692587125287 1
43
- LWLRLAGIL 1.095423221224725 1
44
- LWLRLAGIM 1.564693233486376 1
45
- LWLRLAGIV 1.51570341511803 1
46
- LWLRLAGIW 1.51570341511803 1
47
- LWLRLAGLA 1.654240588260583 1
48
- LWLRLAGLL 1.6052507698922371 1
49
- LWLRLAGLM 1.6052507698922371 1
50
- LWLRLAGLV 1.5351968241241638 1
51
- LWLRLAGLW 1.6052507698922371 1
52
- LWLRLAPIA 1.5365701683496 1
53
- LWLRLAPIL -0.6911145740741516 1
54
- LWLRLAPIM 1.5045548747478423 1
55
- LWLRLAPIV 1.5029195514071119 1
56
- LWLRLAPIW 1.5045548747478423 1
57
- LWLRLAPLA 1.5941022295220497 1
58
- LWLRLAPLL 1.5941022295220497 1
59
- LWLRLAPLM 1.0482635904711317 1
60
- LWLRLAPLV 1.5941022295220497 1
61
- LWLRLAPLW 1.9240366477415827 1
62
- LWLRLFGIA 1.1096011049143444 1
63
- LWLRLFGIL 1.0239387679632501 1
64
- LWLRLFGIM 1.039547159146271 1
65
- LWLRLFGIV 1.3741650160884817 1
66
- LWLRLFGIW 0.9205033950098517 1
67
- LWLRLFGLA 1.1290945139204782 1
68
- LWLRLFGLL 0.7788682657952464 1
69
- LWLRLFGLM 1.1290945139204782 1
70
- LWLRLFGLV 1.6957600914950415 1
71
- LWLRLFGLW 1.1290945139204782 1
72
- LWLRLFPIA 0.7194436166277532 1
73
- LWLRLFPIL 0.5187693209356266 1
74
- LWLRLFPIM 1.1989299872803916 1
75
- LWLRLFPIV 0.6090303852808743 1
76
- LWLRLFPIW 0.6090303852808743 1
77
- LWLRLFPLA 0.6665624464533237 1
78
- LWLRLFPLL 0.6665624464533237 1
79
- LWLRLFPLM 0.9905582174368234 1
80
- LWLRLFPLV 0.6665624464533237 1
81
- LWLRLFPLW 0.9382510939293672 1
82
- LWMRLLPLL 1.1621985201131624 1
83
- LWPPLAGIA 2.068594020757958 1
84
- LWPPLAGIL 1.9974820808619786 1
85
- LWPPLAGIM 2.1876377848943775 1
86
- LWPPLAGIV 2.1876377848943775 1
87
- LWPPLAGIW 2.146670045984111 1
88
- LWPPLAGLA 2.0423284236907215 1
89
- LWPPLAGLL 2.228195321300239 1
90
- LWPPLAGLM 2.228195321300239 1
91
- LWPPLAGLV 2.608994001265285 1
92
- LWPPLAGLW 2.228195321300239 1
93
- LWPPLAPIA 2.0918913935797376 1
94
- LWPPLAPIL 2.127499426155844 1
95
- LWPPLAPIM 2.1355215056139234 1
96
- LWPPLAPIV 2.1179151555313753 1
97
- LWPPLAPIW 2.127499426155844 1
98
- LWPPLAPLA 2.1638323982713965 1
99
- LWPPLAPLL 3.024194577486327 1
100
- LWPPLAPLM 1.3853546716238603 1
101
- LWPPLAPLV 1.023320248474045 1
102
- LWPPLAPLW 2.5807597992034426 1
103
- LWPPLFGIA 1.6172994073536977 1
104
- LWPPLFGIL 1.6188615985200867 1
105
- LWPPLFGIM 1.609277327895618 1
106
- LWPPLFGIV 1.609277327895618 1
107
- LWPPLFGIW -0.8061571955426897 1
108
- LWPPLFGLA 1.5979957219474148 1
109
- LWPPLFGLL 1.708408953294294 1
110
- LWPPLFGLM 1.6988246826698252 1
111
- LWPPLFGLV 2.2750745308688574 1
112
- LWPPLFGLW 1.6680496677154881 1
113
- LWPPLFPIA 1.4387257378102056 1
114
- LWPPLFPIL 1.4387257378102056 1
115
- LWPPLFPIM 1.4146593914921861 1
116
- LWPPLFPIV 1.4483100084346743 1
117
- LWPPLFPIW 1.4483100084346743 1
118
- LWPPLFPLA 1.5378573632088814 1
119
- LWPPLFPLL 1.5282730925844128 1
120
- LWPPLFPLM 1.5282730925844128 1
121
- LWPPLFPLV 1.887969017153194 1
122
- LWPPLFPLW 1.5282730925844128 1
123
- LWPRLAGIA 1.407912542734666 1
124
- LWPRLAGIL 1.2845209311292174 1
125
- LWPRLAGIM 0.9796102693832813 1
126
- LWPRLAGIV 1.3998904632765863 1
127
- LWPRLAGIW 1.1654771669927984 1
128
- LWPRLAGLA 1.399092042377022 1
129
- LWPRLAGLL 1.3740682859034248 1
130
- LWPRLAGLM 1.4193838722827201 1
131
- LWPRLAGLV 1.4691459881450952 1
132
- LWPRLAGLW 1.5622244467003805 1
133
- LWPRLAPIA 1.4842630448421439 1
134
- LWPRLAPIL 1.1543286266226107 1
135
- LWPRLAPIM 1.1340367967169123 1
136
- LWPRLAPIV 0.8820936923950077 1
137
- LWPRLAPIW 1.1340367967169123 1
138
- LWPRLAPLA 0.2948187030777843 1
139
- LWPRLAPLL 1.2438759813968179 1
140
- LWPRLAPLM 0.9518955040150759 1
141
- LWPRLAPLV 1.573810399616351 1
142
- LWPRLAPLW 1.1248322172603986 1
143
- LWPRLFGIA 0.6770511605734204 1
144
- LWPRLFGIL 0.4598639155377411 1
145
- LWPRLFGIM 1.0192553292405726 1
146
- LWPRLFGIV 0.6690290811153409 1
147
- LWPRLFGIW 1.0239387679632501 1
148
- LWPRLFGLA 1.2605244095266348 1
149
- LWPRLFGLL 0.758576435889548 1
150
- LWPRLFGLM 1.1088026840147798 1
151
- LWPRLFGLV 0.758576435889548 1
152
- LWPRLFGLW 1.1086880898338607 1
153
- LWPRLFPIA 0.959116970502039 1
154
- LWPRLFPIL 0.5567232617734181 1
155
- LWPRLFPIM 0.84870373915516 1
156
- LWPRLFPIV 0.5887385553751758 1
157
- LWPRLFPIW 0.84870373915516 1
158
- LWPRLFPLA 0.9381364997484481 1
159
- LWPRLFPLL -0.15861498183167344 1
160
- LWPRLFPLM 1.2883627478736797 1
161
- LWPRLFPLV 0.9382510939293672 1
162
- LWPRLFPLW 0.9382510939293672 1
163
- FFCCCGESF 2.493788664220773 0
164
- FFCCCRFRI 6.939565084107656 0
165
- FFCCCRFSI 1.7594750226944238 0
166
- FFCSCEERI 1.6484653031152208 0
167
- FFCSCGERI 2.126183380559794 0
168
- FFCSCRESL 0.07303804258158111 0
169
- FFCSSDERI 2.5633455286950095 0
170
- FFCSSDESF 1.469640725919887 0
171
- FFCSSEERI 1.5281306650959288 0
172
- FFIMMDKKI -1.6174458104318603 0
173
- FFIMPRKDI 2.638871037270585 0
174
- FFIQMEKDL -0.3086320944158666 0
175
- FFIQMGKKF 0.726873827882694 0
176
- FFKMMEKKI -2.529459688965277 0
177
- FFKMMEMDI -0.18666712511912908 0
178
- FFKMMRKDL 2.0723102940713516 0
179
- FFKMMRMDL 4.037329755322921 0
180
- FFKMMRMKF 3.89325308110519 0
181
- FFKMPGKDI 0.11019888439334355 0
182
- FFKMPGKDL 0.2576596431690612 0
183
- FFKQMDMKI 0.2789999721586617 0
184
- FFKQPDMDL 0.5314040109538414 0
185
- FFSCCDERF 3.2943054179584466 0
186
- FFSCCDFRL 4.210145755400449 0
187
- FFSCCDFSL 3.4109660430805224 0
188
- FFSCCEFSF 2.3713347206289583 0
189
- FFSCSDFSI 1.6281105129562938 0
190
- FFSCSEERL 1.9513561620981108 0
191
- FFSCSRESL 1.929271445432191 0
192
- FFSCSRFRL 4.705578696463731 0
193
- FFSSCEESL -1.3932105761448907 0
194
- FFSSCEFSL -1.3849037931725974 0
195
- FFSSSDERF 1.9838326076153405 0
196
- FFSSSDERL 1.7791362838978158 0
197
- FFSSSDFRL 2.195609441559557 0
198
- FFSSSEFRL 3.0878213488351474 0
199
- FFSSSEFSI -0.35260901382966675 0
200
- FWCCCDFRF 4.738196266930846 0
201
- FWCCCEERF 3.3686199680728306 0
202
- FWCCSRFSI 2.206350865070471 0
203
- FWCSCDERF 0.18199762794764163 0
204
- FWCSCEFSI -1.1376388450065322 0
205
- FWCSCRESF 1.2688561862976617 0
206
- FWCSSDERL 2.9059754225303926 0
207
- FWIMMEMDL 0.31461740296517293 0
208
- FWIMPDKKI -3.1652246541349918 0
209
- FWIMPGKDL 0.8117205726703108 0
210
- FWIQPEKDL 0.24088942769878546 0
211
- FWIQPEMDL 1.8154536184993304 0
212
- FWKMMEMKI 0.17524376419506693 0
213
- FWKMPEKKF -2.7595956887562916 0
214
- FWKMPEMKL -0.8156447313615405 0
215
- FWKQPEKKF -1.2589457795373236 0
216
- FWKQPRMDF 4.061972878768342 0
217
- FWSCCEFRI 4.393977618714295 0
218
- FWSCCGESL 3.4128989411484363 0
219
- FWSCSRFRI 5.4808718514044195 0
220
- FWSSCRERF 4.453363000021189 0
221
- FWSSSEFRF 2.962643251638249 0
222
- FWSSSGESF 0.6176261443765156 0
223
- FYCCCGERF 6.194589467650578 0
224
- FYCSCEERI 1.1238837433722904 0
225
- FYCSSDFRI 3.4028373398966245 0
226
- FYIMPGMKI 0.4552196587084154 0
227
- FYKQMEMKI 0.7944972337863621 0
228
- FYSCCDERF 4.124258530852192 0
229
- FYSCCDERL 4.124258530852192 0
230
- FYSCCEFSI 0.5765904661062682 0
231
- FYSCCGERF 5.323195029462891 0
232
- FYSCSDERI 2.7273534468214313 0
233
- FYSSCEERL 2.5103267132461937 0
234
- FYSSSGESI -0.6217108935445976 0
235
- TFCCCEFRF 3.40914477748398 0
236
- TFCCCEFSF 2.3568947676755663 0
237
- TFCCCRESF 1.099320413259733 0
238
- TFCCSEFSF 2.243739546969789 0
239
- TFCCSRESF 1.8538612364563778 0
240
- TFCSCDESF 0.38330724708102615 0
241
- TFCSCDESI 1.6329478777205528 0
242
- TFCSCGFRI 4.799837489178535 0
243
- TFCSSEFSL -0.09170141385863984 0
244
- TFCSSGESF -0.14199750733437505 0
245
- TFIMMDMDF -0.16351753894495497 0
246
- TFIMMDMKF -0.4748613534377927 0
247
- TFIMMEKKI -2.6974903424913474 0
248
- TFIMMGMDI 2.669189762033672 0
249
- TFIMMRMDL 4.007613186483783 0
250
- TFIMPEMKF -0.6683906162746963 0
251
- TFIQMRMDI 4.592604318307105 0
252
- TFIQPGKDF 1.7348788322769004 0
253
- TFKMMEKDL -1.5488531142232775 0
254
- TFKMMRKDF 1.9248055212641473 0
255
- TFKMPDMDL -0.17345429837538145 0
256
- TFKQMDKKL -1.2401658330148744 0
257
- TFKQMEKDF 0.6116174105115224 0
258
- TFKQMRMDF 5.165466724661365 0
259
- TFKQPDMDL -0.05139511243723836 0
260
- TFSCCGFRI 6.845257251511432 0
261
- TFSCCGFSL 4.488275700373962 0
262
- TFSCSDESI 1.7579587495174291 0
263
- TFSCSEESL -0.1870672488874986 0
264
- TFSCSEFSF 0.8758723989481765 0
265
- TFSSCGESL -0.3830319134585849 0
266
- TFSSSDERL 3.3331680863443207 0
267
- TFSSSEESL -0.4709883233914507 0
268
- TFSSSRERF 2.0333533672055184 0
269
- TWCCCDFSF 2.215296548851103 0
270
- TWCCSRESF 0.6849953478212809 0
271
- TWCSCGESI -1.280219142533488 0
272
- TWCSSDFSI -0.2993566678189006 0
273
- TWIMPDMDF -0.2153685922942456 0
274
- TWIMPGKKL -1.374380948381484 0
275
- TWIQMEKKF -1.5210986347860045 0
276
- TWIQMEMDI 1.998127510823304 0
277
- TWIQMRKDL 3.5211947234018752 0
278
- TWIQPGMKI 2.526960709711327 0
279
- TWIQPRKDI 1.5988372962854944 0
280
- TWIQPRKKL -1.2564044634552984 0
281
- TWKMMDKDF -0.6043875619086088 0
282
- TWSCCRESL 3.1597102407033946 0
283
- TWSCSGESL 1.2048217822006901 0
284
- TWSCSRESF -0.09757002310928853 0
285
- TWSCSRFSI 2.889250960014654 0
286
- TWSSCDESF 0.9248682967833317 0
287
- TWSSCDFRI 2.0584431558585488 0
288
- TWSSCEFSL -1.3323777310675537 0
289
- TWSSCGFSF 1.2061102825319492 0
290
- TWSSCRERF 3.9059279354367087 0
291
- TWSSSDERL 3.437615168175161 0
292
- TWSSSDFRF 2.9016757749783357 0
293
- TYCCCRFSF 2.38598779092243 0
294
- TYCCCRFSL 0.0410568227359383 0
295
- TYCCSDESI 3.432717991992763 0
296
- TYCSCEFSF -1.553662958520015 0
297
- TYCSCGFRI 2.1879690696039704 0
298
- TYCSCRERI 2.0564698239278725 0
299
- TYCSCRESF 0.6589104737584217 0
300
- TYCSSEFRL 3.272344590253676 0
301
- TYCSSRESL 1.3595479104378054 0
302
- TYCSSRFRI 2.263803795762274 0
303
- TYIMMDMDL 0.4376727701086003 0
304
- TYIMPGMKI 1.4853171003654797 0
305
- TYIQMDMDL 1.7077658706079655 0
306
- TYIQMGMKI 1.090618218465069 0
307
- TYIQPDKKF -0.9329631593992991 0
308
- TYKMPRKKF 0.5631213340186528 0
309
- TYKQMGKDL 2.595764399340909 0
310
- TYKQMGKKL 0.34737782988448096 0
311
- TYKQPDKKI -2.1041632171507882 0
312
- TYSCCDESI 1.5330509839066786 0
313
- TYSCCRESL 3.160534998403393 0
314
- TYSCSGFRL 4.536395468268973 0
315
- TYSSCEFRL 0.6433060395945056 0
316
- TYSSCGERL 2.2618847736264014 0
317
- TYSSCRERL 3.196000128795728 0
318
- TYSSCRFRF 3.678629266891776 0
319
- TYSSSEESI -1.029423306000927 0
320
- TYSSSGFSL 0.43801710933836974 0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cpl/notebooks_cleanup/4C6/tables/.ipynb_checkpoints/all_peptides_contacts_native-checkpoint.tsv DELETED
The diff for this file is too large to render. See raw diff
 
cpl/notebooks_cleanup/4C6/tables/.ipynb_checkpoints/all_tcr_mhc_contacts_native-checkpoint.tsv DELETED
The diff for this file is too large to render. See raw diff
 
cpl/notebooks_cleanup/4C6/tables/.ipynb_checkpoints/contacts_for_tcren_best-checkpoint.tsv DELETED
The diff for this file is too large to render. See raw diff