callSampleLables {karyotapR}R Documentation

Call sample labels based on feature counts

Description

callSampleLables() assigns labels (stored as colData column) to cells using feature count data in colData. This is most useful for assigning barcode labels based on barcoded reads (see countBarcodedReads). For method = max, labels are dictated by whichever input.features column has the highest number of counts. By default, ties are broken by choosing whichever label has the lowest index position (ties.method = "first"). Samples with 0 counts for all input.features columns are labeled according to neg.label. If only one feature column is used, labels are assigned to cells with counts > min.count.threshold, and neg.label otherwise.

Usage

callSampleLables(
  TapestriExperiment,
  input.features,
  output.feature = "sample.call",
  return.table = FALSE,
  neg.label = NA,
  method = "max",
  ties.method = "first",
  min.count.threshold = 1
)

Arguments

TapestriExperiment

A TapestriExperiment object.

input.features

Character vector, column names in colData to evaluate.

output.feature

Character, column name to use for the call output. Default "sample.call".

return.table

Logical, if TRUE, returns a data.frame of the sample.calls. If FALSE (default), returns updated TapestriExperiment object.

neg.label

Character, label for samples with no counts. Default NA.

method

Character, call method. Only "max" currently supported, calls based on whichever input.features column has the most counts.

ties.method

Character, passed to max.col() indicating how to break ties. Default "first".

min.count.threshold

Numeric, minimum number of counts per cell to use for call. Default 1.

Value

A TapestriExperiment object with sample calls added to colData column sample.name. If return.table == TRUE, a data.frame of sample calls.

Examples

tap.object <- newTapestriExperimentExample() # example TapestriExperiment object
colData(tap.object)$gRNA1 <- 2 # example barcode counts
colData(tap.object)$gRNA2 <- 10 # example barcode counts
tap.object <- callSampleLables(tap.object,
  input.features = c("gRNA1", "gRNA2"),
  output.feature = "sample.grna"
)

[Package karyotapR version 1.0.1 Index]