I build my model for plotting this way:
gr99 <- GRanges(seqnames = set$CHROM,IRanges(start=set$POS,end=set$POS)) atrack = AnnotationTrack(gr99, name = "credible set", id = set$X.SNPID,stacking ="dense") displayPars(atrack) = list(fontcolor.group="#80808000",col=NULL,fill="black",showFeatureId=T,cex=0.8,fontcolor.item="red") genome(atrack)="hg19" plotTracks(list(atrack), from =from[i], to =to[i],showId=T)
The above code works perfectly and plots everything I need, but once I have only one object in GRanges, it shows me an error:
gr99 <- GRanges(seqnames = set$CHROM[1],IRanges(start=set$POS[1],end=set$POS[1])) atrack = AnnotationTrack(gr99, name = "credible set", id = set$X.SNPID[1],stacking ="dense") displayPars(atrack) = list(fontcolor.group="#80808000",col=NULL,fill="black",showFeatureId=T,cex=0.8,fontcolor.item="red") genome(atrack)="hg19" plotTracks(list(atrack), from =from[i], to =to[i],showId=T) Error in valid.viewport(x, y, width, height, just, gp, clip, xscale, yscale, : invalid 'xscale' in viewport
How can I plot the id if I have only one line (object/record) in GRanges?
EDIT:
> set
CHROM POS X.SNPID indexSNP GENE
1 chr1 114377568 rs2476601 rs2476601 PTPN22
2 chr1 114303808 rs6679677 rs2476601 --
I have edited my question by adding the first two lines of the set. Please note, I get an error only when I want to plot only the first element of a "set" object.