From afdb945f5a112da41e2bc71f87c9dd2d0000d01e Mon Sep 17 00:00:00 2001 From: Mark Robinson Date: Thu, 7 May 2020 18:14:27 +0000 Subject: [PATCH] add 2 files --- code/README.md | 3 +++ code/maybe_diffcyt_bug.R | 46 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 code/README.md create mode 100644 code/maybe_diffcyt_bug.R diff --git a/code/README.md b/code/README.md new file mode 100644 index 0000000..4c2402f --- /dev/null +++ b/code/README.md @@ -0,0 +1,3 @@ +# Code + +Save command-line scripts and shared R code here. diff --git a/code/maybe_diffcyt_bug.R b/code/maybe_diffcyt_bug.R new file mode 100644 index 0000000..34911ef --- /dev/null +++ b/code/maybe_diffcyt_bug.R @@ -0,0 +1,46 @@ + +source(here::here("code/my_diffcyt.R")) + +library(diffcyt) +library(CATALYST) + +rdsdir <- here::here("output") +sce <- readRDS(file.path(rdsdir, "sce_tumor_merged.rds")) + + +(ei <- metadata(sce)$experiment_info) +(mm <- model.matrix(~treatment, data=ei)) + +da_res <- diffcyt(sce, design = mm, contrast = c(0, -1), + analysis_type = "DA", + method_DA = "diffcyt-DA-voom", + clustering_to_use = "merging", + verbose = TRUE) + +assay(da_res$d_counts) + +# repeat after outlier removal +outliers <- c("5__untreated","6_7__untreated") +sce_s <- filterSCE(sce, !(sample_id %in% outliers)) + + +(ei <- metadata(sce_s)$experiment_info) +(mm <- model.matrix(~treatment, data=ei)) + +da_res <- diffcyt(sce_s, design = mm, contrast = c(0, -1), + analysis_type = "DA", + method_DA = "diffcyt-DA-voom", + clustering_to_use = "merging", + verbose = TRUE) + +z <- my_diffcyt(sce_s, design = mm, contrast = c(0, -1), + analysis_type = "DA", + method_DA = "diffcyt-DA-voom", + clustering_to_use = "merging", + verbose = TRUE) + +table(cluster_ids(sce, "merging"), sce$sample_id) +assay(z) +table(cluster_ids(sce_s, "merging"), sce_s$sample_id) + +sessionInfo() -- GitLab