-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscratchpad.Rmd
executable file
·69 lines (65 loc) · 1.89 KB
/
scratchpad.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
---
title: "Scratchpad"
output: html_notebook
---
#TODO: Do I need this heatmap? Does it work?
```{r}
drake::loadd(abqr_001_trspc)
adegraphics::table.image(abqr_001_trspc$D)
```
#TODO: Check if this is can be discarded
```{r}
drake::loadd(all_haps)
names(all_haps[[1]]) %>%
stringr::str_remove_all(" ") %>%
stringr::str_remove("freq:") %>%
stringr::str_remove("_bwa") %>%
stringr::str_replace("strain", "h") %>%
stringr::str_c("s", .) %>%
tibble::enframe(name = NULL) %>%
tidyr::separate(value, into = c("sample", "hapl", "freq"), sep = "_") %>%
dplyr::mutate(freq = freq %>%
as.numeric() %>%
magrittr::multiply_by(100) %>%
round(1)) %>%
tidyr::unite(col = ids, remove = FALSE)
```
```{r}
drake::loadd(all_haps)
names(all_haps[[2]]) %>%
str_c("s", .) %>%
str_remove("bwa") %>%
str_remove("fr_") %>%
tibble::enframe(name = NULL) %>%
tidyr::separate(value, into = c("sample", "hapl", "freq"), sep = "_") %>%
dplyr::mutate(freq = freq %>% as.numeric() %>% round(3) * 100) %>%
dplyr::mutate(hapl = as.numeric(hapl) %>%
magrittr::add(1) %>%
as.character() %>%
str_c("h", .)) %>%
tidyr::unite(col = ids, remove = FALSE)
```
```{r}
drake::loadd(all_haps)
names(all_haps[[2]])
names(all_haps[[2]]) %<>%
str_c("s", .) %>%
str_remove("bwa") %>%
str_remove("fr_") %>%
tibble::enframe(name = NULL) %>%
tidyr::separate(value, into = c("sample", "hapl", "freq"), sep = "_") %>%
dplyr::mutate(freq = freq %>% as.numeric() %>% round(3) * 100) %>%
dplyr::mutate(hapl = as.numeric(hapl) %>%
magrittr::add(1) %>%
as.character() %>%
str_c("h", .)) %>%
tidyr::unite(col = ids) %>%
dplyr::pull(ids) #%>%
# setNames(object = all_haps[[2]])
names(all_haps[[2]])
all_haps[[2]]
```
```{r}
clean_names_abqr(all_haps[[1]])
all_haps
```