@@ -60,7 +60,8 @@ output_path <- here::here('reports')
6060pinvars <-
6161 read_tsv(pinpoints_path,
6262 col_types = cols(.default = col_character())) %>%
63- type_convert(guess_integer = TRUE)
63+ type_convert(guess_integer = TRUE) %>%
64+ mutate(row_label = as.integer(row_label))
6465
6566poolvars <-
6667 read_tsv(all_variants_path,
@@ -71,35 +72,22 @@ poolvars <-
7172``` {r eval=have(params$rescue)}
7273rescue <-
7374 read_tsv(rescue_path) %>%
75+ mutate(row_label = as.integer(row_label)) %>%
7476 select(-sample_id)
7577
7678pinvars <-
7779 pinvars %>%
78- full_join(rescue, by=c('uvarid','row_id','column_id','varid','row_label','column_label','sample_alias'))
80+ full_join(rescue, by=c('uvarid','row_id','column_id','row_label','column_label','varid','sample_alias')) %>%
81+ mutate(is_pool_pin = if_else(is.na(is_pool_pin),0,is_pool_pin))
7982```
8083
8184``` {r eval=have(params$annotations)}
8285
83- annotations <-
84- read_tsv(annotations_path,
85- na = '-', col_types = cols(.default = col_character())) %>%
86- type_convert(guess_integer = TRUE)
87-
88- pinvars <-
89- pinvars %>%
90- left_join(annotations, by='varid')
91-
92- poolvars <-
93- poolvars %>%
94- left_join(annotations, by='varid')
95- ```
96-
97-
98- ``` {r eval=F}
9986annotations <-
10087 read_tsv(annotations_path,
10188 na = '-', col_types = cols(.default = col_character())) %>%
10289 type_convert(guess_integer = TRUE) %>%
90+ mutate(is_lof = if_else(LoF == 'HC',1,0)) %>%
10391 mutate(clinvar_stars = case_when(
10492 str_detect(ClinVar_CLNREVSTAT, "practice_guideline") ~ 4,
10593 str_detect(ClinVar_CLNREVSTAT, "reviewed_by_expert_panel") ~ 3,
@@ -111,23 +99,13 @@ annotations <-
11199 mutate(is_p = if_else(str_detect(ClinVar_CLNSIG, 'Pathogenic') | str_detect(ClinVar_CLNSIG, "Likely_pathogenic"), 1,0)) %>%
112100 mutate(is_lofp = if_else(is_lof == 1 | is_p == 1,1,0))
113101
114- rescue <-
115- read_tsv(rescue_path) %>%
116- select(-sample_id)
117-
118102pinvars <-
119- read_tsv(pinpoints_path,
120- col_types = cols(.default = col_character())) %>%
121- type_convert(guess_integer = TRUE) %>%
122- left_join(rescue, by=c('uvarid','row_id','column_id','varid')) %>%
103+ pinvars %>%
123104 left_join(annotations, by='varid')
124105
125106poolvars <-
126- read_tsv(all_variants_path,
127- col_types = cols(.default = col_character())) %>%
128- type_convert(guess_integer = TRUE) %>%
107+ poolvars %>%
129108 left_join(annotations, by='varid')
130-
131109```
132110
133111``` {r}
@@ -166,8 +144,10 @@ pinvars <-
166144``` {r}
167145plot_data <-
168146 pinvars %>%
147+ filter(is_pool_pin == 1) %>%
169148 group_by(sample_id,row_factor, column_factor) %>%
170149 summarise(private_variants = n())
150+
171151plot_data %>%
172152 ggplot(aes(x = column_factor, y = row_factor, fill = private_variants)) +
173153 geom_point(shape = 22, size = 14, color='black') +
@@ -190,8 +170,8 @@ plot_data %>%
190170``` {r eval=have(params$annotations)}
191171plot_data <-
192172 pinvars %>%
193- mutate(row_factor = fct_rev(factor(row_label, levels = 1:2, ordered = TRUE)),
194- column_factor = factor(column_label, levels = LETTERS[1:2], ordered = TRUE) ) %>%
173+ filter(is_pool_pin = = 1) %>%
174+ filter(is_lofp == 1 ) %>%
195175 group_by(sample_id,row_factor, column_factor) %>%
196176 summarise(private_variants = n())
197177
@@ -214,11 +194,15 @@ plot_data %>%
214194 ggtitle('pLoF/p only')
215195```
216196
197+
198+
199+
200+
217201``` {r eval=have(params$annotations) & have(params$rescue)}
218202plot_data <-
219203 pinvars %>%
220- mutate(row_factor = fct_rev(factor(row_label, levels = 1:2, ordered = TRUE)),
221- column_factor = factor(column_label, levels = LETTERS[1:2], ordered = TRUE) ) %>%
204+ filter((probability >= 0.5 & is_single) | is_pool_pin == 1) %>%
205+ filter(is_lofp == 1 ) %>%
222206 group_by(sample_id,row_factor, column_factor) %>%
223207 summarise(private_variants = n())
224208
0 commit comments