Create a molecule list for an observer
create_molecule_list.RdBuild a MoleculeList for an Observer, selecting which molecules the
observer applies to. This is a small builder that returns the raw named
list for create_observer() or observer$molecule_list.
Arguments
- for_all
Logical (length 1). When
TRUE, the observer applies to all molecules. Omitted whenNULL.- include
Character vector of molecule names to include. Always serialises as a JSON array, even for a single name. Omitted when
NULL.- exclude
Character vector of molecule names to exclude. Always serialises as a JSON array, even for a single name. Omitted when
NULL.
Value
A named list with ForAll, MoleculeNamesToInclude, and
MoleculeNamesToExclude for the arguments supplied (an empty named
list when all are NULL).
Examples
create_molecule_list(for_all = FALSE, include = "Drug")
#> $ForAll
#> [1] FALSE
#>
#> $MoleculeNamesToInclude
#> $MoleculeNamesToInclude[[1]]
#> [1] "Drug"
#>
#>
# Multiple names and an exclusion
create_molecule_list(include = c("Drug", "Metabolite"), exclude = "Water")
#> $MoleculeNamesToInclude
#> $MoleculeNamesToInclude[[1]]
#> [1] "Drug"
#>
#> $MoleculeNamesToInclude[[2]]
#> [1] "Metabolite"
#>
#>
#> $MoleculeNamesToExclude
#> $MoleculeNamesToExclude[[1]]
#> [1] "Water"
#>
#>