cmatkhan commited on
Commit
08f5bf1
·
verified ·
1 Parent(s): a6118da

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. scripts/parse_hughes_2006.R +56 -38
scripts/parse_hughes_2006.R CHANGED
@@ -224,59 +224,77 @@ genome_map = tibble(
224
 
225
  stopifnot(setequal(genome_map$hughes_target, unique(df_oe$hughes_target)))
226
 
 
 
 
 
 
 
 
 
 
 
 
227
  df_oe_harmonized = df_oe %>%
228
  left_join(
229
- select(hughes_2006_meta,
 
230
  regulator_locus_tag,
231
  regulator_symbol)) %>%
232
  left_join(genome_map) %>%
233
- select(regulator_locus_tag, regulator_symbol,
 
234
  target_locus_tag, target_symbol,
235
  dye_plus, dye_minus, mean_norm_log2fc)
236
 
237
- df_oe_harmonized %>%
238
- write_parquet("~/code/hf/hughes_2006/overexpression.parquet",
239
- compression = "zstd",
240
- write_statistics = TRUE,
241
- use_dictionary = c(
242
- regulator_locus_tag = TRUE,
243
- regulator_symbol = TRUE,
244
- target_locus_tag = TRUE,
245
- target_symbol = TRUE
246
- )
247
- )
 
248
 
249
  df_ko_harmonized = df_ko %>%
250
  left_join(
251
- select(hughes_2006_meta,
 
252
  regulator_locus_tag,
253
  regulator_symbol)) %>%
254
  left_join(genome_map) %>%
255
- select(regulator_locus_tag, regulator_symbol,
 
256
  target_locus_tag, target_symbol,
257
  dye_plus, dye_minus, mean_norm_log2fc)
258
 
259
- df_ko_harmonized %>%
260
- write_parquet("~/code/hf/hughes_2006/knockout.parquet",
261
- compression = "zstd",
262
- write_statistics = TRUE,
263
- use_dictionary = c(
264
- regulator_locus_tag = TRUE,
265
- regulator_symbol = TRUE,
266
- target_locus_tag = TRUE,
267
- target_symbol = TRUE
268
- )
269
- )
 
270
 
271
- hughes_2006_meta %>%
272
- janitor::clean_names() %>%
273
- write_parquet("~/code/hf/hughes_2006/metadata.parquet",
274
- compression = "zstd",
275
- write_statistics = TRUE,
276
- use_dictionary = c(
277
- regulator_locus_tag = TRUE,
278
- regulator_symbol = TRUE,
279
- oe_passed_qc = TRUE,
280
- del_passed_qc = TRUE
281
- )
282
- )
 
 
224
 
225
  stopifnot(setequal(genome_map$hughes_target, unique(df_oe$hughes_target)))
226
 
227
+ hughes_2006_meta_with_id = hughes_2006_meta %>%
228
+ group_by(regulator_locus_tag) %>%
229
+ mutate(sample_id = cur_group_id()) %>%
230
+ ungroup() %>%
231
+ select(sample_id, all_of(colnames(hughes_2006_meta))) %>%
232
+ arrange(sample_id)
233
+
234
+ stopifnot(
235
+ hughes_2006_meta_with_id %>% group_by(sample_id) %>% filter(n()>1) %>% nrow() == 0
236
+ )
237
+
238
  df_oe_harmonized = df_oe %>%
239
  left_join(
240
+ select(hughes_2006_meta_with_id,
241
+ sample_id,
242
  regulator_locus_tag,
243
  regulator_symbol)) %>%
244
  left_join(genome_map) %>%
245
+ select(sample_id,
246
+ regulator_locus_tag, regulator_symbol,
247
  target_locus_tag, target_symbol,
248
  dye_plus, dye_minus, mean_norm_log2fc)
249
 
250
+ # df_oe_harmonized %>%
251
+ # write_parquet("~/code/hf/hughes_2006/overexpression.parquet",
252
+ # compression = "zstd",
253
+ # write_statistics = TRUE,
254
+ # use_dictionary = c(
255
+ # sample_id = TRUE,
256
+ # regulator_locus_tag = TRUE,
257
+ # regulator_symbol = TRUE,
258
+ # target_locus_tag = TRUE,
259
+ # target_symbol = TRUE
260
+ # )
261
+ # )
262
 
263
  df_ko_harmonized = df_ko %>%
264
  left_join(
265
+ select(hughes_2006_meta_with_id,
266
+ sample_id,
267
  regulator_locus_tag,
268
  regulator_symbol)) %>%
269
  left_join(genome_map) %>%
270
+ select(sample_id,
271
+ regulator_locus_tag, regulator_symbol,
272
  target_locus_tag, target_symbol,
273
  dye_plus, dye_minus, mean_norm_log2fc)
274
 
275
+ # df_ko_harmonized %>%
276
+ # write_parquet("~/code/hf/hughes_2006/knockout.parquet",
277
+ # compression = "zstd",
278
+ # write_statistics = TRUE,
279
+ # use_dictionary = c(
280
+ # sample_id = TRUE,
281
+ # regulator_locus_tag = TRUE,
282
+ # regulator_symbol = TRUE,
283
+ # target_locus_tag = TRUE,
284
+ # target_symbol = TRUE
285
+ # )
286
+ # )
287
 
288
+ # hughes_2006_meta_with_id %>%
289
+ # janitor::clean_names() %>%
290
+ # write_parquet("~/code/hf/hughes_2006/metadata.parquet",
291
+ # compression = "zstd",
292
+ # write_statistics = TRUE,
293
+ # use_dictionary = c(
294
+ # sample_id = TRUE,
295
+ # regulator_locus_tag = TRUE,
296
+ # regulator_symbol = TRUE,
297
+ # oe_passed_qc = TRUE,
298
+ # del_passed_qc = TRUE
299
+ # )
300
+ # )