R/utils.R

Defines functions subset_gp recycle_gp

 
stop_wrap = ComplexHeatmap:::stop_wrap
warning_wrap = ComplexHeatmap:::warning_wrap
message_wrap = ComplexHeatmap:::message_wrap


recycle_gp = function(gp, n = 1) {
	g = lapply(gp, function(x) {
		if(length(x) == 1 && n > 1) {
			rep(x, n)
		} else {
			x
		}
	})
	class(g) = "gpar"
	return(g)
}

subset_gp = function(gp, i = 1) {
	g = lapply(gp, function(x) {
		x[i]
	})
	class(g) = "gpar"
	return(g)
}
jokergoo/EnrichedHeatmap documentation built on Feb. 27, 2024, 6:43 p.m.