refineSegment: Refine the segmentation based on estimated somatic ratio.

Description Usage Arguments Value Author(s) See Also Examples

Description

Neighbor segments with difference in somatic ratio less than certain threshold will be merged together.

Usage

1
refineSegment(segmentwithratio, data, threshold1 = 0.01, threshold2 = 0.05, adjust = FALSE, method = "mle")

Arguments

segmentwithratio

A GRanges object, segments with annotation of somatic ratio, usually the output of somaticRatio().

data

A GRanges object, input data from SomatiCAFormat().

threshold1

The threshold used to merge the segments based on median LAF. Default is 0.01.

threshold2

The threshold used to merge the segments based on somatic ratio. Default is 0.05.

method

Method used to estimate somatic ratio of given segments. For the "mle" method somatic ratio is estimated by a maximum likelihood approach. For the "mean" method, somatic ratio is estimated by the ratio between mean of tumor sample and normal sample. For the "geometric", somatic ratio is estimated by geometric mean of somatic ratios of all sites in a given segment.

adjust

Adjust the normal and tumor library and make their median equal.

Value

A GRanges object, refined segments with annotation of somatic ratio.

Author(s)

Mengjie Chen

See Also

See Also somaticRatio.

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
chr <- c("chr1", "chr1", "chr1", "chr2", "chr2", "chr2")
start <- c(1, 300, 600, 1, 200, 400) 
end <- c(300, 600, 800, 200, 400, 650)
medLAF <- c(0.2, 0.4, 0.3, 0.2, 0.3, 0.4)
gLAF <- rep(0.4, 6)
seg <- GRanges(seqnames=chr, 
                   ranges=IRanges(start=start, end=end), 
                   medLAF=medLAF, 
                   medgLAF=gLAF) 


rawLAF <- c(rnorm(300, 0.2, 0.05), rnorm(300, 0.4, 0.05), rnorm(200, 0.3, 0.05), 
            rnorm(200, 0.2, 0.05), rnorm(200, 0.3, 0.05), rnorm(250, 0.4, 0.05)) 
germLAF <- c(rnorm(800+650, 0.4, 0.05)) 
reads1 <- c(rpois(300, 25), rpois(300, 50), rpois(200, 60),  rpois(200, 25), 
            rpois(200, 40), rpois(250, 50))
reads2 <- rpois(800+650,50)
chr <- c(rep("chr1", 800), rep("chr2", 650))
position <- c(c(1:800), c(1:650))
zygo <- rep("het", 800+650)
data <- GRanges(seqnames=chr, 
                 ranges=IRanges(start=position, width=1), 
                 zygosity=zygo, 
                 tCount=reads1, 
                 LAF=rawLAF, 
                 tCountN=reads2, 
                 germLAF=germLAF) 
                 
x <- somaticRatio(seg, data, method = "mle")
y <- refineSegment(x, data)

SomatiCA documentation built on Oct. 5, 2016, 4:18 a.m.