Open teunbrand opened 4 years ago
I'm now having a decent vctrs
-based (vctr_rcrd
) S3 equivalent of the GRanges
class, but I am having trouble marching these through the internals of ggplot. The intention is to let this be a hidden class that doesn't need to face the user but is used as a representation of genomic ranges internally.
Particularly, I can't seem to get past certain unlist operations in scale_apply()
. See related SO question: https://stackoverflow.com/questions/59401011/unlist-behaviour-on-vctr-rcrd-class-objects
I'm now leaning towards making a general vctrs
-compatible scale and coordinate system as a seperate package, which I could then extend in ggnomics.
I found out that we can have GRanges
objects as columns with some workarounds, so I'll probably make a coordinate system based on the original S4 class.
Update: the genomic position scale appears to be working in theory.
Caveat: I can't get any expression other than the plain column name to work. I'd need the compute aesthetics parts of ggplot to change and allow S4 classes in order to achieve this properly.
Basically to have a GRanges object (chromsome:start-end parametrisation) as the position on the x- or y-axis and have a coord_* function reflect this.
The struggle at the moment is to have a vector-like implementation of GRanges as a single column in a base R data.frame. See my related SO question: https://stackoverflow.com/questions/59370461/granges-as-column-in-basedata-frame