Skip to content

Commit

Permalink
Merge pull request #65 from PF2-pasteur-fr/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
hvaret committed May 7, 2019
2 parents c7ccb6b + b1e326d commit e5db42a
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 21 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: SARTools
Type: Package
Title: Statistical Analysis of RNA-Seq Tools
Version: 1.6.6
Date: 2018-10-04
Version: 1.6.7
Date: 2019-05-07
Author: Marie-Agnes Dillies and Hugo Varet
Maintainer: Hugo Varet <[email protected]>
Depends: R (>= 3.3.0), DESeq2 (>= 1.12.0), edgeR (>= 3.12.0), xtable
Expand Down
5 changes: 5 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
CHANGES IN VERSION 1.6.7
------------------------
o modified the installation guidelines for the Bioconductor packages
o new parameters in the MAPlot() and volcanoPlot() functions thanks to Ken Field suggestion on GitHub

CHANGES IN VERSION 1.6.6
------------------------
o fixed a bug introduced in version 1.6.4 when giving featureCounts files as input
Expand Down
9 changes: 7 additions & 2 deletions R/MAPlot.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
#' @param complete A \code{list} of \code{data.frame} containing features results (from \code{exportResults.DESeq2()} or \code{exportResults.edgeR()})
#' @param alpha cut-off to apply on each adjusted p-value
#' @param outfile TRUE to export the figure in a png file
#' @param log2FClim numeric vector containing both upper and lower y-axis limits for all the MA-plots produced (NULL by default to set them automatically)
#' @return A file named MAPlot.png in the figures directory containing one MA-plot per comparison
#' @author Marie-Agnes Dillies and Hugo Varet

