Skip to contents

get_grna_assignments() returns the gRNA-to-cell assignments contained within a sceptre_object. The output is a sparse logical matrix, with gRNAs in the rows and cells in the columns. A given entry of the matrix is set to TRUE if the given gRNA is assigned to the given cell (and FALSE otherwise).

Usage

get_grna_assignments(sceptre_object, apply_cellwise_qc = FALSE)

Arguments

sceptre_object

a sceptre_object that has had assign_grnas() called on it

apply_cellwise_qc

a logical value (i.e., TRUE or FALSE) indicating whether to return the gRNA-to-cell assignment matrix after cellwise QC has been applied (default FALSE)

Value

a sparse logical matrix containing the gRNA-to-cell assignments

Details

When using the "maximum" assignment strategy, exactly one gRNA is assigned to a given cell. In other words, each column of the gRNA-to-cell assignment matrix contains exactly one TRUE entry.

Examples

library(sceptredata)
data(highmoi_example_data)
data(grna_target_data_frame_highmoi)
# import data
sceptre_object <- import_data(
  response_matrix = highmoi_example_data$response_matrix,
  grna_matrix = highmoi_example_data$grna_matrix,
  grna_target_data_frame = grna_target_data_frame_highmoi,
  moi = "high",
  extra_covariates = highmoi_example_data$extra_covariates,
  response_names = highmoi_example_data$gene_names
)
discovery_pairs <- construct_cis_pairs(sceptre_object)
sceptre_object <- sceptre_object |>
  set_analysis_parameters(
    discovery_pairs = discovery_pairs,
    side = "left"
  ) |>
  assign_grnas(
    method = "mixture", parallel = TRUE, n_processors = 2
  ) |>
  run_qc()
#> 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.

grna_assignment_matrix <- get_grna_assignments(
  sceptre_object = sceptre_object
)
grna_assignment_matrix_with_qc <- get_grna_assignments(
  sceptre_object = sceptre_object,
  apply_cellwise_qc = TRUE
)