From 66a193304047c392d46f2903d4ee10f2519e86c6 Mon Sep 17 00:00:00 2001 From: sreichl Date: Fri, 5 Apr 2024 11:55:54 +0200 Subject: [PATCH] add export of filtered normalized counts #6 --- workflow/rules/mixscape.smk | 1 + workflow/scripts/lda.R | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/workflow/rules/mixscape.smk b/workflow/rules/mixscape.smk index e38eb0e..0b46c57 100644 --- a/workflow/rules/mixscape.smk +++ b/workflow/rules/mixscape.smk @@ -38,6 +38,7 @@ rule lda: lda_object = os.path.join(result_path,'{sample}','FILTERED_object.rds'), filtered_metadata = os.path.join(result_path,'{sample}','FILTERED_metadata.csv'), lda_data = os.path.join(result_path,'{sample}','LDA_data.csv'), + filtered_assay_data = os.path.join(result_path,'{sample}','FILTERED_{}_data.csv'.format(config["assay"]), filtered_prtb_data = os.path.join(result_path,'{sample}','FILTERED_PRTB_data.csv'), lda_plot = report(os.path.join(result_path,'{sample}','plots','LDA_UMAP.png'), caption="../report/lda_umap.rst", diff --git a/workflow/scripts/lda.R b/workflow/scripts/lda.R index 3b085ca..e139aa8 100644 --- a/workflow/scripts/lda.R +++ b/workflow/scripts/lda.R @@ -15,6 +15,7 @@ lda_object_path <- snakemake@output[["lda_object"]] lda_plot_path <- snakemake@output[["lda_plot"]] lda_data_path <- snakemake@output[["lda_data"]] filtered_prtb_data_path <- snakemake@output[["filtered_prtb_data"]] +filtered_assay_data_path <- snakemake@output[["filtered_assay_data"]] # parameters assay <- snakemake@config[["assay"]] @@ -119,3 +120,6 @@ fwrite(as.data.frame(lda_data), file=file.path(lda_data_path), row.names=TRUE) # save matrix of PRTB values fwrite(as.data.frame(GetAssayData(object = sub, slot = "data", assay = "PRTB")), file=file.path(filtered_prtb_data_path), row.names=TRUE) + +# save matrix of assay values +fwrite(as.data.frame(GetAssayData(object = sub, slot = "data", assay = assay)), file=file.path(filtered_assay_data_path), row.names=TRUE)