Skip to content

Commit

Permalink
swap MetaDE for metap, remove NMF dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewwbutler committed Feb 14, 2018
1 parent 2385378 commit f4da9c6
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 40 deletions.
11 changes: 5 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: Seurat
Version: 2.2.0
Date: 2018-01-10
Version: 2.2.1
Date: 2018-02-14
Title: Tools for Single Cell Genomics
Description: A toolkit for quality control, analysis, and exploration of single cell RNA sequencing data. 'Seurat' aims to enable users to identify and interpret sources of heterogeneity from single cell transcriptomic measurements, and to integrate diverse types of single cell data. See Satija R, Farrell J, Gennert D, et al (2015) <doi:10.1038/nbt.3192>, Macosko E, Basu A, Satija R, et al (2015) <doi:10.1016/j.cell.2015.05.002>, and Butler A and Satija R (2017) <doi:10.1101/164889> for more details.
Authors@R: c(
Expand Down Expand Up @@ -47,14 +47,14 @@ Imports:
Rcpp,
tclust,
ranger,
NMF,
dtw,
SDMTools,
plotly,
diffusionMap,
Hmisc,
tidyr,
ggridges
ggridges,
metap
LinkingTo: Rcpp, RcppEigen, RcppProgress
License: GPL-3 | file LICENSE
LazyData: true
Expand Down Expand Up @@ -95,5 +95,4 @@ Suggests:
testthat,
SummarizedExperiment,
MAST,
DESeq2,
MetaDE
DESeq2
7 changes: 6 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ import(fpc)
import(ggplot2)
import(gridExtra)
import(lars)
import(metap)
import(methods)
import(parallel)
import(pbapply)
Expand All @@ -277,7 +278,6 @@ importFrom(Matrix,colSums)
importFrom(Matrix,readMM)
importFrom(Matrix,rowSums)
importFrom(Matrix,sparseMatrix)
importFrom(NMF,aheatmap)
importFrom(RColorBrewer,brewer.pal.info)
importFrom(ROCR,performance)
importFrom(ROCR,prediction)
Expand Down Expand Up @@ -306,6 +306,7 @@ importFrom(dplyr,top_n)
importFrom(dplyr,ungroup)
importFrom(dtw,dtw)
importFrom(gdata,drop.levels)
importFrom(gdata,interleave)
importFrom(ggridges,geom_density_ridges)
importFrom(ggridges,theme_ridges)
importFrom(gplots,heatmap.2)
Expand All @@ -317,9 +318,11 @@ importFrom(graphics,abline)
importFrom(graphics,axis)
importFrom(graphics,contour)
importFrom(graphics,hist)
importFrom(graphics,lines)
importFrom(graphics,locator)
importFrom(graphics,mtext)
importFrom(graphics,par)
importFrom(graphics,plot)
importFrom(graphics,points)
importFrom(graphics,rect)
importFrom(graphics,smoothScatter)
Expand Down Expand Up @@ -348,6 +351,7 @@ importFrom(stats,coef)
importFrom(stats,complete.cases)
importFrom(stats,cor)
importFrom(stats,cov)
importFrom(stats,density)
importFrom(stats,dist)
importFrom(stats,dnorm)
importFrom(stats,glm)
Expand All @@ -366,6 +370,7 @@ importFrom(stats,poisson)
importFrom(stats,predict)
importFrom(stats,prop.test)
importFrom(stats,qqplot)
importFrom(stats,quantile)
importFrom(stats,qunif)
importFrom(stats,relevel)
importFrom(stats,reorder)
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
All notable changes to Seurat will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)

## [2.2.1] - 2018-02-14
### Changed
- MetaDE replaced with metap for combining p-values (MetaDE was removed from CRAN)
- NMF heatmaps replaced (NMF to be archived by CRAN)

