PhanstielLab / plotgardener

https://phanstiellab.github.io/plotgardener/
Other
302 stars 28 forks source link

Cannot specify location using plotHicTriangle #115

Closed Ziwei-Liu closed 6 months ago

Ziwei-Liu commented 7 months ago

My command works when not specifying x- or y- location: plotHicTriangle(data = "lvan.allValidPairs.hic", resolution = 10000, chrom = "LG14",chromstart = 9000000, chromend = 10000000)

But when I want to specify location and add annotation on it, it reports bug:

> plotHicTriangle(data = "lvan.allValidPairs.hic", resolution = 10000, chrom = "LG14",chromstart = 9000000, chromend = 10000000, x = 2, y = 0.5, width = 3, height = 1.5)
Error in if (!grepl("page", as.character(current.vpPath()))) { : 
  argument is of length zero

Same bug reported when using annoGenomeLabel and annoHeatmapLegend:

> annoGenomeLabel(plot = hicplot, scale = "Mb", x = 0.5, y = 2.03,just = c("left", "top"))
Error: argument "length" is missing, with no default.
> annoHeatmapLegend(plot = hicplot, x = 3.5, y = 0.5,width = 0.13, height = 1.2,just = c("right", "top"))
Error in if (!grepl("page", as.character(current.vpPath()))) { : 
  argument is of length zero

I wonder if i missed assembly option, but it didn't work with it too:

> plotHicTriangle(data = "lvan.allValidPairs.hic", resolution = 10000, chrom = "LG14",chromstart = 9000000, chromend = 10000000, assembly = my_assembly, x = 2, y = 0.5, width = 3, height = 1.5, just = "top", default.units = "inches")
Error in if (!grepl("page", as.character(current.vpPath()))) { : 
  argument is of length zero

By the way, my_assembly is my home made own assembly by makeTxDbFromGFF using my own gff file and my own made BSgenome using my own fasta and .2bit file. Though I think it is not responsible for the bug.

nekramer commented 7 months ago

Hi there!

Are these functions everything you have called? If so, this error is most likely popping up because you have not initialized a page with pageCreate. Even if you have created a page but restarted your R session, grid will no longer have access to the page structure and won't be able to find any plotgardener pages to actually place your plots on. I apologize that it came back with a confusing error message, and I'll work on catching this and showing a more direct message.

Please let me know if calling a new pageCreate before your code does not solve the issue, or if you continue to have the problem with other plotting functions!

Ziwei-Liu commented 6 months ago

Hi there!

Are these functions everything you have called? If so, this error is most likely popping up because you have not initialized a page with pageCreate. Even if you have created a page but restarted your R session, grid will no longer have access to the page structure and won't be able to find any plotgardener pages to actually place your plots on. I apologize that it came back with a confusing error message, and I'll work on catching this and showing a more direct message.

Please let me know if calling a new pageCreate before your code does not solve the issue, or if you continue to have the problem with other plotting functions!

Yes, pageCreate works. I can draw a regular picture now. Thank you!