Dear all,
I'm new to ggbio and can't seem to find an solution. I have a GRanges object gr containing ChIP-seq data (on all chromosomes, imported with rtracklayer0, and want to plot just a detail on one chromosome, using
autoplot(gr, geom="line", aes(y=score), zoom.region=GRanges(seqnames="chrI", IRanges(10000, 11000)))
i.e. gr is the GRanges object, and I want to see the peaks on chrI, from 10 to 11 kb.
Instead the plotter takes ages and produces peaks for *all* the chromosomes (and which appear to be wrong anyway). Using xlim=, or which= (instead of zoom.region) doesn't solve it.
If I do it as follows:
gr2 <- gr[seqnames(gr)=="chrI" & start(gr)> 10000 & end(gr)<11000]
autoplot(gr2, geom="line", aes(y=score))
it works, but that defeats the whole purpose of xlim (or the similar other arguments)
What am I doing wrong? Cheers,
Philip
I guess I picked up the zoom.region, which and xlim arguments from other examples. In this context I find ggbio's lack of warnings about unused arguments a bit inconvenient.
> Why wouldn't you just modify your GRanges,
Because I would have thought that an xlim-like argument would (and should?) just work for a plot function, and not take ages and give (imho) wrong output. It also avoids inelegantly copying things all over the place.
Cheers,
Philip