Merge neighboring segments with same somatic copy number and events.

Share:

Description

Take segments with subclonality characterization as input and merge same events.

Usage

1
MergeSegment(segment)

Arguments

segment

A GRanges object, output of subclonality().

Value

A GRanges object, merged segments.

Author(s)

Mengjie Chen

See Also

See Also as subclonality, ~~~

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
### This is just a toy example.
chr <- c("chr1", "chr1", "chr1", "chr1", "chr2", "chr2", "chr2", "chr2")
start <- c(1, 41, 61 , 71, 1, 51, 71, 91)
end <- c(41, 61 , 71, 91, 51, 71, 91, 101)
medLAF <- c(0.15, 0.27, 0.4, 0.42, 0.4, 0.41, 0.42, 0.39)
medgermlineLAF <- rep(0.42, 8)
ratio <- c(0.5, 0.7, 1.1, 1, 1.1, 1, 1, 0.9)
copynumber <- c(1, 1, 2, 2, 2, 2, 2, 2)
event <- c("LOH", "Loss", "=", "=", "=", "=", "=", "=")
clonality <- c("Clonal", "subclonal_loss", "subclonal_gain", "=", "=", "=", "=", "subclonal_loss")
germlinecopynumber <- c(2, 2, 2, 2, 2, 2, 2, 2)
subclonecopynumber <- c(1, 1, 3, 2, 2, 2, 2, 1)
subpercent <- c(1, 0.4, 0.1, 0, 0, 0, 0, 0.1)
x <- GRanges(seqnames=chr, 
             ranges=IRanges(start=start, end=end),
             medLAF=medLAF,
	           medgLAF=medgermlineLAF,
	           ratio=ratio,
             somaCN=copynumber, 
             event=event,
	           clonality=clonality,
	           germCN=germlinecopynumber,
	           subclonalCN=subclonecopynumber,
             subpercent=subpercent)                
merged <- MergeSegment(x)