Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/bigomics/playbase
Browse files Browse the repository at this point in the history
  • Loading branch information
ivokwee committed Nov 1, 2024
2 parents c0026ff + 6ff9ad6 commit b66eb2c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: playbase
Type: Package
Title: Core back-end functionality and logic for OmicsPlayground
Version: 0.1.55
Version: 0.1.57
Author: BigOmics Analytics SA
Maintainer: The package maintainer <[email protected]>
Description: More about what it does (maybe more than one line)
Expand Down
2 changes: 1 addition & 1 deletion R/gset-meta.r
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ gset.fitContrastsWithAllMethods <- function(gmt,
if (nmissing > 0) {
message("Found ", nmissing, " missing values in X. Removing prior to GSVA::ssgsea.")
}
zx.ssgsea <- try(GSVA::gsva(as.matrix(X[complete.cases(X), ]),
zx.ssgsea <- try(GSVA::gsva(as.matrix(X[complete.cases(X), , drop = FALSE]),
gmt[],
method = "ssgsea",
parallel.sz = mc.cores,
Expand Down
32 changes: 17 additions & 15 deletions R/pgx-compute.R
Original file line number Diff line number Diff line change
Expand Up @@ -904,22 +904,24 @@ pgx.add_GMT <- function(pgx, custom.geneset = NULL, max.genesets = 20000) {
# get the length of go.genesets and add to gmt info
go.size <- sapply(go.genesets, length)

# convert to sparse matrix
go.gmt <- playbase::createSparseGenesetMatrix(
gmt.all = go.genesets,
min.geneset.size = 15,
max.geneset.size = 400,
all_genes = full_feature_list,
min_gene_frequency = 1,
annot = pgx$genes,
filter_genes = FALSE
)
if (length(go.size) > 0) { # if no go genesets pass the min/max filter playbase function crashes
# convert to sparse matrix
go.gmt <- playbase::createSparseGenesetMatrix(
gmt.all = go.genesets,
min.geneset.size = 15,
max.geneset.size = 400,
all_genes = full_feature_list,
min_gene_frequency = 1,
annot = pgx$genes,
filter_genes = FALSE
)

# merge go.gmt with G
G <- playbase::merge_sparse_matrix(
m1 = G,
m2 = Matrix::t(go.gmt)
)
# merge go.gmt with G
G <- playbase::merge_sparse_matrix(
m1 = G,
m2 = Matrix::t(go.gmt)
)
}
}

# NEW: convert G feature/symbol/human_ortholog to SYMBOL
Expand Down
2 changes: 1 addition & 1 deletion R/pgx-wgcna.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pgx.wgcna <- function(
nmissing <- sum(is.na(X))
if (nmissing > 0) {
message("Found ", nmissing, " missing values in X. Removing prior to WGCNA.")
X <- X[complete.cases(X), ]
X <- X[complete.cases(X), , drop = FALSE]
}
sdx <- matrixStats::rowSds(X, na.rm = TRUE)
X <- X[sdx > 0.1 * mean(sdx, na.rm = TRUE), ] ## filter low SD
Expand Down

0 comments on commit b66eb2c

Please sign in to comment.