Skip to contents

Computes a distance function on fitting relative copy numbers to whole number absolute values for a grid of ploidies and cellularities. Copied from rascal.

Usage

AbsoluteCopyNumberDistanceGrid(
  relative_copy_numbers,
  weights = NULL,
  min_ploidy = 1.5,
  max_ploidy = 5.5,
  ploidy_step = 0.01,
  min_cellularity = 0.01,
  max_cellularity = 1,
  cellularity_step = 0.01,
  distance_function = c("MAD", "RMSD")
)

Arguments

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)

min_ploidy, max_ploidy

the range of ploidies.

ploidy_step

the stepwise increment of ploidies along the grid.

min_cellularity, max_cellularity

the range of cellularities.

cellularity_step

the stepwise increment of cellularities along the grid.

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", ]
segments <- CopyNumberSegments(copy_number)
distances <- AbsoluteCopyNumberDistanceGrid(segments$copy_number, segments$weight)