Entering edit mode
a.clark5
•
0
@aclark5-16086
Last seen 3.9 years ago
I am plotting an annotation track of Ensembl transcripts using the BiomartGeneRegionTrack class, and have set the stacking type to "squish" as below.
biomTrack <- BiomartGeneRegionTrack(genome = "hg19", name = "ENSEMBL\nGenes", cex.title=0.8, stacking = "squish",background.title= "white", col.title="black", filters=list(ensembl_transcript_id=c("ENST00000265395","ENST00000265393","ENST00000283928","ENST00000436758")))
tracks <- list(biomTrack)
sizes <- c(4)
plotTracks(tracks, from = 27500000,to=28400000,showTitle=T,protein_coding = "grey",sizes=sizes,length(tracks))
However, in the annotation I have two transcripts which are very close in proximity, and when plotted at the scale I am using, they appear to merge into one transcript. As they don't actually overlap, the squish setting does not seperate these into different stacks. I was wondering if it is possible to manually assign transcripts to stacks?
Did you try collapse=FALSE in the BiomartGeneRegionTrack constructor? Individual transcripts should never get collapsed, but just to make sure.
There is no real control over the stacking as this tries to optimize for the available space, but you can do some tricks. For instance, including a transcript label enforces some spacing:
plotTracks(tracks, from = 27500000,to=28400000,showTitle=T,protein_coding = "grey",sizes=sizes,length(tracks), collapse=TRUE, transcriptAnnotation="name")
If you set the colouring to white you will get empty spaces:
plotTracks(tracks, from = 27500000,to=28400000,showTitle=T,protein_coding = "grey",sizes=sizes,length(tracks), collapse=TRUE, transcriptAnnotation="name", fontcolor.group="white")
Thanks Florian, that worked nicely. Adding the names caused an overlap and shifted one transcript on to the second stack.