Skip to content

Instantly share code, notes, and snippets.

@chrisamiller
Created March 21, 2016 02:38
Show Gist options
  • Save chrisamiller/d2be64d0d1ae70b27af6 to your computer and use it in GitHub Desktop.
Save chrisamiller/d2be64d0d1ae70b27af6 to your computer and use it in GitHub Desktop.
$ Rscript shortTest.R
Loading required package: IRanges
Loading required package: methods
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’:
anyDuplicated, append, as.data.frame, as.vector, cbind, colnames,
do.call, duplicated, eval, evalq, Filter, Find, get, grep, grepl,
intersect, is.unsorted, lapply, lengths, Map, mapply, match, mget,
order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
union, unique, unlist, unsplit
Loading required package: S4Vectors
Loading required package: stats4
Loading required package: bmm
Loading required package: ggplot2
Loading required package: NORMT3
NORMT3: Evaluates erf, erfc, Faddeeva functions and Gaussian/T sum densities
Copyright: Guy Nason 2005-2012
Loading required package: rgl
Loading required package: RColorBrewer
Loading required package: grid
Loading required package: plotrix
Attaching package: ‘plotrix’
The following object is masked from ‘package:rgl’:
mtext3d
Loading required package: MKmisc
Loading required package: TeachingDemos
Using sciClone version 1.0.7
Warning messages:
1: package ‘IRanges’ was built under R version 3.2.2
2: package ‘BiocGenerics’ was built under R version 3.2.2
3: package ‘S4Vectors’ was built under R version 3.2.2
4: In .recacheSubclasses(def@className, def, doSubclasses, env) :
undefined subclass "externalRefMethod" of class "expressionORfunction"; definition not updated
5: In .recacheSubclasses(def@className, def, doSubclasses, env) :
undefined subclass "externalRefMethod" of class "functionORNULL"; definition not updated
6: package ‘ggplot2’ was built under R version 3.2.4
7: package ‘rgl’ was built under R version 3.2.3
8: package ‘plotrix’ was built under R version 3.2.3
9: package ‘MKmisc’ was built under R version 3.2.3
10: package ‘TeachingDemos’ was built under R version 3.2.3
=========================================================
Test 1 - single sample - shortTest1
[1] ""
[1] "checking input data..."
30 sites (of 99 original sites) are copy number neutral and have adequate depth in all samples
68 sites (of 99 original sites) were removed because of copy-number alterations
5 sites (of 99 original sites) were removed because of inadequate depth
69 sites (of 99 original sites) were removed because of copy-number alterations or inadequate depth
[1] "clustering..."
Disable overlapping std dev condition
kmeans initialization:
V1
0.0533951930599975
0.0640273104332983
0.245587723874108
0.302830061995031
0.0224438902743142
0.0957576372678371
0.273761110586846
0.161240416210296
0.114791882043451
0.327232154758731
Using threshold: 0.7
Dropped cluster 1 with too few variants ( 0 ) center: 0.4999975
Dropped cluster 2 with too few variants ( 0 ) center: 0.4999975
Dropped cluster 2 with too few variants ( 0 ) center: 0.4999975
Dropped cluster 2 with too few variants ( 0 ) center: 0.4999975
Dropped cluster 2 with too few variants ( 0 ) center: 0.4999975
Dropped cluster 2 with too few variants ( 0 ) center: 0.4999975
Dropped cluster 2 with too few variants ( 0 ) center: 0.4999975
Dropped cluster 2 with too few variants ( 0 ) center: 0.4999975
Cluster 1 pi = 0.534 center = 0.092 SEM = (0.080, 0.106) sd = (0.044, 0.133)
Cluster 2 pi = 0.466 center = 0.301 SEM = (0.286, 0.318) sd = (0.251, 0.352)
Converged on the following parameters:
mu:
313.202290924945 957.351431182502
alpha:
39.8433388393954 16.9017813165123
nu:
122.936383432134 661.683589747891
beta:
1.56680804056888 5.02271446392351
pi:
0.533557733488125 0.466442268511742
[1] "finished clustering full-dimensional data..."
[1] "found 2 clusters using bmm in full dimensional data"
=========================================================
Test 2 - two samples - shortTest2
[1] "checking input data..."
27 sites (of 100 original sites) are copy number neutral and have adequate depth in all samples
69 sites (of 100 original sites) were removed because of copy-number alterations
16 sites (of 100 original sites) were removed because of inadequate depth
73 sites (of 100 original sites) were removed because of copy-number alterations or inadequate depth
[1] "clustering each dimension independently"
Disable overlapping std dev condition
kmeans initialization:
Sample1.vaf
0.0224438902743142
0.0643171156654504
0.0957576372678371
0.161240416210296
0.114754220370405
0.327232154758731
0.268797694249063
0.0533951930599975
0.245587723874108
0.302830061995031
Using threshold: 0.7
Dropped cluster 1 with too few variants ( 0 ) center: 0.4999978
Dropped cluster 2 with too few variants ( 0 ) center: 0.4999978
Dropped cluster 2 with too few variants ( 0 ) center: 0.4999978
Dropped cluster 2 with too few variants ( 0 ) center: 0.4999978
Dropped cluster 3 with too few variants ( 0 ) center: 0.4999978
Dropped cluster 3 with too few variants ( 0 ) center: 0.4999978
Dropped cluster 3 with too few variants ( 0 ) center: 0.4999978
Dropped cluster 3 with too few variants ( 0 ) center: 0.4999978
Cluster 1 pi = 0.519 center = 0.092 SEM = (0.076, 0.106) sd = (0.043, 0.136)
Cluster 2 pi = 0.481 center = 0.302 SEM = (0.284, 0.316) sd = (0.250, 0.350)
Converged on the following parameters:
mu:
258.275873817108 884.915450010394
alpha:
34.9231351535405 15.6366641056993
nu:
101.500335634494 613.245679828065
beta:
1.38046757646485 4.68807233477937
pi:
0.518904476994944 0.481095525004907
[1] "finished 1d clustering Sample1 ..."
[1] "found 2 clusters using bmm in dimension Sample1"
[,1] [,2]
[1,] 0.09213505 0.3015253
Disable overlapping std dev condition
kmeans initialization:
Sample2.vaf
0.317204301075269
0.0122448979591837
0.0912403707836987
0.279592675000129
0.22329560072035
0.0414508324420915
0.163861298556878
0.199648268398268
0.132223577594266
0.25337380693488
Using threshold: 0.7
Dropped cluster 1 with too few variants ( 0 ) center: 0.4999974
Dropped cluster 1 with too few variants ( 0 ) center: 0.4999974
Dropped cluster 2 with too few variants ( 0 ) center: 0.4999974
Dropped cluster 2 with too few variants ( 0 ) center: 0.4999974
Dropped cluster 3 with too few variants ( 0 ) center: 0.4999974
Dropped cluster 3 with too few variants ( 0 ) center: 0.4999974
Dropped cluster 4 with too few variants ( 0 ) center: 0.4999974
Cluster 1 pi = 0.474 center = 0.132 SEM = (0.114, 0.147) sd = (0.078, 0.178)
Cluster 2 pi = 0.182 center = 0.037 SEM = (0.026, 0.047) sd = (0.012, 0.057)
Cluster 3 pi = 0.344 center = 0.255 SEM = (0.234, 0.278) sd = (0.195, 0.314)
Converged on the following parameters:
mu:
371.537266944108 92.4028884135574 434.392339456871
alpha:
26.5185903220515 16.9629065624326 12.8302727740624
nu:
168.760077222771 27.2783792578847 272.097480728221
beta:
1.80705348568522 0.184876431539476 2.73487591888221
pi:
0.473965691862213 0.182332549497176 0.343701761640277
[1] "finished 1d clustering Sample2 ..."
[1] "found 3 clusters using bmm in dimension Sample2"
[,1] [,2] [,3]
[1,] 0.1316587 0.0371269 0.2544297
[1] "clustering..."
Disable overlapping std dev condition
kmeans initialization:
Sample1.vaf Sample2.vaf
0.161240416210296 0.110600938967136
0.11675351244235 0.14062371261432
0.104256282783149 0.0525441394801786
0.0594859950768393 0.110415713707115
0.326899139200687 0.242828914768181
0.26370550508623 0.208049535934151
0.237654320987654 0.169421487603306
0.323155848304516 0.288995581518914
0.0421208215416515 0.0249194414607949
0.311482198240529 0.161081204033664
Using threshold: 0.83666
Dropped cluster 2 with too few variants ( 0 ) center: 0.4999978, 0.4999974,
Dropped cluster 4 with too few variants ( 0 ) center: 0.4999978, 0.4999974,
Dropped cluster 5 with too few variants ( 0 ) center: 0.4999978, 0.4999974,
Dropped cluster 5 with too few variants ( 0 ) center: 0.4999978, 0.4999974,
Dropped cluster 6 with too few variants ( 0 ) center: 0.4999978, 0.4999974,
Cluster 1 pi = 0.226 center = 0.281 0.189 SEM = (0.252, 0.309) (0.165, 0.212) sd = (0.217, 0.343) (0.134, 0.245)
Cluster 2 pi = 0.220 center = 0.129 0.109 SEM = (0.108, 0.147) (0.084, 0.130) sd = (0.079, 0.167) (0.055, 0.151)
Cluster 3 pi = 0.147 center = 0.062 0.112 SEM = (0.049, 0.077) (0.092, 0.131) sd = (0.033, 0.085) (0.071, 0.149)
Cluster 4 pi = 0.255 center = 0.322 0.270 SEM = (0.297, 0.343) (0.247, 0.296) sd = (0.261, 0.380) (0.206, 0.324)
Cluster 5 pi = 0.151 center = 0.072 0.033 SEM = (0.043, 0.093) (0.021, 0.042) sd = (0.024, 0.117) (0.010, 0.051)
Converged on the following parameters:
mu:
292.443725217263 233.980282042501 146.45631235799 446.78957627068 56.9189646201603
259.058035138726 136.993834856914 187.234532490536 367.213942361011 77.945459259211
alpha:
7.82044619094722 12.3540068885839 11.1870011472754 7.84334030567485 11.3700048784079
10.2706659618817 13.6081141368208 8.77931127266422 9.11661491042327 14.54706348935
nu:
193.860496724118 105.897597879171 50.8225579570117 321.999964910558 20.7686267638982
139.283655971858 57.5803668698813 80.2529274146831 237.559256979574 22.3937216520391
beta:
2.01765247528966 0.819895790115712 0.251577901587151 2.67896591884538 0.315447843581927
1.28239322148697 0.683026321049377 0.46918037610796 2.16598284616886 0.13622308071735
pi:
0.22627905099654 0.220138531387987 0.14686570331112 0.255332366432928 0.1513843528705
[1] "finished clustering full-dimensional data..."
[1] "found 5 clusters using bmm in full dimensional data"
=========================================================
Test 3.0 - three samples - should fail
[1] "checking input data..."
can't do clustering - no copy number 2 regions to operate on in sample 3
=========================================================
Test 3.1 - three samples - should succeed
[1] "checking input data..."
27 sites (of 99 original sites) are copy number neutral and have adequate depth in all samples
68 sites (of 99 original sites) were removed because of copy-number alterations
16 sites (of 99 original sites) were removed because of inadequate depth
72 sites (of 99 original sites) were removed because of copy-number alterations or inadequate depth
[1] "clustering each dimension independently"
Disable overlapping std dev condition
kmeans initialization:
Sample1.vaf
0.0533951930599975
0.114754220370405
0.0643171156654504
0.302830061995031
0.327232154758731
0.268797694249063
0.0957576372678371
0.161240416210296
0.0224438902743142
0.245587723874108
Using threshold: 0.7
Dropped cluster 1 with too few variants ( 0 ) center: 0.4999978
Dropped cluster 1 with too few variants ( 0 ) center: 0.4999978
Dropped cluster 2 with too few variants ( 0 ) center: 0.4999978
Dropped cluster 3 with too few variants ( 0 ) center: 0.4999978
Dropped cluster 3 with too few variants ( 0 ) center: 0.4999978
Dropped cluster 3 with too few variants ( 0 ) center: 0.4999978
Dropped cluster 3 with too few variants ( 0 ) center: 0.4999978
Dropped cluster 3 with too few variants ( 0 ) center: 0.4999978
Cluster 1 pi = 0.519 center = 0.092 SEM = (0.077, 0.105) sd = (0.045, 0.134)
Cluster 2 pi = 0.481 center = 0.302 SEM = (0.286, 0.321) sd = (0.251, 0.358)
Converged on the following parameters:
mu:
258.275873817108 884.915450010394
alpha:
34.9231351535405 15.6366641056993
nu:
101.500335634494 613.245679828065
beta:
1.38046757646485 4.68807233477937
pi:
0.518904476994944 0.481095525004907
[1] "finished 1d clustering Sample1 ..."
[1] "found 2 clusters using bmm in dimension Sample1"
[,1] [,2]
[1,] 0.09255257 0.3028275
Disable overlapping std dev condition
kmeans initialization:
Sample2.vaf
0.22329560072035
0.317204301075269
0.0414508324420915
0.279592675000129
0.0122448979591837
0.199648268398268
0.0912403707836987
0.25337380693488
0.132223577594266
0.163861298556878
Using threshold: 0.7
Dropped cluster 1 with too few variants ( 0 ) center: 0.4999974
Dropped cluster 1 with too few variants ( 0 ) center: 0.4999974
Dropped cluster 2 with too few variants ( 0 ) center: 0.4999974
Dropped cluster 2 with too few variants ( 0 ) center: 0.4999974
Dropped cluster 2 with too few variants ( 0 ) center: 0.4999974
Dropped cluster 3 with too few variants ( 0 ) center: 0.4999974
Dropped cluster 4 with too few variants ( 0 ) center: 0.4999974
Cluster 1 pi = 0.182 center = 0.037 SEM = (0.026, 0.047) sd = (0.012, 0.060)
Cluster 2 pi = 0.474 center = 0.131 SEM = (0.116, 0.146) sd = (0.081, 0.178)
Cluster 3 pi = 0.344 center = 0.255 SEM = (0.233, 0.277) sd = (0.190, 0.310)
Converged on the following parameters:
mu:
92.4028884135574 371.537266944108 434.392339456871
alpha:
16.9629065624326 26.5185903220515 12.8302727740624
nu:
27.2783792578847 168.760077222771 272.097480728221
beta:
0.184876431539476 1.80705348568522 2.73487591888221
pi:
0.182332549497176 0.473965691862213 0.343701761640277
[1] "finished 1d clustering Sample2 ..."
[1] "found 3 clusters using bmm in dimension Sample2"
[,1] [,2] [,3]
[1,] 0.03655547 0.1310386 0.2540035
Disable overlapping std dev condition
kmeans initialization:
Sample3.vaf
0.355919647914942
0.145348837209302
0.396821226952611
0.5
0.426567229797085
0.202778671039448
0.170814380892956
0.246739963882596
0.379622227874472
0.0385756676557863
Using threshold: 0.7
Dropped cluster 1 with too few variants ( 0 ) center: 0.4999987
Dropped cluster 1 with too few variants ( 0 ) center: 0.4999987
Dropped cluster 2 with too few variants ( 0 ) center: 0.4999987
Dropped cluster 2 with too few variants ( 0 ) center: 0.4999987
Dropped cluster 2 with too few variants ( 0 ) center: 0.4999987
Dropped cluster 3 with too few variants ( 0 ) center: 0.4999987
Dropped cluster 3 with too few variants ( 0 ) center: 0.4999987
Dropped cluster 3 with too few variants ( 1 ) center: 0.04038232
Cluster 1 pi = 0.481 center = 0.401 SEM = (0.384, 0.420) sd = (0.340, 0.448)
Cluster 2 pi = 0.482 center = 0.198 SEM = (0.181, 0.214) sd = (0.147, 0.249)
Outliers:
Sample3.vaf
7 0.03857567
Converged on the following parameters:
mu:
932.51908742482 573.881181675544
alpha:
11.9218083763685 21.1828918140315
nu:
781.376849679564 320.051933805707
beta:
6.70021409946878 2.89556632685756
pi:
0.481407723817922 0.481557984351843
[1] "finished 1d clustering Sample3 ..."
[1] "found 2 clusters using bmm in dimension Sample3"
[,1] [,2]
[1,] 0.4017063 0.1973864
[1] "clustering..."
Disable overlapping std dev condition
kmeans initialization:
Sample1.vaf Sample2.vaf Sample3.vaf
0.326899139200687 0.242828914768181 0.404148833107653
0.105110071959452 0.0427364482686534 0.234584218393517
0.0224438902743142 0.0122448979591837 0.0385756676557863
0.29786381972911 0.172033934002241 0.405962689341232
0.138996964326323 0.125612325790728 0.178916334120599
0.252714591180024 0.199876900488789 0.368284132088855
0.0817463340316129 0.05978059903858 0.158511328475895
0.322243512025069 0.294641167515414 0.394168537680594
0.325892857142857 0.272058823529412 0.5
0.0594859950768393 0.110415713707115 0.211569739752854
Using threshold: 0.887904
Dropped cluster 1 with too few variants ( 0 ) center: 0.4999978, 0.4999974, 0.4999987,
Dropped cluster 1 with too few variants ( 0 ) center: 0.4999978, 0.4999974, 0.4999987,
Dropped cluster 1 with too few variants ( 1 ) center: 0.02424786, 0.01427628, 0.04016148,
Dropped cluster 1 with too few variants ( 0 ) center: 0.4999978, 0.4999974, 0.4999987,
Dropped cluster 1 with too few variants ( 0 ) center: 0.4999978, 0.4999974, 0.4999987,
Dropped cluster 3 with too few variants ( 0 ) center: 0.4999978, 0.4999974, 0.4999987,
Dropped cluster 3 with too few variants ( 0 ) center: 0.4999978, 0.4999974, 0.4999987,
Dropped cluster 3 with too few variants ( 0 ) center: 0.4999978, 0.4999974, 0.4999987,
Cluster 1 pi = 0.481 center = 0.303 0.231 0.402 SEM = (0.283, 0.320) (0.212, 0.248) (0.384, 0.419) sd = (0.245, 0.360) (0.168, 0.276) (0.349, 0.459)
Cluster 2 pi = 0.519 center = 0.092 0.084 0.185 SEM = (0.078, 0.103) (0.070, 0.097) (0.168, 0.201) sd = (0.052, 0.134) (0.034, 0.129) (0.131, 0.239)
Converged on the following parameters:
mu:
732.993959285287 348.095689502667
588.714075075456 238.137237810944
879.631175639706 547.502988905377
alpha:
15.6514003443879 34.9083989148518
19.3741059091488 36.9326636931008
11.923822075069 24.4360116947321
nu:
507.810650820646 137.1117139269
349.64752275096 90.4646795024133
737.042773303062 290.711465325547
beta:
4.69099542915828 1.37754448208594
3.44286487797127 1.27894095342383
6.70114360788827 2.93397623307679
pi:
0.481482851848748 0.518517150151104
[1] "finished clustering full-dimensional data..."
[1] "found 2 clusters using bmm in full dimensional data"
Writing 'results/clusters3.3d120.png'
Will create: /Users/cmiller/git/sciclone/sciclone-meta/tests/results/clusters3.3d.gif
Executing: 'convert -delay 1x10 results/clusters3.3d*.png results/clusters3.3d.gif'
Deleting frames
Neptune:tests cmiller$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment