Last data update: 2014.03.03

R: Get SCE coordinates
getSCEcoordinatesR Documentation

Get SCE coordinates

Description

Extracts the coordinates of a sister chromatid exchanges (SCE) from an aneuBiHMM object.

Usage

getSCEcoordinates(model, resolution = c(3, 6), min.segwidth = 2,
  fragments = NULL, min.reads = 50)

Arguments

model

An aneuBiHMM object.

resolution

An integer vector specifying the resolution at bin level at which to scan for SCE events.

min.segwidth

Minimum segment length in bins when scanning for SCE events.

fragments

A GRanges object with read fragments or a file that contains such an object. These reads will be used for fine mapping of the SCE events.

min.reads

Minimum number of reads required for SCE refinement.

Value

A GRanges object containing the SCE coordinates.

Author(s)

Aaron Taudt

Examples

## Get an example BED file with single-cell-sequencing reads
bedfile <- system.file("extdata", "KK150311_VI_07.bam.bed.gz", package="AneuFinderData")
## Bin the BAM file into bin size 1Mp
binned <- binReads(bedfile, format='bed', assembly='hg19', binsize=1e6,
                  chromosomes=c(1:22,'X','Y'), pairedEndReads=TRUE)
## Fit the Hidden Markov Model
model <- findSCEs(binned[[1]], eps=0.1, max.time=60)
## Find sister chromatid exchanges
model$sce <- getSCEcoordinates(model)
print(model$sce)
plot(model)

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(AneuFinder)
Loading required package: GenomicRanges
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
Loading required package: stats4

Attaching package: 'S4Vectors'

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

    colMeans, colSums, expand.grid, rowMeans, rowSums

Loading required package: IRanges
Loading required package: GenomeInfoDb
Loading required package: cowplot
Loading required package: ggplot2

Attaching package: 'cowplot'

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

    ggsave

Loading required package: AneuFinderData
Loading AneuFinder
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/AneuFinder/getSCEcoordinates.Rd_%03d_medium.png", width=480, height=480)
> ### Name: getSCEcoordinates
> ### Title: Get SCE coordinates
> ### Aliases: getSCEcoordinates
> 
> ### ** Examples
> 
> ## Get an example BED file with single-cell-sequencing reads
> bedfile <- system.file("extdata", "KK150311_VI_07.bam.bed.gz", package="AneuFinderData")
> ## Bin the BAM file into bin size 1Mp
> binned <- binReads(bedfile, format='bed', assembly='hg19', binsize=1e6,
+                   chromosomes=c(1:22,'X','Y'), pairedEndReads=TRUE)
Reading file KK150311_VI_07.bam.bed.gz ... 1.99s
Fetching chromosome lengths from UCSC ... 0.79s
Filtering reads ... 0.39s
Calculating complexity ...max count before zero is les than min required count (4), sample not sufficiently deep or duplicates removed
 0.41s
