Skip to content

Commit 2822d51

Browse files
committed
Stop if reference lables use / as its used as sep in annotations
1 parent 9002bd8 commit 2822d51

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

R/annotate_registered_clusters.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ annotate_registered_clusters <-
5858
annotate_registered_cluster,
5959
cutoff_merge_ratio = cutoff_merge_ratio
6060
)
61+
62+
if(any(grepl("/", colnames(cor_stats_layer)))) {
63+
stop(
64+
"Cannot use refrence lables containing '/' - check colnames(cor_stats_layer)",
65+
call. = FALSE
66+
)
67+
}
6168

6269
confidence <- apply(cor_stats_layer, 1, max) > confidence_threshold
6370

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## Obtain the necessary data
2+
if (!exists("modeling_results")) {
3+
modeling_results <- fetch_data(type = "modeling_results")
4+
}
5+
6+
## query spatialDLPFC modeling results
7+
query_modeling_results <- fetch_data(
8+
type = "spatialDLPFC_Visium_modeling_results"
9+
)
10+
11+
## Compute the correlations
12+
cor_stats_layer <- layer_stat_cor(
13+
stats = query_modeling_results$enrichment,
14+
modeling_results,
15+
model_type = "enrichment"
16+
)
17+
18+
## Obtain labels
19+
annotate_registered_clusters(cor_stats_layer)
20+
21+
22+
test_that("Stop with slash", {
23+
colnames(cor_stats_layer) <- gsub("ayer", "/", colnames(cor_stats_layer))
24+
expect_error(annotate_registered_clusters(cor_stats_layer))
25+
})

0 commit comments

Comments
 (0)