Generate a Template Screening Function with Optional Roxygen2 Documentation
Source:R/69-TemplateScreenFunc.R
TemplateScreenFunc.RdCreates a scaffold for a new screening function that conforms to the expected
interface for bulk-scRNA integration workflows. The template includes standard
parameters (e.g., matched_bulk, sc_data, phenotype) and a return structure
compatible with downstream validation (e.g., ValidateScreenFunc). Optionally
includes roxygen2 documentation and supports writing to a new or existing .R file.
When filename = "current", the function attempts to append to the active
script in RStudio or Positron (requires rstudioapi).
Usage
TemplateScreenFunc(
filename = "my_screen.R",
func_name = "my_screen",
append = TRUE,
documentation = FALSE,
open = TRUE,
...
)Arguments
- filename
Character. Path to the output
.Rfile. If"current"(case-insensitive), uses the currently open script in RStudio/Positron. Must end in.Rif specified explicitly. Default:"my_screen.R".- func_name
Character. Name of the generated function. Must be a valid R identifier (starts with letter, followed by letters, digits,
_, or.). Default:"my_screen".- append
Logical. If
TRUE(default), appends to an existing file; otherwise, overwrites it. If overwriting a non-empty file, prompts for user confirmation.- documentation
Logical. Whether to include a full roxygen2 documentation block above the function. Default:
FALSE. IfTRUE, users should rundevtools::document()afterward.- open
Logical. Whether to open the file in the RStudio/Positron editor after writing (if available). Default:
TRUE.- ...
Additional arguments (currently unused, reserved for future extension).
See also
Other Add_Screen_method:
RegisterScreenMethod(),
ScreenStrategy,
ValidateScreenFunc()