<jupyter_start><jupyter_text>Quick start on how to access different datasetsThis notebook demonstrates how to use the `src.data` module to quickly and easily load different datasets on ligands, kinases, profiling, distances and target datasets.<jupyter_code>%load_ext autoreload
%autoreload 2
from pathlib import Path

from IPython.display import display, HTML
from opencadd.databases import klifs

from src.paths import PATH_DATA, PATH_RESULTS
from src.data import ligands, kinases, profiling, distances, targets
HERE = Path(_dh[-1])  # noqa: F821
DATA = PATH_DATA
RESULTS = PATH_RESULTS / "all"<jupyter_output><empty_output><jupyter_text>Ligand datasetsGet kinase-binding ligand details.  PKIDB<jupyter_code>dataset = ligands.pkidb()
print(f"Number of ligands: {dataset.shape[0]}")
dataset.head()<jupyter_output>Number of ligands: 260<jupyter_text>Kinase datasetsGet kinase details.  KinMap<jupyter_code>dataset = kinases.kinmap()
print(f"Number of kinases: {dataset.shape[0]}")
dataset.head()<jupyter_output>Number of kinases: 536<jupyter_text>KLIFS<jupyter_code>klifs_session = klifs.setup_remote()
dataset = klifs_session.kinases.all_kinases()
print(f"Number of kinases: {dataset.shape[0]}")
dataset.head()<jupyter_output>Number of kinases: 1127<jupyter_text>Profiling datasetsGet kinase-ligand bioactivities.  KaramanBioactivity measure: $K_D$ [nM]<jupyter_code>dataset = profiling.karaman()
print(f"Number of kinases: {dataset.shape[0]}")
print(f"Number of ligands: {dataset.shape[1]}")
print(f"Number of measurements: {dataset.unstack().dropna().shape[0]}")
display(HTML(dataset.head().to_html()))
dataset.count().sort_values().plot(kind="barh", figsize=(5, 6));
ligand = "Erlotinib"
n_measurements = dataset[ligand].dropna().shape[0]
print(f"Number of measurements for {ligand}: {n_measurements}")<jupyter_output>Number of measurements for Erlotinib: 48<jupyter_text>DavisBioactivity measure: $K_D$ [nM]<jupyter_code>dataset = profiling.davis()
print(f"Number of kinases: {dataset.shape[0]}")
print(f"Number of ligands: {dataset.shape[1]}")
print(f"Number of measurements: {dataset.unstack().dropna().shape[0]}")
display(HTML(dataset.head().to_html()))
dataset.count().sort_values().plot(kind="barh", figsize=(5, 12));<jupyter_output>Number of kinases: 350
Number of ligands: 72
Number of measurements: 7099<jupyter_text>Karaman-Davis<jupyter_code>dataset = profiling.karaman_davis()
print(f"Number of kinases: {dataset.shape[0]}")
print(f"Number of ligands: {dataset.shape[1]}")
print(f"Number of measurements: {dataset.unstack().dropna().shape[0]}")
display(HTML(dataset.head().to_html()))
dataset.count().sort_values().plot(kind="barh", figsize=(5, 12));<jupyter_output>No measurements                                                                 20611
One measurement                                                                  6296
Two identical measurements                                                       1291
Two measurements <= or > cutoff 100; keep lower value                              30
One measurement <=, one > cutoff 100 but difference <= 100; keep lower value        2
One measurement <=, one > cutoff 100 but difference > 100; remove values           10
dtype: int64
Number of kinases: 353
Number of ligands: 80
Number of measurements: 7619<jupyter_text>PKIS2Bioactivity measure: > Percentage of the kinase that remains bound to the immobilized inhibitor relative to a DMSO control (% control). We then converted these numbers into percent inhibition (%Inh)>> $\%Inh = 100 - \%control$https://doi.org/10.1371/journal.pone.0181585We will call this measure here $\%displ$ (percent of kinase displaced)<jupyter_code>dataset = profiling.pkis2(kinmap_kinases=True)
print(f"Number of kinases: {dataset.shape[0]}")
print(f"Number of ligands: {dataset.shape[1]}")
print(f"Number of measurements: {dataset.unstack().dropna().shape[0]}")
print(f"Minimum value: {dataset.min().min()}")
print(f"Maximum value: {dataset.max().max()}")
dataset.head()
ax = (dataset > 0).sum().plot(kind="hist")
ax.set_xlabel(r"Number of $\%displ > 0$ values in full dataset");
ax = dataset.plot(kind="kde", legend=None, xlim=(0, 100))
ax.set_xlabel(r"$\%displ$ distribution per ligand");<jupyter_output><empty_output><jupyter_text>Kinase-kinase distances datasetsGet kinase-kinase distances.  KiSSim<jupyter_code>dataset = distances.kissim()
print(f"Kinase distance matrix dimensions: {dataset.shape}")
dataset.iloc[:5, :5]<jupyter_output>Kinase distance matrix dimensions: (257, 257)<jupyter_text>Target datasetsGet targets for input ligands.  PKIDB<jupyter_code>ligand_names = ["Erlotinib", "Lapatinib", "Imatinib"]
targets.pkidb(ligand_names)<jupyter_output>Changed kinase names (unknown names may be discarded - see function docstring):
   kinase.input            kinase.kinmap
1         NR1I2  unknown (not in KinMap)
3         ERBB2                    ErbB2
6         NTRK1                     TRKA
7         CSF1R                      FMS
8        PDGFRA                   PDGFRa
11       PDGFRB                   PDGFRb
{'fraction_non_alphanumeric': 0.12361111111111112, 'fraction_numerical': 0.02757936507936508, 'mean_word_length': 4.485310119695321, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 42, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '85231', 'license': 'MIT', 'n_tokens_mistral': 1718, 'n_tokens_neox': 1537, 'n_words': 390, 'path': 'notebooks/001_quick_start/002_quick_start_datasets.ipynb', 'repo_name': 'volkamerlab/kissim_app', 'size': '5040'}