Skip to content

Commit 0197567

Browse files
authored
Merge pull request #47 from stemangiola/print_hotifx
Print hotifx
2 parents 6e29a0d + c5991fe commit 0197567

File tree

4 files changed

+54
-57
lines changed

4 files changed

+54
-57
lines changed

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Type: Package
22
Package: tidySingleCellExperiment
33
Title: Brings SingleCellExperiment to the Tidyverse
4-
Version: 1.7.3
4+
Version: 1.7.4
55
Authors@R: c(person("Stefano", "Mangiola", email = "[email protected]",
66
role = c("aut", "cre")) )
77
Description: tidySingleCellExperiment is an adapter that abstracts the 'SingleCellExperiment' container
8-
in the form of tibble and allows the data manipulation, plotting and nesting using 'tidyverse'.
8+
in the form of a tibble and allows the data manipulation, plotting and nesting using 'tidyverse'.
99
License: GPL-3
1010
Depends:
1111
R (>= 4.1.0),
@@ -57,7 +57,7 @@ Biarch: true
5757
biocViews: AssayDomain, Infrastructure, RNASeq, DifferentialExpression, GeneExpression, Normalization, Clustering, QualityControl, Sequencing
5858
Encoding: UTF-8
5959
LazyData: true
60-
RoxygenNote: 7.1.2
60+
RoxygenNote: 7.2.0
6161
Roxygen: list(markdown = TRUE)
6262
URL: https://github.com/stemangiola/tidySingleCellExperiment
6363
BugReports: https://github.com/stemangiola/tidySingleCellExperiment/issues

R/methods.R

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,24 @@
1-
setClass("tidySingleCellExperiment", contains = "SingleCellExperiment")
2-
3-
#' tidy for SingleCellExperiment
4-
#'
5-
#' @param object A SingleCellExperiment object
6-
#'
7-
#' @return A tidySingleCellExperiment object
8-
#'
9-
#' @name tidy
10-
#'
11-
#' @examples
12-
#'
13-
#' tidySingleCellExperiment::pbmc_small
14-
#' @export
15-
tidy <- function(object) {
16-
UseMethod("tidy", object)
17-
}
18-
19-
#' @importFrom methods as
20-
#' @importFrom lifecycle deprecate_warn
21-
#'
22-
#' @param object A SingleCellExperiment object
23-
#'
24-
#' @export
25-
tidy.SingleCellExperiment <- function(object) {
26-
27-
# DEPRECATE
28-
deprecate_warn(
29-
when = "1.1.1",
30-
what = "tidy()",
31-
details = "tidySingleCellExperiment says: tidy() is not needed anymore."
32-
)
33-
34-
object
35-
}
361

372
setMethod(
383
f = "show",
394
signature = "SingleCellExperiment",
405
definition = function(object) {
41-
if (isTRUE(x = getOption(x = "restore_SingleCellExperiment_show", default = FALSE))) {
42-
f <- getMethod(
43-
f = "show",
44-
signature = "SingleCellExperiment",
45-
where = asNamespace(ns = "SingleCellExperiment")
6+
if (
7+
isTRUE(x = getOption(x = "restore_SingleCellExperiment_show", default = FALSE))
8+
) {
9+
f <-getMethod(
10+
f = "show",
11+
signature = "SummarizedExperiment",
12+
where = asNamespace(ns = "SummarizedExperiment")
4613
)
4714
f(object = object)
48-
} else {
49-
object %>%
50-
print()
51-
}
15+
16+
} else { print(object) }
5217
}
5318
)
5419

20+
setClass("tidySingleCellExperiment", contains = "SingleCellExperiment")
21+
5522
#' Extract and join information for features.
5623
#'
5724
#'
@@ -130,5 +97,39 @@ setMethod("join_features", "SingleCellExperiment", function(.data,
13097
})
13198

13299

100+
#' tidy for SingleCellExperiment
101+
#'
102+
#' @param object A SingleCellExperiment object
103+
#'
104+
#' @return A tidySingleCellExperiment object
105+
#'
106+
#' @name tidy
107+
#'
108+
#' @examples
109+
#'
110+
#' tidySingleCellExperiment::pbmc_small
111+
#' @export
112+
tidy <- function(object) {
113+
UseMethod("tidy", object)
114+
}
115+
116+
#' @importFrom methods as
117+
#' @importFrom lifecycle deprecate_warn
118+
#'
119+
#' @param object A SingleCellExperiment object
120+
#'
121+
#' @export
122+
tidy.SingleCellExperiment <- function(object) {
123+
124+
# DEPRECATE
125+
deprecate_warn(
126+
when = "1.1.1",
127+
what = "tidy()",
128+
details = "tidySingleCellExperiment says: tidy() is not needed anymore."
129+
)
130+
131+
object
132+
}
133+
133134

134135

R/print_method.R

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#' @export
2727
#'
2828
NULL
29-
NULL
3029

3130
#' @importFrom rlang names2
3231
#' @importFrom pillar align
@@ -63,6 +62,7 @@ tbl_format_header.tidySingleCellExperiment <- function(x, setup, ...){
6362
assay_names %>% paste(collapse=", ")
6463
), after = 1)
6564
}
65+
6666
style_subtle(pillar___format_comment(header, width = setup$width))
6767

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

137137
x |>
138-
as_tibble(n_dimensions_to_return = 5) |>
138+
as_tibble(n_dimensions_to_return = 5 ) |>
139+
139140
new_data_frame(class = c("tidySingleCellExperiment", "tbl")) %>%
140141
add_attr( nrow(x), "number_of_features") %>%
141142
add_attr( assays(x) %>% names , "assay_names") %>%
143+
142144
print()
143145

144146
invisible(x)
145147
}
146148

147149

148-
149-
150-
151-
152-
153-

man/print.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)