forked from satijalab/seurat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
swap MetaDE for metap, remove NMF dependency
- Loading branch information
1 parent
2385378
commit f4da9c6
Showing
8 changed files
with
56 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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( | ||
|
@@ -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) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.