Datasets:
Update scripts/parse_mcisaac_data.R
Browse files- scripts/parse_mcisaac_data.R +52 -17
scripts/parse_mcisaac_data.R
CHANGED
|
@@ -86,20 +86,55 @@ mcisaac_GeneName_to_target_locus_tag = mcisaac_for_parquet %>%
|
|
| 86 |
select(GeneName, target_locus_tag) %>%
|
| 87 |
distinct()
|
| 88 |
|
| 89 |
-
mcisaac_for_parquet %>%
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
select(GeneName, target_locus_tag) %>%
|
| 87 |
distinct()
|
| 88 |
|
| 89 |
+
# mcisaac_for_parquet %>%
|
| 90 |
+
# select(regulator_locus_tag, time, mechanism, restriction, date, strain,
|
| 91 |
+
# target_locus_tag, ends_with("median"), starts_with("log2")) %>%
|
| 92 |
+
# group_by(regulator_locus_tag, time, mechanism, restriction, date, strain) %>%
|
| 93 |
+
# write_dataset(path = here("data/mcisaac/hf/data"), format = "parquet")
|
| 94 |
+
|
| 95 |
+
db_mcisaac_data = read_csv("data/mcisaac/database_mcisaac_20251126.csv") %>%
|
| 96 |
+
select(id, regulator_locus_tag, mechanism, restriction, time, notes) %>%
|
| 97 |
+
mutate(
|
| 98 |
+
strain = trimws(str_extract(notes, "(?<=strain_id:)[^;]+")),
|
| 99 |
+
date = trimws(str_extract(notes, "(?<=date:)[^;]+")),
|
| 100 |
+
mechanism = toupper(mechanism)) %>%
|
| 101 |
+
select(-notes) %>%
|
| 102 |
+
dplyr::rename(db_id = id) %>%
|
| 103 |
+
bind_rows(
|
| 104 |
+
mcisaac_for_parquet %>%
|
| 105 |
+
filter(regulator_locus_tag %in% c("GEV", "Z3EV")) %>%
|
| 106 |
+
select(regulator_locus_tag, time, mechanism,
|
| 107 |
+
restriction, date, strain) %>%
|
| 108 |
+
distinct() %>%
|
| 109 |
+
mutate(db_id = 0)) %>%
|
| 110 |
+
arrange(db_id) %>%
|
| 111 |
+
mutate(sample_id = row_number())
|
| 112 |
+
|
| 113 |
+
final_mcisaac = mcisaac_for_parquet %>%
|
| 114 |
+
left_join(db_mcisaac_data) %>%
|
| 115 |
+
select(sample_id, db_id,
|
| 116 |
+
regulator_locus_tag, regulator_symbol,
|
| 117 |
+
target_locus_tag, target_symbol,
|
| 118 |
+
time, mechanism, restriction, date, strain,
|
| 119 |
+
ends_with("median"), starts_with("log2"))
|
| 120 |
+
|
| 121 |
+
# note! verify before overwriting that the sample_id for the unique sample
|
| 122 |
+
# tuple is the same as it is in the current hackett_2020, or that any changes
|
| 123 |
+
# are intentional
|
| 124 |
+
|
| 125 |
+
# final_mcisaac %>%
|
| 126 |
+
# write_parquet("~/code/hf/hackett_2020/hackett_2020.parquet",
|
| 127 |
+
# compression = "zstd",
|
| 128 |
+
# chunk_size = 6175,
|
| 129 |
+
# write_statistics = TRUE,
|
| 130 |
+
# use_dictionary = c(
|
| 131 |
+
# sample_id = TRUE,
|
| 132 |
+
# regulator_locus_tag = TRUE,
|
| 133 |
+
# regulator_symbol = TRUE,
|
| 134 |
+
# target_locus_tag = TRUE,
|
| 135 |
+
# target_symbol = TRUE,
|
| 136 |
+
# time = TRUE,
|
| 137 |
+
# mechanism = TRUE,
|
| 138 |
+
# restriction = TRUE,
|
| 139 |
+
# date = TRUE,
|
| 140 |
+
# strain = TRUE))
|