[med-svn] [r-bioc-edger] 01/05: New upstream version 3.16.5+dfsg
Andreas Tille
tille at debian.org
Thu Jan 5 15:01:03 UTC 2017
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository r-bioc-edger.
commit 104c7f6134efca6babba374ffc1ccec7869e51c2
Author: Andreas Tille <tille at debian.org>
Date: Thu Jan 5 15:47:54 2017 +0100
New upstream version 3.16.5+dfsg
---
DESCRIPTION | 6 +++---
R/addPriorCount.R | 2 ++
R/cpm.R | 2 +-
R/dispBinTrend.R | 7 ++++---
R/estimateGLMCommonDisp.R | 2 +-
R/geneset-DGEList.R | 26 +++++++++++++-------------
R/glmTreat.R | 3 ++-
R/plotMDS.DGEList.R | 11 +++++++----
R/scaleOffset.R | 37 +++++++++++++++++++++++++++++++++++++
build/vignette.rds | Bin 229 -> 228 bytes
inst/doc/edgeR.pdf | Bin 45765 -> 45765 bytes
man/camera.DGEList.Rd | 17 ++++++++++++-----
man/plotMDS.DGEList.Rd | 8 ++++----
man/roast.DGEList.Rd | 32 ++++++++++++++++++++++++++------
man/scaleOffset.Rd | 35 +++++++++++++++++++++++++++++++++++
src/R_calculate_cpm.cpp | 3 ++-
src/add_prior.cpp | 2 --
17 files changed, 149 insertions(+), 44 deletions(-)
diff --git a/DESCRIPTION b/DESCRIPTION
index 30ac9d4..a8d4580 100755
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
Package: edgeR
-Version: 3.16.1
-Date: 2016-10-25
+Version: 3.16.5
+Date: 2016-12-12
Title: Empirical Analysis of Digital Gene Expression Data in R
Description: Differential expression analysis of RNA-seq expression profiles with biological replication. Implements a range of statistical methodology based on the negative binomial distributions, including empirical Bayes estimation, exact tests, generalized linear models and quasi-likelihood tests. As well as RNA-seq, it be applied to differential signal analysis of other types of genomic data that produce counts, including ChIP-seq, SAGE and CAGE.
Author: Yunshun Chen <yuchen at wehi.edu.au>, Aaron Lun <alun at wehi.edu.au>, Davis McCarthy <dmccarthy at wehi.edu.au>, Xiaobei Zhou <xiaobei.zhou at uzh.ch>, Mark Robinson <mark.robinson at imls.uzh.ch>, Gordon Smyth <smyth at wehi.edu.au>
@@ -16,4 +16,4 @@ biocViews: GeneExpression, Transcription, AlternativeSplicing,
TimeCourse, SAGE, Sequencing, ChIPSeq, RNASeq, BatchEffect,
MultipleComparison, Normalization, QualityControl
NeedsCompilation: yes
-Packaged: 2016-10-25 22:31:14 UTC; biocbuild
+Packaged: 2016-12-14 23:27:46 UTC; biocbuild
diff --git a/R/addPriorCount.R b/R/addPriorCount.R
index 51293c0..4f45262 100644
--- a/R/addPriorCount.R
+++ b/R/addPriorCount.R
@@ -21,7 +21,9 @@ addPriorCount <- function(y, lib.size=NULL, offset=NULL, prior.count=1)
# Adding the prior count.
out <- .Call(.cR_add_prior_count, y, offset, prior.count)
if (is.character(out)) stop(out)
+
names(out) <- c("y", "offset")
+ out$offset <- makeCompressedMatrix(out$offset, byrow=TRUE)
return(out)
}
diff --git a/R/cpm.R b/R/cpm.R
index 7f6d428..5f6d041 100644
--- a/R/cpm.R
+++ b/R/cpm.R
@@ -24,7 +24,7 @@ cpm.default <- function(x, lib.size=NULL, log=FALSE, prior.count=0.25, ...)
if(is.null(lib.size)) lib.size <- colSums(x)
if(!is.double(lib.size)) storage.mode(lib.size) <- "double"
lib.size <- makeCompressedMatrix(lib.size, byrow=TRUE)
- err <- .Call(.cR_check_positive, lib.size, "library sizes")
+ err <- .Call(.cR_check_nonnegative, lib.size, "library sizes")
if (is.character(err)) stop(err)
# Calculating in C++ for max efficiency
diff --git a/R/dispBinTrend.R b/R/dispBinTrend.R
index d0fb75a..1382a55 100644
--- a/R/dispBinTrend.R
+++ b/R/dispBinTrend.R
@@ -30,7 +30,7 @@ dispBinTrend <- function(y, design=NULL, offset=NULL, df=5, span=0.3, min.n=400,
method.trend <- match.arg(method.trend, c("spline", "loess"))
# Check AveLogCPM
- if(is.null(AveLogCPM)) AveLogCPM <- aveLogCPM(y,weights=weights)
+ if(is.null(AveLogCPM)) AveLogCPM <- aveLogCPM(y, offset=offset, weights=weights)
# Define bins of genes based on min.n in each bin
# All zero rows are marked as group==0
@@ -57,8 +57,9 @@ dispBinTrend <- function(y, design=NULL, offset=NULL, df=5, span=0.3, min.n=400,
bin.d <- bin.A <- rep(0,nbins)
for(i in 1:nbins) {
bin <- group==i
- bin.d[i] <- estimateGLMCommonDisp(y[bin,], design, method=method.bin, offset[bin,], min.row.sum=0, weights=weights[bin,] ,...)
- bin.A[i] <- mean(AveLogCPM[bin])
+ binAve <- AveLogCPM[bin]
+ bin.d[i] <- estimateGLMCommonDisp(y[bin,], design, method=method.bin, offset[bin,], min.row.sum=0, weights=weights[bin,], AveLogCPM=binAve, ...)
+ bin.A[i] <- mean(binAve)
}
# If just one bin, trended dispersion is constant
diff --git a/R/estimateGLMCommonDisp.R b/R/estimateGLMCommonDisp.R
index 6b60a9e..68619b4 100644
--- a/R/estimateGLMCommonDisp.R
+++ b/R/estimateGLMCommonDisp.R
@@ -40,7 +40,7 @@ estimateGLMCommonDisp.default <- function(y, design=NULL, offset=NULL, method="C
if(is.null(offset)) offset <- log(colSums(y))
# Check AveLogCPM
- if(is.null(AveLogCPM)) AveLogCPM <- aveLogCPM(y,weights=weights)
+ if(is.null(AveLogCPM)) AveLogCPM <- aveLogCPM(y, offset=offset, weights=weights)
# Call lower-level function
disp <- switch(method,
diff --git a/R/geneset-DGEList.R b/R/geneset-DGEList.R
index 0d74f33..7f2f686 100644
--- a/R/geneset-DGEList.R
+++ b/R/geneset-DGEList.R
@@ -1,37 +1,37 @@
-roast.DGEList <- function(y, index=NULL, design=NULL, contrast=ncol(design), ...)
+roast.DGEList <- function(y, index=NULL, design=NULL, contrast=ncol(design), geneid=NULL, set.statistic="mean", gene.weights=NULL,...)
# Rotation gene set testing for RNA-Seq data
# Yunshun Chen, Gordon Smyth
-# Created 19 Dec 2012. Last revised on 27 May 2015
+# Created 19 Dec 2012. Last revised on 26 Nov 2016
{
y <- .zscoreDGE(y=y, design=design, contrast=contrast)
- roast(y=y, index=index, design=design, contrast=contrast, var.prior=1, df.prior=Inf, ...)
-}
+ roast(y=y, index=index, design=design, contrast=contrast, geneid=geneid, set.statistic=set.statistic, gene.weights=gene.weights, var.prior=1, df.prior=Inf)
+}
-mroast.DGEList <- function(y, index=NULL, design=NULL, contrast=ncol(design), ...)
+mroast.DGEList <- function(y, index=NULL, design=NULL, contrast=ncol(design), geneid=NULL, set.statistic="mean", gene.weights=NULL, adjust.method="BH", midp=TRUE, sort="directional", ...)
# Rotation gene set testing for RNA-Seq data with multiple sets
# Yunshun Chen, Gordon Smyth
-# Created 8 Jan 2013. Last revised 27 May 2015.
+# Created 8 Jan 2013. Last revised 26 Nov 2016.
{
y <- .zscoreDGE(y=y, design=design, contrast=contrast)
- mroast(y=y, index=index, design=design, contrast=contrast, var.prior=1, df.prior=Inf, ...)
+ mroast(y=y, index=index, design=design, contrast=contrast, geneid=geneid, set.statistic=set.statistic, gene.weights=gene.weights, var.prior=1, df.prior=Inf, adjust.method=adjust.method, midp=midp, sort=sort)
}
-fry.DGEList <- function(y, index=NULL, design=NULL, contrast=ncol(design), ...)
+fry.DGEList <- function(y, index=NULL, design=NULL, contrast=ncol(design), geneid=NULL, sort="directional", ...)
# Rotation gene set testing for RNA-Seq data with multiple sets
# Yunshun Chen, Gordon Smyth
-# Created 1 Dec 2015. Last revised 15 April 2016.
+# Created 1 Dec 2015. Last revised 26 Nov 2016.
{
y <- .zscoreDGE(y=y, design=design, contrast=contrast)
- fry(y=y, index=index, design=design, contrast=contrast, standardize="none", ...)
+ fry(y=y, index=index, design=design, contrast=contrast, standardize="none", geneid=geneid, sort=sort)
}
-camera.DGEList <- function(y, index, design=NULL, contrast=ncol(design), ...)
+camera.DGEList <- function(y, index, design=NULL, contrast=ncol(design), weights=NULL, use.ranks=FALSE, allow.neg.cor=FALSE, inter.gene.cor=0.01, sort=TRUE, ...)
# Rotation gene set testing for RNA-Seq data accounting for inter-gene correlation
# Yunshun Chen, Gordon Smyth
-# Created 07 Jan 2013. Last modified 27 May 2015.
+# Created 07 Jan 2013. Last modified 26 Nov 2016.
{
y <- .zscoreDGE(y=y, design=design, contrast=contrast)
- camera(y=y, index=index, design=design, contrast=contrast, ...)
+ camera(y=y, index=index, design=design, contrast=contrast, weights=weights, use.ranks=use.ranks, allow.neg.cor=allow.neg.cor, inter.gene.cor=inter.gene.cor, trend.var=FALSE, sort=sort)
}
romer.DGEList <- function(y, index, design=NULL, contrast=ncol(design), ...)
diff --git a/R/glmTreat.R b/R/glmTreat.R
index a67f49c..7a5ba12 100644
--- a/R/glmTreat.R
+++ b/R/glmTreat.R
@@ -1,7 +1,7 @@
glmTreat <- function(glmfit, coef=ncol(glmfit$design), contrast=NULL, lfc=0, null="interval")
# Likelihood ratio test or quasi-likelihood F-test with a threshold
# Yunshun Chen and Gordon Smyth
-# Created on 05 May 2014. Last modified on 03 Oct 2016
+# Created on 05 May 2014. Last modified on 16 Nov 2016
{
if(lfc < 0) stop("lfc has to be non-negative")
@@ -115,6 +115,7 @@ glmTreat <- function(glmfit, coef=ncol(glmfit$design), contrast=NULL, lfc=0, nul
c <- 1.470402
j <- z.right + z.left > c
p.value <- rep_len(1L, ngenes)
+ j <- j[!is.na(j)]
p.value[j] <- .integratepnorm(-z.right[j], -z.right[j] + c) + .integratepnorm(z.left[j] - c, z.left[j])
p.value[!j] <- 2*.integratepnorm(-z.right[!j], z.left[!j])
} else {
diff --git a/R/plotMDS.DGEList.R b/R/plotMDS.DGEList.R
index 85280fb..593727d 100644
--- a/R/plotMDS.DGEList.R
+++ b/R/plotMDS.DGEList.R
@@ -1,7 +1,7 @@
-plotMDS.DGEList <- function (x,top=500,labels=NULL,pch=NULL,cex=1,dim.plot=c(1,2),ndim=max(dim.plot),gene.selection="pairwise",xlab=NULL,ylab=NULL,method="logFC",prior.count=2,...)
+plotMDS.DGEList <- function (x,top=500,labels=NULL,pch=NULL,cex=1,dim.plot=c(1,2),ndim=max(dim.plot),gene.selection="pairwise",xlab=NULL,ylab=NULL,method="logFC",prior.count=2,plot=TRUE,...)
# Multidimensional scaling plot of digital gene expression profiles
# Yunshun Chen, Mark Robinson and Gordon Smyth
-# 23 May 2011. Last modified 25 Nov 2014.
+# 23 May 2011. Last modified 26 Nov 2016.
{
method <- match.arg(method, c("logfc","logFC","bcv","BCV"))
if(method=="logfc") method <- "logFC"
@@ -10,7 +10,7 @@ plotMDS.DGEList <- function (x,top=500,labels=NULL,pch=NULL,cex=1,dim.plot=c(1,2
# Default method is to convert to moderated logCPM and call limma plotMDS
if(method=="logFC") {
y <- cpm(x,log=TRUE,prior.count=prior.count)
- return(plotMDS(y,top=top,labels=labels,pch=pch,cex=cex,dim.plot=dim.plot,ndim=ndim,gene.selection=gene.selection,xlab=xlab,ylab=ylab,...))
+ return(plotMDS(y,top=top,labels=labels,pch=pch,cex=cex,dim.plot=dim.plot,ndim=ndim,gene.selection=gene.selection,xlab=xlab,ylab=ylab,plot=plot,...))
}
# From here method="bcv"
@@ -75,5 +75,8 @@ plotMDS.DGEList <- function (x,top=500,labels=NULL,pch=NULL,cex=1,dim.plot=c(1,2
mds$x <- a1[,dim.plot[1]]
mds$y <- a1[,dim.plot[2]]
mds$axislabel <- "BCV distance"
- plotMDS(mds,labels=labels,pch=pch,cex=cex,xlab=xlab,ylab=ylab,...)
+ if(plot)
+ plotMDS(mds,labels=labels,pch=pch,cex=cex,xlab=xlab,ylab=ylab,...)
+ else
+ mds
}
diff --git a/R/scaleOffset.R b/R/scaleOffset.R
new file mode 100644
index 0000000..297258f
--- /dev/null
+++ b/R/scaleOffset.R
@@ -0,0 +1,37 @@
+scaleOffset <- function(y, ...)
+UseMethod("scaleOffset")
+
+scaleOffset.default <- function(y, offset, ...)
+# Ensures scale of offsets are consistent with library sizes.
+# Aaron Lun and Yunshun Chen.
+# Created 8 Dec 2016.
+{
+ if(is.matrix(y)) lib.size <- colSums(y)
+ else lib.size <- y
+
+ if(is.matrix(offset)) {
+ if (ncol(offset)!=length(lib.size)) {
+ if (! (is(offset, "compressedMatrix") && attributes(offset)$repeat.col) ) {
+ stop("'ncol(offset)' should be equal to number of libraries")
+ }
+ }
+ adj <- rowMeans(offset)
+ } else {
+ if (length(offset)!=length(lib.size)) {
+ stop("length of 'offset' should be equal to number of libraries")
+ }
+ adj <- mean(offset)
+ }
+
+ mean(log(lib.size)) + offset - adj
+}
+
+scaleOffset.DGEList <- function(y, offset, ...)
+# Ensures scale of offsets are consistent with library sizes.
+# Aaron Lun and Yunshun Chen.
+# Created 8 Dec 2016.
+{
+ y$offset <- scaleOffset(y$samples$lib.size, offset)
+ y
+}
+
diff --git a/build/vignette.rds b/build/vignette.rds
index 9304f3b..553db84 100644
Binary files a/build/vignette.rds and b/build/vignette.rds differ
diff --git a/inst/doc/edgeR.pdf b/inst/doc/edgeR.pdf
index 94330ea..1678357 100644
Binary files a/inst/doc/edgeR.pdf and b/inst/doc/edgeR.pdf differ
diff --git a/man/camera.DGEList.Rd b/man/camera.DGEList.Rd
index bb8725b..1f9bc25 100644
--- a/man/camera.DGEList.Rd
+++ b/man/camera.DGEList.Rd
@@ -4,16 +4,23 @@
\description{
Test whether a set of genes is highly ranked relative to other genes in terms of differential expression, accounting for inter-gene correlation.
}
+
\usage{
-\method{camera}{DGEList}(y, index, design=NULL, contrast=ncol(design), \dots)
+\method{camera}{DGEList}(y, index, design, contrast = ncol(design), weights = NULL,
+ use.ranks = FALSE, allow.neg.cor=FALSE, inter.gene.cor=0.01, sort = TRUE, \dots)
}
\arguments{
\item{y}{a \code{DGEList} object containing dispersion estimates.}
- \item{index}{an index vector or a list of index vectors. Can be any vector such that \code{y[indices,]} selects the rows corresponding to the test set.}
- \item{design}{the design matrix.}
- \item{contrast}{the contrast of the linear model coefficients for which the test is required. Can be an integer specifying a column of \code{design}, or the name of a column of \code{design}, or else a numeric vector of same length as the number of columns of \code{design}.}
- \item{\dots}{other arguments are passed to \code{\link{camera.default}}.}
+ \item{index}{an index vector or a list of index vectors. Can be any vector such that \code{y[index,]} selects the rows corresponding to the test set. The list can be made using \code{\link{ids2indices}}.}
+ \item{design}{design matrix.}
+ \item{contrast}{contrast of the linear model coefficients for which the test is required. Can be an integer specifying a column of \code{design}, or else a numeric vector of same length as the number of columns of \code{design}.}
+ \item{weights}{numeric matrix of observation weights of same size as \code{y}, or a numeric vector of array weights with length equal to \code{ncol(y)}, or a numeric vector of gene weights with length equal to \code{nrow(y)}.}
+ \item{use.ranks}{do a rank-based test (\code{TRUE}) or a parametric test (\code{FALSE})?}
+ \item{allow.neg.cor}{should reduced variance inflation factors be allowed for negative correlations?}
+ \item{inter.gene.cor}{numeric, optional preset value for the inter-gene correlation within tested sets. If \code{NA} or \code{NULL}, then an inter-gene correlation will be estimated for each tested set.}
+ \item{sort}{logical, should the results be sorted by p-value?}
+ \item{\dots}{other arguments are not currently used}
}
\details{
diff --git a/man/plotMDS.DGEList.Rd b/man/plotMDS.DGEList.Rd
index f6c6644..41acd87 100644
--- a/man/plotMDS.DGEList.Rd
+++ b/man/plotMDS.DGEList.Rd
@@ -6,9 +6,8 @@ Plot samples on a two-dimensional scatterplot so that distances on the plot appr
}
\usage{
\method{plotMDS}{DGEList}(x, top = 500, labels = NULL, pch = NULL, cex = 1,
- dim.plot = c(1,2), ndim = max(dim.plot), gene.selection = "pairwise",
- xlab = NULL, ylab = NULL, method = "logFC", prior.count = 2,
- \dots)
+ dim.plot = c(1,2), ndim = max(dim.plot), gene.selection = "pairwise",
+ xlab = NULL, ylab = NULL, method = "logFC", prior.count = 2, plot = TRUE, \dots)
}
\arguments{
\item{x}{a \code{DGEList} object.}
@@ -23,6 +22,7 @@ Plot samples on a two-dimensional scatterplot so that distances on the plot appr
\item{ylab}{y-axis label}
\item{method}{method used to compute distances. Possible values are "logFC" or \code{"bcv"}.}
\item{prior.count}{average prior count to be added to observation to shrink the estimated log-fold-changes towards zero. Only used when \code{method="logFC"}.}
+ \item{plot}{logical. If \code{TRUE} then a plot is created on the current graphics device.}
\item{\dots}{any other arguments are passed to \code{plot}.}
}
@@ -45,7 +45,7 @@ Note that the \code{"bcv"} method is slower than the \code{"logFC"} method when
}
\value{
-An object of class \code{\link[limma:plotMDS]{MDS}} is invisibly returned and a plot is created on the current graphics device.
+An object of class \code{\link[limma:plotMDS]{MDS}} is invisibly returned and (if \code{plot=TRUE}) a plot is created on the current graphics device.
}
\author{Yunshun Chen, Mark Robinson and Gordon Smyth}
diff --git a/man/roast.DGEList.Rd b/man/roast.DGEList.Rd
index 1aaf419..377a939 100644
--- a/man/roast.DGEList.Rd
+++ b/man/roast.DGEList.Rd
@@ -8,17 +8,37 @@ Rotation gene set testing for Negative Binomial generalized linear models.
}
\usage{
-\method{roast}{DGEList}(y, index=NULL, design=NULL, contrast=ncol(design), \dots)
-\method{mroast}{DGEList}(y, index=NULL, design=NULL, contrast=ncol(design), \dots)
-\method{fry}{DGEList}(y, index=NULL, design=NULL, contrast=ncol(design), \dots)
+\method{roast}{DGEList}(y, index = NULL, design = NULL, contrast = ncol(design), geneid = NULL,
+ set.statistic = "mean", gene.weights = NULL, \dots)
+
+\method{mroast}{DGEList}(y, index = NULL, design = NULL, contrast = ncol(design), geneid = NULL,
+ set.statistic = "mean", gene.weights = NULL,
+ adjust.method = "BH", midp = TRUE, sort = "directional", ...)
+
+\method{fry}{DGEList}(y, index = NULL, design = NULL, contrast = ncol(design), geneid = NULL,
+ sort = "directional", ...)
}
\arguments{
\item{y}{\code{DGEList} object.}
- \item{index}{index vector specifying which rows (genes) of \code{y} are in the test set. This can be a vector of indices, or a logical vector of the same length as \code{statistics}, or any vector such as \code{y[iset,]} contains the values for the gene set to be tested. Defaults to all genes. For \code{mroast} a list of index vectors.}
+ \item{index}{index vector specifying which rows (probes) of \code{y} are in the test set.
+ Can be a vector of integer indices, or a logical vector of length \code{nrow(y)}, or a vector of gene IDs corresponding to entries in \code{geneid}.
+ Alternatively it can be a data.frame with the first column containing the index vector and the second column containing directional gene weights.
+ For \code{mroast} or \code{fry}, \code{index} is a list of index vectors or a list of data.frames. }
\item{design}{design matrix}
- \item{contrast}{contrast for which the test is required. Can be an integer specifying a column of \code{design}, or the name of a column of \code{design}, or else a contrast vector of length equal to the number of columns of \code{design}.}
- \item{\dots}{other arguments are passed to \code{\link{roast.default}} or \code{\link{mroast.default}}.}
+ \item{contrast}{contrast for which the test is required.
+ Can be an integer specifying a column of \code{design}, or the name of a column of \code{design}, or a numeric contrast vector of length equal to the number of columns of \code{design}.}
+ \item{geneid}{gene identifiers corresponding to the rows of \code{y}.
+ Can be either a vector of length \code{nrow(y)} or the name of the column of \code{y$genes} containing the gene identifiers.
+ Defaults to \code{rownames(y)}.}
+ \item{set.statistic}{summary set statistic. Possibilities are \code{"mean"},\code{"floormean"},\code{"mean50"} or \code{"msq"}.}
+ \item{gene.weights}{numeric vector of directional (positive or negative) genewise weights.
+ For \code{mroast} or \code{fry}, this vector must have length equal to \code{nrow(y)}.
+ For \code{roast}, can be of length \code{nrow(y)} or of length equal to the number of genes in the test set.}
+ \item{adjust.method}{method used to adjust the p-values for multiple testing. See \code{\link{p.adjust}} for possible values.}
+ \item{midp}{logical, should mid-p-values be used in instead of ordinary p-values when adjusting for multiple testing?}
+ \item{sort}{character, whether to sort output table by directional p-value (\code{"directional"}), non-directional p-value (\code{"mixed"}), or not at all (\code{"none"}).}
+ \item{\dots}{other arguments are currently ignored.}
}
\value{
diff --git a/man/scaleOffset.Rd b/man/scaleOffset.Rd
new file mode 100644
index 0000000..2b6d339
--- /dev/null
+++ b/man/scaleOffset.Rd
@@ -0,0 +1,35 @@
+\name{scaleOffset}
+\alias{scaleOffset}
+\alias{scaleOffset.DGEList}
+\alias{scaleOffset.default}
+
+\title{Scale offsets}
+
+\description{Ensures scale of offsets are consistent with library sizes.}
+
+\usage{
+\method{scaleOffset}{DGEList}(y, offset, \dots)
+\method{scaleOffset}{default}(y, offset, \dots)
+}
+\arguments{
+\item{y}{numeric vector or matrix of counts, or a \code{DGEList} object.}
+\item{offset}{numeric vector or matrix of offsets to be scaled.}
+\item{\dots}{other arguments that are not currently used.}
+}
+
+\value{numeric vector or matrix of scaled offsets.}
+
+\details{
+\code{scaleOffset} ensures that the scale of offsets are consistent with library sizes.
+This is done by ensuring that the mean offset for each gene is the same as the mean log-library size.
+The length or dimensions of \code{offset} should be consistent with the number of libraries in \code{y}.
+}
+
+\author{Aaron Lun, Yunshun Chen}
+
+\examples{
+y <- matrix(rnbinom(40,size=1,mu=100),10,4)
+offset <- rnorm(4)
+scaleOffset(y, offset)
+}
+
diff --git a/src/R_calculate_cpm.cpp b/src/R_calculate_cpm.cpp
index 8b5c22e..7d95f4e 100644
--- a/src/R_calculate_cpm.cpp
+++ b/src/R_calculate_cpm.cpp
@@ -67,7 +67,8 @@ SEXP R_calculate_cpm_raw (SEXP y, SEXP libsize) try {
counts.fill_and_next(count_ptr);
for (lib=0; lib<num_libs; ++lib) {
- outptr[lib*num_tags]=count_ptr[lib]/(lptr2[lib]/one_million);
+ const double& curlib=lptr2[lib];
+ outptr[lib*num_tags]=(curlib==0 ? R_NaN : count_ptr[lib]/(curlib/one_million));
}
++outptr;
allL.advance();
diff --git a/src/add_prior.cpp b/src/add_prior.cpp
index 3faa1b0..d986061 100644
--- a/src/add_prior.cpp
+++ b/src/add_prior.cpp
@@ -12,8 +12,6 @@ void add_prior::fill_and_next() {
if (same_across_rows() && tagdex!=0) {
// Skipping if all rows are the same, and we've already filled it in once.
return;
- } else if (tagdex>=num_tags) {
- throw std::runtime_error("number of increments exceeds available number of tags");
}
ave_lib=0;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/r-bioc-edger.git
More information about the debian-med-commit
mailing list