Skip to contents

Plots the probability densities of GMM components for given chromosome or chromosome arm, store in a TapestriExperiment. calcGMMCopyNumber() must be run first.

Usage

plotCopyNumberGMM(
  TapestriExperiment,
  feature.id = 1,
  chromosome.scope = "chr",
  draw.boundaries = FALSE
)

Arguments

TapestriExperiment

TapestriExperiment object.

feature.id

chromosome or chromosome arm to plot.

chromosome.scope

"chr" or "arm", for plotting models for either whole chromosomes or chromosome arms.

draw.boundaries

logical, if TRUE, draw decision boundaries between each Gaussian component.

Value

ggplot object, density plot

Examples

# \donttest{
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 <- calcSmoothCopyNumber(tap.object)
#>  Smoothing copy number by median...
#>  Smoothing copy number by median... [1s]
#> 
tap.object <- calcGMMCopyNumber(tap.object,
  cell.barcodes = colnames(tap.object),
  control.copy.number = control.copy.number,
  model.components = 1:5
)
#>  Calculating GMMs using 300 input cells.
#>  Generating probe values for 500 simulated cells...
#>  Generating probe values for 500 simulated cells... [982ms]
#> 
#>  Fitting Gaussian distributions to simulated cells...
#>  Fitting Gaussian distributions to simulated cells... [11.3s]
#> 
#>  Calculating posterior probabilities...
#>  Calculating posterior probabilities... [292ms]
#> 
#>  Calling copy number from posterior probabilities...
#>  Calling copy number from posterior probabilities... [59ms]
#> 
#>  Saving whole chromosome copy number calls to altExp: smoothedCopyNumberByChr,
#>   assay: gmmCopyNumber...
#>  Saving chromosome arm copy number calls to altExp: smoothedCopyNumberByArm,
#>   assay: gmmCopyNumber...
#>  Saving GMM models and metadata to `gmmParams` slot...

tap.object <- plotCopyNumberGMM(tap.object,
  feature.id = 7,
  chromosome.scope = "chr",
  draw.boundaries = TRUE
)
# }