For any tabular data structure with "chr[om]" and one or more of starts, ends, widths, and strands, there _is_ an obvious mapping, though! And I personally always have an optional argument to keep the rest as mcols(). It just seems so straightforward.
The generic granges() method also suggests that people often want a way for something that is not itself a GRanges to at least emit one. granges(foo) is also a lot easier than with(foo, GRanges(fairly, Involved(), Constructor, ...) It would be nice if everything were a bed, wig, BAM or similar. Then rtracklayer would be all anyone needs. But, sometimes in the course of events, an unenlightened soul will have their library emit a table of coordinates bearing information that would be more useful as a GRanges. Given the frequency with which this occurs, it's nice to have that generic. Anyways, this is all your fault! If you hadn't built such a marvelously useful data structure, people wouldn't want to use it in ways you never intended. :-) No good deed goes unpunished, --t > On Oct 6, 2013, at 1:26 PM, Michael Lawrence <lawrence.mich...@gene.com> > wrote: > > I'm still unconvinced that there is an obvious, general path from > data.frame -> GRanges. It's usually easy enough to just call GRanges(), > often of the pattern with(df, GRanges(...)). Moreover, it's unusual for me > to encounter genomic data in data.frames. > > > > > On Sun, Oct 6, 2013 at 8:37 AM, Kasper Daniel Hansen < > kasperdanielhan...@gmail.com> wrote: > >> Also, it goes without saying that I am happy to provide a patch for >> GenomicRanges, and check that it passes R CMD check, to minimize the work >> of the maintainer. >> >> Kasper >> >> >> On Sun, Oct 6, 2013 at 9:28 AM, Kasper Daniel Hansen < >> kasperdanielhan...@gmail.com> wrote: >> >>> bsseq::data.frame2GRanges does the obvious step of converting a >> data.frame >>> to GRanges. It has a couple of bells and whistles where strand can be >>> ignored and additional columns (apart from genomic location) may be >> ignore >>> in the output object. >>> >>> I (and now quite a few other people) use this function almost every day. >>> I have seen other implementations in other packages, suggesting this is >>> not just something I (we) use. >>> >>> I suggests adding this function to GenomicRanges. I am happy to support >>> it going forward. >>> >>> Using this function we could also add an as(x, "GRanges") method for >>> x=data.frame, but I still suggest keeping the basic function for the >>> extended functionality it provides. >>> >>> Best, >>> Kasper >> >> [[alternative HTML version deleted]] >> >> _______________________________________________ >> Bioc-devel@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/bioc-devel > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioc-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/bioc-devel _______________________________________________ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel