Skip to content

Commit

Permalink
Merge branch 'release/v0.0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
drisso committed Jun 8, 2016
2 parents e098dfc + 4ed4773 commit a734661
Show file tree
Hide file tree
Showing 14 changed files with 426 additions and 414 deletions.
12 changes: 6 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
Package: scone
Version: 0.0.3
Version: 0.0.4
Title: Single Cell Overview of Normalized Expression data
Description: scone is a package to compare and rank the performance of different normalization schemes in real single-cell RNA-seq datasets.
Authors@R: c(person("Michael", "Cole", email = "mbeloc@gmail.com",
role = c("aut", "cre", "cph")),
person("Davide", "Risso", email = "risso.davide@gmail.com",
role = c("aut")))
Author: Michael Cole [aut, cre, cph] and Davide Risso [aut]
Author: Michael Cole [aut, cre, cph], Davide Risso [aut]
Maintainer: Michael Cole <mbeloc@gmail.com>
Date: 2016-02-14
Date: 2016-05-12
License: Artistic-2.0
Depends:
R (>= 3.1)
R (>= 3.3)
Imports:
BiocParallel,
clusterCells,
cluster,
DESeq,
EDASeq,
MASS,
Expand All @@ -28,7 +28,7 @@ Imports:
limma,
matrixStats,
mixtools,
scde
grDevices
Suggests:
knitr,
rmarkdown,
Expand Down
6 changes: 4 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

export(DESEQ_FN)
export(DESEQ_FN_POS)
export(FQT_FN)
export(FQ_FN)
export(FQ_FN_POS)
export(TMM_FN)
Expand All @@ -26,12 +27,13 @@ importFrom(MASS,glm.nb)
importFrom(RUVSeq,RUVg)
importFrom(aroma.light,normalizeQuantileRank.matrix)
importFrom(class,knn)
importFrom(clusterCells,subsampleClustering)
importFrom(cluster,silhouette)
importFrom(diptest,dip.test)
importFrom(edgeR,calcNormFactors)
importFrom(fpc,pamk)
importFrom(grDevices,colorRampPalette)
importFrom(limma,lmFit)
importFrom(matrixStats,colIQRs)
importFrom(matrixStats,colMedians)
importFrom(matrixStats,rowMedians)
importFrom(mixtools,normalmixEM)
importFrom(scde,bwpca)
20 changes: 14 additions & 6 deletions R/SCONE_DEFAULTS.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ uq_f <- function(which="upper", round = FALSE){
# exprs(x) <- UQ_FN(exprs(x))
# return(x)
# })
#
#
# setMethod(f="UQ_FN",
# signature="matrix",
# definition= function(ei){
Expand Down Expand Up @@ -52,15 +52,23 @@ FQ_FN = function(ei){
return(eo)
}

#' @rdname FQ_FN
#' @details FQT_FN handles ties carefully (see \code{\link[limma]{normalizeQuantiles}}).
#' @export
FQT_FN = function(ei){
eo = normalizeQuantileRank.matrix(ei, ties = TRUE)
return(eo)
}

#' Full-Quantile normalization applied to positive data.
#' @export
#' @param ei = Numerical matrix. (rows = genes, cols = samples). Unique row.names are required.
#' @return FQ (positive) normalized matrix.
FQ_FN_POS = function(ei){

# Vector of integers used for computation
base_rank = 1:nrow(ei)

# Quantile Index Matrix: Values between 0 and 1 corresponding to quantile
quant_mat = NULL
# Re-ordered Data Matrix
Expand All @@ -75,7 +83,7 @@ FQ_FN_POS = function(ei){
quant[quant > 1] = NA
quant_mat = cbind(quant_mat,quant)
}

# Vector form of quantile index matrix
quant_out = as.numeric(as.vector(quant_mat))
# Interpolation Matrix (Values of all quantiles)
Expand All @@ -95,7 +103,7 @@ FQ_FN_POS = function(ei){

# Average over the interpolated values from all samples
inter_mean = inter_mat/ob_counts

## Substituting Mean Interpolated Values for Expression Values and Return
eo = matrix(inter_mean,ncol = dim(ei)[2])
eo[is.na(eo)] = 0
Expand Down Expand Up @@ -136,7 +144,7 @@ DESEQ_FN_POS = function(ei){
}
if(!any(geom_mean > 0)){
stop("Geometric mean non-positive for all genes.")
}
}
ratios = ei / geom_mean # Divide each Expression Value by Geometric Mean of Corresponding Gene
if(any(is.infinite(geom_mean))){
stop("Infinite mean! This should never happen :-<")
Expand Down
2 changes: 2 additions & 0 deletions R/biplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,6 @@ biplot_colored <- function(x, y, choices=1:2, expand=1, ...) {

text(yy/ratio, labels=labs, col=2)
arrows(0, 0, yy[, 1] * 0.8/ratio, yy[, 2] * 0.8/ratio, col = 2, length = 0.1)

invisible(xx)
}
Loading

0 comments on commit a734661

Please sign in to comment.