Commit 642f98b9 authored by smorabit's avatar smorabit
Browse files

bug fix in SelectNetworkGenes

parent 011ab0b5
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -29,7 +29,12 @@ SelectNetworkGenes <- function(
    # binarize counts matrix in chunks to save memory
    expr_mat <- GetAssayData(seurat_obj, slot='counts')
    n_chunks <- ceiling(ncol(expr_mat) / 10000)

    if(n_chunks == 1){
      chunks <- factor(rep(1), levels=1)
    } else{
      chunks <- cut(1:nrow(expr_mat), n_chunks)
    }
    expr_mat <- do.call(rbind, lapply(levels(chunks), function(x){
      cur <- expr_mat[chunks == x,]
      cur[cur > 0] <- 1