Skip to content

Commit

Permalink
Make compatible with GSVA >=1.36.0
Browse files Browse the repository at this point in the history
GSVA >= 1.36.0 does not support `parallel.type` any more.
Instead it automatically uses the backend registered by BiocParallel,
the argument is, therefore, not required any more.

GSVA 1.36.0 is shipped with the latest, R4.0.0 Bioconductor release.
grst committed May 5, 2020
1 parent 23d8f48 commit b8ce5e4
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions R/xCell.R
Original file line number Diff line number Diff line change
@@ -93,7 +93,9 @@ xCellAnalysis <- function(expr, signatures=NULL, genes=NULL, spill=NULL, rnaseq=
#' @param genes list of genes to use in the analysis.
#' @param file.name string for the file name for saving the scores. Default is NULL.
#' @param parallel.sz integer for the number of threads to use. Default is 4.
#' @param parallel.type Type of cluster architecture when using snow. 'SOCK' or 'FORK'. Fork is faster, but is not supported in windows.
#' @param parallel.type Type of cluster architecture when using snow. 'SOCK' or 'FORK'.
#' Fork is faster, but is not supported in windows.
#' This argument is ignored in GSVA versions >= 1.36.0. Register a `BiocParallel` backend instead.

#' @return the raw xCell scores
rawEnrichmentAnalysis <- function(expr, signatures, genes, file.name = NULL, parallel.sz = 4, parallel.type = 'SOCK') {
@@ -111,8 +113,16 @@ rawEnrichmentAnalysis <- function(expr, signatures, genes, file.name = NULL, par
expr <- apply(expr, 2, rank)

# Run ssGSEA analysis for the ranked gene expression dataset
scores <- GSVA::gsva(expr, signatures, method = "ssgsea",
ssgsea.norm = FALSE,parallel.sz = parallel.sz,parallel.type = parallel.type)
if(packageVersion("GSVA") >= "1.36.0") {
# GSVA >= 1.36.0 does not support `parallel.type` any more.
# Instead it automatically uses the backend registered by BiocParallel.
scores <- GSVA::gsva(expr, signatures, method = "ssgsea",
ssgsea.norm = FALSE,parallel.sz = parallel.sz)
} else {
scores <- GSVA::gsva(expr, signatures, method = "ssgsea",
ssgsea.norm = FALSE,parallel.sz = parallel.sz,parallel.type = parallel.type)
}


scores = scores - apply(scores,1,min)

0 comments on commit b8ce5e4

Please sign in to comment.