Giter Site home page Giter Site logo

drs4's Introduction

title author date vignette output
DrS4: help in contemplating S4 class usage
Vincent J. Carey, stvjc at channing.harvard.edu
`r format(Sys.time(), '%B %d, %Y')`
%\VignetteEngine{knitr::rmarkdown} %\VignetteIndexEntry{DrS4: help in contemplating S4 class usage} %\VignetteEncoding{UTF-8}
BiocStyle::html_document
highlight number_sections theme toc
pygments
true
united
true

Observation: methods may report more than we need

We are interested in the SingleCellExperiment class.

It is defined in a package.

suppressPackageStartupMessages({
 library(SingleCellExperiment)
 library(DrS4)
 library(dplyr)
})
methods(class="SingleCellExperiment")

There are many methods listed, including '=='.

try(getMethod("==", "SingleCellExperiment"))

We can find the signatures for which '==' is defined:

showMethods("==")

Finding methods defined in a package

DrS4 aims to provide clearer access to the methods actually defined for a class. This requires specifying a package where we look for the class and its methods. More work needs to be done in this domain. Specifically, the function 'defdMethods' currently only retrieves one method/signature for each generic method defined for the class.

Example

library(DrS4)
require("SingleCellExperiment")
scem = defdMethods(cl="SingleCellExperiment",
          pkg="SingleCellExperiment")
head(scem)

Listing available coercion methods

Here we'll list methods of coercing between classes involving SummarizedExperiment, RangedSummarizedExperiment, and SingleCellExperiment.

require("SummarizedExperiment")
se = defdMethods("SummarizedExperiment") # pkg has simple default
rse = defdMethods("RangedSummarizedExperiment", pkg="SummarizedExperiment")
cmb = try(rbind(scem,se,rse))
tmp = (cmb |> filter(method=="coerce"))
sl = (tmp |> select(sigs))[[1]]
names(sl) = tmp$cl
sl

drs4's People

Contributors

vjcitn avatar

Stargazers

Shian Su avatar Tim Triche, Jr. avatar

Watchers

Tim Triche, Jr. avatar James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.