Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix in bio/deseq2/DESeqDataSetFromMatrix/wrapper.R and in bigr_pipelines/rnaseq/rules/029.clusterprofiler.terms.smk on the Unofficial branch #14

Merged
merged 3 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bigr_pipelines/rnaseq/rules/029.clusterprofiler.terms.smk
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
16 changes: 11 additions & 5 deletions bio/deseq2/DESeqDataSetFromMatrix/wrapper.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,36 @@ 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,
sep = "\t",
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(counts) > count_filter;
counts <- counts[keep, ];

base::message("Counts loaded");

#read coldata file
coldata <- utils::read.table(
file=snakemake@input[["coldata"]],
header = TRUE,
Expand All @@ -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=","
);
}
Expand Down
Loading