MAPlot <- function(complete, alpha=0.05, outfile=TRUE){
MAPlot <- function(complete, alpha=0.05, outfile=TRUE, log2FClim=NULL){
ncol <- ifelse(length(complete)<=4, ceiling(sqrt(length(complete))), 3)
nrow <- ceiling(length(complete)/ncol)
if (outfile) png(filename="figures/MAPlot.png", width=cairoSizeWrapper(1800*ncol), height=cairoSizeWrapper(1800*nrow), res=300)
Expand All @@ -18,7 +19,11 @@ MAPlot <- function(complete, alpha=0.05, outfile=TRUE){
complete.name <- complete.name[complete.name$baseMean>0,]
complete.name$padj <- ifelse(is.na(complete.name$padj),1,complete.name$padj)
log2FC <- complete.name$log2FoldChange
ylim <- 1.1 * c(-1,1) * quantile(abs(log2FC[is.finite(log2FC)]), probs=0.99)
if (is.null(log2FClim)){
ylim <- 1.1 * c(-1,1) * quantile(abs(log2FC[is.finite(log2FC)]), probs=0.99)
} else{
ylim <- log2FClim
}
plot(complete.name$baseMean, pmax(ylim[1], pmin(ylim[2], log2FC)),
log = "x", cex=0.45, las = 1, ylim = ylim,
col = ifelse(complete.name[,"padj"] < alpha, "red", "black"),
Expand Down
Empty file modified R/cairoSizeWrapper.R
100644 → 100755
Empty file.
9 changes: 6 additions & 3 deletions R/summarizeResults.DESeq2.r
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@
#' @param cooksCutoff outliers detection threshold (TRUE to let DESeq2 choosing it or FALSE to disable the outliers detection)
#' @param alpha significance threshold to apply to the adjusted p-values
#' @param col colors for the plots
#' @param log2FClim numeric vector containing both upper and lower y-axis limits for all the MA-plots produced (NULL by default to set them automatically)
#' @param padjlim numeric value between 0 and 1 for the adjusted p-value upper limits for all the volcano plots produced (NULL by default to set them automatically)
#' @return A list containing: (i) a list of \code{data.frames} from \code{exportResults.DESeq2()}, (ii) the table summarizing the independent filtering procedure and (iii) a table summarizing the number of differentially expressed features
#' @author Hugo Varet

summarizeResults.DESeq2 <- function(out.DESeq2, group, independentFiltering=TRUE, cooksCutoff=TRUE,
alpha=0.05, col=c("lightblue","orange","MediumVioletRed","SpringGreen")){
alpha=0.05, col=c("lightblue","orange","MediumVioletRed","SpringGreen"),
log2FClim=NULL, padjlim=NULL){
# create the figures/tables directory if does not exist
if (!I("figures" %in% dir())) dir.create("figures", showWarnings=FALSE)
if (!I("tables" %in% dir())) dir.create("tables", showWarnings=FALSE)
Expand Down Expand Up @@ -50,10 +53,10 @@ summarizeResults.DESeq2 <- function(out.DESeq2, group, independentFiltering=TRUE
rawpHist(complete=complete)

# MA-plots
MAPlot(complete=complete, alpha=alpha)
MAPlot(complete=complete, alpha=alpha, log2FClim=log2FClim)

# Volcano plots
volcanoPlot(complete=complete, alpha=alpha)
volcanoPlot(complete=complete, alpha=alpha, padjlim=padjlim)

return(list(complete=complete, tabIndepFiltering=tabIndepFiltering, nDiffTotal=nDiffTotal))
}
9 changes: 6 additions & 3 deletions R/summarizeResults.edgeR.r
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
#' @param counts matrix of raw counts
#' @param alpha significance threshold to apply to the adjusted p-values
#' @param col colors for the plots
#' @param log2FClim numeric vector containing both upper and lower y-axis limits for all the MA-plots produced (NULL by default to set them automatically)
#' @param padjlim numeric value between 0 and 1 for the adjusted p-value upper limits for all the volcano plots produced (NULL by default to set them automatically)
#' @return A list containing: (i) a list of \code{data.frames} from \code{exportResults.edgeR()} and (ii) a table summarizing the number of differentially expressed features
#' @author Hugo Varet

summarizeResults.edgeR <- function(out.edgeR, group, counts, alpha=0.05,
col=c("lightblue","orange","MediumVioletRed","SpringGreen")){
col=c("lightblue","orange","MediumVioletRed","SpringGreen"),
log2FClim=NULL, padjlim=NULL){
# create the figures/tables directory if does not exist
if (!I("figures" %in% dir())) dir.create("figures", showWarnings=FALSE)
if (!I("tables" %in% dir())) dir.create("tables", showWarnings=FALSE)
Expand All @@ -34,10 +37,10 @@ summarizeResults.edgeR <- function(out.edgeR, group, counts, alpha=0.05,
rawpHist(complete=complete)

# MA-plots
MAPlot(complete=complete, alpha=alpha)
MAPlot(complete=complete, alpha=alpha, log2FClim=log2FClim)

# Volcano plots
volcanoPlot(complete=complete, alpha=alpha)
volcanoPlot(complete=complete, alpha=alpha, padjlim=padjlim)

return(list(complete=complete, nDiffTotal=nDiffTotal))
}
9 changes: 7 additions & 2 deletions R/volcanoPlot.r
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
#' @param complete A \code{list} of \code{data.frame} containing features results (from \code{exportResults.DESeq2()} or \code{exportResults.edgeR()})
#' @param alpha cut-off to apply on each adjusted p-value
#' @param outfile TRUE to export the figure in a png file
#' @param padjlim numeric value between 0 and 1 for the adjusted p-value upper limits for all the volcano plots produced (NULL by default to set them automatically)
#' @return A file named volcanoPlot.png in the figures directory containing one volcano plot per comparison
#' @author Hugo Varet

volcanoPlot <- function(complete, alpha=0.05, outfile=TRUE){
volcanoPlot <- function(complete, alpha=0.05, outfile=TRUE, padjlim=NULL){
ncol <- ifelse(length(complete)<=4, ceiling(sqrt(length(complete))), 3)
nrow <- ceiling(length(complete)/ncol)
if (outfile) png(filename="figures/volcanoPlot.png", width=cairoSizeWrapper(1800*ncol), height=cairoSizeWrapper(1800*nrow), res=300)
Expand All @@ -17,7 +18,11 @@ volcanoPlot <- function(complete, alpha=0.05, outfile=TRUE){
complete.name <- complete[[name]]
complete.name$padj[which(complete.name$padj==0)] <- .Machine$double.xmin
log10pval <- -log10(complete.name$padj)
ylim <- c(0,1) * quantile(log10pval, probs=0.99, na.rm=TRUE)
if (is.null(padjlim)){
ylim <- c(0,1) * quantile(log10pval, probs=0.99, na.rm=TRUE)
} else{
ylim <- c(0,1) * -log10(padjlim)
}
plot(complete.name$log2FoldChange, pmin(ylim[2], log10pval), ylim=ylim, las=1, cex=0.45,
xlab=expression(log[2]~fold~change), ylab=expression(-log[10]~adjusted~P~value),
col=ifelse(complete.name$padj <= alpha, "red", "black"), pch=ifelse(log10pval >= ylim[2], 2, 20),
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ How to install SARTools?
In addition to the SARTools package itself, the workflow requires the installation of several packages: DESeq2, edgeR, genefilter, xtable and knitr (all available online, see the dedicated webpages). SARTools needs R version 3.3.0 or higher, DESeq2 1.12.0 or higher and edgeR 3.12.0 or higher: old versions of DESeq2 or edgeR may be incompatible with SARTools.

To install the SARTools package from GitHub, open a R session and:
- install DESeq2, edgeR and genefilter with `source("http://bioconductor.org/biocLite.R")` and `biocLite(c("DESeq2", "edgeR", "genefilter"))` (if not installed yet)
- install DESeq2, edgeR and genefilter with `if (!requireNamespace("BiocManager")){install.packages("BiocManager")}` and `BiocManager::install(c("DESeq2", "edgeR", "genefilter"))` (if not installed yet)
- install devtools with `install.packages("devtools")` (if not installed yet)
- Notes:

Expand Down
4 changes: 3 additions & 1 deletion man/MAPlot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion man/summarizeResults.DESeq2.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion man/summarizeResults.edgeR.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion man/volcanoPlot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion template_script_DESeq2.r
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
### R script to compare several conditions with the SARTools and DESeq2 packages
### Hugo Varet
### March 20th, 2018
### designed to be executed with SARTools 1.6.6
### designed to be executed with SARTools 1.6.7
################################################################################

################################################################################
Expand Down
2 changes: 1 addition & 1 deletion template_script_DESeq2_CL.r
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
### R script to compare several conditions with the SARTools and DESeq2 packages
### Hugo Varet
### March 20th, 2018
### designed to be executed with SARTools 1.6.6
### designed to be executed with SARTools 1.6.7
### run "Rscript template_script_DESeq2_CL.r --help" to get some help
################################################################################

Expand Down
2 changes: 1 addition & 1 deletion template_script_edgeR.r
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
### R script to compare several conditions with the SARTools and edgeR packages
### Hugo Varet
### March 20th, 2018
### designed to be executed with SARTools 1.6.6
### designed to be executed with SARTools 1.6.7
################################################################################

################################################################################
Expand Down
2 changes: 1 addition & 1 deletion template_script_edgeR_CL.r
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
### R script to compare several conditions with the SARTools and edgeR packages
### Hugo Varet
### May 16th, 2018
### designed to be executed with SARTools 1.6.6
### designed to be executed with SARTools 1.6.7
### run "Rscript template_script_edgeR_CL.r --help" to get some help
################################################################################

Expand Down

0 comments on commit e5db42a

Please sign in to comment.