Skip to content

Commit bd88e73

Browse files
authored
Merge pull request #145 from stemangiola/fix-sample-swap
Fix sample swap
2 parents 5a0e2ba + 7f459a1 commit bd88e73

18 files changed

+889
-825
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Meta
1010
doc
1111
dev
1212
tidy_heatmap.Rcheck*
13-
1413
/doc/
1514
/Meta/
15+
sccomp_draws_files
16+
.DS_Store

R/utilities.R

+15-16
Original file line numberDiff line numberDiff line change
@@ -662,23 +662,22 @@ get_top_left_annotation = function(.data_, .column, .row, .abundance, annotation
662662
left_join(x_y_annot_cols, by = "col_name") %>%
663663
mutate(col_orientation = map_chr(orientation, ~ .x %>% when((.) == "column" ~ quo_name(.column), (.) == "row" ~ quo_name(.row))))
664664

665+
666+
return_factor_ordering_by_col_or_row_names <- function(.data, col, orient) {
667+
.data %>%
668+
ungroup() %>%
669+
select(all_of(c(orient, col))) %>%
670+
distinct() %>%
671+
arrange(!!as.symbol(orient)) %>%
672+
select(all_of(col)) %>%
673+
pull(1)
674+
}
675+
665676

666-
df = df %>%
667-
668-
# Add data
669-
mutate(
670-
data = map2(
671-
col_name,
672-
col_orientation,
673-
~ .data_ %>%
674-
ungroup() %>%
675-
select(all_of(c(.y, .x))) %>%
676-
distinct() %>%
677-
arrange(all_of((.y))) %>%
678-
select(all_of(.x)) |>
679-
pull(1)
680-
)
681-
)
677+
# Add data
678+
df =
679+
df %>%
680+
mutate( data = map2(col_name, col_orientation, ~ return_factor_ordering_by_col_or_row_names(!!.data_, .x, .y) ) )
682681

683682
df = df %>%
684683

inst/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

man/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

paper/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

tests/testthat/_snaps/tests/annotated-heatmap-1.svg

+12-12
Loading

tests/testthat/_snaps/tests/annotated-heatmap-2.svg

+25-25
Loading

tests/testthat/_snaps/tests/grouped-annotated-heatmap-1.svg

+12-12
Loading

0 commit comments

Comments
 (0)