This helper function takes a user-friendly list of single and multiple phenotype names and converts it to a named list of phenotype selectors for use with phenoptr::select_rows. By using parse_phenotypes a user does not have to know the (somewhat inscrutable) details of select_rows.

parse_phenotypes(...)

## Arguments

... Phenotypes to be decoded, or a list of same, optionally with names.

## Value

A named list of phenotype selectors for use with phenoptr::select_rows.

## Details

Each phenotype must be either a single phenotype name (e.g. CD3+ or CD8-) or two or more names separated by a slash (/) or comma (,).

Phenotypes containing slashes are interpreted as requiring all of the individual phenotypes. For example, "CD3+/CD8-" is a CD3+ cell which is also CD8-.

Phenotypes containing commas are interpreted as requiring any of the individual phenotypes. For example, "CD68+,CD163+" is a cell which is either CD68+ or CD163+ or both.

Additionally, a phenotype name without a + or - and containing either "Total" or "All" will be interpreted as meaning "All cells".

## Examples

# Create selectors for
# - All CD3+ cells
# - CD3+/CD8+ double-positive cells
# - CD3+/CD8- single-positive cells
# - All cells regardless of phenotype
# - Macrophages, defined as either CD68+ OR CD163+
parse_phenotypes("CD3+", "CD3+/CD8+", "CD3+/CD8-",
"Total Cells", Macrophage="CD68+,CD163+")#> $CD3+ #> [1] "CD3+" #> #>$CD3+/CD8+
#> $CD3+/CD8+[[1]] #> [1] "CD3+" #> #>$CD3+/CD8+[[2]]
#> [1] "CD8+"
#>
#>
#> $CD3+/CD8- #>$CD3+/CD8-[[1]]
#> [1] "CD3+"
#>
#> $CD3+/CD8-[[2]] #> [1] "CD8-" #> #> #>$Total Cells
#> [1] NA
#>
#> \$Macrophage
#> [1] "CD68+"  "CD163+"
#>