Hi,
I am using gviz to plot bed format file.
I have a pair of bed files, with equal lines in them and each line is the same name. e.g.
file1.bed
chr4 190954356 190968056 group-1 0 + ... (the rest of the fields omitted here) chr4 190962609 191009216 group-2 0 + ...
file2.bed
chr14 106359834 106376979 group-1 0 + ... chr14 106360687 106378941 group-2 0 +...
For each line, I am converting to AnnotationTrack, and use the pushViewport library to put two plots side by side (one for chr4, one for chr14 in this case).
grid.newpage()
pushViewport(viewport(layout = grid.layout(1,2)))
pushViewport(viewport(layout.pos.col = 1, layout.pos.row = 1))
plotTracks(tracksA, chromosome=chromA, add=TRUE, stacking="full", groupAnnotation = "group")
popViewport(1)
pushViewport(viewport(layout.pos.col = 2, layout.pos.row = 1))
plotTracks(tracksB, chromosome=chromB, add=TRUE, stacking="full", groupAnnotation = "group")
popViewport(1)
However, the order of the groups (group-1, group-2, etc) were random based on the space availability (default is to "squish").
If I would like is to keep the order of the groups "as-is" (as they appear in the bed file), is there any way that I can tweak the plot?
Sorry I am new to R and Gviz library, and my questions might have been addressed somewhere else.
Thanks,
Shuoguo