[Bioc-devel] recalling methods

Martin Morgan mtmorgan at fredhutch.org
Thu Dec 4 19:26:53 CET 2014


On 12/04/2014 09:56 AM, Michael Love wrote:
> I was thinking about a request from someone at Bioc2014 (I can't
> remember at the moment)
>
> As an end-user, if I have an object x, how can I *quickly* recall the
> main methods for that? As in, without breaking my flow and going to
> ?myClass or help("myClass-class"). Suppose x is a GRanges, how can I
> remember that there is a method called narrow() which works on x?
>
> showMethods(classes=class(x)) will print out a huge list for many
> complex Bioc classes. And printTo=FALSE turns this huge list into an
> unhelpful character vector, e.g.:
>
> head(showMethods(classes="GRanges",printTo=FALSE),8)
> [1] ""                                    "Function \".asSpace\":"
>    [3] " <not an S4 generic function>"       ""
>    [5] "Function \".linkToCachedObject<-\":" " <not an S4 generic function>"
>    [7] ""                                    "Function \".replaceSEW\":"
>
> any ideas?

   showMethods(classes="GRanges", where=search())

But this doesn't get 'narrow()' out of the box because it is inheritted (from 
GenomicRanges) and has not yet been invoked (so you'd be able to discover it if 
you'd used it...)

   cl = c("GRanges", names(getClass("GRanges")@contains))
   showMethods(classes=cl, where=search())

Yep, that's convenient.

Martin

>
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>


-- 
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



More information about the Bioc-devel mailing list