From 89cca76e070ff36b3e5885e26ebd500553fac64a Mon Sep 17 00:00:00 2001 From: mAGLAVE <55588167+mAGLAVE@users.noreply.github.com> Date: Thu, 14 Mar 2024 18:21:09 +0100 Subject: [PATCH 1/3] BugFix: add {} around awk terms --- bigr_pipelines/rnaseq/rules/029.clusterprofiler.terms.smk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bigr_pipelines/rnaseq/rules/029.clusterprofiler.terms.smk b/bigr_pipelines/rnaseq/rules/029.clusterprofiler.terms.smk index 55fd02890fe..acf0b5488cd 100644 --- a/bigr_pipelines/rnaseq/rules/029.clusterprofiler.terms.smk +++ b/bigr_pipelines/rnaseq/rules/029.clusterprofiler.terms.smk @@ -20,7 +20,7 @@ rule term2gene_TERMS_PPI: tmpdir="tmp", params: begin='FS=OFS="\t"', - body=["print $3 FS $1"], + body=["{print $3 FS $1}"], group: "prepare_terms_ppi" log: @@ -51,7 +51,7 @@ rule terms2name_TERMS_PPI: tmpdir="tmp", params: begin='FS=OFS="\t"', - body=["print $3 FS $4"], + body=["{print $3 FS $4}"], group: "prepare_terms_ppi" log: From 1cd68a065db429d3f8ba373516f8482d18477e4c Mon Sep 17 00:00:00 2001 From: mAGLAVE <55588167+mAGLAVE@users.noreply.github.com> Date: Thu, 14 Mar 2024 18:28:24 +0100 Subject: [PATCH 2/3] Bug fix in bio/deseq2/DESeqDataSetFromMatrix/wrapper.R - set a value to x variable into the lapply function - add a filtering step to filter count table to keep only samples from coldata file --- bio/deseq2/DESeqDataSetFromMatrix/wrapper.R | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/bio/deseq2/DESeqDataSetFromMatrix/wrapper.R b/bio/deseq2/DESeqDataSetFromMatrix/wrapper.R index dee22e6d121..4dabb56ea1f 100755 --- a/bio/deseq2/DESeqDataSetFromMatrix/wrapper.R +++ b/bio/deseq2/DESeqDataSetFromMatrix/wrapper.R @@ -16,6 +16,7 @@ base::sink(log.file,type="message"); base::library(package="DESeq2", quietly=TRUE); +#read counts table file counts <- utils::read.table( file=snakemake@input[["counts"]], header = TRUE, @@ -23,26 +24,28 @@ counts <- utils::read.table( stringsAsFactors = FALSE ); +#formatting counts table with genes in row names gene_names_col <- "genes"; if ("count_gene_col" %in% base::names(snakemake@params)) { gene_names_col <- base::as.character(x=snakemake@params[["count_gene_col"]]); } rownames(counts) <- counts[, gene_names_col]; - -numerical_columns <- base::unlist(base::lapply(x, base::is.numeric)); +numerical_columns <- base::unlist(base::lapply(counts[1,], base::is.numeric)); counts <- counts[, numerical_columns]; +#filtering low counts count_filter <- 0; if ("count_filter" %in% names(snakemake@params)) { count_filter <- base::as.numeric( x = snakemake@params[["count_filter"]] ); } - -keep <- rowSums(counts(counts)) > count_filter; +keep <- rowSums(head(counts)) > count_filter; counts <- counts[keep, ]; + base::message("Counts loaded"); +#read coldata file coldata <- utils::read.table( file=snakemake@input[["coldata"]], header = TRUE, @@ -51,11 +54,14 @@ coldata <- utils::read.table( ); base::message("Coldata loaded"); +#filtering count table to keep only samples from coldata file +counts <- counts[, colnames(counts) %in% coldata[,1]]; + extra <- "countData=counts, colData=coldata" if ("extra" %in% base::names(snakemake@params)) { extra <- base::paste( extra, - base::as.character(x=snakemake@params[["extra"]]) + base::as.character(x=snakemake@params[["extra"]]), sep="," ); } From aad0cec868f4f47f1cf017e305229b432273dda4 Mon Sep 17 00:00:00 2001 From: mAGLAVE <55588167+mAGLAVE@users.noreply.github.com> Date: Thu, 14 Mar 2024 18:30:44 +0100 Subject: [PATCH 3/3] Update bio/deseq2/DESeqDataSetFromMatrix/wrapper.R remove the head that replace the counts to remove --- bio/deseq2/DESeqDataSetFromMatrix/wrapper.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bio/deseq2/DESeqDataSetFromMatrix/wrapper.R b/bio/deseq2/DESeqDataSetFromMatrix/wrapper.R index 4dabb56ea1f..6d95deb1d92 100755 --- a/bio/deseq2/DESeqDataSetFromMatrix/wrapper.R +++ b/bio/deseq2/DESeqDataSetFromMatrix/wrapper.R @@ -40,7 +40,7 @@ if ("count_filter" %in% names(snakemake@params)) { x = snakemake@params[["count_filter"]] ); } -keep <- rowSums(head(counts)) > count_filter; +keep <- rowSums(counts) > count_filter; counts <- counts[keep, ]; base::message("Counts loaded");