Hi!
I'm trying to learn the circlize package and I get weird sorting. Can anyone please tell me why the most expressed and the least expressed gene is ending up where they are (see marking) and not following the gradient?
Data looks like this:
From highest:
...
To lowest:
This is the command I run:
# Create color gradient
col_fun <- colorRamp2(c(-1,0, 1), c("blue", "white", "red"))
# Generate plot on pdf
cairo_pdf("results/plot1_test.pdf", width = 16, height = 9)
# Create gap, start.degree = where to put gap, gap.after = how wide gap should be
circos.par(start.degree = 70, gap.after = 20)
# Create outer track
circos.heatmap(plot1_outer, col = col_fun, rownames.side = "outside", track.height = 0.15)
# Add labels outer track
circos.track(track.index = get.current.track.index(), panel.fun = function(x, y) {
if(CELL_META$sector.numeric.index == 1) { # the last sector
cn = "DEG_LogFC"
n = length(cn)
circos.text(x = rep(CELL_META$cell.xlim[2], n) + convert_x(0.5, "mm"),
y = 1:n - 0.5, labels = cn,
cex = 0.5, adj = c(0, 0.5), facing = "inside")
}
}, bg.border = NA)
# Finnish plot on pdf
dev.off()
I have tried with both cluster = TRUE
and cluster = FALSE
, also tried sorting the genes before creating the plot but no difference.
Thanks in advance!
/ Jonas
Do you have a reproducible example to share ?
I'm still a newbie sharing examples so please bare with me:), this should do the same that I've done:
Expression data:
)
}, bg.border = NA)