GVIZ plotTracks plots dense features under each other
2
0
Entering edit mode
9.1 years ago
tonja.r ▴ 600

I am using gviz from a bioconductor to plot SNPs data using chromosome and genome axis:

My problem is that it plots dense located SNPs under each other and I could not find a parameter to avoid. I also could not find if it is possible to plot the name of the SNPs to the corresponding bar or mark one specific SNP with another color.

gr99 <- GRanges(seqnames = c("chr7","chr7","chr7","chr7","chr7","chr7"),
                IRanges(start=c(128580042,128580052,128575552,128576086,128579202,128579666),
                        end=c(128580042,128580052,128575552,128576086,128579202,128579666)))

atrack2=AnnotationTrack(gr99, name = "SNP")
gen = c()
gen[chr] =genome(atrack2)="hg19"
gtrack <- GenomeAxisTrack()
itrack <- IdeogramTrack(genome = gen, chromosome = "chr7")
plotTracks(list(itrack,gtrack, atrack2),panel.only == TRUE)
SNP • 3.7k views
ADD COMMENT
0
Entering edit mode

Not the best solution. Make two or more tracks and plot them together

a <- seq(1,length(gr99),2)
​plotTracks(list(itrack,gtrack, atrack2[a],atrack2[-a]))
ADD REPLY
1
Entering edit mode
9.0 years ago
tonja.r ▴ 600

AnnotationTrack has a stacking parameter:

atrack = AnnotationTrack(gr99, name = "CREDIBLE SET", id = set$X.SNPID,stacking ="dense")
ADD COMMENT
0
Entering edit mode
9.1 years ago
Jimbou ▴ 950

And here it is:

atrack1=AnnotationTrack(gr99, name = "SNP", id = paste0("rs",c(1:6))) # id == the SNP names
displayPars(atrack1) <- list(fontcolor.group="#80808000",col=NULL,fill="black",showId=T,showFeatureId=T,cex=1.2,fontcolor.item="red")
plotTracks(list(itrack,gtrack, atrack1))

You can play with the displayPars to get your picture of choice

displayPars(atrack1)
ADD COMMENT

Login before adding your answer.

Traffic: 2800 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6