assign_grnas()
performs the gRNA-to-cell assignments. sceptre
provides three gRNA-to-cell assignment strategies: the mixture method, the thresholding method, and the maximum method. The mixture method involves assigning gRNAs to cells using a principled mixture model. Next, the thresholding method assigns a gRNA to a cell if the UMI count of the gRNA in the cell is greater than or equal to some integer threshold. Finally, the maximum method assigns the gRNA that accounts for the greatest number of UMIs in a given cell to that cell. The maximum method is available only in low MOI. See Chapter 3 of the manual for more detailed information about assign_grnas()
.
Usage
assign_grnas(
sceptre_object,
method = "default",
print_progress = TRUE,
parallel = FALSE,
n_processors = "auto",
log_dir = tempdir(),
...
)
Arguments
- sceptre_object
a
sceptre_object
- method
(optional) a string indicating the method to use to assign the gRNAs to cells, one of
"mixture"
,"thresholding"
, or"maximum"
- print_progress
(optional; default
TRUE
) a logical indicating whether to print progress updates- parallel
(optional; default
FALSE
) a logical indicating whether to run the function in parallel- n_processors
(optional; default "auto") an integer specifying the number of processors to use if
parallel
is set toTRUE
. The default,"auto"
, automatically detects the number of processors available on the machine.- log_dir
(optional; default
tempdir()
) a string indicating the directory in which to write the log files (ignored ifparallel = FALSE
)- ...
optional method-specific additional arguments
Examples
library(sceptredata)
data("lowmoi_example_data")
# 1. import data, set default analysis parameters
sceptre_object <- import_data(
response_matrix = lowmoi_example_data$response_matrix,
grna_matrix = lowmoi_example_data$grna_matrix,
extra_covariates = lowmoi_example_data$extra_covariates,
grna_target_data_frame = lowmoi_example_data$grna_target_data_frame,
moi = "low"
) |> set_analysis_parameters()
# 2. assign gRNAs (three different methods)
sceptre_object <- sceptre_object |> assign_grnas(method = "thresholding")
sceptre_object <- sceptre_object |> assign_grnas(method = "maximum")
sceptre_object <- sceptre_object |> assign_grnas(
method = "mixture", parallel = TRUE, n_processors = 2
)
#> Running gRNA assignments in parallel. Change directories to /var/folders/7v/5sqjgh8j28lgf8qx3gbtq1h00000gp/T//RtmpHhxNRw/sceptre_logs/ and view the files assign_grnas_*.out for progress updates.