Skip to contents

calcCopyNumber() transforms the normalized count matrix normcounts of a TapestriExperiment object into copy number values based on a set of reference cell barcodes and given copy number value (e.g. 2 for diploid). This is practically used to set the median copy number of a usually diploid reference cell population to a known copy number value, e.g. 2, and then calculate the copy number for all the cells relative to that reference population. This occurs individually for each probe, such that the result is one copy number value per cell barcode per probe (cell-probe unit). control.copy.number is a data.frame lookup table used to indicate the copy number value and cell barcodes to use as the reference. A template for control.copy.number can be generated using generateControlCopyNumberTemplate(), which will have a row for each chromosome arm represented in TapestriExperiment.

The control.copy.number data.frame should include 3 columns named arm, copy.number, and sample.label. arm is chromosome arm names from chr1p through chrXq, copy.number is the reference copy number value (2 = diploid), and sample.label is the value corresponding to the colData column given in sample.feature to indicate the set of reference cell barcodes to use to set the copy number. This is best used in a workflow where the cells are clustered first into their respective samples, and then one cluster is used as the reference population the other clusters. This also allows for the baseline copy number to be set for each chromosome arm individually in the case where the reference population is not completely diploid.

Usage

calcCopyNumber(
  TapestriExperiment,
  control.copy.number,
  sample.feature = "cluster",
  remove.bad.probes = FALSE
)

generateControlCopyNumberTemplate(
  TapestriExperiment,
  copy.number = 2,
  sample.feature.label = NA
)

Arguments

TapestriExperiment

TapestriExperiment object.

control.copy.number

data.frame with columns arm, copy.number, and sample.label. See details.

sample.feature

Character, colData column to use for subsetting cell.barcodes. Default "cluster".

remove.bad.probes

Logical, if TRUE, probes with median normalized counts = 0 are removed from the returned TapestriExperiment. If FALSE (default), probes with median normalized counts = 0 throw error and stop function.

copy.number

Numeric, sets all entries of copy.number column in output. Default 2 (diploid).

sample.feature.label

Character, sets all entries of sample.label column in output.

Value

TapestriExperiment object with cell-probe copy number values in copyNumber assay slot.

data.frame with 3 columns named arm, copy.number, and sample.label

Functions

  • generateControlCopyNumberTemplate(): generates a data.frame template for control.copy.number in calcCopyNumber().

Examples

tap.object <- newTapestriExperimentExample() # example TapestriExperiment object
#>  Moving gRNA probe  to `altExp` slot "grnaCounts".
#>  Moving barcode probe  to `altExp` slot "barcodeCounts".
#>  Moving chrY probe(s) probe_231, probe_232, probe_233, probe_234, probe_235, probe_236, probe_237, probe_238, probe_239, and probe_240 to `altExp` slot "chrYCounts".
tap.object <- calcNormCounts(tap.object)
control.copy.number <- generateControlCopyNumberTemplate(tap.object,
  copy.number = 2,
  sample.feature.label = "cellline1"
)
tap.object <- calcCopyNumber(tap.object,
  control.copy.number,
  sample.feature = "test.cluster"
)
tap.object <- newTapestriExperimentExample() # example TapestriExperiment object
#>  Moving gRNA probe  to `altExp` slot "grnaCounts".
#>  Moving barcode probe  to `altExp` slot "barcodeCounts".
#>  Moving chrY probe(s) probe_231, probe_232, probe_233, probe_234, probe_235, probe_236, probe_237, probe_238, probe_239, and probe_240 to `altExp` slot "chrYCounts".
control.copy.number <- generateControlCopyNumberTemplate(tap.object,
  copy.number = 2,
  sample.feature.label = "cellline1"
)