diff --git a/DESCRIPTION b/DESCRIPTION index 42b3d5e..b7597a7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: tidySingleCellExperiment Title: Brings SingleCellExperiment to the Tidyverse -Version: 1.11.7 +Version: 1.11.8 Authors@R: c(person("Stefano", "Mangiola", comment=c(ORCID="0000-0001-7474-836X"), email="mangiolastefano@gmail.com", @@ -26,7 +26,6 @@ Imports: SummarizedExperiment, tibble, ggplot2, - plotly, magrittr, rlang, purrr, @@ -58,7 +57,8 @@ Suggests: GGally, uwot, celldex, - dittoSeq + dittoSeq, + plotly VignetteBuilder: knitr RdMacros: diff --git a/NAMESPACE b/NAMESPACE index 26adeae..7020d9c 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -21,7 +21,6 @@ S3method(mutate,SingleCellExperiment) S3method(nest,SingleCellExperiment) S3method(pivot_longer,SingleCellExperiment) S3method(plot_ly,SingleCellExperiment) -S3method(plot_ly,default) S3method(print,SingleCellExperiment) S3method(pull,SingleCellExperiment) S3method(rename,SingleCellExperiment) @@ -45,7 +44,6 @@ S3method(unite,SingleCellExperiment) S3method(unnest,tidySingleCellExperiment_nested) export("%>%") export(join_transcripts) -export(plot_ly) export(tidy) export(unnest_single_cell_experiment) exportMethods(aggregate_cells) @@ -111,7 +109,6 @@ importFrom(pillar,get_extent) importFrom(pillar,style_subtle) importFrom(pillar,tbl_format_header) importFrom(pkgconfig,get_config) -importFrom(plotly,plot_ly) importFrom(purrr,as_mapper) importFrom(purrr,imap) importFrom(purrr,map) @@ -156,6 +153,7 @@ importFrom(ttservice,aggregate_cells) importFrom(ttservice,bind_cols) importFrom(ttservice,bind_rows) importFrom(ttservice,join_features) +importFrom(ttservice,plot_ly) importFrom(utils,data) importFrom(utils,packageDescription) importFrom(utils,tail) diff --git a/R/plotly_methods.R b/R/plotly_methods.R index 890cdb8..2d7a61a 100755 --- a/R/plotly_methods.R +++ b/R/plotly_methods.R @@ -1,54 +1,14 @@ -#' @name plotly -#' @rdname plotly -#' @inherit plotly::plot_ly +#' @name plot_ly +#' @rdname plot_ly +#' @inherit ttservice::plot_ly #' @return `plotly` #' -#' @examples -#' # TODO +#' @examples +#' data(pbmc_small) +#' pbmc_small |> +#' plot_ly(x = ~ nCount_RNA, y = ~ nFeature_RNA) #' -#' @importFrom plotly plot_ly -#' @export -plot_ly <- function(data=data.frame(), - ..., type=NULL, name=NULL, - color=NULL, colors=NULL, alpha=NULL, - stroke=NULL, strokes=NULL, alpha_stroke=1, - size=NULL, sizes=c(10, 100), - span=NULL, spans=c(1, 20), - symbol=NULL, symbols=NULL, - linetype=NULL, linetypes=NULL, - split=NULL, frame=NULL, - width=NULL, height=NULL, source="A") { - UseMethod("plot_ly") -} - -#' @rdname plotly -#' @export -plot_ly.default <- function(data=data.frame(), - ..., type=NULL, name=NULL, - color=NULL, colors=NULL, alpha=NULL, - stroke=NULL, strokes=NULL, alpha_stroke=1, - size=NULL, sizes=c(10, 100), - span=NULL, spans=c(1, 20), - symbol=NULL, symbols=NULL, - linetype=NULL, linetypes=NULL, - split=NULL, frame=NULL, - width=NULL, height=NULL, source="A") { - data %>% - # This is a trick to not loop the call - drop_class("tbl_df") %>% - plotly::plot_ly(..., - type=type, name=name, - color=color, colors=colors, alpha=alpha, - stroke=stroke, strokes=strokes, alpha_stroke=alpha_stroke, - size=size, sizes=sizes, - span=span, spans=spans, - symbol=symbol, symbols=symbols, - linetype=linetype, linetypes=linetypes, - split=split, frame=frame, - width=width, height=height, source=source) -} - -#' @rdname plotly +#' @importFrom ttservice plot_ly #' @export plot_ly.SingleCellExperiment <- function(data=data.frame(), ..., type=NULL, name=NULL, @@ -63,7 +23,7 @@ plot_ly.SingleCellExperiment <- function(data=data.frame(), data %>% # This is a trick to not loop the call as_tibble() %>% - plot_ly(..., + ttservice::plot_ly(..., type=type, name=name, color=color, colors=colors, alpha=alpha, stroke=stroke, strokes=strokes, alpha_stroke=alpha_stroke, diff --git a/man/plotly.Rd b/man/plot_ly.Rd similarity index 89% rename from man/plotly.Rd rename to man/plot_ly.Rd index c06b179..654560d 100644 --- a/man/plotly.Rd +++ b/man/plot_ly.Rd @@ -1,64 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/plotly_methods.R -\name{plotly} -\alias{plotly} +\name{plot_ly} \alias{plot_ly} -\alias{plot_ly.default} \alias{plot_ly.SingleCellExperiment} \title{Initiate a plotly visualization} \usage{ -plot_ly( - data = data.frame(), - ..., - type = NULL, - name = NULL, - color = NULL, - colors = NULL, - alpha = NULL, - stroke = NULL, - strokes = NULL, - alpha_stroke = 1, - size = NULL, - sizes = c(10, 100), - span = NULL, - spans = c(1, 20), - symbol = NULL, - symbols = NULL, - linetype = NULL, - linetypes = NULL, - split = NULL, - frame = NULL, - width = NULL, - height = NULL, - source = "A" -) - -\method{plot_ly}{default}( - data = data.frame(), - ..., - type = NULL, - name = NULL, - color = NULL, - colors = NULL, - alpha = NULL, - stroke = NULL, - strokes = NULL, - alpha_stroke = 1, - size = NULL, - sizes = c(10, 100), - span = NULL, - spans = c(1, 20), - symbol = NULL, - symbols = NULL, - linetype = NULL, - linetypes = NULL, - split = NULL, - frame = NULL, - width = NULL, - height = NULL, - source = "A" -) - \method{plot_ly}{SingleCellExperiment}( data = data.frame(), ..., @@ -191,7 +137,9 @@ help inform default axis/scale titles (e.g., \code{plot_ly(x = mtcars$wt)} vs \code{plot_ly(x = ~mtcars$wt)}) } \examples{ -# TODO +data(pbmc_small) +pbmc_small |> + plot_ly(x = ~ nCount_RNA, y = ~ nFeature_RNA) } \references{