
Generates a new ADTCounts class via DSB normalisation
new_adt_counts_dsb.RdThis function generates a new ADTCounts class using DSB normalisation from
Mulè et al., instead of CLR. When empty_drops is provided, the per-protein
background is estimated from empty droplets. Without empty_drops, the
function falls back to a 2-component k-means on the log-transformed cell
counts ("ModelNegativeADTnorm").
Usage
new_adt_counts_dsb(
raw_counts,
cell_info,
empty_drops = NULL,
isotype_names = NULL,
dsb_params = params_sc_dsb(),
scale_factor = c("standardise", "mean_subtract"),
seed = 42L,
.verbose = TRUE
)Arguments
- raw_counts
Numeric matrix. Cells x proteins matrix of raw ADT counts with cell barcodes as row names and protein names as column names.
- cell_info
Named integer vector. Output of
get_cell_info(). Defines as elements the cell indices (R-based) and as names the barcodes.- empty_drops
Optional numeric matrix. Cells x proteins matrix of empty-droplet ADT counts. If provided, used to estimate per-protein ambient background.
- isotype_names
Optional string vector. Column names in
raw_countsidentifying isotype control proteins. Required whendsb_params$use_isotype_controls = TRUE.- dsb_params
List. Output of
params_sc_dsb()with DSB parameters.- scale_factor
String. One of
c("standardise", "mean_subtract"). Only used whenempty_dropsis provided.- seed
Integer. Random seed for k-means initialisation.
- .verbose
Boolean or integer. Controls verbosity and returns run times.
FALSE-> quiet,TRUEor1L-> normal verbosity,2L-> detailed verbosity.
Examples
# DSB without empty droplets, i.e. the k-means fallback, using the isotypes
adt <- generate_single_cell_test_data_adt()
cell_info <- stats::setNames(
seq_len(nrow(adt$counts)),
rownames(adt$counts)
)
new_adt_counts_dsb(
adt$counts,
cell_info = cell_info,
isotype_names = adt$var$protein_id[adt$var$is_isotype],
.verbose = FALSE
)
#> ADTCounts
#> Cells: 1000
#> Proteins: 15
#> Type: DSB