Removing duplicate reads ... 0.29s
Calculating coverage ... 0.54s
Making fixed-width bins for bin size 1e+06 ... 0.42s
Binning into bin size 1e+06 with on average 163.62 reads per bin
Counting overlaps for offset 0 ... 0.07s
Warning messages:
1: In FUN(genome = names(SUPPORTED_UCSC_GENOMES)[idx], circ_seqs = supported_genome$circ_seqs,  :
  NCBI seqlevel was set to NA for hg19 UCSC seqlevel(s) not in the NCBI
  assembly: chrM
2: In valid.GenomicRanges.seqinfo(x, suggest.trim = TRUE) :
  GRanges object contains 14735 out-of-bound ranges located on sequences
  13, 14, 15, 16, 17, 18, 19, X, and Y. Note that only ranges located on
  a non-circular sequence whose length is not NA can be considered
  out-of-bound (use seqlengths() and isCircular() to get the lengths and
  circularity flags of the underlying sequences). You can use trim() to
  trim these ranges. See ?`trim,GenomicRanges-method` for more
  information.
3: In bed2GRanges(file, assembly = assembly, chromosomes = chromosomes,  :
  Not using chromosomes 20, 21, 22 because they are not in the data.
4: In estimateComplexity(data) :
  Complexity estimation with preseqR failed.
5: In value[[3L]](cond) :
  Complexity estimation with Michaelis-Menten failed.
6: In valid.GenomicRanges.seqinfo(x, suggest.trim = TRUE) :
  GRanges object contains 14735 out-of-bound ranges located on sequences
  13, 14, 15, 16, 17, 18, 19, X, and Y. Note that only ranges located on
  a non-circular sequence whose length is not NA can be considered
  out-of-bound (use seqlengths() and isCircular() to get the lengths and
  circularity flags of the underlying sequences). You can use trim() to
  trim these ranges. See ?`trim,GenomicRanges-method` for more
  information.
> ## Fit the Hidden Markov Model
> model <- findSCEs(binned[[1]], eps=0.1, max.time=60)

findSCEs():
===========
Find CNVs for ID = KK150311_VI_07.bam.bed.gz:
Replaced read counts > 297 (99.9% quantile) by 297 in 6 bins. Set option 'count.cutoff.quantile=1' to disable this filtering. This filtering was done to increase the speed of the HMM and should not affect the results.


--------------------------------------------------------------------------------
Running univariate
Trial 1 / 5
number of states = 12
number of bins = 5854
maximum number of iterations = 1000
maximum running time = 60 sec
epsilon = 1
data mean = 79.4076, data variance = 5492.24
 Iteration              log(P)             dlog(P)   Diff in posterior    Time in sec
         0                -inf                   -                   -              0
         1      -238491.543249                 inf         5854.000000              0
         2       -22407.767348       216083.775901         8813.599754              0
         3       -20132.355452         2275.411896         2182.615610              0
         4       -20040.051916           92.303537          157.950637              0
         5       -20027.796828           12.255087           69.828931              0
         6       -20020.626081            7.170747           46.886898              0
         7       -20015.878583            4.747498           29.973946              0
         8       -20011.855050            4.023533           22.460521              0
         9       -20008.390234            3.464815           15.783727              0
        10       -20002.174053            6.216181           51.684656              0
        11       -19987.255990           14.918063           42.943213              0
        12       -19981.856022            5.399968           23.324936              0
        13       -19978.469739            3.386283            7.665198              0
        14       -19975.377433            3.092306            5.967936              0
        15       -19972.398136            2.979297            2.176670              0
        16       -19969.493087            2.905049            2.332388              0
        17       -19966.652209            2.840878            1.442033              0
        18       -19963.875041            2.777168            1.745757              0
        19       -19961.167770            2.707270            1.491031              0
 Iteration              log(P)             dlog(P)   Diff in posterior    Time in sec
        20       -19958.537522            2.630248            1.497193              0
        21       -19955.986089            2.551433            1.268013              0
        22       -19953.509184            2.476905            1.117429              0
        23       -19951.100458            2.408726            0.975868              0
        24       -19948.754519            2.345939            0.910804              0
        25       -19946.467543            2.286976            0.875202              0
        26       -19944.236841            2.230702            0.860119              0
        27       -19942.060360            2.176481            0.851539              0
        28       -19939.936376            2.123984            0.856703              0
        29       -19937.863338            2.073038            0.863397              0
        30       -19935.839793            2.023545            0.867885              0
        31       -19933.864356            1.975437            0.870361              0
        32       -19931.935695            1.928661            0.869775              0
        33       -19930.052523            1.883172            0.867111              0
        34       -19928.213595            1.838928            0.863097              0
        35       -19926.417706            1.795889            0.858232              0
        36       -19924.663687            1.754018            0.852837              0
        37       -19922.950409            1.713279            0.847140              0
        38       -19921.276773            1.673636            0.841293              0
        39       -19919.641718            1.635055            0.835384              0
 Iteration              log(P)             dlog(P)   Diff in posterior    Time in sec
        40       -19918.044212            1.597505            0.829527              0
        41       -19916.483258            1.560955            0.823653              0
        42       -19914.957885            1.525372            0.817788              0
        43       -19913.467156            1.490729            0.811956              0
        44       -19912.010159            1.456997            0.806157              0
        45       -19910.586010            1.424149            0.800397              0
        46       -19909.193852            1.392158            0.794685              0
        47       -19907.832854            1.360998            0.789046              0
        48       -19906.502208            1.330646            0.783461              0
        49       -19905.201131            1.301077            0.777923              0
        50       -19903.928863            1.272268            0.772427              0
        51       -19902.684667            1.244196            0.767000              0
        52       -19901.467826            1.216841            0.761640              0
        53       -19900.277646            1.190180            0.756316              0
        54       -19899.113451            1.164195            0.751034              0
        55       -19897.974585            1.138865            0.745791              0
        56       -19896.860413            1.114172            0.740585              0
        57       -19895.770316            1.090097            0.735413              0
        58       -19894.703694            1.066622            0.730274              0
        59       -19893.659963            1.043731            0.725185              1
 Iteration              log(P)             dlog(P)   Diff in posterior    Time in sec
        60       -19892.638557            1.021406            0.720158              1
        61       -19891.638924            0.999632            0.715177              1
Convergence reached!
Trial 2 / 5
number of states = 12
number of bins = 5854
maximum number of iterations = 1000
maximum running time = 60 sec
epsilon = 1
data mean = 79.4076, data variance = 5492.24
 Iteration              log(P)             dlog(P)   Diff in posterior    Time in sec
         0                -inf                   -                   -              0
         1      -200055.546213                 inf         5854.000000              0
         2       -29361.821249       170693.724964         5299.890971              0
         3       -25586.413996         3775.407253         1711.225671              0
         4       -23971.559710         1614.854286         2362.630388              0
         5       -23737.611434          233.948276          519.527438              0
         6       -23718.782788           18.828646          127.729207              0
         7       -23712.380406            6.402383           40.733279              0
         8       -23709.353607            3.026799           26.311663              0
         9       -23706.209498            3.144109           15.467631              0
        10       -23703.673535            2.535963           12.269023              0
        11       -23702.525006            1.148529            7.235212              0
        12       -23701.939517            0.585489            4.132252              0
Convergence reached!
Trial 3 / 5
number of states = 12
number of bins = 5854
maximum number of iterations = 1000
maximum running time = 60 sec
epsilon = 1
data mean = 79.4076, data variance = 5492.24
 Iteration              log(P)             dlog(P)   Diff in posterior    Time in sec
         0                -inf                   -                   -              0
         1      -329838.854256                 inf         5854.000000              0
         2       -26985.345689       302853.508567         5648.138838              0
         3       -23735.770357         3249.575332         4240.025076              0
         4       -21161.086967         2574.683390         2028.213841              0
         5       -20178.613122          982.473844          726.830845              0
         6       -19533.188103          645.425019          642.834532              0
         7       -19174.303699          358.884405          628.247987              0
         8       -19002.141671          172.162028          530.963923              0
         9       -18942.971617           59.170054          382.954442              0
        10       -18897.070894           45.900723          319.135577              0
        11       -18845.785770           51.285124          308.253926              0
        12       -18791.128763           54.657007          300.168505              0
        13       -18745.331016           45.797747          282.098549              0
        14       -18708.999507           36.331509          259.228924              0
        15       -18678.679566           30.319941          232.360369              0
        16       -18654.062602           24.616963          196.783636              0
        17       -18636.187062           17.875540          151.387335              0
        18       -18625.176633           11.010430          107.937867              0
        19       -18618.818111            6.358522           77.293013              0
 Iteration              log(P)             dlog(P)   Diff in posterior    Time in sec
        20       -18614.519361            4.298750           59.160438              0
        21       -18610.410823            4.108538           51.170212              0
        22       -18606.234585            4.176238           44.709125              0
        23       -18603.774985            2.459600           35.158332              0
        24       -18602.266817            1.508168           27.986924              0
        25       -18600.847176            1.419641           24.868078              0
        26       -18599.352226            1.494950           23.877101              0
        27       -18597.972274            1.379952           23.037540              0
        28       -18596.881278            1.090996           21.607551              0
        29       -18596.047650            0.833628           19.800431              0
Convergence reached!
Trial 4 / 5
number of states = 12
number of bins = 5854
maximum number of iterations = 1000
maximum running time = 60 sec
epsilon = 1
data mean = 79.4076, data variance = 5492.24
 Iteration              log(P)             dlog(P)   Diff in posterior    Time in sec
         0                -inf                   -                   -              0
         1       -28758.272619                 inf         5854.000000              0
         2       -19855.207561         8903.065057         2105.353299              0
         3       -19391.980894          463.226668          892.656525              0
         4       -19189.615742          202.365152          679.709234              0
         5       -19050.710189          138.905553          644.257793              0
         6       -18940.838597          109.871592          638.665259              0
         7       -18848.360407           92.478190          627.961439              0
         8       -18770.346090           78.014317          590.383846              0
         9       -18707.815292           62.530799          520.317660              0
        10       -18661.075197           46.740095          430.934591              0
        11       -18628.167489           32.907708          334.795719              0
        12       -18607.048579           21.118910          241.334676              0
        13       -18595.560635           11.487944          167.371850              0
        14       -18589.513322            6.047312          121.445258              0
        15       -18585.298681            4.214642           95.865010              0
        16       -18581.405997            3.892684           81.312546              0
        17       -18577.896890            3.509107           69.363085              0
        18       -18575.365158            2.531731           59.127646              0
        19       -18573.433712            1.931447           51.273415              0
 Iteration              log(P)             dlog(P)   Diff in posterior    Time in sec
        20       -18571.841536            1.592176           45.129759              0
        21       -18570.528223            1.313313           40.055291              0
        22       -18569.474794            1.053429           35.605066              0
        23       -18568.646091            0.828703           31.593846              0
Convergence reached!
Trial 5 / 5
number of states = 12
number of bins = 5854
maximum number of iterations = 1000
maximum running time = 60 sec
epsilon = 1
data mean = 79.4076, data variance = 5492.24
 Iteration              log(P)             dlog(P)   Diff in posterior    Time in sec
         0                -inf                   -                   -              0
         1       -33084.912375                 inf         5854.000000              0
         2       -21135.638982        11949.273393          826.079302              0
         3       -20782.298992          353.339990          602.183391              0
         4       -20544.173130          238.125861          656.236195              0
         5       -20341.324611          202.848520          636.470742              0
         6       -20196.028765          145.295845          607.227292              0
         7       -20059.801269          136.227497          634.630365              0
         8       -19933.273270          126.527998          673.316784              0
         9       -19825.988300          107.284970          754.452920              0
        10       -19712.088832          113.899468          891.607469              0
        11       -19588.648095          123.440738          708.995506              0
        12       -19501.944727           86.703368          462.974213              1
        13       -19434.261264           67.683463          433.507121              1
        14       -19376.027507           58.233757          431.292638              1
        15       -19327.552002           48.475504          390.799136              1
        16       -19287.874374           39.677629          334.662053              1
        17       -19251.214537           36.659837          290.198330              1
        18       -19214.136631           37.077907          280.108031              1
        19       -19174.280971           39.855660          288.663721              1
 Iteration              log(P)             dlog(P)   Diff in posterior    Time in sec
        20       -19135.158180           39.122791          289.469703              1
        21       -19102.636721           32.521459          277.989423              1
        22       -19076.989926           25.646795          246.735496              1
        23       -19059.671561           17.318365          206.287755              1
        24       -19049.521717           10.149844          167.380808              1
        25       -19042.985037            6.536680          137.382170              1
        26       -19038.412813            4.572224          112.396063              1
        27       -19034.274256            4.138557           92.306475              1
        28       -19026.567364            7.706891           81.951509              1
        29       -19018.552543            8.014821           77.556668              1
        30       -19013.989744            4.562799           71.621592              1
        31       -19011.417268            2.572477           63.701819              1
        32       -19009.796775            1.620493           55.699770              1
        33       -19008.661945            1.134829           48.540978              1
        34       -19007.708093            0.953852           42.924711              1
Convergence reached!
Rerunning trial 1 with eps = 0.1
number of states = 12
number of bins = 5854
maximum number of iterations = 1000
maximum running time = 60 sec
epsilon = 0.1
data mean = 79.4076, data variance = 5492.24
 Iteration              log(P)             dlog(P)   Diff in posterior    Time in sec
         0                -inf                   -                   -              0
         1       -19891.638924                 inf         5854.000000              0
         2       -19890.660531            0.978393            0.710233              0
         3       -19889.702856            0.957674            0.705318              0
         4       -19888.765396            0.937461            0.700443              0
         5       -19887.847657            0.917738            0.695613              0
         6       -19886.949164            0.898494            0.690812              0
         7       -19886.069451            0.879713            0.686037              0
         8       -19885.208067            0.861384            0.681288              0
         9       -19884.364573            0.843494            0.676563              0
        10       -19883.538543            0.826030            0.671862              0
        11       -19882.729561            0.808982            0.667186              0
        12       -19881.937224            0.792338            0.662534              0
        13       -19881.161138            0.776086            0.657905              0
        14       -19880.400921            0.760217            0.653302              0
        15       -19879.656202            0.744719            0.648719              0
        16       -19878.926619            0.729583            0.644157              0
        17       -19878.211820            0.714799            0.639616              0
        18       -19877.511461            0.700358            0.635096              0
        19       -19876.825210            0.686251            0.630601              0
 Iteration              log(P)             dlog(P)   Diff in posterior    Time in sec
        20       -19876.152742            0.672468            0.626125              0
        21       -19875.493740            0.659002            0.621670              0
        22       -19874.847898            0.645843            0.617234              0
        23       -19874.214914            0.632983            0.612818              0
        24       -19873.594498            0.620416            0.608421              0
        25       -19872.986366            0.608133            0.604043              0
        26       -19872.390240            0.596126            0.599685              0
        27       -19871.805851            0.584389            0.595345              0
        28       -19871.232936            0.572915            0.591025              0
        29       -19870.671240            0.561696            0.586722              0
        30       -19870.120513            0.550727            0.582439              0
        31       -19869.580512            0.540001            0.578174              1
        32       -19869.051000            0.529512            0.573928              1
        33       -19868.531747            0.519253            0.569708              1
        34       -19868.022528            0.509219            0.565505              1
        35       -19867.523124            0.499404            0.561320              1
        36       -19867.033321            0.489803            0.557153              1
        37       -19866.552910            0.480411            0.553004              1
        38       -19866.081688            0.471222            0.548875              1
        39       -19865.619458            0.462230            0.544764              1
 Iteration              log(P)             dlog(P)   Diff in posterior    Time in sec
        40       -19865.166025            0.453432            0.540669              1
        41       -19864.721203            0.444823            0.536592              1
        42       -19864.284806            0.436397            0.532532              1
        43       -19863.856656            0.428150            0.528489              1
        44       -19863.436577            0.420079            0.524463              1
        45       -19863.024399            0.412178            0.520462              1
        46       -19862.619956            0.404443            0.516488              1
        47       -19862.223084            0.396872            0.512530              1
        48       -19861.833626            0.389458            0.508588              1
        49       -19861.451426            0.382200            0.504663              1
        50       -19861.076334            0.375092            0.500754              1
        51       -19860.708202            0.368132            0.496860              1
        52       -19860.346886            0.361316            0.492983              1
        53       -19859.992245            0.354641            0.489121              1
        54       -19859.644143            0.348102            0.485274              1
        55       -19859.302445            0.341698            0.481444              1
        56       -19858.967020            0.335425            0.477629              1
        57       -19858.637741            0.329279            0.473829              1
        58       -19858.314482            0.323259            0.470045              1
        59       -19857.997122            0.317360            0.466277              1
 Iteration              log(P)             dlog(P)   Diff in posterior    Time in sec
        60       -19857.685542            0.311580            0.462524              1
        61       -19857.379625            0.305917            0.458786              1
        62       -19857.079257            0.300368            0.455063              1
        63       -19856.784328            0.294929            0.451355              1
        64       -19856.494728            0.289600            0.447662              1
        65       -19856.210352            0.284376            0.443985              1
        66       -19855.931096            0.279256            0.440322              1
        67       -19855.656859            0.274238            0.436673              1
        68       -19855.387541            0.269318            0.433039              1
        69       -19855.123045            0.264495            0.429419              1
        70       -19854.863277            0.259768            0.425813              1
        71       -19854.608145            0.255132            0.422221              1
        72       -19854.357558            0.250588            0.418643              1
        73       -19854.111426            0.246131            0.415079              1
        74       -19853.869665            0.241762            0.411528              1
        75       -19853.632188            0.237477            0.407994              1
        76       -19853.398913            0.233274            0.404474              1
        77       -19853.169760            0.229153            0.400968              1
        78       -19852.944649            0.225111            0.397476              1
        79       -19852.723502            0.221147            0.393998              1
 Iteration              log(P)             dlog(P)   Diff in posterior    Time in sec
        80       -19852.506243            0.217258            0.390533              1
        81       -19852.292799            0.213444            0.387083              1
        82       -19852.083097            0.209702            0.383647              1
        83       -19851.877066            0.206031            0.380238              1
        84       -19851.674636            0.202430            0.376845              1
        85       -19851.475739            0.198897            0.373467              1
        86       -19851.280309            0.195430            0.370103              1
        87       -19851.088280            0.192029            0.366757              1
        88       -19850.899589            0.188691            0.363426              1
        89       -19850.714173            0.185416            0.360111              1
        90       -19850.531971            0.182202            0.356825              1
        91       -19850.352924            0.179048            0.353567              1
        92       -19850.176972            0.175952            0.350326              1
        93       -19850.004058            0.172914            0.347107              1
        94       -19849.834126            0.169932            0.343916              1
        95       -19849.667121            0.167005