## [2.2.0] - 2018-01-10
### Added
- Multiple alignment functionality with RunMultiCCA and AlignSubspace extended to multiple datasets
Expand Down
25 changes: 13 additions & 12 deletions R/differential_expression.R
Original file line number Diff line number Diff line change
Expand Up @@ -613,15 +613,16 @@ FindAllMarkersNode <- function(
#' use all other cells for comparison.
#' @param grouping.var grouping variable
#' @param assay.type Type of assay to fetch data for (default is RNA)
#' @param meta.method method for combining p-values. See MetaDE::MetaDE.pvalue
#' for details.
#' @param meta.method method for combining p-values. Should be a function from
#' the metap package (NOTE: pass the function, not a string)
#' @param \dots parameters to pass to FindMarkers
#'
#' @return Matrix containing a ranked list of putative conserved markers, and
#' associated statistics (p-values within each group and a combined p-value
#' (such as Fishers combined p-value or others from the MetaDE package),
#' percentage of cells expressing the marker, average differences)
#'
#' @import metap
#' @export
#'
#' @examples
Expand All @@ -632,19 +633,19 @@ FindAllMarkersNode <- function(
#' size = length(x = [email protected]),
#' replace = TRUE
#' )
#' FindConservedMarkers(pbmc_small, ident.1 = 1, ident.2 = 2, grouping.var = "groups")
#' FindConservedMarkers(pbmc_small, ident.1 = 0, ident.2 = 1, grouping.var = "groups")
#'
FindConservedMarkers <- function(
object,
ident.1,
ident.2 = NULL,
grouping.var,
assay.type = "RNA",
meta.method = "minP",
meta.method = minimump,
...
) {
if (!'MetaDE' %in% rownames(x = installed.packages())) {
stop("Please install MetaDE (note Bioconductor dependencies) - learn more at https://cran.r-project.org/web/packages/MetaDE/index.html")
if(class(meta.method) != "function") {
stop("meta.method should be a function from the metap package. Please see https://cran.r-project.org/web/packages/metap/metap.pdf for a detail description of the available functions.")
}
object.var <- FetchData(object = object, vars.all = grouping.var)
object <- SetIdent(
Expand Down Expand Up @@ -716,12 +717,12 @@ FindConservedMarkers <- function(
MARGIN = 1,
FUN = max
)
combined.pval <- MetaDE::MetaDE.pvalue(x = list(p = markers.combined[, pval.codes]),
meta.method = meta.method)$meta.analysis
combined.pval <- cbind(combined.pval$pval, combined.pval$FDR)
colnames(combined.pval) <- paste0(colnames(combined.pval), c(rep("_p_val", length(meta.method)), rep("_FDR", length(meta.method))))
markers.combined$combined_pval <- combined.pval
markers.combined <- markers.combined[order(markers.combined$combined_pval[,1]), ]
combined.pval <- data.frame(cp = apply(X = markers.combined[, pval.codes],
MARGIN = 1,
FUN = function(x) meta.method(x)$p))
colnames(combined.pval) <- paste0(as.character(formals()$meta.method), "_p_val")
markers.combined <- cbind(markers.combined, combined.pval)
markers.combined <- markers.combined[order(markers.combined[, paste0(as.character(formals()$meta.method), "_p_val")]), ]
return(markers.combined)
}

Expand Down
4 changes: 4 additions & 0 deletions R/plotting_utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -278,3 +278,7 @@ BlackAndWhite <- function(...) {
PurpleAndYellow <- function(...) {
return(CustomPalette(low = "magenta", high = "yellow", mid = "black", ...))
}

BlueAndRed <- function(...) {
return(CustomPalette(low = "#313695" , high = "#A50026", mid = "#FFFFBF", ...))
}
35 changes: 18 additions & 17 deletions R/spatial_internal.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ slimdmvnorm <- function (x, mean = rep(0, p), sigma = diag(p), log = FALSE) {
###############
#Internal, not documented for now
#
#' @importFrom NMF aheatmap
#' @importFrom utils write.table
#
CalcInsitu <- function(
Expand Down Expand Up @@ -129,13 +128,12 @@ CalcInsitu <- function(
)
}
if (do.plot) {
aheatmap(
x = insilico.stain,
Rowv = NA,
Colv = NA,
color = col.use,
main = title.use
)
heatmap2NoKey(x = insilico.stain,
Rowv = NA,
Colv = NA,
trace = "none",
col = col.use,
dimTitle = title.use)
}
if (do.return) {
return(as.vector(x = insilico.stain))
Expand Down Expand Up @@ -172,8 +170,6 @@ map.cell.score <- function(gene, gene.value, insitu.bin, mu, sigma, alpha) {

#Internal, not documented for now
#
#' @importFrom NMF aheatmap
#
MapCell <- function(
object,
cell.name,
Expand Down Expand Up @@ -246,14 +242,19 @@ MapCell <- function(
)
), ]
}
aheatmap(
x = matrix(data = total.prob, nrow=8, ncol=8),
Rowv = NA,
Colv = NA,
txt = txt.matrix,
color = BlackAndWhite()
heatmap2NoKey(x = matrix(data = total.prob, nrow=8, ncol=8),
Rowv = NA,
Colv = NA,
col = BlackAndWhite(),
trace = "none"
)
heatmap2NoKey(x = scale.probs,
Rowv = NA,
Colv = NA,
col = BlueAndRed(),
trace = "none",
symbreaks = FALSE
)
aheatmap(x = scale.probs, Rowv = NA, Colv = NA)
ResetPar()
}
return(total.prob)
Expand Down
1 change: 1 addition & 0 deletions R/zfRenderSeurat.R
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ zf.insitu.ventral <- function(seuratObject, gene, label=TRUE, ...) {
}

#' @export
#' @importFrom gdata interleave
zf.insitu.side <- function(expressionMatrix, nonmirror = TRUE, mirror = TRUE) {
# Determine geometry
tierBins <- 30 # 1 bin per cell tier.
Expand Down
8 changes: 4 additions & 4 deletions man/FindConservedMarkers.Rd

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

0 comments on commit f4da9c6

Please sign in to comment.