GVIZ shows error if plotting only one id
3
0
Entering edit mode
tonja.r ▴ 80
@tonjar-7565
Last seen 8.1 years ago
United Kingdom

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

gviz • 2.4k views
ADD COMMENT
1
Entering edit mode
Robert Ivanek ▴ 750
@robert-ivanek-5892
Last seen 12 months ago
Switzerland

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)

ADD COMMENT
0
Entering edit mode
Robert Ivanek ▴ 750
@robert-ivanek-5892
Last seen 12 months ago
Switzerland

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

 

ADD COMMENT
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode
dbrawand • 0
@dbrawand-8214
Last seen 9.4 years ago

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.

ADD COMMENT
1
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 538 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