Browse code

get rid of infinite loop

Zuguang Gu authored on 13/12/2018 13:08:13
Showing3 changed files

... ...
@@ -3334,9 +3334,7 @@ anno_zoom = function(align_to, panel_fun = function(index, nm = NULL) { grid.rec
3334 3334
 				}
3335 3335
 			}
3336 3336
 		}
3337
- 
3338 3337
 		popViewport()
3339
-		
3340 3338
 	}
3341 3339
 
3342 3340
 	column_fun = function(index) {
... ...
@@ -920,6 +920,8 @@ smartAlign2 = function(start, end, range, range_fixed = TRUE) {
920 920
         ncluster = length(unique(cluster))
921 921
         
922 922
         if(ncluster.before == ncluster && i_try > 0) break
923
+
924
+        if(i_try > 100) break
923 925
         
924 926
         # tile intervals in each cluster and re-assign x1 and x2
925 927
         new_x1 = numeric(length(x1))
... ...
@@ -466,8 +466,9 @@ anno2 = anno_zoom(align_to = subgroup, which = "row", panel_fun = panel_fun2,
466 466
 	gap = unit(1, "cm"), width = unit(3, "cm"), side = "left")
467 467
 
468 468
 # in infinite loop
469
-Heatmap(m, right_annotation = rowAnnotation(subgroup = subgroup, foo = anno), 
470
-	left_annotation = rowAnnotation(bar = anno2, subgroup = subgroup),
469
+Heatmap(m, right_annotation = rowAnnotation(subgroup = subgroup, foo = anno,
470
+	show_annotation_name = FALSE), 
471
+	left_annotation = rowAnnotation(bar = anno2, subgroup = subgroup, show_annotation_name = FALSE),
471 472
 	show_row_dend = FALSE,
472 473
 	row_split = subgroup)
473 474