Last data update: 2014.03.03

R: Recursive segmentation algorithm for CNV detection and...
segmentR Documentation

Recursive segmentation algorithm for CNV detection and genotyping

Description

Recursive segmentation algorithm for CNV detection and genotyping, using normalized read depth from whole exome sequencing.

Usage

segment(Y_qc, Yhat, optK, K, sampname_qc, ref_qc, chr, lmax, mode)

Arguments

Y_qc

Raw read depth matrix after quality control procedure returned from qc

Yhat

Normalized read depth matrix returned from normalize

optK

Optimal value K returned from choiceofK

K

Number of latent Poisson factors. Can be an integer if optimal solution has been chosen or a vector of integers so that AIC, BIC, and RSS are computed for choice of optimal k.

sampname_qc

Vector of sample names after quality control procedure returned from qc

ref_qc

IRanges object of genomic positions of each exon after quality control procedure returned from qc

chr

Chromosome number returned from getbambed

lmax

Maximum CNV length in number of exons returned.

mode

Can be either "integer" or "fraction", which respectively correspond to format of the returned copy numbers.

Value

Final callset of CNVs with genotyping results.

Author(s)

Yuchao Jiang yuchaoj@wharton.upenn.edu

See Also

normalize, choiceofK

Examples

Y_qc <- qcObjDemo$Y_qc
Yhat <- normObjDemo$Yhat
BIC <- normObjDemo$BIC
K <- normObjDemo$K
sampname_qc <- qcObjDemo$sampname_qc
ref_qc <- qcObjDemo$ref_qc
chr <- bambedObjDemo$chr
finalcall <- segment(Y_qc, Yhat, optK = K[which.max(BIC)], K = K, sampname_qc,
    ref_qc, chr, lmax = 200, mode = "integer")
finalcall

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(CODEX)
Loading required package: Rsamtools
Loading required package: GenomeInfoDb
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Loading required package: S4Vectors

Attaching package: 'S4Vectors'

The following objects are masked from 'package:base':

    colMeans, colSums, expand.grid, rowMeans, rowSums

Loading required package: IRanges
Loading required package: GenomicRanges
Loading required package: Biostrings
Loading required package: XVector
Loading required package: BSgenome.Hsapiens.UCSC.hg19
Loading required package: BSgenome
Loading required package: rtracklayer

Attaching package: 'CODEX'

The following object is masked from 'package:BiocGenerics':

    normalize

> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/CODEX/segment.Rd_%03d_medium.png", width=480, height=480)
> ### Name: segment
> ### Title: Recursive segmentation algorithm for CNV detection and
> ###   genotyping
> ### Aliases: segment
> ### Keywords: package
> 
> ### ** Examples
> 
> Y_qc <- qcObjDemo$Y_qc
> Yhat <- normObjDemo$Yhat
> BIC <- normObjDemo$BIC
> K <- normObjDemo$K
> sampname_qc <- qcObjDemo$sampname_qc
> ref_qc <- qcObjDemo$ref_qc
> chr <- bambedObjDemo$chr
> finalcall <- segment(Y_qc, Yhat, optK = K[which.max(BIC)], K = K, sampname_qc,
+     ref_qc, chr, lmax = 200, mode = "integer")
Segmenting sample 1: NA06994.
Segmenting sample 2: NA10847.
Segmenting sample 3: NA11840.
Segmenting sample 4: NA12249.
Segmenting sample 5: NA12716.
Segmenting sample 6: NA12750.
Segmenting sample 7: NA12751.
Segmenting sample 8: NA12760.
Segmenting sample 9: NA12761.
Segmenting sample 10: NA12763.
Segmenting sample 11: NA18966.
Segmenting sample 12: NA18967.
Segmenting sample 13: NA18968.
Segmenting sample 14: NA18969.
Segmenting sample 15: NA18970.
Segmenting sample 16: NA18971.
Segmenting sample 17: NA18972.
Segmenting sample 18: NA18973.
Segmenting sample 19: NA18974.
Segmenting sample 20: NA18975.
Segmenting sample 21: NA18976.
Segmenting sample 22: NA18981.
Segmenting sample 23: NA18987.
Segmenting sample 24: NA18990.
Segmenting sample 25: NA18991.
Segmenting sample 26: NA19098.
Segmenting sample 27: NA19119.
Segmenting sample 28: NA19131.
Segmenting sample 29: NA19137.
Segmenting sample 30: NA19138.
Segmenting sample 31: NA19141.
Segmenting sample 32: NA19143.
Segmenting sample 33: NA19144.
Segmenting sample 34: NA19152.
Segmenting sample 35: NA19153.
Segmenting sample 36: NA19159.
Segmenting sample 37: NA19160.
Segmenting sample 38: NA19171.
Segmenting sample 39: NA19200.
Segmenting sample 40: NA19201.
Segmenting sample 41: NA19204.
Segmenting sample 42: NA19206.
Segmenting sample 43: NA19207.
Segmenting sample 44: NA19209.
Segmenting sample 45: NA19210.
Segmenting sample 46: NA19223.
> finalcall
 sample_name chr  cnv   st_bp      ed_bp      length_kb st_exon ed_exon raw_cov
 "NA18990"   "22" "dup" "22312814" "22326373" "13.56"   "60"    "72"    "1382" 
 norm_cov   copy_no lratio   mBIC   
 "1005.096" "3"     "57.782" "47.18"
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>