https://github.com/arjunrajlaboratory/RajLabSeqTools
Tip revision: c8b8c79b2ec9c1bd9eb7ced427bb2aec25f19506 authored by Benjamin Emert on 26 March 2020, 17:37:11 UTC
Updated reorganizeBasespaceFiles.py to better parse samples with same first index (e.g. sample 1 and sample10)
Updated reorganizeBasespaceFiles.py to better parse samples with same first index (e.g. sample 1 and sample10)
Tip revision: c8b8c79
deseq2.R
log <- file(snakemake@log[[1]], open="wt")
sink(log)
sink(log, type="message")
library("DESeq2")
parallel <- FALSE
if (snakemake@threads > 1) {
library("BiocParallel")
# setup parallelization
register(MulticoreParam(snakemake@threads))
parallel <- TRUE
}
dds <- readRDS(snakemake@input[[1]])
contrast <- c("condition", snakemake@params[["contrast"]])
res <- results(dds, contrast=contrast, parallel=parallel)
# shrink fold changes for lowly expressed genes
res <- lfcShrink(dds, contrast=contrast, res=res)
# sort by p-value
res <- res[order(res$padj),]
# TODO explore IHW usage
# store results
svg(snakemake@output[["ma_plot"]])
plotMA(res, ylim=c(-2,2))
dev.off()
write.table(as.data.frame(res), file=snakemake@output[["table"]])
