model.apply: Computes copy number for a set of CGH segments

Description Usage Arguments Value Author(s) See Also Examples

Description

This function translates log ratios of a set of segments into copy numbers, applying a copy number model as produced by model.auto or model.test.

If exact is set set to FALSE, copy numbers are rounded and consecutive segments with the same copy number are merged.

Usage

1
2
3
  model.apply(segStarts, segEnds, segChroms, segLogRatios, segLengths, model = NA,
    center = model['center'], width = model['width'], ploidy = model['ploidy'],
    exact = FALSE, merge = TRUE)

Arguments

segStarts

Numeric vector, the starting positions of the CGH segments to modelize.

segEnds

Numeric vector, the endind positions of the CGH segments to modelize.

segChroms

Vector, the chromosome holding the CGH segments to modelize.

segLogRatios

Double vector, the log ratios of the CGH segments to modelize.

segLengths

Numeric vector, the lengths of the CGH segments to modelize.

model

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

center

Single double value, the center parameter to use in the model.

width

Single double value, the width parameter to use in the model.

ploidy

Single numeric value, copy number supposed to be the most common within the analyzed genome.

exact

Single logical value, whether to return continue copy numbers (double) or discrete ones (integer).

merge

Single logical value, whether to merge consecutive segments with the same copy number when exact is FALSE.

Value

Returns a data.frame describing the segments :

segStarts

Extracted from the segStarts argument.

segEnds

Extracted from the segEnds argument.

segChroms

Extracted from the segChroms argument.

segLogRatios

Double, the theoretic log ratio of the segment, with 2 copies as reference.

segCopies

Numeric, the copy number of the segment.

segLengths

Extracted from the segLengths argument.

Author(s)

Sylvain Mareschal

See Also

copies, model.auto, model.test

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
  # 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
  )
  
  # Profile simplification
  segments <- model.apply(
    segStarts,
    segEnds,
    segChroms,
    segLogRatios,
    segLengths,
    model = model,
    exact = FALSE,
    merge = TRUE
  )
  layout(matrix(1:2, ncol=1))
  plot(x=segStarts, y=segLogRatios, type="s", xlab="Position", ylab="Log Ratios")
  plot(x=segments$segStarts, y=segments$segCopies, type="s", xlab="Position", ylab="Copies")
  print(segments)
  
  layout(1)

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