Skip to content

Commit 3c44e1c

Browse files
committed
add code comms
1 parent 0db8f7f commit 3c44e1c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

R/plotSpillmat.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,31 @@ plotSpillmat <- function(x, sm = NULL, anno = TRUE,
5353

5454
# check validity of input spillover matrix
5555
sm <- .check_sm(sm, isotope_list)
56+
57+
# get barcode channels
5658
chs <- channels(x)
5759
bc_chs <- chs[rowData(x)$is_bc]
60+
61+
# make symmetric & subset
5862
bc_idx <- which(colnames(sm) %in% bc_chs)
5963
bc_rng <- seq(min(bc_idx), max(bc_idx))
6064
sm <- .make_symetric(sm)[bc_rng, bc_rng]
6165

66+
# get bin labels
6267
df <- melt(sm * 100)
6368
colnames(df) <- c("emitting", "receiving", "spill")
6469
df$spillover <- paste0(sprintf("%2.3f", df$spill), "%")
6570
max <- ceiling(max(100 * sm[row(sm) != col(sm)]) / 0.25) * 0.25
6671
total <- paste0(sprintf("%2.2f", colSums(sm) * 100 - 100), "%")
6772

73+
# get bin colors
6874
labs <- chs[bc_rng]
6975
ex <- !labs %in% chs[bc_idx]
7076
lab_cols <- rep("black", nrow(sm))
7177
lab_cols[ex] <- "grey"
7278
total[ex] <- NA
7379

80+
# plotting
7481
if (hm_pal[1] != "white")
7582
hm_pal <- c("white", hm_pal)
7683
p <- ggplot(df,

0 commit comments

Comments
 (0)