Search
Question: GVIZ shows error if plotting only one id
0
3.7 years ago by
tonja.r40
United Kingdom
tonja.r40 wrote:

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     --

modified 3.5 years ago by dbrawand0 • written 3.7 years ago by tonja.r40
1
3.7 years ago by
Robert Ivanek530
Switzerland
Robert Ivanek530 wrote:

Thanks for pointing out this issue. I submitted a fix to the devel version which should be available in next few days (version 1.11.16)

0
3.7 years ago by
Robert Ivanek530
Switzerland
Robert Ivanek530 wrote:

Dear Tonja,

creating an AnnotationTrack from Granges with only one range and plotting it should work straight away. Would you mind to share also first few lines from the "set" object, from which you built the GRanges/AnnotationTrack? It would us to reproduce the issue.

Thanks

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.

0
3.5 years ago by
dbrawand0
dbrawand0 wrote:

I experience exactly the same thing with alike input data. If I do not plot the id it works fine. It also works if there is more than 1 feature to plot.

1

Hm, not sure why that fix never made it through. Just committed another one. Will be available in Gviz version 1.12.1