Skip to contents

Computes a distance function on fitting relative copy numbers to whole number absolute values with the given ploidy and cellularity. Copied from rascal.

Usage

AbsoluteCopyNumberDistance(
  ploidy,
  cellularity,
  relative_copy_numbers,
  weights = NULL,
  distance_function = c("MAD", "RMSD")
)

Arguments

ploidy

the tumour ploidy.

cellularity

the cellularity, i.e. the fraction of cells that are from the tumour.

relative_copy_numbers

a numeric vector containing relative copy numbers, i.e. ratios of copy numbers to the average copy number.

weights

a numeric vector of weights to apply to each copy number value (should be same length as relative_copy_numbers)

distance_function

the distance function to use, either "MAD" for the mean absolute difference or "RMSD" for the root mean square difference, where differences are between the fitted absolute copy number values and the nearest whole number.

Value

the distance in the fitted absolute copy numbers to whole numbers.

Examples

data(copy_number)
copy_number <- copy_number[copy_number$sample_id == "X17222", ]
AbsoluteCopyNumberDistance(3, 0.67, copy_number$segmented)
#> [1] 0.1429545