Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
10d84c2
use new pillar methods
stemangiola May 20, 2022
8e7a0c4
version UP
stemangiola May 20, 2022
30e2316
fix bug tidybulk reference
stemangiola May 20, 2022
e58f396
typo
stemangiola May 20, 2022
aab95cb
fix CHECK
stemangiola May 20, 2022
3e372b7
dummy change
stemangiola Jul 25, 2022
c8f746c
dummy change
stemangiola Jul 25, 2022
179891a
print restore show
stemangiola Jul 26, 2022
ced3531
use new pillar methods
stemangiola May 20, 2022
cb058a3
version UP
stemangiola May 20, 2022
875ede1
fix bug tidybulk reference
stemangiola May 20, 2022
19ff7ef
typo
stemangiola May 20, 2022
665217e
fix CHECK
stemangiola May 20, 2022
dbfd4eb
use new pillar methods
stemangiola May 20, 2022
4edb3e7
version UP
stemangiola May 20, 2022
2bde91b
fix bug tidybulk reference
stemangiola May 20, 2022
8b2e38d
fix CHECK
stemangiola May 20, 2022
4936f89
dummy change
stemangiola Jul 25, 2022
b486241
print restore show
stemangiola Jul 26, 2022
ce0578b
pull
stemangiola Jul 26, 2022
ebc07b8
use new pillar methods
stemangiola May 20, 2022
7c84cc2
version UP
stemangiola May 20, 2022
feb66b1
fix bug tidybulk reference
stemangiola May 20, 2022
4dd7cba
fix CHECK
stemangiola May 20, 2022
7c1dc6e
dummy change
stemangiola Jul 25, 2022
481aebe
print restore show
stemangiola Jul 26, 2022
de2c753
use new pillar methods
stemangiola May 20, 2022
9e5e47c
version UP
stemangiola May 20, 2022
d79710d
fix bug tidybulk reference
stemangiola May 20, 2022
72599e1
fix CHECK
stemangiola May 20, 2022
b02d844
use new pillar methods
stemangiola May 20, 2022
3c85828
version UP
stemangiola May 20, 2022
f6eefa7
fix bug tidybulk reference
stemangiola May 20, 2022
209b6d4
fix CHECK
stemangiola May 20, 2022
683d448
dummy change
stemangiola Jul 25, 2022
7dbb9de
pull
stemangiola Jul 26, 2022
c5991fe
version UP
stemangiola Jul 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Type: Package
Package: tidySingleCellExperiment
Title: Brings SingleCellExperiment to the Tidyverse
Version: 1.7.3
Version: 1.7.4
Authors@R: c(person("Stefano", "Mangiola", email = "[email protected]",
role = c("aut", "cre")) )
Description: tidySingleCellExperiment is an adapter that abstracts the 'SingleCellExperiment' container
in the form of tibble and allows the data manipulation, plotting and nesting using 'tidyverse'.
in the form of a tibble and allows the data manipulation, plotting and nesting using 'tidyverse'.
License: GPL-3
Depends:
R (>= 4.1.0),
Expand Down Expand Up @@ -57,7 +57,7 @@ Biarch: true
biocViews: AssayDomain, Infrastructure, RNASeq, DifferentialExpression, GeneExpression, Normalization, Clustering, QualityControl, Sequencing
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.2
RoxygenNote: 7.2.0
Roxygen: list(markdown = TRUE)
URL: https://github.com/stemangiola/tidySingleCellExperiment
BugReports: https://github.com/stemangiola/tidySingleCellExperiment/issues
89 changes: 45 additions & 44 deletions R/methods.R
Original file line number Diff line number Diff line change
@@ -1,57 +1,24 @@
setClass("tidySingleCellExperiment", contains = "SingleCellExperiment")

#' tidy for SingleCellExperiment
#'
#' @param object A SingleCellExperiment object
#'
#' @return A tidySingleCellExperiment object
#'
#' @name tidy
#'
#' @examples
#'
#' tidySingleCellExperiment::pbmc_small
#' @export
tidy <- function(object) {
UseMethod("tidy", object)
}

#' @importFrom methods as
#' @importFrom lifecycle deprecate_warn
#'
#' @param object A SingleCellExperiment object
#'
#' @export
tidy.SingleCellExperiment <- function(object) {

# DEPRECATE
deprecate_warn(
when = "1.1.1",
what = "tidy()",
details = "tidySingleCellExperiment says: tidy() is not needed anymore."
)

object
}

setMethod(
f = "show",
signature = "SingleCellExperiment",
definition = function(object) {
if (isTRUE(x = getOption(x = "restore_SingleCellExperiment_show", default = FALSE))) {
f <- getMethod(
f = "show",
signature = "SingleCellExperiment",
where = asNamespace(ns = "SingleCellExperiment")
if (
isTRUE(x = getOption(x = "restore_SingleCellExperiment_show", default = FALSE))
) {
f <-getMethod(
f = "show",
signature = "SummarizedExperiment",
where = asNamespace(ns = "SummarizedExperiment")
)
f(object = object)
} else {
object %>%
print()
}

} else { print(object) }
}
)

setClass("tidySingleCellExperiment", contains = "SingleCellExperiment")

#' Extract and join information for features.
#'
#'
Expand Down Expand Up @@ -130,5 +97,39 @@ setMethod("join_features", "SingleCellExperiment", function(.data,
})


#' tidy for SingleCellExperiment
#'
#' @param object A SingleCellExperiment object
#'
#' @return A tidySingleCellExperiment object
#'
#' @name tidy
#'
#' @examples
#'
#' tidySingleCellExperiment::pbmc_small
#' @export
tidy <- function(object) {
UseMethod("tidy", object)
}

#' @importFrom methods as
#' @importFrom lifecycle deprecate_warn
#'
#' @param object A SingleCellExperiment object
#'
#' @export
tidy.SingleCellExperiment <- function(object) {

# DEPRECATE
deprecate_warn(
when = "1.1.1",
what = "tidy()",
details = "tidySingleCellExperiment says: tidy() is not needed anymore."
)

object
}



14 changes: 5 additions & 9 deletions R/print_method.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#' @export
#'
NULL
NULL

#' @importFrom rlang names2
#' @importFrom pillar align
Expand Down Expand Up @@ -63,6 +62,7 @@ tbl_format_header.tidySingleCellExperiment <- function(x, setup, ...){
assay_names %>% paste(collapse=", ")
), after = 1)
}

style_subtle(pillar___format_comment(header, width = setup$width))

}
Expand Down Expand Up @@ -91,7 +91,7 @@ tbl_format_header.tidySingleCellExperiment <- function(x, setup, ...){
#'
#' The following options are used by the tibble and pillar packages
#' to format and print `tbl_df` objects.
#' Used by the formatting workhorse `trunc_mat()` and, therefore,
#' Used by the formatting workhorse `trunc_mat()` and therefore,
#' indirectly, by `print.tbl()`.
#'
#' * `tibble.print_max`: Row number threshold: Maximum number of rows printed.
Expand Down Expand Up @@ -135,19 +135,15 @@ NULL
print.SingleCellExperiment <- function(x, ..., n = NULL, width = NULL, n_extra = NULL) {

x |>
as_tibble(n_dimensions_to_return = 5) |>
as_tibble(n_dimensions_to_return = 5 ) |>

new_data_frame(class = c("tidySingleCellExperiment", "tbl")) %>%
add_attr( nrow(x), "number_of_features") %>%
add_attr( assays(x) %>% names , "assay_names") %>%

print()

invisible(x)
}








2 changes: 1 addition & 1 deletion man/print.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.