Entering edit mode
9.1 years ago
Hi all,
I would like to order the groups in an AnnotationTrack. However, I cannot find a function to do this. In the code below I would like to position 'Group1' on the top, followed by 'GroupWithLongName' and afterwards 'AnotherGroup'.
Thank you in advance!
library(Gviz)
library(GenomicRanges)
# Creating example data
st <- c(0, 550, 0, 350, 550, 0, 550)
ed <- c(500, 800, 300, 500, 800, 500, 800)
str <- c("+", "+", "+", "-", "+", "+", "+")
gr <- c("Group1","Group1","AnotherGroup", "AnotherGroup", "AnotherGroup", "GroupWithLongName", "GroupWithLongName")
aTrack.groups <- AnnotationTrack(start=st, end=ed, strand=str, chromosome= 1,
genome="someGenome", feature="test", group=gr,
id=paste("annTrack item", 1:7),
name="Another annotation track",
stacking="squish")
ax <- GenomeAxisTrack()
# plotting
res <- plotTracks(list(ax, aTrack.groups), groupAnnotation = "group", cex.group = 1.2)
Thanks! That is exactly what I was looking for!