scoreSpecificity: Calculate specificity scores for a set of targets and...

View source: R/scoreSpecificity.R

scoreSpecificityR Documentation

Calculate specificity scores for a set of targets and controls, based on the beta distribution

Description

Calculate specificity scores for a set of targets and controls. Most often used for single-cell feature barcode data, but may be useful for other applications where a positive signal needs to be distinguished from a variable background. Adapted from T-BEAM, 10x Genomics's approach to monomeric MHC antibody specificity scoring. The return is a list structure, with each list element containing a dataframe of specificity scores for each target. Likelihood scores are determined via a cumulative beta distribution function with a confidence of .925.

Usage

scoreSpecificity(
  counts, targets, controls,
  nPrior = 3, sPrior = 1)

Arguments

counts

numeric matrix, a matrix of counts with markers names as the rownames and the sample identifiers (single cells, libraries, ect) as the column names. Matrix needs to contain a row for each target and control, but can contain non-relevant rows not being used in this calculation.

targets

character vector, names of the target markers for which to test specificity. All values must appear in row names of counts.

controls

character vector, names of the control markers to be used in build null distributions for specificity. All values must appear in row names of counts.

nPrior

integer, pseudoCount for the control count to be added to the count from counts. Higher numbers for nPrior may be appropriate if you have reason to suspect noisy data and want to make high likelihood scores more difficult to achieve by chance. Defaults to 3.

sPrior

integer, pseudoCount for the target count to be added to the count from counts. Higher ratios of this to nPrior will results in lower discrimination between false and true positives, but better elimination of false negatives. Defaults to 1.

Value

a data frame of specificity scores, with one row per sample and one column for each target marker. Each value is a likelihood score for specificity for that list's antigen


mjdufort/miscHelpers documentation built on Jan. 18, 2025, 11:55 a.m.