Commit d860e90f authored by Lena Hersemann's avatar Lena Hersemann

changes data path to be able to run the app outside the cluster_comp_data folder

parent 29e14de7
......@@ -24,7 +24,7 @@ load_pack(Seurat)
# Determine data directory from execution context ---------------------------------------------------------------------
dataPath= args[1]
dataPath= paste0(args[1], "cluster_comp_data")
#dataPath = "."
......@@ -32,10 +32,10 @@ dataPath= args[1]
# LOAD data ------------------------------------------------------------------------------------------------------------
# check presence of all required data
all_files <- list.files(dataPath)
all_files <- list.files(dataPath, pattern = ".txt")
files_req <- c("cluster_info", "cluster_marker_genes", "scaled_counts", "tsne_info")
if (any(!str_detect(files_req, paste0(files_req, collapse = "|")))) { stop("ATTENTION: please make sure cluster_info_*.txt, cluster_marker_genes_*.txt, scaled_counts.txt and tsne_info_*.txt exist in your working directory") }
if (any(!str_detect(all_files, paste0(files_req, collapse = "|")))) { stop("ATTENTION: please make sure cluster_info_*.txt, cluster_marker_genes_*.txt, scaled_counts.txt and tsne_info_*.txt exist in your working directory") }
# load all files
......@@ -43,8 +43,8 @@ samples <- list.files(dataPath, pattern = "cluster_info_") %>% str_replace_all(.
samples <- samples[order(nchar(samples), samples)]
cluster_info <- do.call(rbind, lapply(samples, function(x){
tsne_info <- read_tsv(paste0("tsne_info_", x, ".txt"))
read_tsv(paste0("cluster_info_", x, ".txt")) %>%
tsne_info <- read_tsv(paste0(dataPath, "/tsne_info_", x, ".txt"))
read_tsv(paste0(dataPath, "/cluster_info_", x, ".txt")) %>%
transmute(cell_id, cluster_num = cluster, cluster_name = paste0(x)) %>%
left_join(tsne_info)
})) %>%
......@@ -56,7 +56,7 @@ cluster_info <- do.call(rbind, lapply(samples, function(x){
marker_data <- lapply(setNames(samples, samples), function(x){
read_tsv(paste0("cluster_marker_genes_", x, ".txt")) %>%
read_tsv(paste0(dataPath, "/cluster_marker_genes_", x, ".txt")) %>%
group_by(gene) %>%
filter(1:n() == 1) %>%
ungroup() %>%
......@@ -76,7 +76,7 @@ marker_info <- do.call(rbind, lapply(names(marker_data), function(x) marker_data
ungroup()
count_data <- fread("scaled_counts.txt")
count_data <- data.table::fread(paste0(dataPath, "/scaled_counts.txt"))
gene_info <- select(count_data, ensembl_gene_id, external_gene_name, start_position, end_position, chromosome_name, description) %>%
mutate(description = str_replace_all(description, "\\[Source:MGI Symbol;Acc:MGI:[:digit:]*]", ""))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment