Skip to content

Commit

Permalink
Fix compute_partitions() in cluster_cells.R.
Browse files Browse the repository at this point in the history
  • Loading branch information
brgew committed Mar 21, 2024
1 parent f94efc3 commit 42fc8c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: monocle3
Title: Clustering, Differential Expression, and Trajectory Analysis for
Single-Cell RNA-Seq
Version: 1.4.13
Version: 1.4.14
Authors@R: c(
person(given = "Hannah",
family = "Pliner",
Expand Down
5 changes: 5 additions & 0 deletions R/cluster_cells.R
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,8 @@ compute_partitions <- function(g,
optim_res,
qval_thresh=0.05,
verbose = FALSE){
# The cells membership may have information about the
# clusters to which cells' nearest neighbors belong.
cell_membership <- as.factor(igraph::membership(optim_res))
membership_matrix <- Matrix::sparse.model.matrix( ~ cell_membership + 0)
num_links <- Matrix::t(membership_matrix) %*%
Expand All @@ -617,6 +619,9 @@ compute_partitions <- function(g,

num_links <- num_links_ij / total_edges

# Deal with zero total edges.
num_links[is.nan(num_links)] <- 0

cluster_mat <- matrix(stats::p.adjust(cluster_mat),
nrow=length(louvain_modules),
ncol=length(louvain_modules))
Expand Down

0 comments on commit 42fc8c4

Please sign in to comment.