Skip to content

Commit

Permalink
fix the issue
Browse files Browse the repository at this point in the history
  • Loading branch information
zktuong committed Feb 17, 2024
1 parent e755059 commit 3689d07
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 67 deletions.
10 changes: 7 additions & 3 deletions R/plot_cpdb_heatmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,21 @@ plot_cpdb_heatmap <- function(pvals, cell_types = NULL, degs_analysis = FALSE, l
cell_types <- sort(unique(unlist(strsplit(colnames(all_intr)[col_start:ncol(all_intr)],
paste0("\\", DEFAULT_CPDB_SEP)))))
}
cell_types_comb <- apply(expand.grid(cell_types, cell_types), 1, function(z) paste(z,
collapse = "|"))
cell_types_comb <- apply(expand.grid(cell_types, cell_types), 1, function(z) {
paste(z, collapse = "|")
})
cell_types_keep <- row.names(all_intr)[row.names(all_intr) %in% cell_types_comb]
empty_celltypes <- setdiff(cell_types_comb, cell_types_keep)
all_intr <- all_intr[row.names(all_intr) %in% cell_types_keep, ]
if (length(empty_celltypes) > 0) {
tmp_ <- matrix(0, nrow = length(empty_celltypes), ncol = ncol(all_intr))
colnames(tmp_) <- colnames(all_intr)
rownames(tmp_) <- empty_celltypes
if (!degs_analysis) {
tmp_ <- tmp_ + 1
}
tmp_ <- as.data.frame(tmp_)
all_intr <- rbind(all_intr, tmp_)
all_intr <- as.matrix(rbind(all_intr, tmp_))
}
all_count <- reshape2::melt(all_intr)
if (!degs_analysis) {
Expand Down
2 changes: 1 addition & 1 deletion man/kidneyimmune.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/plot_cpdb.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/plot_cpdb_heatmap.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3689d07

Please sign in to comment.