Skip to content

Commit

Permalink
Added an to remove genes with 0 expression across all cells from the …
Browse files Browse the repository at this point in the history
…GEX input
  • Loading branch information
dosorio committed May 22, 2024
1 parent 26d6053 commit 88a701a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Package: SCORPION
Type: Package
Title: Single Cell Oriented Reconstruction of PANDA Individual Optimized Networks
Version: 1.0.1
Version: 1.0.2
Authors@R: c(person("Daniel","Osorio", email = "[email protected]", role = c("aut","cre"), comment = c(ORCID = "0000-0003-4424-8422")),
person("Marieke L.","Kuijjer", email = "[email protected]", role = c("aut"), comment = c(ORCID = "0000-0001-6280-3130")))
Description: Constructs gene regulatory networks from single-cell gene expression data using the PANDA (Passing Attributes between Networks for Data Assimilation) algorithm.
License: GPL-3
Encoding: UTF-8
LazyData: true
Imports: cli, methods, irlba, igraph, RANN, Matrix, pbapply, RhpcBLASctl
RoxygenNote: 7.1.2
RoxygenNote: 7.2.3
3 changes: 2 additions & 1 deletion R/makeSuperCells.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ makeSuperCells <- function(X,
colnames(X) <- paste("cell", 1:N.c, sep = "_")
}

X <- X[rowSums(X) > 0,]
keep.genes <- setdiff(rownames(X), genes.exclude)
X <- X[keep.genes, ]

Expand Down Expand Up @@ -254,7 +255,7 @@ makeSuperCells <- function(X,
stop("weights must be the same length as groups or NULL in case of unweighted averaging")
}
M.AV <- Matrix::sparseMatrix(i = i, j = j, x = weights[i])
GE <- X %*% M.AV
GE <- GE %*% M.AV

weighted_supercell_size <-
unlist(lapply(
Expand Down
10 changes: 7 additions & 3 deletions R/scorpion.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
#' @param zScaling Boolean to indicate use of Z-Scores in output. False will use [0,1] scale.
#' @param showProgress Boolean to indicate printing of output for algorithm progress.
#' @param randomizationMethod Method by which to randomize gene expression matrix. Default "None". Must be one of "None", "within.gene", "by.genes". "within.gene" randomization scrambles each row of the gene expression matrix, "by.gene" scrambles gene labels.
#' @param scaleByPresent Boolean to indicate scaling of correlations by percentage of positive samples
#' @param scaleByPresent Boolean to indicate scaling of correlations by percentage of positive samples.
#' @param filterExpr Boolean to indicate wheter or not to remove genes with 0 expression across all cells from the GEX input.
#' @return A list of matrices describing networks achieved by convergence with PANDA algorithm.
#' @examples
#' # Loading example data
Expand Down Expand Up @@ -102,11 +103,14 @@ scorpion <- function(tfMotifs = NULL,
zScaling = TRUE,
showProgress = TRUE,
randomizationMethod = 'None',
scaleByPresent = FALSE) {
scaleByPresent = FALSE,
filterExpr = FALSE) {

cli::cli_h1('SCORPION')

gexMatrix <- gexMatrix[rowSums(gexMatrix) > 0,]
if(isTRUE(filterExpr)){
gexMatrix <- gexMatrix[rowSums(gexMatrix) > 0,]
}
gexMatrix <- makeSuperCells(X = gexMatrix, gamma = gammaValue, n.pc = nPC, fast.pca = FALSE)

if(is.null(ppiNet) & is.null(tfMotifs)){
Expand Down
7 changes: 5 additions & 2 deletions man/scorpion.Rd

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

0 comments on commit 88a701a

Please sign in to comment.