| Title: | Logging for High-Throughput Omics Data Analysis |
|---|---|
| Description: | Provides logging capabilities for SingleCellExperiment and SummarizedExperiment objects. This package extends these classes to include tracking of operations such as filtering and column/row-level modifications. The log is displayed when the object is printed, helping users keep track of the data transformations applied during analysis. This is particularly useful for complex analysis workflows where multiple filtering and transformation steps are applied. |
| Authors: | Juan David Henao [aut, cre] (ORCID: <https://orcid.org/0000-0003-0783-1432>), Stefano Mangiola [aut] (ORCID: <https://orcid.org/0000-0001-7474-836X>), Michael Love [ctb] |
| Maintainer: | Juan David Henao <[email protected]> |
| License: | GPL-3 |
| Version: | 0.99.0 |
| Built: | 2026-11-18 09:54:20 UTC |
| Source: | https://github.com/BiocStaging/omicslog |
Subset a ExperimentLogged object
## S4 method for signature 'SummarizedExperimentLogged,ANY,ANY,ANY' x[i, j, ..., drop = TRUE] ## S4 method for signature 'SingleCellExperimentLogged,ANY,ANY,ANY' x[i, j, ..., drop = TRUE]## S4 method for signature 'SummarizedExperimentLogged,ANY,ANY,ANY' x[i, j, ..., drop = TRUE] ## S4 method for signature 'SingleCellExperimentLogged,ANY,ANY,ANY' x[i, j, ..., drop = TRUE]
x |
A ExperimentLogged object |
i, j, ...
|
Indices for subsetting |
drop |
Passed to the |
The subset ExperimentLogged object, with removed features and observations added to its log.
# Create a logged SummarizedExperiment if (requireNamespace("tidySummarizedExperiment", quietly = TRUE)) { se <- tidySummarizedExperiment::pasilla se_logged <- log_start(se) se_logged <- se_logged[1:10,1:5] se_logged }# Create a logged SummarizedExperiment if (requireNamespace("tidySummarizedExperiment", quietly = TRUE)) { se <- tidySummarizedExperiment::pasilla se_logged <- log_start(se) se_logged <- se_logged[1:10,1:5] se_logged }
$<- for ExperimentLoggedAssign column to colData using $<- for ExperimentLogged
## S4 replacement method for signature 'SummarizedExperimentLogged' x$name <- value ## S4 replacement method for signature 'SingleCellExperimentLogged' x$name <- value## S4 replacement method for signature 'SummarizedExperimentLogged' x$name <- value ## S4 replacement method for signature 'SingleCellExperimentLogged' x$name <- value
x |
An ExperimentLogged object |
name |
Name of the |
value |
Values for the column |
The modified ExperimentLogged object, with the change added to its log.
# Create a logged SummarizedExperiment if (requireNamespace("tidySummarizedExperiment", quietly = TRUE)) { se <- tidySummarizedExperiment::pasilla se_logged <- log_start(se) # Modify existing column colData(se_logged)$condition <- tolower(colData(se_logged)$condition) # Add new column colData(se_logged)$new_column <- rep("test", ncol(se_logged)) se_logged }# Create a logged SummarizedExperiment if (requireNamespace("tidySummarizedExperiment", quietly = TRUE)) { se <- tidySummarizedExperiment::pasilla se_logged <- log_start(se) # Modify existing column colData(se_logged)$condition <- tolower(colData(se_logged)$condition) # Add new column colData(se_logged)$new_column <- rep("test", ncol(se_logged)) se_logged }
assays<- for ExperimentLoggedAssign List to assays using assays<- for ExperimentLogged
## S4 replacement method for signature 'SummarizedExperimentLogged,SimpleList' assays(x, withDimnames = TRUE, ...) <- value ## S4 replacement method for signature 'SingleCellExperimentLogged,SimpleList' assays(x, withDimnames = TRUE, ...) <- value## S4 replacement method for signature 'SummarizedExperimentLogged,SimpleList' assays(x, withDimnames = TRUE, ...) <- value ## S4 replacement method for signature 'SingleCellExperimentLogged,SimpleList' assays(x, withDimnames = TRUE, ...) <- value
x |
An ExperimentLogged object |
withDimnames, ...
|
Passed to the |
value |
A SimpleList of assays |
The modified ExperimentLogged object, with added and modified assays added to its log.
# Create a logged SingleCellExperiment if (requireNamespace("tidySingleCellExperiment", quietly = TRUE)) { data(pbmc_small, package="tidySingleCellExperiment") sce_logged <- log_start(pbmc_small) assays(sce_logged)$log2.counts <- log2(assays(sce_logged)$counts) sce_logged }# Create a logged SingleCellExperiment if (requireNamespace("tidySingleCellExperiment", quietly = TRUE)) { data(pbmc_small, package="tidySingleCellExperiment") sce_logged <- log_start(pbmc_small) assays(sce_logged)$log2.counts <- log2(assays(sce_logged)$counts) sce_logged }
colData<- for ExperimentLoggedAssign column to colData using colData<- for ExperimentLogged
## S4 replacement method for signature 'ExperimentLogged,DataFrame' colData(x) <- value ## S4 replacement method for signature 'ExperimentLogged,DFrame' colData(x) <- value## S4 replacement method for signature 'ExperimentLogged,DataFrame' colData(x) <- value ## S4 replacement method for signature 'ExperimentLogged,DFrame' colData(x) <- value
x |
An ExperimentLogged object |
value |
A DataFrame with the new column data |
The modified ExperimentLogged object, with added and modified
colData columns added to its log.
# Create a logged SingleCellExperiment if (requireNamespace("tidySingleCellExperiment", quietly = TRUE)) { data(pbmc_small, package="tidySingleCellExperiment") sce_logged <- log_start(pbmc_small) colData(sce_logged)$num.idents <- as.numeric(colData(sce_logged)$letter.idents) sce_logged }# Create a logged SingleCellExperiment if (requireNamespace("tidySingleCellExperiment", quietly = TRUE)) { data(pbmc_small, package="tidySingleCellExperiment") sce_logged <- log_start(pbmc_small) colData(sce_logged)$num.idents <- as.numeric(colData(sce_logged)$letter.idents) sce_logged }
A class union of SummarizedExperimentLogged and SingleCellExperimentLogged, used to define logging methods once for both classes.
counts <- matrix(rpois(20, 10), nrow = 5) se_logged <- log_start(SummarizedExperiment(assays = list(counts = counts))) sce_logged <- log_start(SingleCellExperiment(assays = list(counts = counts))) is(se_logged, "ExperimentLogged") is(sce_logged, "ExperimentLogged")counts <- matrix(rpois(20, 10), nrow = 5) se_logged <- log_start(SummarizedExperiment(assays = list(counts = counts))) sce_logged <- log_start(SingleCellExperiment(assays = list(counts = counts))) is(se_logged, "ExperimentLogged") is(sce_logged, "ExperimentLogged")
extract() is re-exported from tidyr, so it is available after
library(omicslog). These methods log the operation on
ExperimentLogged objects; see tidyr::extract() for the generic.
## S3 method for class 'SummarizedExperimentLogged' extract( data, col, into, regex = "([[:alnum:]]+)", remove = TRUE, convert = FALSE, ... ) ## S3 method for class 'SingleCellExperimentLogged' extract( data, col, into, regex = "([[:alnum:]]+)", remove = TRUE, convert = FALSE, ... )## S3 method for class 'SummarizedExperimentLogged' extract( data, col, into, regex = "([[:alnum:]]+)", remove = TRUE, convert = FALSE, ... ) ## S3 method for class 'SingleCellExperimentLogged' extract( data, col, into, regex = "([[:alnum:]]+)", remove = TRUE, convert = FALSE, ... )
data |
An ExperimentLogged object |
col |
Column to extract from |
into |
Names of new variables to create |
regex |
A regular expression to extract values |
remove |
If TRUE, remove input column from output |
convert |
If TRUE, runs type.convert() on each new column |
... |
Additional arguments passed to tidyr::extract |
An ExperimentLogged object with the extracted colData columns,
with the extraction added to its log.
if (requireNamespace("tidySummarizedExperiment", quietly = TRUE)) { se <- tidySummarizedExperiment::pasilla se_logged <- log_start(se) result <- se_logged |> mutate(type = sub("_end","",colData(se)$type)) |> extract(type, into = "exp") result }if (requireNamespace("tidySummarizedExperiment", quietly = TRUE)) { se <- tidySummarizedExperiment::pasilla se_logged <- log_start(se) result <- se_logged |> mutate(type = sub("_end","",colData(se)$type)) |> extract(type, into = "exp") result }
filter() is re-exported from dplyr, so it is available after
library(omicslog). These methods log the operation on
ExperimentLogged objects; see dplyr::filter() for the generic.
## S3 method for class 'SummarizedExperimentLogged' filter(.data, ...) ## S3 method for class 'SingleCellExperimentLogged' filter(.data, ...)## S3 method for class 'SummarizedExperimentLogged' filter(.data, ...) ## S3 method for class 'SingleCellExperimentLogged' filter(.data, ...)
.data |
An ExperimentLogged object |
... |
Logical expressions used for filtering |
An ExperimentLogged object with the features and observations that match the conditions, with the number removed added to its log.
if (requireNamespace("tidySummarizedExperiment", quietly = TRUE)) { se <- tidySummarizedExperiment::pasilla se_logged <- log_start(se) result <- se_logged |> filter(condition == "treated") result }if (requireNamespace("tidySummarizedExperiment", quietly = TRUE)) { se <- tidySummarizedExperiment::pasilla se_logged <- log_start(se) result <- se_logged |> filter(condition == "treated") result }
This function wraps a SummarizedExperiment object with logging capabilities. Operations performed on the resulting object will be tracked and displayed when the object is printed.
log_start(se) ## S4 method for signature 'SummarizedExperimentLogged' show(object) ## S4 method for signature 'SingleCellExperimentLogged' show(object)log_start(se) ## S4 method for signature 'SummarizedExperimentLogged' show(object) ## S4 method for signature 'SingleCellExperimentLogged' show(object)
se |
A SummarizedExperiment or derived object |
object |
An ExperimentLogged object |
log_start() returns an ExperimentLogged object
(SummarizedExperimentLogged or SingleCellExperimentLogged) with an empty
log. show() prints the object followed by its operation log and
returns NULL invisibly.
if (requireNamespace("tidySummarizedExperiment", quietly = TRUE)) { se <- tidySummarizedExperiment::pasilla se_logged <- log_start(se) result <- se_logged |> filter(condition == "treated") result }if (requireNamespace("tidySummarizedExperiment", quietly = TRUE)) { se <- tidySummarizedExperiment::pasilla se_logged <- log_start(se) result <- se_logged |> filter(condition == "treated") result }
mutate() is re-exported from dplyr, so it is available after
library(omicslog). These methods log the operation on
ExperimentLogged objects; see dplyr::mutate() for the generic.
## S3 method for class 'SummarizedExperimentLogged' mutate(.data, ...) ## S3 method for class 'SingleCellExperimentLogged' mutate(.data, ...)## S3 method for class 'SummarizedExperimentLogged' mutate(.data, ...) ## S3 method for class 'SingleCellExperimentLogged' mutate(.data, ...)
.data |
An ExperimentLogged object |
... |
Name-value pairs of expressions used to modify columns |
An ExperimentLogged object with the new or modified columns, with the change added to its log.
if (requireNamespace("tidySummarizedExperiment", quietly = TRUE)) { se <- tidySummarizedExperiment::pasilla se_logged <- log_start(se) result <- se_logged |> mutate(type = sub("_end","",colData(se)$type)) result }if (requireNamespace("tidySummarizedExperiment", quietly = TRUE)) { se <- tidySummarizedExperiment::pasilla se_logged <- log_start(se) result <- se_logged |> mutate(type = sub("_end","",colData(se)$type)) result }
reducedDim<- for SingleCellExperimentLoggedAssign a matrix to a named reduced dimension using reducedDim<- for SingleCellExperimentLogged
## S4 replacement method for signature 'SingleCellExperimentLogged,character' reducedDim(x, type, withDimnames = TRUE, ...) <- value ## S4 replacement method for signature 'SingleCellExperimentLogged,numeric' reducedDim(x, type, withDimnames = TRUE, ...) <- value## S4 replacement method for signature 'SingleCellExperimentLogged,character' reducedDim(x, type, withDimnames = TRUE, ...) <- value ## S4 replacement method for signature 'SingleCellExperimentLogged,numeric' reducedDim(x, type, withDimnames = TRUE, ...) <- value
x |
A SingleCellExperimentLogged object |
type |
Name or index of the reduced dimension to set |
withDimnames, ...
|
Passed to the |
value |
A matrix with one row per cell |
The modified SingleCellExperimentLogged object, with the change added to its log.
# Create a logged SingleCellExperiment if (requireNamespace("tidySingleCellExperiment", quietly = TRUE)) { data(pbmc_small, package="tidySingleCellExperiment") sce_logged <- log_start(pbmc_small) reducedDim(sce_logged) <- reducedDim(sce_logged)[,1:2] sce_logged }# Create a logged SingleCellExperiment if (requireNamespace("tidySingleCellExperiment", quietly = TRUE)) { data(pbmc_small, package="tidySingleCellExperiment") sce_logged <- log_start(pbmc_small) reducedDim(sce_logged) <- reducedDim(sce_logged)[,1:2] sce_logged }
reducedDims<- for SingleCellExperimentLoggedAssign a List of matrices to reducedDims using reducedDims<- for SingleCellExperimentLogged
## S4 replacement method for signature 'SingleCellExperimentLogged' reducedDims(x, withDimnames = TRUE, ...) <- value## S4 replacement method for signature 'SingleCellExperimentLogged' reducedDims(x, withDimnames = TRUE, ...) <- value
x |
A SingleCellExperimentLogged object |
withDimnames, ...
|
Passed to the |
value |
A list of matrices, each with one row per cell |
The modified SingleCellExperimentLogged object, with added and modified reduced dimensions added to its log.
# Create a logged SingleCellExperiment if (requireNamespace("tidySingleCellExperiment", quietly = TRUE)) { data(pbmc_small, package="tidySingleCellExperiment") sce_logged <- log_start(pbmc_small) reducedDims(sce_logged)$TSNE <- abs(reducedDims(sce_logged)$TSNE) sce_logged }# Create a logged SingleCellExperiment if (requireNamespace("tidySingleCellExperiment", quietly = TRUE)) { data(pbmc_small, package="tidySingleCellExperiment") sce_logged <- log_start(pbmc_small) reducedDims(sce_logged)$TSNE <- abs(reducedDims(sce_logged)$TSNE) sce_logged }
rowData<- for ExperimentLoggedAssign column to rowData using rowData<- for ExperimentLogged
## S4 replacement method for signature 'ExperimentLogged,DataFrame' rowData(x) <- value ## S4 replacement method for signature 'ExperimentLogged,DFrame' rowData(x) <- value## S4 replacement method for signature 'ExperimentLogged,DataFrame' rowData(x) <- value ## S4 replacement method for signature 'ExperimentLogged,DFrame' rowData(x) <- value
x |
An ExperimentLogged object |
value |
A DataFrame with the new row data |
The modified ExperimentLogged object, with added and modified
rowData columns added to its log.
# Create a logged SingleCellExperiment if (requireNamespace("tidySingleCellExperiment", quietly = TRUE)) { data(pbmc_small, package="tidySingleCellExperiment") sce_logged <- log_start(pbmc_small) rowData(sce_logged)$vst.variable <- ifelse(rowData(sce_logged)$vst.variable,1,0 ) sce_logged }# Create a logged SingleCellExperiment if (requireNamespace("tidySingleCellExperiment", quietly = TRUE)) { data(pbmc_small, package="tidySingleCellExperiment") sce_logged <- log_start(pbmc_small) rowData(sce_logged)$vst.variable <- ifelse(rowData(sce_logged)$vst.variable,1,0 ) sce_logged }
select() is re-exported from dplyr, so it is available after
library(omicslog). These methods log the operation on
ExperimentLogged objects; see dplyr::select() for the generic.
## S3 method for class 'SummarizedExperimentLogged' select(.data, ...) ## S3 method for class 'SingleCellExperimentLogged' select(.data, ...)## S3 method for class 'SummarizedExperimentLogged' select(.data, ...) ## S3 method for class 'SingleCellExperimentLogged' select(.data, ...)
.data |
An ExperimentLogged object |
... |
Name of columns to select or deselect |
An ExperimentLogged object with the selected colData columns,
with the number of removed columns added to its log. If the selection
drops the key columns (.feature, .sample), tidySummarizedExperiment
returns a tibble, which is returned unchanged and without a log.
if (requireNamespace("tidySummarizedExperiment", quietly = TRUE)) { se <- tidySummarizedExperiment::pasilla se_logged <- log_start(se) # Drop a colData column: still a logged object result <- se_logged |> select(!type) result }if (requireNamespace("tidySummarizedExperiment", quietly = TRUE)) { se <- tidySummarizedExperiment::pasilla se_logged <- log_start(se) # Drop a colData column: still a logged object result <- se_logged |> select(!type) result }
A class extending SingleCellExperiment to include logging capabilities. This class tracks operations performed on the object and displays a log when the object is printed.
log_historyA data.frame storing the history of operations
counts <- matrix(rpois(40, 5), nrow = 5, dimnames = list(paste0("gene", 1:5), paste0("cell", 1:8))) sce <- SingleCellExperiment(assays = list(counts = counts)) sce_logged <- log_start(sce) is(sce_logged, "SingleCellExperimentLogged") sce_logged[, 1:4]counts <- matrix(rpois(40, 5), nrow = 5, dimnames = list(paste0("gene", 1:5), paste0("cell", 1:8))) sce <- SingleCellExperiment(assays = list(counts = counts)) sce_logged <- log_start(sce) is(sce_logged, "SingleCellExperimentLogged") sce_logged[, 1:4]
slice() is re-exported from dplyr, so it is available after
library(omicslog). These methods log the operation on
ExperimentLogged objects; see dplyr::slice() for the generic.
## S3 method for class 'SummarizedExperimentLogged' slice(.data, ..., .preserve = FALSE) ## S3 method for class 'SingleCellExperimentLogged' slice(.data, ..., .preserve = FALSE)## S3 method for class 'SummarizedExperimentLogged' slice(.data, ..., .preserve = FALSE) ## S3 method for class 'SingleCellExperimentLogged' slice(.data, ..., .preserve = FALSE)
.data |
An ExperimentLogged object |
... |
Row selection expressions |
.preserve |
If TRUE, preserves the grouping structure of the data |
An ExperimentLogged object with the selected rows, with the number of kept and removed rows added to its log.
if (requireNamespace("tidySummarizedExperiment", quietly = TRUE)) { se <- tidySummarizedExperiment::pasilla se_logged <- log_start(se) result <- se_logged |> slice(1) result }if (requireNamespace("tidySummarizedExperiment", quietly = TRUE)) { se <- tidySummarizedExperiment::pasilla se_logged <- log_start(se) result <- se_logged |> slice(1) result }
A class extending SummarizedExperiment to include logging capabilities. This class tracks operations performed on the object and displays a log when the object is printed.
log_historyA data.frame storing the history of operations
counts <- matrix(rpois(20, 10), nrow = 5, dimnames = list(paste0("gene", 1:5), paste0("s", 1:4))) se <- SummarizedExperiment(assays = list(counts = counts)) se_logged <- log_start(se) is(se_logged, "SummarizedExperimentLogged") se_logged[1:3, ]counts <- matrix(rpois(20, 10), nrow = 5, dimnames = list(paste0("gene", 1:5), paste0("s", 1:4))) se <- SummarizedExperiment(assays = list(counts = counts)) se_logged <- log_start(se) is(se_logged, "SummarizedExperimentLogged") se_logged[1:3, ]