Summarises which file contributed how many cells to which unit, and
flags the units that were assembled from more than one file. This is
the post-condition check for cr_assign_units(): a unit built from
several files should be one you can name and justify.
Usage
cr_unit_map(
x,
id_col = "well_id",
file_col = "source_path",
call = rlang::caller_env()
)Arguments
- x
A cell table carrying a unit identifier and a file column, as returned by
cr_assign_units().- id_col
Name of the unit identifier column. Default
"well_id".- file_col
Name of the file column. Default
"source_path"; the path rather than the base name, because base names repeat across plates.- call
The execution environment of the calling function. Used for error reporting; experts only.
Value
A tibble with one row per file: the unit identifier, the file,
n_cells, n_files (files contributing to that unit) and merged
(TRUE when n_files > 1).
See also
Other import:
cr_assign_units(),
cr_centroid_overlap(),
cr_column_map(),
cr_extract_markers(),
cr_filename_grammar(),
cr_marker_rules(),
cr_merge_rules(),
cr_parse_paths(),
cr_path_spec(),
cr_read_cellprofiler(),
cr_read_cells(),
cr_read_design(),
cr_read_export(),
cr_read_exports(),
cr_read_qupath(),
cr_read_segmantr()
Examples
cells <- tibble::tibble(
source_path = rep(c("a.csv", "b.csv", "c.csv"), times = c(3, 2, 4)),
compound = "CompoundA",
replicate = rep(c("1", "1.1", "2"), times = c(3, 2, 4)),
merge_unit = rep(c(FALSE, TRUE, FALSE), times = c(3, 2, 4))
)
units <- cr_assign_units(cells, key_vars = "compound")
cr_unit_map(units)
#> # A tibble: 3 × 5
#> well_id source_path n_cells n_files merged
#> <chr> <chr> <int> <int> <lgl>
#> 1 CompoundA|1 a.csv 3 2 TRUE
#> 2 CompoundA|1 b.csv 2 2 TRUE
#> 3 CompoundA|2 c.csv 4 1 FALSE