copies: LogRatio to copies conversion

Description Usage Arguments Value Author(s) See Also Examples

Description

copies applies a model to a vector of logRatios, converting them into copy amounts.

LCN is similar, but returns only Log-ratio related Copy Numbers, corresponding to a model with 0 as center, 1 as width and 2 as ploidy. See the references for further details on the models.

Usage

1
2
3
  LCN(x, exact = TRUE)
  copies(x, model = NA, center = model['center'], width = model['width'],
    ploidy = model['ploidy'], exact = TRUE, from = c("logRatios", "LCN", "copies"))

Arguments

x

Numeric vector, the values to be converted (their nature depends on from).

model

A numeric vector, as returned by model.auto or model.test. Can be NA if parameters are provided via other arguments.

center

Single numeric value, the most common LCN within the analyzed genome.

width

Single numeric value, LCN gaps between two consecutive real copy amounts.

ploidy

Single numeric value, the real copy amount corresponding to center LCN. A few altered human genome should have a ploidy of 2, use 0 to compute relative copy numbers rather than absolute ones.

exact

Single logical value, whether to round copy numbers or not.

from

Single character value defining what computation apply to x. "logRatios" assumes x to be logRatios to be converted to copy numbers, applying a full model (center, width, ploidy). "LCN" assumes x to be Log-ratio related Copy Numbers, as returned by LCN, so only the exact argument is used. "copies" assumes x to be already modelized copy numbers to be turned back into logRatios, using ploidy as reference.

Value

A numeric vector the same length as x.

Author(s)

Sylvain Mareschal

See Also

model.auto, model.apply

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
  # Generating random segmentation results
  ## with 30% normal cells contamination
  ## with +10% for normal DNA labelling
  segLogRatios <- c(
    rnorm(
      sample(5:20, 1),
      mean = log((1*0.7 + 2*0.3)/(2*1.1), 2),   # One deletion
      sd = 0.08
    ),
    rnorm(
      sample(80:120, 1),
      mean = log(2/(2*1.1), 2),                 # No alteration
      sd = 0.08
    ),
    rnorm(
      sample(40:60, 1),
      mean = log((3*0.7 + 2*0.3)/(2*1.1), 2),   # One more copy
      sd = 0.08
    )
  )
  segLogRatios <- sample(segLogRatios)
  segLengths <- as.integer(3 + round(rchisq(length(segLogRatios), 1)*100))
  segEnds <- cumsum(segLengths)
  segStarts <- c(1L, head(segEnds, -1))
  segChroms <- rep("chr1", length(segEnds))
  
  # Generated genome
  genome <- data.frame(
    segChroms,
    segStarts,
    segEnds,
    segLogRatios,
    segLengths
  )
  print(genome)
  
  # Automatic modelization
  model <- model.auto(
    segLogRatios = segLogRatios,
    segChroms = segChroms,
    segLengths = segLengths
  )
  
  # Relative copy numbers
  print(
    copies(
      segLogRatios,
      model = model,
      ploidy = 0,
	  exact = FALSE
    )
  )
  
  # Absolute copy number (assuming n=2)
  print(
    copies(
      segLogRatios,
      model = model,
      ploidy = 2,
      exact = FALSE
    )
  )

cghRA documentation built on May 2, 2019, 3:34 a.m.