| |
| |
|
|
| library(tidyverse) |
| library(here) |
| library(arrow) |
| library(GEOquery) |
|
|
| |
| |
| genomicfeatures = arrow::open_dataset(here("data/genome_files/hf/features")) %>% |
| as_tibble() |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
| |
| |
|
|
| split_manipulation <- function(manipulation_str) { |
| parts <- str_split(manipulation_str, "::")[[1]] |
|
|
| if (length(parts) != 2) { |
| stop("Unexpected format. Expected 'LOCUS::TAGGED_CONSTRUCT'") |
| } |
|
|
| tagged_locus <- parts[1] |
| rhs <- parts[2] |
|
|
| |
| dbd_donor_symbol_str <- "none" |
| ortholog <- "none" |
|
|
| |
| if (str_detect(rhs, "-[A-Za-z0-9]+DBD-Mnase$")) { |
| dbd_donor_symbol_str <- toupper(str_remove(str_split(rhs, "-", simplify = TRUE)[[2]], "DBD")) |
| } else if (str_detect(rhs, "^K\\.lactis .*?-Mnase$")) { |
| ortholog <- rhs |
| } |
|
|
| list( |
| mnase_tagged_symbol = tagged_locus, |
| dbd_donor_symbol = dbd_donor_symbol_str, |
| ortholog_donor = ortholog |
| ) |
| } |
|
|
|
|
| split_deletion <- function(deletion_str) { |
| parts <- str_split(deletion_str, "::", simplify = TRUE) |
|
|
| list( |
| paralog_deletion_symbol = parts[1], |
| paralog_resistance_cassette = if (ncol(parts) >= 2) parts[2] else "none" |
| ) |
| } |
|
|
| split_construct_to_tibble = function(split_list){ |
| background = list(background=split_list[[1]]) |
| manipulation_list = split_manipulation(split_list[[2]]) |
| deletion_list = split_deletion(tryCatch(split_list[[3]], error = function(e) "none")) |
|
|
| bind_cols(map(list(background, manipulation_list, deletion_list), as_tibble)) |
|
|
| } |
|
|
|
|
| split_constructs <- function(s) { |
| s <- str_trim(s) |
| if (s == "" || is.na(s)) return(character(0)) |
| |
| split_geno = str_split(s, "\\s+(?=[A-Za-z0-9_.()\\-]+::)")[[1]] |
|
|
| bind_cols(tibble(genotype = s), split_construct_to_tibble(split_geno)) |
|
|
|
|
| } |
|
|
| gse178430_meta = read_csv("data/barkai_checseq/GSE179430/SraRunTable.csv") %>% |
| mutate(genotype = str_replace(genotype, "Yap2", "Cad1")) %>% |
| mutate(genotype = str_replace(genotype, "Yap4", "Cin5")) |
|
|
| gse178430_parsed_meta = bind_cols( |
| select(gse178430_meta, `Sample Name`, strainid, Instrument) %>% |
| dplyr::rename(accession = `Sample Name`, |
| instrument = Instrument), |
| bind_rows(map(gse178430_meta$genotype, split_constructs))) %>% |
| left_join(select(genomicfeatures, locus_tag, symbol) %>% |
| dplyr::rename(mnase_tagged_symbol = symbol)) %>% |
| dplyr::rename(regulator_locus_tag = locus_tag, |
| regulator_symbol = mnase_tagged_symbol) %>% |
| select(accession, regulator_locus_tag, regulator_symbol, strainid, |
| instrument, genotype, dbd_donor_symbol, ortholog_donor, |
| paralog_deletion_symbol, paralog_resistance_cassette) %>% |
| arrange(accession) %>% |
| mutate(series = "GSE178430") %>% |
| mutate(sample_id = row_number()) %>% |
| relocate(sample_id, series, accession) |
|
|
| gse209631_meta = read_csv("data/barkai_checseq/GSE209631/SraRunTable.csv") |
|
|
| gse209631_parsed_meta = gse209631_meta %>% |
| select(`Sample Name`, tagged_tf, Instrument, `variant-type`) %>% |
| janitor::clean_names() %>% |
| dplyr::rename(accession = sample_name) %>% |
| arrange(tagged_tf, variant_type) %>% |
| left_join(select(genomicfeatures, locus_tag, symbol) %>% dplyr::rename(tagged_tf = symbol)) %>% |
| dplyr::rename(regulator_symbol = tagged_tf, regulator_locus_tag = locus_tag) %>% |
| select(accession, regulator_locus_tag, regulator_symbol, variant_type) %>% |
| arrange(accession) %>% |
| mutate(series = "GSE209631") %>% |
| mutate(sample_id = row_number()) %>% |
| relocate(sample_id, series, accession) |
|
|
|
|
|
|
| gse222268 = GEOquery::getGEO(filename=here("data/barkai_checseq/GSE222268_series_matrix.txt")) |
|
|
| gse222268_meta = Biobase::pData(gse222268@phenoData) %>% as_tibble() %>% |
| select(title, geo_accession, extract_protocol_ch1, description, |
| instrument_model, library_selection) %>% |
| mutate(description = ifelse(description == "", library_selection, description)) %>% |
| dplyr::rename(accession = geo_accession) %>% |
| select(-library_selection, -instrument_model, -extract_protocol_ch1) |
|
|
| gse222268_parsed_meta <- gse222268_meta %>% |
| mutate( |
| regulator_symbol = str_extract(title, "^[^_]+"), |
| experiment_details = str_remove(title, "^[^_]+_")) %>% |
| mutate(regulator_symbol = toupper(regulator_symbol)) %>% |
| mutate(regulator_symbol = str_replace(regulator_symbol, "UGA3C", "UGA3")) %>% |
| mutate(regulator_symbol = ifelse(str_detect(regulator_symbol, "MNASE"), |
| "none", regulator_symbol)) %>% |
| left_join( |
| select(genomicfeatures, locus_tag, symbol) %>% |
| dplyr::rename(regulator_locus_tag = locus_tag, |
| regulator_symbol = symbol)) %>% |
| replace_na(list(regulator_locus_tag = "none")) %>% |
| select(-title) %>% |
| arrange(accession) %>% |
| mutate(series = "GSE222268") %>% |
| mutate(sample_id = row_number()) %>% |
| relocate(sample_id, series, accession) |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|