From f8644a8d96e474805acc0353ee576772a167575f Mon Sep 17 00:00:00 2001 From: hvaret <hugo.varet@pasteur.fr> Date: Mon, 6 Apr 2020 16:24:27 +0200 Subject: [PATCH] round --- DESCRIPTION | 2 +- R/run.DESeq2.r | 6 +++++- R/run.Limma.r | 7 ++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index c179134..5441fb4 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: ChIPuanaR Type: Package Title: Differential analysis of ChIP-Seq data Version: 0.99.0 -Date: 2020-01-13 +Date: 2020-04-06 Author: Marie-Agnes Dillies, Hugo Varet and Maëlle Daunesse Maintainer: Maëlle Daunesse <maelle.daunesse@pasteur.fr> Depends: R (>= 3.4.0), DESeq2, limma, kableExtra, knitr, ggplot2 diff --git a/R/run.DESeq2.r b/R/run.DESeq2.r index 823f997..e36ec13 100755 --- a/R/run.DESeq2.r +++ b/R/run.DESeq2.r @@ -44,7 +44,11 @@ run.DESeq2 <- function(counts, conditions, batch=NULL, pAdjustMethod="BH", spike colnames(counts.norm) <- paste0("norm.",colnames(counts)) res <- results(dds, contrast=c("conditions", levelTest, levelRef), pAdjustMethod=pAdjustMethod, cooksCutoff=TRUE, independentFiltering=FALSE) - res <- res[, c("baseMean", "log2FoldChange", "pvalue", "padj", "lfcSE", "stat")] + res <- res[, c("baseMean", "log2FoldChange", "lfcSE", "stat", "pvalue", "padj")] + res$baseMean <- round(res$baseMean, 2) + res$log2FoldChange <- round(res$log2FoldChange, 2) + res$lfcSE <- round(res$lfcSE, 2) + res$stat <- round(res$stat, 2) resAnDif <- data.frame(counts, counts.norm, res) results[[paste0(levelTest,"_vs_",levelRef)]] <- resAnDif cat(paste("Comparison", levelTest, "vs", levelRef, "done\n")) diff --git a/R/run.Limma.r b/R/run.Limma.r index 8657330..9a4dc80 100644 --- a/R/run.Limma.r +++ b/R/run.Limma.r @@ -51,9 +51,10 @@ run.Limma <- function(counts, conditions, normalize.method="quantile", spikes=NU fit2 <- contrasts.fit(fit=fit, contrasts=cont.matrix) efit <- eBayes(fit=fit2) colnames(v$E) <- paste0("norm.", colnames(counts)) - resAnDif <- data.frame(counts,v$E, - baseMean=efit$Amean, - log2FoldChange=as.numeric(efit$coefficients), + resAnDif <- data.frame(counts, + round(v$E, 2), + baseMean=round(efit$Amean, 2), + log2FoldChange=round(as.numeric(efit$coefficients), 2), pvalue=as.numeric(efit$p.val), padj=p.adjust(efit$p.value, method=pAdjustMethod)) results[[paste0(levelTest,"_vs_",levelRef)]] <- resAnDif -- GitLab