Skip to content

Commit

Permalink
Merge pull request #65 from yangchen2/master
Browse files Browse the repository at this point in the history
get_pvalue_tool_columns using p-value columns instead of corrected P-value columns
  • Loading branch information
gibsramen authored Mar 22, 2024
2 parents b2e5314 + b45ee00 commit 0c7ffa3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
24 changes: 17 additions & 7 deletions qadabra/workflow/rules/common.smk
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,24 @@ def get_pvalue_tool_columns(wildcards):
target = d["target_level"]
reference = d["reference_level"]

# columns = {
# "edger": "PValue",
# "deseq2": "pvalue",
# "ancombc": "pvals",
# "aldex2": f"model.{covariate}{target} Pr(>|t|)",
# "maaslin2": "pval",
# "metagenomeseq": "pvalues",
# "corncob": "fit.p",
# }

columns = {
"edger": "PValue",
"deseq2": "pvalue",
"ancombc": "pvals",
"aldex2": f"model.{covariate}{target} Pr(>|t|)",
"maaslin2": "pval",
"metagenomeseq": "pvalues",
"corncob": "fit.p",
"edger": "PValue_BH_adj",
"deseq2": "padj",
"ancombc": "qvals",
"aldex2": f"model.{covariate}{target} Pr(>|t|).BH",
"maaslin2": "pval_BH_adj",
"metagenomeseq": "adjPvalues",
"corncob": "adjusted_p_values",
}
return columns[wildcards.tool]

Expand Down
8 changes: 4 additions & 4 deletions qadabra/workflow/scripts/R/ancombc.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ coef_col <- paste("coefs", covariate, target, sep = ".")
pval_col <- paste("pvals", covariate, target, sep = ".")
coefs <- ancombc.results$res$beta
pvals <- ancombc.results$res$p_val
# qvals <- ancombc.results$res$q_val
qvals <- ancombc.results$res$q_val

# Modify result names
row.names(coefs) <- gsub("^F_", "", row.names(coefs))
row.names(pvals) <- gsub("^F_", "", row.names(pvals))
# row.names(qvals) <- gsub("^F_", "", row.names(qvals))
row.names(qvals) <- gsub("^F_", "", row.names(qvals))

results_all <- data.frame(coefs=coefs, pvals=pvals)
colnames(results_all) <- c("coefs", "pvals")
results_all <- data.frame(coefs=coefs, pvals=pvals, qvals=qvals)
colnames(results_all) <- c("coefs", "pvals", "qvals")

# Save results to output file
write.table(results_all, file=snakemake@output[[1]], sep="\t")
Expand Down

0 comments on commit 0c7ffa3

Please sign in to comment.