A cr_dataset is what comes out of ingest: the cells of every export,
the per-file provenance that lets any row be traced back to the
acquisition it came from, and optionally the design those files
encode. It is the object to inspect before committing to an analysis,
and it converts to a cr_experiment with cr_build_experiment().
Usage
cr_dataset(
cells,
design = NULL,
unit_var = NULL,
provenance = NULL,
file_col = "source_path",
metadata = list(),
call = rlang::caller_env()
)
# S3 method for class 'cr_dataset'
print(x, ...)
# S3 method for class 'cr_dataset'
summary(object, ...)Arguments
- cells
A data frame of cells, typically from
cr_read_exports().- design
Optional
cr_design()object, or a data frame that is passed tocr_design().- unit_var
Name of the analysis unit column. Defaults to the design's unit column, or the first of
well,slide,well_idorunitpresent incells.- provenance
Optional per-file table. When
NULLit is derived fromcells: one row per file with its cell count and every column that is constant within the file.- file_col
Name of the file column used for provenance. Default
"source_path".- metadata
Optional list of arbitrary user metadata.
- call
The execution environment of the calling function. Used for error reporting; experts only.
- x
A
cr_dataset.- ...
Ignored.
- object
A
cr_dataset.
Value
An object of class cr_dataset:
cellsTibble of per-cell measurements.
provenanceTibble with one row per source file, or
NULL.designA
cr_design, orNULL.unit_varName of the analysis unit column, or
NULL.metadataList of user metadata.
x, invisibly.
A tibble with one row per source file, or NULL when the data
set carries no provenance.
See also
cr_read_exports(), cr_design(), cr_build_experiment().
Other constructors:
cr_build_experiment(),
cr_design(),
cr_validate_experiment()
Examples
cells <- tibble::tibble(
source_path = rep(c("a.csv", "b.csv"), each = 3),
source_file = rep(c("a.csv", "b.csv"), each = 3),
well = rep(c("A01", "A02"), each = 3),
treatment = rep(c("Vehicle", "CompoundA"), each = 3),
target_signal = c(10, 12, 11, 30, 33, 29)
)
ds <- cr_dataset(cells)
ds
#>
#> ── cr_dataset
#> • cells: 6 x 5
#> • source files: 2
#> • unit column: well
#> • units: 2
#> • design: not set
ds$provenance
#> # A tibble: 2 × 5
#> source_path source_file well treatment n_cells
#> <chr> <chr> <chr> <chr> <int>
#> 1 a.csv a.csv A01 Vehicle 3
#> 2 b.csv b.csv A02 CompoundA 3