Skip to content

Commit

Permalink
Don't filter cells with zeros, filter metacells with zeros
Browse files Browse the repository at this point in the history
  • Loading branch information
rfriedman22 committed Jul 23, 2024
1 parent 19ac412 commit 0c06ed1
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions R/deg.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,6 @@ pseudobulk_ccs_for_states <- function(ccs,
}
else {
sub_cds = ccs@cds[gene_group_df$id,]

sub_cds = sub_cds[, Matrix::colSums(counts(sub_cds)) > 0]
cell_group_df = cell_group_df %>%
filter(rowname %in% colnames(sub_cds))
agg_coldata = agg_coldata %>%
filter(pseudobulk_id %in% cell_group_df$pseudobulk_id)

agg_expr_mat = monocle3::aggregate_gene_expression(
sub_cds,
cell_group_df = cell_group_df,
Expand All @@ -85,6 +78,10 @@ pseudobulk_ccs_for_states <- function(ccs,
gene_agg_fun = gene_agg_fun
)

agg_expr_mat = agg_expr_mat[,Matrix::colSums(agg_expr_mat) > 0]
agg_coldata = agg_coldata %>%
filter(pseudobulk_id %in% colnames(agg_expr_mat))

agg_rowdata = agg_rowdata[row.names(agg_expr_mat),]
}

Expand Down

0 comments on commit 0c06ed1

Please sign in to comment.