cmatkhan commited on
Commit
2aff5da
·
verified ·
1 Parent(s): 1b4bf69

add scripts directory

Browse files
scripts/harbison_locus_tag_to_target_locus_tag.csv ADDED
The diff for this file is too large to render. See raw diff
 
scripts/harbison_regulator_to_regulator_locus_tag.csv ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ harbison_regulator,regulator_locus_tag
2
+ A1 (MATA1),YSC0017
3
+ ABF1,YKL112W
4
+ ABT1,YNR054C
5
+ ACA1,YER045C
6
+ ACE2,YLR131C
7
+ ADR1,YDR216W
8
+ AFT2,YPL202C
9
+ ARG80,YMR042W
10
+ ARG81,YML099C
11
+ ARO80,YDR421W
12
+ ARR1,YPR199C
13
+ ASH1,YKL185W
14
+ ASK10,YGR097W
15
+ AZF1,YOR113W
16
+ BAS1,YKR099W
17
+ BYE1,YKL005C
18
+ CAD1,YDR423C
19
+ CBF1,YJR060W
20
+ CHA4,YLR098C
21
+ CIN5,YOR028C
22
+ CRZ1,YNL027W
23
+ CST6,YIL036W
24
+ CUP9,YPL177C
25
+ DAL80,YKR034W
26
+ DAL81,YIR023W
27
+ DAL82,YNL314W
28
+ DAT1,YML113W
29
+ DIG1,YPL049C
30
+ DOT6,YER088C
31
+ ECM22,YLR228C
32
+ EDS1,YBR033W
33
+ FAP7,YDL166C
34
+ FHL1,YPR104C
35
+ FKH1,YIL131C
36
+ FKH2,YNL068C
37
+ FZF1,YGL254W
38
+ GAL3,YDR009W
39
+ GAL4,YPL248C
40
+ GAL80,YML051W
41
+ GAT1,YFL021W
42
+ GAT3,YLR013W
43
+ GCN4,YEL009C
44
+ GCR1,YPL075W
45
+ GCR2,YNL199C
46
+ GLN3,YER040W
47
+ GTS1,YGL181W
48
+ GZF3,YJL110C
49
+ HAA1,YPR008W
50
+ HAC1,YFL031W
51
+ HAL9,YOL089C
52
+ HAP1,YLR256W
53
+ HAP2,YGL237C
54
+ HAP3,YBL021C
55
+ HAP4,YKL109W
56
+ HAP5,YOR358W
57
+ HIR1,YBL008W
58
+ HIR2,YOR038C
59
+ HIR3,YJR140C
60
+ HMS1,YOR032C
61
+ HMS2,YJR147W
62
+ HOG1,YLR113W
63
+ HSF1,YGL073W
64
+ IFH1,YLR223C
65
+ IME1,YJR094C
66
+ IME4,YGL192W
67
+ INO2,YDR123C
68
+ INO4,YOL108C
69
+ IXR1,YKL032C
70
+ KRE33,YNL132W
71
+ KSS1,YGR040W
72
+ LEU3,YLR451W
73
+ MAC1,YMR021C
74
+ MAL13,YGR288W
75
+ MAL33,YBR297W
76
+ MBF1,YOR298C-A
77
+ MBP1,YDL056W
78
+ MCM1,YMR043W
79
+ MDS3,YGL197W
80
+ MET18,YIL128W
81
+ MET28,YIR017C
82
+ MET31,YPL038W
83
+ MET32,YDR253C
84
+ MET4,YNL103W
85
+ MGA1,YGR249W
86
+ MIG1,YGL035C
87
+ MIG2,YGL209W
88
+ MIG3,YER028C
89
+ MOT3,YMR070W
90
+ MSN1,YOL116W
91
+ MSN2,YMR037C
92
+ MSN4,YKL062W
93
+ MSS11,YMR164C
94
+ MTH1,YDR277C
95
+ NDD1,YOR372C
96
+ NDT80,YHR124W
97
+ NNF2,YGR089W
98
+ NRG1,YDR043C
99
+ OAF1,YAL051W
100
+ OPI1,YHL020C
101
+ PDC2,YDR081C
102
+ PDR1,YGL013C
103
+ PDR3,YBL005W
104
+ PHD1,YKL043W
105
+ PHO2,YDL106C
106
+ PHO4,YFR034C
107
+ PIP2,YOR363C
108
+ PPR1,YLR014C
109
+ PUT3,YKL015W
110
+ RAP1,YNL216W
111
+ RCO1,YMR075W
112
+ RCS1,YGL071W
113
+ RDR1,YOR380W
114
+ RDS1,YCR106W
115
+ REB1,YBR049C
116
+ RFX1,YLR176C
117
+ RGM1,YMR182C
118
+ RGT1,YKL038W
119
+ RIM101,YHL027W
120
+ RLM1,YPL089C
121
+ RLR1,YNL139C
122
+ RME1,YGR044C
123
+ ROX1,YPR065W
124
+ RPH1,YER169W
125
+ RPI1,YIL119C
126
+ RPN4,YDL020C
127
+ RTG1,YOL067C
128
+ RTG3,YBL103C
129
+ RTS2,YOR077W
130
+ SFL1,YOR140W
131
+ SFP1,YLR403W
132
+ SIG1,YER068W
133
+ SIP3,YNL257C
134
+ SIP4,YJL089W
135
+ SKN7,YHR206W
136
+ SKO1,YNL167C
137
+ SMK1,YPR054W
138
+ SMP1,YBR182C
139
+ SNF1,YDR477W
140
+ SNT2,YGL131C
141
+ SOK2,YMR016C
142
+ SPT10,YJL127C
143
+ SPT2,YER161C
144
+ SPT23,YKL020C
145
+ SRD1,YCR018C
146
+ STB1,YNL309W
147
+ STB2,YMR053C
148
+ STB4,YMR019W
149
+ STB5,YHR178W
150
+ STB6,YKL072W
151
+ STE12,YHR084W
152
+ STP1,YDR463W
153
+ STP2,YHR006W
154
+ STP4,YDL048C
155
+ SUM1,YDR310C
156
+ SUT1,YGL162W
157
+ SUT2,YPR009W
158
+ SWI4,YER111C
159
+ SWI5,YDR146C
160
+ SWI6,YLR182W
161
+ TBS1,YBR150C
162
+ TEC1,YBR083W
163
+ THI2,YBR240C
164
+ TOS8,YGL096W
165
+ TYE7,YOR344C
166
+ UGA3,YDL170W
167
+ UME1,YPL139C
168
+ UME6,YDR207C
169
+ UPC2,YDR213W
170
+ USV1,YPL230W
171
+ WAR1,YML076C
172
+ WTM1,YOR230W
173
+ WTM2,YOR229W
174
+ XBP1,YIL101C
175
+ YAP1,YML007W
176
+ YAP3,YHL009C
177
+ YAP5,YIR018W
178
+ YAP6,YDR259C
179
+ YAP7,YOL028C
180
+ YBL054W,YBL054W
181
+ YBR239C,YBR239C
182
+ YBR267W,YBR267W
183
+ YDR026C,YDR026C
184
+ YDR049W,YDR049W
185
+ YDR266C,YDR266C
186
+ YDR520C,YDR520C
187
+ YER051W,YER051W
188
+ YER130C,YER130C
189
+ YER184C,YER184C
190
+ YFL044C,YFL044C
191
+ YFL052W,YFL052W
192
+ YGR067C,YGR067C
193
+ YHP1,YDR451C
194
+ YJL206C,YJL206C
195
+ YKL222C,YKL222C
196
+ YKR064W,YKR064W
197
+ YLR278C,YLR278C
198
+ YML081W,YML081W
199
+ YNR063W,YNR063W
200
+ YOX1,YML027W
201
+ YPR022C,YPR022C
202
+ YPR196W,YPR196W
203
+ YRR1,YOR162C
204
+ ZAP1,YJL056C
205
+ ZMS1,YJR127C
scripts/parse_harbison_data.R ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ library(tidyverse)
2
+ library(readxl)
3
+ library(here)
4
+ library(arrow)
5
+
6
+ # genomic feature harmonization table ----
7
+ # see https://huggingface.co/datasets/BrentLab/yeast_genome_resources
8
+ genes_table = arrow::open_dataset(here("data/genome_files/hf/features")) %>%
9
+ as_tibble()
10
+
11
+ # function to read in the harbison raw data ----
12
+ read_in_harbison_data = function(xls_path, sheet_name, values_colname, n_max=6229){
13
+ read_excel(xls_path,
14
+ sheet=sheet_name,
15
+ skip=1,
16
+ n_max = n_max) %>%
17
+ dplyr::rename(locus_tag=`...1`,
18
+ gene_name=`...2`,
19
+ description=`...3`) %>%
20
+ mutate(across(!c(locus_tag, gene_name, description), as.numeric)) %>%
21
+ pivot_longer(!c(locus_tag, gene_name, description),
22
+ names_to='tf_cond',
23
+ values_to=values_colname) %>%
24
+ separate(tf_cond, c('tf', 'condition'), sep="_")
25
+ }
26
+
27
+ # read in the raw pvalue data ----
28
+ # note that n_max is set to 6229, which is the end of the genomic data. on some
29
+ # sheets, there is data accidently left in by the original researcher
30
+ harbison_pval_df_list = list(
31
+ ypd = read_in_harbison_data(
32
+ here('data/harbison/pvalbygene_forpaper_abbr.xls'),
33
+ 'YPD',
34
+ 'pvalue'),
35
+ other_conds = read_in_harbison_data(
36
+ here('data/harbison/pvalbygene_forpaper_abbr.xls'),
37
+ "other conditions",
38
+ "pvalue")
39
+ )
40
+
41
+ harbison_pval_df = bind_rows(harbison_pval_df_list)
42
+
43
+ # read in the raw effect ratio data ----
44
+ harbison_effect_df_list = list(
45
+ ypd = read_in_harbison_data(
46
+ here('data/harbison/ratiobygene_forpaper_abbr.xls'),
47
+ 'YPD',
48
+ "effect"),
49
+ other_conds = read_in_harbison_data(
50
+ here('data/harbison/ratiobygene_forpaper_abbr.xls'),
51
+ 'Other Conditions',
52
+ 'effect'))
53
+
54
+ harbison_effect_df = bind_rows(harbison_effect_df_list)
55
+
56
+ # combine the effect and pvalue data ----
57
+ combined_harbison = harbison_effect_df %>%
58
+ select(-gene_name) %>%
59
+ left_join(select(harbison_pval_df, -gene_name)) %>%
60
+ # remove the control sample and remove locus tags that correspond to
61
+ # now deleted ORFs (these weren't merged into other annotations, they were
62
+ # simply complely removed from the annotation set)
63
+ filter(!locus_tag %in% c('YCL006C', 'YCR103C', 'YER187W-A')) %>%
64
+ dplyr::rename(harbison_locus_tag = locus_tag) %>%
65
+ mutate(tf = trimws(toupper(tf)))
66
+
67
+ # create a lookup map from the harbison targets to SGD 3-1 ----
68
+ locus_tags = combined_harbison %>%
69
+ select(harbison_locus_tag) %>%
70
+ distinct() %>%
71
+ left_join(genes_table, by = c("harbison_locus_tag" = "locus_tag")) %>%
72
+ mutate(locus_tag = harbison_locus_tag) %>%
73
+ select(harbison_locus_tag, locus_tag, symbol)
74
+
75
+ locus_tags_aliases = read_csv('data/harbison/locus_tags_aliases.csv') %>%
76
+ left_join(genes_table, by = c('curr_notation'='locus_tag')) %>%
77
+ dplyr::rename(locus_tag = curr_notation) %>%
78
+ select(harbison_locus_tag, locus_tag, symbol)
79
+
80
+ locus_tags_complete = locus_tags %>%
81
+ filter(!is.na(symbol)) %>%
82
+ bind_rows(locus_tags_aliases) %>%
83
+ dplyr::rename(target_locus_tag = locus_tag,
84
+ target_symbol = symbol)
85
+
86
+ stopifnot(nrow(locus_tags_complete) == nrow(locus_tags))
87
+
88
+ stopifnot(setequal(unique(combined_harbison$harbison_locus_tag),
89
+ locus_tags_complete$harbison_locus_tag))
90
+
91
+ # create a lookup map from the regulator names to SGD 3-1 ----
92
+ tf_symbol_to_locus_tag_df = combined_harbison %>%
93
+ select(tf) %>%
94
+ mutate(tf = trimws(toupper(tf))) %>%
95
+ distinct() %>%
96
+ left_join(genes_table, by = c('tf' = 'symbol')) %>%
97
+ select(tf, locus_tag) %>%
98
+ dplyr::rename(regulator_locus_tag = locus_tag) %>%
99
+ mutate(regulator_symbol = tf) %>%
100
+ select(tf, regulator_symbol, regulator_locus_tag)
101
+
102
+ tf_locus_tag_to_locus_tag_df = tf_symbol_to_locus_tag_df %>%
103
+ filter(!complete.cases(.)) %>%
104
+ select(tf) %>%
105
+ left_join(genes_table, by = c('tf' = 'locus_tag')) %>%
106
+ filter(!is.na(symbol)) %>%
107
+ select(tf, symbol) %>%
108
+ dplyr::rename(regulator_symbol = symbol) %>%
109
+ mutate(regulator_locus_tag = tf)
110
+
111
+ tf_name_df_na = read_csv("data/harbison/tf_name_aliases.csv") %>%
112
+ left_join(genes_table) %>%
113
+ # tf_main is the current SGD 3-1 symbol
114
+ select(tf, tf_main, locus_tag) %>%
115
+ dplyr::rename(regulator_symbol = tf_main, regulator_locus_tag = locus_tag) %>%
116
+ select(tf, regulator_symbol, regulator_locus_tag)
117
+
118
+ harbison_tf_map = bind_rows(
119
+ tf_symbol_to_locus_tag_df[complete.cases(tf_symbol_to_locus_tag_df),],
120
+ tf_locus_tag_to_locus_tag_df,
121
+ tf_name_df_na
122
+ )
123
+
124
+ stopifnot(setequal(harbison_tf_map$tf, unique(combined_harbison$tf)))
125
+
126
+ # create the harmonized data ----
127
+ combined_harbison_harmonized = combined_harbison %>%
128
+ left_join(harbison_tf_map) %>%
129
+ left_join(locus_tags_complete) %>%
130
+ dplyr::rename(harbison_regulator=tf) %>%
131
+ select(-description)
132
+
133
+ combined_harbison_harmonized %>%
134
+ select(condition, regulator_locus_tag, target_locus_tag, effect, pvalue) %>%
135
+ group_by(condition, regulator_locus_tag) %>%
136
+ write_dataset(path = here("data/harbison/hf/data"), format = "parquet")
137
+