get_grna_assignments: Get gRNA assignments

View source: R/getters_and_setters.R

get_grna_assignmentsR Documentation

Get gRNA assignments

Description

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)

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.

Value

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

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()

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
)

timothy-barry/sceptre documentation built on Nov. 19, 2024, 10:04 a.m.