Skip to content

Commit

Permalink
Don't sum, average percentages
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamin-james committed Jan 30, 2025
1 parent 2838da3 commit 6890f85
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions R/deg.R
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,8 @@ deg.prepare <- function(se, pathology, case, control, sample.col, filter_only_ca
SummarizedExperiment::rowData(se) = cbind(SummarizedExperiment::rowData(se), as.data.frame(logCPM))
### Get % expressing info
if ("Percent" %in% names(SummarizedExperiment::assays(pb))) {
Percent <- SummarizedExperiment::assays(pb)$Percent %*% make_pseudobulk(SummarizedExperiment::colData(pb)[[pathology]])
Percent <- SummarizedExperiment::assays(pb)$Percent %*% make_average(SummarizedExperiment::colData(pb)[[pathology]])
pf <- as.data.frame(as.matrix(Percent))
colnames(pf) <- paste0("Percent_", colnames(pf))
for (cn in names(pf)) {
SummarizedExperiment::rowData(se)[[paste0("Percent", cn)]] <- pf[[cn]]
}
Expand Down

0 comments on commit 6890f85

Please sign in to comment.