-
Notifications
You must be signed in to change notification settings - Fork 0
/
design_new_okl.Rmd
102 lines (83 loc) · 1.96 KB
/
design_new_okl.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
---
title: "Design new OKL"
output: html_document
editor_options:
chunk_output_type: console
---
```{r setup}
library(tidyverse)
library(synExtra)
library(here)
library(fst)
library(data.table)
library(powerjoin)
library(morgancpp)
# library(dtplyr)
theme_set(theme_minimal())
synapser::synLogin()
syn <- synDownloader("~/data/", .cache = TRUE)
```
```{r loading}
inputs <- list(
okl_pseudo_kds = "syn51080578",
fingerprints = "syn26262157"
)
input_files <- map(
inputs, syn
)
pseudo_kds <- input_files[["okl_pseudo_kds"]] %>%
fread() %>%
as_tibble()
dir.create(here("new_okl"))
```
```{r}
fingerprints <- MorganFPS$new(input_files[["fingerprints"]], from_file = TRUE)
setdiff(pseudo_kds$lspci_id, fingerprints$names)
similarity_matrix <- fingerprints$tanimoto_subset(
unique(single_dose_datasets$lspci_id),
unique(single_dose_datasets$lspci_id)
) %>%
as_tibble() %>%
rename(lspci_id_1 = id_1, lspci_id_2 = id_2)
write_csv(
similarity_matrix,
here("new_okl", "similarity_values.csv")
)
```
Remove results from mutant kinases, then aggregate across remaining variants
(phosphorylation etc) using minimum pseudo-kd. Should hopefully reflect the
kinase state that people typically want to inhibit.
```{r}
kd_matrix <- pseudo_kds %>%
filter(
dataset == "original_repeat_replaced",
!exclude_target
) %>%
group_by(lspci_id, hgnc_symbol) %>%
slice_min(pseudo_kd, na_rm = TRUE, with_ties = FALSE) %>%
ungroup() %>%
select(
lspci_id, hmsl_id, name,
`DiscoveRx Gene Symbol`, hgnc_symbol,
classification, pseudo_kd, pseudo_kd_relation
)
write_csv(
kd_matrix,
here("new_okl", "kd_values.csv")
)
```
```{r}
new_okl_syn <- synMkdir(
"syn18508401", "new_okl"
)
synStoreMany(
c(
here("new_okl", "kd_values.csv"),
here("new_okl", "similarity_values.csv")
),
parentId = new_okl_syn,
used = unname(inputs),
executed = "https://github.com/labsyspharm/okl-analysis/blob/main/design_new_okl.Rmd",
forceVersion = FALSE
)
```