Skip to contents

Acquisition software and operators annotate exports with short markers, and those markers change the analysis. A cr_marker_rules object states which regular expression means what, so that a marker becomes a typed flag instead of a string somebody has to remember.

Usage

cr_marker_rules(
  merge_unit = NULL,
  partial_plate = NULL,
  omitted_reagent = NULL,
  reacquisition = NULL,
  lot = NULL,
  capture_unknown = TRUE,
  ignore_case = TRUE
)

Arguments

merge_unit

Regular expression marking a file as one half of a two-pass acquisition, or NULL.

partial_plate

Regular expression matched against the container (directory) name, or NULL.

omitted_reagent

Regular expression marking the specificity arm, or NULL.

reacquisition

Regular expression marking a repeated read, or NULL.

lot

Regular expression marking a reagent lot, or NULL.

capture_unknown

Logical. Capture an unmatched trailing parenthetical into variant. Default TRUE.

ignore_case

Logical. Match case-insensitively. Default TRUE.

Value

An object of class cr_marker_rules (a list).

Details

The distinctions the rules encode are deliberate:

  • merge_unit sits on a file and means one spatial unit was acquired in two passes. The two files are one unit and must be merged before any per-unit balancing, or the unit contributes twice the cells of its neighbours.

  • partial_plate sits on a container (the plate directory) and means a partly filled plate. It has no downstream consequence. Collapsing the two into one flag hides the one that matters, so they are matched against different strings.

  • omitted_reagent marks the specificity arm, where the detection reagent was left out. These acquisitions are never samples.

  • reacquisition marks a repeated read of a unit that already has a plain sibling file.

  • lot marks a different reagent lot. A lot marker is not an omitted-reagent control; pooling the two inverts the meaning of the arm.

Any trailing parenthetical that matches none of the rules is captured verbatim into a variant column when capture_unknown = TRUE, rather than being guessed at or silently dropped.

Examples

rules <- cr_marker_rules(
  merge_unit = "\\(split\\)",
  partial_plate = "\\(partial\\)",
  omitted_reagent = "\\(no reagent\\)",
  reacquisition = "\\(repeat\\)",
  lot = "\\(lot[A-Z]\\)"
)
rules
#> $merge_unit
#> [1] "\\(split\\)"
#> 
#> $partial_plate
#> [1] "\\(partial\\)"
#> 
#> $omitted_reagent
#> [1] "\\(no reagent\\)"
#> 
#> $reacquisition
#> [1] "\\(repeat\\)"
#> 
#> $lot
#> [1] "\\(lot[A-Z]\\)"
#> 
#> $capture_unknown
#> [1] TRUE
#> 
#> $ignore_case
#> [1] TRUE
#> 
#> attr(,"class")
#> [1] "cr_marker_rules" "list"