Learn R Programming

SomatiCA (version 2.2.0)

somaticRatio: Estimate somatic ratio for given segments.

Description

Somatic ratio is defined as the ratio of read depths between a tumor and its paired normal sample for a given segment. SomatiCA implements different methods to estimate somatic ratio.

Usage

somaticRatio(seg, data, method = "mle", adjust=FALSE)

Arguments

seg
A GRanges object, segments from larsCBSsegment().
data
Input data, from SomatiCAFormat().
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, segments with annotation of estimated somatic ratio.

See Also

See Also larsCBSsegment.

Examples

Run this code

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")

Run the code above in your browser using DataLab