Applies a cr_marker_rules() set to a table that carries a file-name
column, adding one logical column per rule plus a character variant
column holding any unmatched trailing parenthetical.
Usage
cr_extract_markers(
x,
name_col = "source_file",
container_col = NULL,
rules = cr_marker_rules(),
stem_col = NULL,
strip_ext = TRUE,
call = rlang::caller_env()
)Arguments
- x
A data frame with one row per file (or per cell).
- name_col
Name of the column holding the file name. Default
"source_file".- container_col
Optional name of the column holding the container (plate or directory) name that
partial_plateis matched against.- rules
A
cr_marker_rules()object.- stem_col
Optional name of a column to write the marker-stripped name into.
- strip_ext
Logical. Remove a trailing file extension before matching. Default
TRUE.- call
The execution environment of the calling function. Used for error reporting; experts only.
Value
x with the columns merge_unit, partial_plate,
omitted_reagent, reacquisition, lot (all logical) and
variant (character) added. Columns for rules that were not
supplied are FALSE throughout.
See also
cr_marker_rules(), cr_parse_paths().
Other import:
cr_assign_units(),
cr_centroid_overlap(),
cr_column_map(),
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(),
cr_unit_map()
Examples
files <- tibble::tibble(
source_file = c("CompoundA_10uM_treated_1.csv",
"CompoundA_10uM_treated_1.1 (split).csv",
"CompoundA_vehicle_1 (no reagent).csv",
"CompoundA_vehicle_2 (weekend).csv"),
plate = c("Plate_1", "Plate_1", "Plate_1", "Plate_2 (partial)")
)
cr_extract_markers(
files,
container_col = "plate",
rules = cr_marker_rules(merge_unit = "\\(split\\)",
partial_plate = "\\(partial\\)",
omitted_reagent = "\\(no reagent\\)")
)
#> # A tibble: 4 × 8
#> source_file plate merge_unit partial_plate omitted_reagent reacquisition lot
#> <chr> <chr> <lgl> <lgl> <lgl> <lgl> <lgl>
#> 1 CompoundA_… Plat… FALSE FALSE FALSE FALSE FALSE
#> 2 CompoundA_… Plat… TRUE FALSE FALSE FALSE FALSE
#> 3 CompoundA_… Plat… FALSE FALSE TRUE FALSE FALSE
#> 4 CompoundA_… Plat… FALSE TRUE FALSE FALSE FALSE
#> # ℹ 1 more variable: variant <chr>