Datasets:
submitted to geo
Browse files- annotated_features/batch=run_6778/part-0.parquet +3 -0
- annotated_features/batch=run_7380/part-0.parquet +3 -0
- annotated_features/batch=run_7388/part-0.parquet +3 -0
- annotated_features/batch=run_7390/part-0.parquet +3 -0
- annotated_features_meta.parquet +2 -2
- scripts/cc_sra_submission_with_addtl.R +216 -34
annotated_features/batch=run_6778/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2b1f16fae177cc6415b19eb02784d67fb84f4e221040d47a55afd4cbb584548d
|
| 3 |
+
size 206481
|
annotated_features/batch=run_7380/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:40b614d2b44dcdad9188592ae92e9b61bae0468a724a6640e31f94ab36dec672
|
| 3 |
+
size 287257
|
annotated_features/batch=run_7388/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:78dabc51a1f8e4d56e789843b37dfa6c35ffc6ee3d83d6466fb049632f8db096
|
| 3 |
+
size 265609
|
annotated_features/batch=run_7390/part-0.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0bcc0b130e5cca1e98bf780eba8221e85c512f79a52f182a8411270182510396
|
| 3 |
+
size 254227
|
annotated_features_meta.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:beb52b8eba49ee426214fd19c8b91b746085927a98a3a4152f6887773c21df8b
|
| 3 |
+
size 14727
|
scripts/cc_sra_submission_with_addtl.R
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
|
|
|
|
|
| 1 |
library(tidyverse)
|
| 2 |
library(here)
|
|
|
|
| 3 |
|
| 4 |
-
# TODO: REMOVE HYPERGEOMETRIC PVALUE FROM PROCESSED DATA
|
| 5 |
# TODO: when making processing scripts github, add the background file
|
| 6 |
# and make sure the repo gets registered to zenodo. Put that link to the
|
| 7 |
# background files in the SRA submission
|
| 8 |
|
| 9 |
-
# for "data_usable" in sra submission, change to "perturbation_validated".
|
| 10 |
-
# factor levels should be "true", "false", "unreviewed" (DTO only)
|
| 11 |
-
# num_insertions for number of insertions
|
| 12 |
-
#
|
| 13 |
# cells grown on solid media at room temperature
|
| 14 |
# put the definition of the "Description" values in the
|
| 15 |
|
|
@@ -35,9 +33,12 @@ analysis_set_meta = read_csv("~/htcf_ref/data/yeast_database_modelling/pull_data
|
|
| 35 |
composite_binding = read_csv("~/htcf_ref/data/yeast_database_modelling/pull_data_20250805/data/bindingconcat_meta_20250805.csv") %>%
|
| 36 |
filter(source_name == "brent_nf_cc")
|
| 37 |
|
| 38 |
-
|
|
|
|
| 39 |
recursive=TRUE)
|
| 40 |
|
|
|
|
|
|
|
| 41 |
passing_fastq_from_bam_paths = list.files("~/htcf_local/cc/yeast/passing_fastq_from_bam")
|
| 42 |
|
| 43 |
fastq_df = tibble(filename = passing_fastq_from_bam_paths) %>%
|
|
@@ -58,7 +59,7 @@ fastq_df = tibble(filename = passing_fastq_from_bam_paths) %>%
|
|
| 58 |
|
| 59 |
barcode_details_df = map(barcode_details_list, ~{
|
| 60 |
message(sprintf("working on %s", basename(.x)))
|
| 61 |
-
x = jsonlite::read_json(file.path(
|
| 62 |
tibble(
|
| 63 |
seq = names(x$components$tf$map),
|
| 64 |
regulator_symbol = unlist(x$components$tf$map)) %>%
|
|
@@ -80,6 +81,16 @@ binding_django = read_csv(here("data/binding_from_django_db_20260128.csv"))
|
|
| 80 |
|
| 81 |
barcode_details_df_with_id = barcode_details_df %>%
|
| 82 |
mutate(replicate = str_remove(str_extract(regulator_symbol, "x\\d"), "x")) %>%
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
mutate(regulator_symbol = str_remove(regulator_symbol, "x\\d")) %>%
|
| 84 |
replace_na(list(replicate = '1')) %>%
|
| 85 |
mutate(replicate = as.integer(replicate)) %>%
|
|
@@ -99,8 +110,10 @@ setdiff(basename(c(brentlab_dirs, mitra_dirs)), unique(binding_django$batch))
|
|
| 99 |
|
| 100 |
gm_db = arrow::open_dataset("~/code/hf/callingcards/genome_map")
|
| 101 |
|
| 102 |
-
|
| 103 |
-
|
|
|
|
|
|
|
| 104 |
filter(!batch %in% c('dsir4'))
|
| 105 |
|
| 106 |
fastq_df_with_id = fastq_df %>%
|
|
@@ -108,15 +121,46 @@ fastq_df_with_id = fastq_df %>%
|
|
| 108 |
mutate(regulator_symbol = ifelse(str_detect(regulator_symbol, "unknown"),
|
| 109 |
regulator_locus_tag,
|
| 110 |
regulator_symbol))) %>%
|
| 111 |
-
filter(condition == 'standard')
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
|
| 121 |
|
| 122 |
# ACE2, ARG80, ARG81, LYS14, STB5, SWI5, SWI6 pass in at least one (didn't check which mcisaac cond pass, but all pass in kemmeren pass)
|
|
@@ -151,7 +195,7 @@ af_django_meta = arrow::read_parquet("~/code/hf/callingcards/annotated_features_
|
|
| 151 |
distinct() %>%
|
| 152 |
mutate(single_binding = as.character(single_binding)) %>%
|
| 153 |
dplyr::rename(binding_id = single_binding)) %>%
|
| 154 |
-
left_join(select(barcode_details_df_with_id, regulator_symbol, batch, binding_id, r1_index, r2_index)) %>%
|
| 155 |
dplyr::select(id, genome_map_id, batch,
|
| 156 |
r1_index, r2_index,
|
| 157 |
regulator_locus_tag, regulator_symbol,
|
|
@@ -174,10 +218,6 @@ setdiff(unique(genome_map_meta$batch),basename(c(brentlab_dirs, mitra_dirs)))
|
|
| 174 |
# filter(id == 1) %>%
|
| 175 |
# collect()
|
| 176 |
|
| 177 |
-
library(arrow)
|
| 178 |
-
library(dplyr)
|
| 179 |
-
library(readr)
|
| 180 |
-
|
| 181 |
# Specify output directory
|
| 182 |
# output_dir <- here("~/htcf_local/cc/yeast/callingcards_geo_submission/processed")
|
| 183 |
# dir.create(output_dir, showWarnings = FALSE, recursive = TRUE)
|
|
@@ -215,33 +255,175 @@ id_batch_combos <- af_django_meta %>%
|
|
| 215 |
#
|
| 216 |
# cat("Done! Wrote", nrow(id_batch_combos), "CSV files to", output_dir, "\n")
|
| 217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
submission_df = af_django_meta %>%
|
| 219 |
select(-id) %>%
|
| 220 |
arrange(regulator_locus_tag) %>%
|
|
|
|
|
|
|
| 221 |
mutate(regulator_symbol = ifelse(
|
| 222 |
str_detect(regulator_symbol, "unknown"),
|
| 223 |
regulator_locus_tag,
|
| 224 |
regulator_symbol)) %>%
|
| 225 |
mutate(`library name` = paste0(regulator_locus_tag, "_", regulator_symbol, "_", genome_map_id)) %>%
|
| 226 |
-
mutate(title = paste0(regulator_locus_tag, " (", regulator_symbol, ") calling cards"),
|
| 227 |
-
`library strategy` = "
|
| 228 |
organism = 'Saccharomyces cerevisiae',
|
| 229 |
-
|
| 230 |
molecule = 'genomic DNA',
|
| 231 |
-
`single or paired-end` = 'single
|
| 232 |
-
`instrument model` = '
|
| 233 |
description = paste0(regulator_locus_tag, " tagged callingcards experiment. ",
|
| 234 |
"kemmeren_dto: ", kemmeren_dto, "; mcisaac_dto: ", mcisaac_dto,
|
| 235 |
-
"; genomic_inserts: ", genomic_inserts,
|
| 236 |
"; in_modeling_analysis: ", in_modeling_analysis,
|
| 237 |
"; notes: ", notes),
|
| 238 |
`processed data file` = paste0(`library name`, ".csv.gz"),
|
| 239 |
-
`raw file` = paste0(`library name`, ".
|
|
|
|
| 240 |
dplyr::select(
|
| 241 |
-
`library name`, title, `library strategy`, organism,
|
| 242 |
-
|
| 243 |
-
description,
|
| 244 |
`processed data file`, `raw file`
|
| 245 |
)
|
| 246 |
|
| 247 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# All standard condition up to run_7390
|
| 2 |
+
|
| 3 |
library(tidyverse)
|
| 4 |
library(here)
|
| 5 |
+
library(arrow)
|
| 6 |
|
|
|
|
| 7 |
# TODO: when making processing scripts github, add the background file
|
| 8 |
# and make sure the repo gets registered to zenodo. Put that link to the
|
| 9 |
# background files in the SRA submission
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
# cells grown on solid media at room temperature
|
| 12 |
# put the definition of the "Description" values in the
|
| 13 |
|
|
|
|
| 33 |
composite_binding = read_csv("~/htcf_ref/data/yeast_database_modelling/pull_data_20250805/data/bindingconcat_meta_20250805.csv") %>%
|
| 34 |
filter(source_name == "brent_nf_cc")
|
| 35 |
|
| 36 |
+
barcode_details_root = "~/htcf_lts/sequence_data/yeast_cc/sequence"
|
| 37 |
+
barcode_details_list = list.files(barcode_details_root, "*_barcode_details.json",
|
| 38 |
recursive=TRUE)
|
| 39 |
|
| 40 |
+
passing_bam_paths = read_csv("~/htcf_local/cc/yeast/passing_bams_lookup.txt", col_names = 'bampath')
|
| 41 |
+
|
| 42 |
passing_fastq_from_bam_paths = list.files("~/htcf_local/cc/yeast/passing_fastq_from_bam")
|
| 43 |
|
| 44 |
fastq_df = tibble(filename = passing_fastq_from_bam_paths) %>%
|
|
|
|
| 59 |
|
| 60 |
barcode_details_df = map(barcode_details_list, ~{
|
| 61 |
message(sprintf("working on %s", basename(.x)))
|
| 62 |
+
x = jsonlite::read_json(file.path(barcode_details_root, .))
|
| 63 |
tibble(
|
| 64 |
seq = names(x$components$tf$map),
|
| 65 |
regulator_symbol = unlist(x$components$tf$map)) %>%
|
|
|
|
| 81 |
|
| 82 |
barcode_details_df_with_id = barcode_details_df %>%
|
| 83 |
mutate(replicate = str_remove(str_extract(regulator_symbol, "x\\d"), "x")) %>%
|
| 84 |
+
mutate(condition = case_when(
|
| 85 |
+
batch == "run_7380" & replicate == 2 ~ 'del_MET28',
|
| 86 |
+
regulator_symbol == "CBF1KOmet28" ~ 'del_MET28',
|
| 87 |
+
batch == "run_7380" & replicate == 2 ~ 'glu_1_gal_2',
|
| 88 |
+
batch == "run_7388" & replicate == 2 ~ 'glu_1_gal_2',
|
| 89 |
+
batch == "run_7390" & replicate == 2 ~ 'glu_1_gal_2',
|
| 90 |
+
batch == "run_7392" & replicate == 2 ~ 'glu_1_gal_2',
|
| 91 |
+
.default = 'standard')) %>%
|
| 92 |
+
mutate(replicate = ifelse(condition != "standard", 1, replicate)) %>%
|
| 93 |
+
mutate(regulator_symbol = ifelse(regulator_symbol == 'CBF1KOmet28', "CBF1", regulator_symbol)) %>%
|
| 94 |
mutate(regulator_symbol = str_remove(regulator_symbol, "x\\d")) %>%
|
| 95 |
replace_na(list(replicate = '1')) %>%
|
| 96 |
mutate(replicate = as.integer(replicate)) %>%
|
|
|
|
| 110 |
|
| 111 |
gm_db = arrow::open_dataset("~/code/hf/callingcards/genome_map")
|
| 112 |
|
| 113 |
+
genome_map_meta_raw = arrow::read_parquet("~/code/hf/callingcards/genome_map_meta.parquet")
|
| 114 |
+
|
| 115 |
+
genome_map_meta = genome_map_meta_raw %>%
|
| 116 |
+
filter(condition == "standard") %>%
|
| 117 |
filter(!batch %in% c('dsir4'))
|
| 118 |
|
| 119 |
fastq_df_with_id = fastq_df %>%
|
|
|
|
| 121 |
mutate(regulator_symbol = ifelse(str_detect(regulator_symbol, "unknown"),
|
| 122 |
regulator_locus_tag,
|
| 123 |
regulator_symbol))) %>%
|
| 124 |
+
filter(condition == 'standard') %>%
|
| 125 |
+
filter(batch != "run_7392")
|
| 126 |
+
|
| 127 |
+
fastq_df_lookup = fastq_df_with_id %>%
|
| 128 |
+
mutate(filename = file.path("passing_fastq_from_bam", filename),
|
| 129 |
+
newname = paste0(regulator_locus_tag, "_", regulator_symbol, "_", id)) %>%
|
| 130 |
+
select(filename, newname)
|
| 131 |
+
|
| 132 |
+
bam_lookup = passing_bam_paths %>%
|
| 133 |
+
mutate(base = str_remove(basename(bampath), ".bam")) %>%
|
| 134 |
+
# this is empty, also excluded from the fastqs
|
| 135 |
+
filter(base != "run_6739_MOT3_passing_tagged") %>%
|
| 136 |
+
left_join(fastq_df_lookup %>%
|
| 137 |
+
mutate(base = str_remove(basename(filename), ".fastq.gz"))) %>%
|
| 138 |
+
filter(str_detect(bampath, "undetermined", negate=TRUE)) %>%
|
| 139 |
+
select(-filename) %>%
|
| 140 |
+
# this removes the non standard conditions
|
| 141 |
+
filter(complete.cases(.))
|
| 142 |
+
|
| 143 |
+
setdiff(bam_lookup$newname, fastq_df_lookup$newname)
|
| 144 |
+
setdiff(fastq_df_lookup$newname, bam_lookup$newname)
|
| 145 |
+
|
| 146 |
+
# bam_lookup %>%
|
| 147 |
+
# select(bampath, newname) %>%
|
| 148 |
+
# mutate(newname = paste0(newname, ".bam")) %>%
|
| 149 |
+
# write_tsv("~/htcf_local/cc/yeast/passing_bam_rename_lookup.txt",
|
| 150 |
+
# col_names = FALSE)
|
| 151 |
+
|
| 152 |
+
# fastq_df_lookup %>%
|
| 153 |
+
# write_tsv("~/htcf_local/cc/yeast/passing_bam_fastq_rename_lookup.txt",
|
| 154 |
+
# col_names = FALSE)
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
# fastq_df_with_id %>%
|
| 158 |
+
# filter(binding_id == "NA") %>%
|
| 159 |
+
# filter(condition == "standard") %>%
|
| 160 |
+
# filter(regulator_symbol != "OTU1") %>%
|
| 161 |
+
# mutate(qbed_path = file.path(sprintf("/home/chase/htcf_local/cc/yeast/results/%s/hops/%s_%s.qbed", batch, batch, regulator_symbol_replicate))) %>%
|
| 162 |
+
# select(qbed_path) %>%
|
| 163 |
+
# write_tsv("~/tmp/unprocessed_in_db_qbeds_lookup.txt")
|
| 164 |
|
| 165 |
|
| 166 |
# ACE2, ARG80, ARG81, LYS14, STB5, SWI5, SWI6 pass in at least one (didn't check which mcisaac cond pass, but all pass in kemmeren pass)
|
|
|
|
| 195 |
distinct() %>%
|
| 196 |
mutate(single_binding = as.character(single_binding)) %>%
|
| 197 |
dplyr::rename(binding_id = single_binding)) %>%
|
| 198 |
+
left_join(select(barcode_details_df_with_id, condition, regulator_symbol, batch, binding_id, r1_index, r2_index)) %>%
|
| 199 |
dplyr::select(id, genome_map_id, batch,
|
| 200 |
r1_index, r2_index,
|
| 201 |
regulator_locus_tag, regulator_symbol,
|
|
|
|
| 218 |
# filter(id == 1) %>%
|
| 219 |
# collect()
|
| 220 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 221 |
# Specify output directory
|
| 222 |
# output_dir <- here("~/htcf_local/cc/yeast/callingcards_geo_submission/processed")
|
| 223 |
# dir.create(output_dir, showWarnings = FALSE, recursive = TRUE)
|
|
|
|
| 255 |
#
|
| 256 |
# cat("Done! Wrote", nrow(id_batch_combos), "CSV files to", output_dir, "\n")
|
| 257 |
|
| 258 |
+
af_data = arrow::open_dataset("~/code/hf/callingcards/annotated_features") %>%
|
| 259 |
+
filter(id %in% af_django_meta$id) %>%
|
| 260 |
+
collect() %>%
|
| 261 |
+
left_join(
|
| 262 |
+
af_django_meta %>%
|
| 263 |
+
mutate(regulator_locus_tag = as.character(regulator_locus_tag),
|
| 264 |
+
regulator_symbol = as.character(regulator_symbol)) %>%
|
| 265 |
+
mutate(regulator_symbol = ifelse(str_detect(regulator_symbol, "unknown"), regulator_locus_tag, regulator_symbol)) %>%
|
| 266 |
+
mutate(filename = paste0(regulator_locus_tag, "_", regulator_symbol, "_", genome_map_id)) %>%
|
| 267 |
+
select(id, genome_map_id, filename))
|
| 268 |
+
|
| 269 |
+
promoters = read_tsv("~/code/hf/yeast_genome_resources/yiming_promoters.bed",
|
| 270 |
+
col_names = c("chr", "start", "end", "target_locus_tag", "score", "strand")) %>%
|
| 271 |
+
dplyr::select(target_locus_tag, chr, start, end, strand)
|
| 272 |
+
|
| 273 |
+
# af_data %>%
|
| 274 |
+
# group_by(filename) %>%
|
| 275 |
+
# group_walk(~ {
|
| 276 |
+
# dir.create(here("results/processed"), showWarnings = FALSE)
|
| 277 |
+
# output_name = paste0(.y$filename, ".csv.gz")
|
| 278 |
+
# .x %>%
|
| 279 |
+
# mutate(target_symbol = ifelse(str_detect(target_symbol, "unknown"), target_locus_tag, target_symbol)) %>%
|
| 280 |
+
# dplyr::select(-c(id, hypergeometric_pval, batch)) %>%
|
| 281 |
+
# dplyr::rename(enrichment = callingcards_enrichment) %>%
|
| 282 |
+
# left_join(promoters) %>%
|
| 283 |
+
# dplyr::relocate(genome_map_id, target_locus_tag, target_symbol, chr, start, end, strand) %>%
|
| 284 |
+
# write_csv(file.path(here("results/processed"), output_name))
|
| 285 |
+
# })
|
| 286 |
+
|
| 287 |
+
|
| 288 |
submission_df = af_django_meta %>%
|
| 289 |
select(-id) %>%
|
| 290 |
arrange(regulator_locus_tag) %>%
|
| 291 |
+
mutate(regulator_locus_tag = as.character(regulator_locus_tag),
|
| 292 |
+
regulator_symbol = as.character(regulator_symbol)) %>%
|
| 293 |
mutate(regulator_symbol = ifelse(
|
| 294 |
str_detect(regulator_symbol, "unknown"),
|
| 295 |
regulator_locus_tag,
|
| 296 |
regulator_symbol)) %>%
|
| 297 |
mutate(`library name` = paste0(regulator_locus_tag, "_", regulator_symbol, "_", genome_map_id)) %>%
|
| 298 |
+
mutate(title = paste0(regulator_locus_tag, " (", regulator_symbol, ") calling cards; gmid ", genome_map_id),
|
| 299 |
+
`library strategy` = "OTHER",
|
| 300 |
organism = 'Saccharomyces cerevisiae',
|
| 301 |
+
`cell line` = "Saccharomyces cerevisiae S288C",
|
| 302 |
molecule = 'genomic DNA',
|
| 303 |
+
`single or paired-end` = 'single',
|
| 304 |
+
`instrument model` = 'Illumina MiSeq',
|
| 305 |
description = paste0(regulator_locus_tag, " tagged callingcards experiment. ",
|
| 306 |
"kemmeren_dto: ", kemmeren_dto, "; mcisaac_dto: ", mcisaac_dto,
|
|
|
|
| 307 |
"; in_modeling_analysis: ", in_modeling_analysis,
|
| 308 |
"; notes: ", notes),
|
| 309 |
`processed data file` = paste0(`library name`, ".csv.gz"),
|
| 310 |
+
`raw file` = paste0(`library name`, ".bam")) %>%
|
| 311 |
+
dplyr::rename(perturbation_validated = data_usable) %>%
|
| 312 |
dplyr::select(
|
| 313 |
+
`library name`, title, `library strategy`, organism, `cell line`,
|
| 314 |
+
molecule, `single or paired-end`, `instrument model`,
|
| 315 |
+
description, perturbation_validated,
|
| 316 |
`processed data file`, `raw file`
|
| 317 |
)
|
| 318 |
|
| 319 |
+
setdiff(paste0(bam_lookup$newname,".bam"), submission_df$`raw file`)
|
| 320 |
+
setdiff(submission_df$`raw file`, paste0(bam_lookup$newname,".bam"))
|
| 321 |
+
|
| 322 |
+
write_csv(submission_df, here("data/cc_submission_df.csv"))
|
| 323 |
+
|
| 324 |
+
################################################################################
|
| 325 |
+
################################################################################
|
| 326 |
+
################################################################################
|
| 327 |
+
# library(tidyverse)
|
| 328 |
+
# library(arrow)
|
| 329 |
+
# library(here)
|
| 330 |
+
#
|
| 331 |
+
# genome_map_meta = arrow::read_parquet("~/code/hf/callingcards/genome_map_meta.parquet")
|
| 332 |
+
#
|
| 333 |
+
# genome_map_meta_af = genome_map_meta %>% filter(batch %in% c("run_6778", "run_7380", "run_7388", "run_7390"))
|
| 334 |
+
#
|
| 335 |
+
# af = list.files("~/tmp/callingcards_output", full.names = TRUE)
|
| 336 |
+
#
|
| 337 |
+
# af_gmid_map = tibble(
|
| 338 |
+
# af = str_remove(basename(af), "_af.csv"),
|
| 339 |
+
# batch = str_extract(af, "run_\\d+"),
|
| 340 |
+
# regulator_orig = str_remove(af, paste0(batch, "_")),
|
| 341 |
+
# regulator_symbol = str_remove(regulator_orig, "x\\d")) %>%
|
| 342 |
+
# mutate(regulator_symbol = ifelse(regulator_symbol == 'CBF1KOmet28', "CBF1", regulator_symbol)) %>%
|
| 343 |
+
# mutate(condition = case_when(
|
| 344 |
+
# str_detect(regulator_orig, "x\\d$", negate=TRUE) | str_detect(regulator_orig, "x1$") ~ 'standard',
|
| 345 |
+
# regulator_orig == 'CBF1x2' ~ 'del_MET28',
|
| 346 |
+
# regulator_orig == 'CBF1KOmet28' ~ 'del_MET28',
|
| 347 |
+
# regulator_orig == 'GCR1x2' ~ 'glu_1_gal_2',
|
| 348 |
+
# regulator_orig == 'GCR2x2' ~ 'glu_1_gal_2',
|
| 349 |
+
# regulator_orig == 'TYE7x2' ~ 'glu_1_gal_2',
|
| 350 |
+
# regulator_orig == "MIG1x2" ~ 'glu_1_gal_2')) %>%
|
| 351 |
+
# left_join(dplyr::select(genome_map_meta_af, batch, regulator_symbol, condition, id)) %>%
|
| 352 |
+
# mutate(id = ifelse(regulator_orig == 'CBF1KOmet28', 746, id))
|
| 353 |
+
#
|
| 354 |
+
#
|
| 355 |
+
# af_df = map(af, read_csv)
|
| 356 |
+
# names(af_df) = af_gmid_map$id
|
| 357 |
+
#
|
| 358 |
+
# genomicfeatures = arrow::read_parquet("~/code/hf/yeast_genome_resources/brentlab_features.parquet")
|
| 359 |
+
#
|
| 360 |
+
# promoters = read_tsv("~/code/hf/yeast_genome_resources/yiming_promoters.bed",
|
| 361 |
+
# col_names = c("chr", "start", "end", "name", "score", "strand")) %>%
|
| 362 |
+
# dplyr::select("chr", "name", "start", "end", "strand") %>%
|
| 363 |
+
# left_join(dplyr::select(genomicfeatures, name = locus_tag, symbol))
|
| 364 |
+
#
|
| 365 |
+
# af_df_all = bind_rows(af_df, .id = "genome_map_id") %>%
|
| 366 |
+
# mutate(genome_map_id = as.integer(genome_map_id)) %>%
|
| 367 |
+
# dplyr::select(c(
|
| 368 |
+
# 'genome_map_id','name','experiment_hops',
|
| 369 |
+
# 'background_hops','background_total_hops','experiment_total_hops',
|
| 370 |
+
# 'callingcards_enrichment','poisson_pval','hypergeometric_pval')) %>%
|
| 371 |
+
# left_join(promoters) %>%
|
| 372 |
+
# dplyr::rename(target_locus_tag = name, target_symbol = symbol) %>%
|
| 373 |
+
# dplyr::select(
|
| 374 |
+
# c('genome_map_id','target_locus_tag','target_symbol','experiment_hops',
|
| 375 |
+
# 'background_hops','background_total_hops','experiment_total_hops',
|
| 376 |
+
# 'callingcards_enrichment','poisson_pval','hypergeometric_pval')) %>%
|
| 377 |
+
# left_join(dplyr::select(af_gmid_map, id, batch), by = c("genome_map_id" = "id")) %>%
|
| 378 |
+
# mutate(genome_map_id = as.integer(genome_map_id))
|
| 379 |
+
#
|
| 380 |
+
# af_meta = arrow::read_parquet('~/code/hf/callingcards/annotated_features_meta.parquet')
|
| 381 |
+
#
|
| 382 |
+
# af_meta_new = af_gmid_map %>%
|
| 383 |
+
# dplyr::select(id, batch, regulator_symbol, condition) %>%
|
| 384 |
+
# dplyr::rename(genome_map_id = id) %>%
|
| 385 |
+
# left_join(dplyr::select(genomicfeatures,
|
| 386 |
+
# regulator_locus_tag = locus_tag,
|
| 387 |
+
# regulator_symbol = symbol)) %>%
|
| 388 |
+
# mutate(data_usable = 'unreviewed', analysis_set = FALSE) %>%
|
| 389 |
+
# # note that this is 810 before adding these records
|
| 390 |
+
# mutate(id = max(af_meta$id)+row_number(),
|
| 391 |
+
# pss_id = "NA",
|
| 392 |
+
# binding_id = "NA") %>%
|
| 393 |
+
# dplyr::relocate(id)
|
| 394 |
+
#
|
| 395 |
+
# af_meta_augment = af_meta %>%
|
| 396 |
+
# dplyr::select(-preferred_replicate) %>%
|
| 397 |
+
# bind_rows(af_meta_new) %>%
|
| 398 |
+
# replace_na(list(binding_id = "NA"))
|
| 399 |
+
#
|
| 400 |
+
# # af_meta_augment |>
|
| 401 |
+
# # arrow::as_arrow_table() |>
|
| 402 |
+
# # (\(tbl) {
|
| 403 |
+
# # dict_cols <- c("data_usable", "batch", "condition", "regulator_locus_tag", "regulator_symbol")
|
| 404 |
+
# # for (col in dict_cols) {
|
| 405 |
+
# # tbl[[col]] <- tbl[[col]]$cast(arrow::dictionary())
|
| 406 |
+
# # }
|
| 407 |
+
# # tbl
|
| 408 |
+
# # })() |>
|
| 409 |
+
# # arrow::as_arrow_table() |>
|
| 410 |
+
# # arrow::write_parquet(
|
| 411 |
+
# # "/home/chase/code/hf/callingcards/annotated_features_meta.parquet",
|
| 412 |
+
# # compression = "zstd",
|
| 413 |
+
# # compression_level = 9,
|
| 414 |
+
# # write_statistics = TRUE
|
| 415 |
+
# # )
|
| 416 |
+
# #
|
| 417 |
+
# # af_df_all %>%
|
| 418 |
+
# # left_join(dplyr::select(af_meta_new, id, genome_map_id)) %>%
|
| 419 |
+
# # dplyr::relocate(id) %>%
|
| 420 |
+
# # select(-genome_map_id) %>%
|
| 421 |
+
# # arrow::write_dataset(
|
| 422 |
+
# # path = "/home/chase/code/hf/callingcards/annotated_features_tmp",
|
| 423 |
+
# # format = "parquet",
|
| 424 |
+
# # partitioning = c("batch"),
|
| 425 |
+
# # existing_data_behavior = "error",
|
| 426 |
+
# # compression = "zstd",
|
| 427 |
+
# # compression_level = 9,
|
| 428 |
+
# # write_statistics = TRUE,
|
| 429 |
+
# # use_dictionary = TRUE)
|