-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwrite_gene_sets_xls.R
52 lines (43 loc) · 1.48 KB
/
write_gene_sets_xls.R
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
#!/usr/bin/env Rscript
library(dplyr)
library(janitor)
library(reshape2)
genes = readxl::read_xlsx("/Users/vapp0002/Downloads/KonradPaper_GeneLists.xlsx",
sheet = 1,
col_names = TRUE)
modules = readxl::read_xlsx("/Users/vapp0002/Downloads/KonradPaper_GeneLists.xlsx",
sheet = 2,
skip = 1,
col_names = c("SET", "MODULE"))
modules$SET = make_clean_names(modules$SET, allow_dupes = TRUE)
modules$MODULE = make_clean_names(modules$MODULE, allow_dupes = TRUE)
gene_sets = genes %>%
clean_names() %>%
select(-entrez_id, -ensemblgene) %>%
melt(id.vars = c("gene_symbol")) %>%
filter(value == TRUE) %>%
select(variable, gene_symbol) %>%
rename(SET = variable)
wgcna = genes %>%
clean_names %>%
select(wgcna_modules, gene_symbol)
meta_modules = inner_join(gene_sets, modules, by = c("SET")) %>%
select(MODULE, gene_symbol)
write.table(wgcna,
"Konrad_Raznahan_WGCNA_Modules.txt",
sep = "\t",
row.names = F,
col.names = F,
quote = F)
write.table(gene_sets,
"Konrad_Raznahan_Sets.txt",
sep = "\t",
row.names = F,
col.names = F,
quote = F)
write.table(meta_modules,
"Konrad_Raznahan_Modules.txt",
sep = "\t",
row.names = F,
col.names = F,
quote = F)