Browse code

order in 'align_to' is adjusted

Zuguang Gu authored on 08/06/2020 13:26:45
Showing2 changed files

... ...
@@ -8,6 +8,7 @@ CHANGES in VERSION 2.5.3
8 8
 * `discrete_legend_body()`: adjust ncol and nrow if there are empty rows and columns in the layout.
9 9
 * `anno_image()`: fixed a bug that images are not reordered.
10 10
 * `anno_mark()`: now expression is correctly supported.
11
+* `anno_zoom()`: order of index in `panel_fun` is adjusted to the order in the heatmap
11 12
 
12 13
 ========================
13 14
 
... ...
@@ -3375,6 +3375,9 @@ anno_zoom = function(align_to, panel_fun = function(index, nm = NULL) { grid.rec
3375 3375
 			}
3376 3376
 		}
3377 3377
 
3378
+		## adjust index order 
3379
+		align_to = lapply(align_to, function(x) intersect(index, x))
3380
+
3378 3381
 		nrl = sapply(align_to, length)
3379 3382
 		align_to_df = lapply(align_to, function(x) {
3380 3383
 			ind = which(index %in% x)
... ...
@@ -3552,6 +3555,9 @@ anno_zoom = function(align_to, panel_fun = function(index, nm = NULL) { grid.rec
3552 3555
 				align_to = align_to[lnm]
3553 3556
 			}
3554 3557
 		}
3558
+
3559
+		align_to = lapply(align_to, function(x) intersect(index, x))
3560
+
3555 3561
 		nrl = sapply(align_to, length)
3556 3562
 		align_to_df = lapply(align_to, function(x) {
3557 3563
 			ind = which(index %in% x)