We may or may not have achieved the global optimal solution and underlying truth in the above section. Luckily SMASH
provides a hands-off thorough grid search without any prior knowledge of the number of subclones, subclone configuration, subclone proportions, proportion of unclassified point mutations, etc. in the following code.
grid_ith = grid_ITH_optim(
my_data = input,
my_purity = sim$purity,
list_eS = eS,
trials = 50,
max_iter = 4e3)
#> cc = 1; kk = 1 **********
#> cc = 2; kk = 1 **********
#> cc = 3; kk = 1 ********** kk = 2 **********
#> cc = 4; kk = 1 ********** kk = 2 ********** kk = 3 **********
#> cc = 5; kk = 1 ********** kk = 2 ********** kk = 3 ********** kk = 4 ********** kk = 5 ********** kk = 6 **********
names(grid_ith)
#> [1] "GRID" "INFER"
# Grid of solutions
grid_ith$GRID
#> cc kk ms entropy LL AIC BIC q unc_q0 alloc pi_eps
#> 1 1 1 2 0.00 -307.41 -618.82 -622.6440 1 1|13 0.78001400
#> 2 2 1 6 0.39 -224.26 -460.52 -471.9921 0.87,0.13 1.588782 1|13;2|20 0.38062121
#> 3 2 1 6 0.69 -246.62 -505.24 -516.7121 0.53,0.47 -0.435362 1|13;2|19 0.41285982
#> 4 2 1 5 0.59 -295.80 -601.60 -611.1601 0.72,0.28 1.218544 1|16;2|34 0.00000000
#> 5 3 1 9 0.98 -142.87 -303.74 -320.9482 0.51,0.36,0.13 1.743127,1.847057 1|13;2|18;3|19 0.00000000
#> 6 3 1 8 0.99 -153.38 -322.76 -338.0562 0.45,0.42,0.13 -2.362137,-0.482741 1|13;2|18;3|19 0.00000000
#> 7 3 1 8 1.02 -161.29 -338.58 -353.8762 0.5,0.32,0.18 -1.018705,0.552578 1|13;2|18;3|19 0.00000000
#> 8 3 1 8 0.87 -245.73 -507.46 -522.7562 0.05,0.47,0.47 -1.813139,-0.40923 1|5;2|8;3|19 0.40978325
#> 9 3 2 9 0.98 -142.87 -303.74 -320.9482 0.38,0.49,0.13 1.047088,1.478796 1|13;2|18;3|19 0.00000000
#> 10 4 1 10 1.21 -139.76 -299.52 -318.6402 0.44,0.09,0.33,0.13 1.836166,1.377129,1.943698 1|13;2|4;3|14;4|19 0.00000000
#> 11 4 1 11 1.15 -154.35 -330.70 -351.7323 0.05,0.45,0.36,0.13 -1.495057,-0.455178,0.98301 1|5;2|8;3|18;4|19 0.09135708
#> 12 4 1 9 0.62 -221.83 -461.66 -478.8682 0.01,0.04,0.81,0.13 -2.448191,-2.178116,0.921208 1|2;2|3;3|9;4|20 0.37729469
#> 13 4 1 10 1.11 -142.74 -305.48 -324.6002 0.04,0.48,0.36,0.13 1.12048,1.767768,1.92637 1|6;2|7;3|18;4|19 0.00000000
#> 14 4 1 11 1.15 -142.09 -306.18 -327.2123 0.05,0.46,0.36,0.13 -1.771242,0.650579,-1.312927 1|5;2|8;3|18;4|19 0.00000000
#> 15 4 1 10 1.14 -141.33 -302.66 -321.7802 0.49,0.05,0.33,0.13 1.658064,1.481153,1.212404 1|13;2|8;3|10;4|19 0.00000000
#> 16 4 2 10 1.10 -142.74 -305.48 -324.6002 0.04,0.35,0.13,0.49 -1.287477,-0.870428,-1.949154 1|6;2|7;3|19;4|18 0.00000000
#> 17 4 2 11 1.14 -142.09 -306.18 -327.2123 0.05,0.33,0.13,0.49 -1.808309,-1.307732,-0.78863 1|5;2|8;3|19;4|18 0.00000000
#> 18 4 2 10 1.21 -142.72 -305.44 -324.5602 0.51,0.22,0.14,0.13 1.987396,1.916164,1.635483 1|13;2|18;3|4;4|15 0.00000000
#> 19 4 2 10 1.21 -142.81 -305.62 -324.7402 0.51,0.23,0.13,0.13 0.620006,-1.596313,-2.235706 1|13;2|18;3|14;4|5 0.00000000
#> 20 4 2 9 0.95 -221.87 -461.74 -478.9482 0.06,0.68,0.13,0.13 -2.835281,0.899629,-2.90326 1|5;2|9;3|15;4|5 0.37687450
#> 21 4 2 9 1.10 -164.37 -346.74 -363.9482 0.03,0.35,0.13,0.48 -1.142864,-2.582756,-0.127506 1|6;2|7;3|19;4|18 0.20601182
#> 22 4 2 11 1.14 -152.52 -327.04 -348.0723 0.05,0.33,0.13,0.49 -1.761158,-0.22231,-2.716538 1|5;2|8;3|19;4|18 0.11454631
#> 23 4 3 10 1.21 -139.76 -299.52 -318.6402 0.31,0.09,0.46,0.13 1.637031,1.659007,1.995268 1|13;2|4;3|14;4|19 0.00000000
#> 24 4 3 10 1.08 -141.33 -302.66 -321.7802 0.03,0.33,0.13,0.51 -2.173503,-1.507991,-1.775524 1|13;2|10;3|19;4|8 0.00000000
#> 25 4 3 10 1.15 -141.33 -302.66 -321.7802 0.36,0.05,0.46,0.13 1.81663,1.661772,1.796831 1|13;2|8;3|10;4|19 0.00000000
#> 26 4 3 10 1.10 -141.33 -302.66 -321.7802 0.03,0.38,0.13,0.46 -2.802917,0.654739,-2.200637 1|13;2|8;3|19;4|10 0.00000000
#> 27 4 3 10 1.27 -142.72 -305.44 -324.5602 0.38,0.35,0.14,0.13 1.804812,1.197795,1.055059 1|13;2|18;3|4;4|15 0.00000000
#> 28 4 3 10 1.02 -142.72 -305.44 -324.5602 0.38,0.01,0.13,0.49 -0.23425,-0.966434,-1.782314 1|13;2|4;3|15;4|18 0.00000000
#> 29 5 1 11 1.26 -141.19 -304.38 -325.4123 0.04,0.45,0.05,0.33,0.13 1.765709,1.420863,1.80696,1.959864 1|6;2|7;3|8;4|10;5|19 0.00000000
#> 30 5 1 11 1.34 -139.64 -301.28 -322.3123 0.04,0.41,0.09,0.33,0.13 1.245093,1.53851,1.243456,1.849004 1|6;2|7;3|4;4|14;5|19 0.00000000
#> 31 5 1 11 1.14 -142.58 -307.16 -328.1923 0.04,0.48,0.35,0.01,0.13 1.477177,1.835859,1.565682,1.570549 1|6;2|7;3|18;4|4;5|15 0.00000000
#> 32 5 1 12 1.38 -139.19 -302.38 -325.3243 0.05,0.39,0.09,0.33,0.13 -0.904063,-2.302741,0.883772,-1.853337 1|5;2|8;3|4;4|14;5|19 0.00000000
#> 33 5 1 11 1.17 -141.17 -304.34 -325.3723 0.49,0.05,0.32,0.01,0.13 0.763207,0.99262,-0.597088,-2.010696 1|13;2|8;3|10;4|4;5|15 0.00000000
#> 34 5 2 11 1.34 -142.58 -307.16 -328.1923 0.04,0.48,0.22,0.14,0.13 1.280233,1.308232,1.98148,1.681647 1|6;2|7;3|18;4|4;5|15 0.00000000
#> 35 5 2 11 1.44 -139.60 -301.20 -322.2323 0.44,0.09,0.19,0.14,0.13 1.927028,1.252031,1.303311,1.658146 1|13;2|4;3|14;4|4;5|15 0.00000000
#> 36 5 3 12 1.43 -141.93 -307.86 -330.8043 0.05,0.33,0.13,0.35,0.14 -0.833174,-1.657431,-1.521311,0.994842 1|5;2|8;3|15;4|18;5|4 0.00000000
#> 37 5 3 11 1.32 -139.64 -301.28 -322.3123 0.04,0.28,0.13,0.09,0.46 -0.971608,-1.117897,-0.977414,-1.624446 1|6;2|7;3|19;4|4;5|14 0.00000000
#> 38 5 3 12 1.35 -139.19 -302.38 -325.3243 0.05,0.26,0.13,0.09,0.46 -2.216888,-0.534829,-0.498728,-1.840551 1|5;2|8;3|19;4|4;5|14 0.00000000
#> 39 5 3 12 1.30 -151.07 -326.14 -349.0843 0.05,0.3,0.13,0.05,0.46 -1.753946,-1.742063,-0.021633,-1.216391 1|5;2|8;3|19;4|9;5|9 0.11171478
#> 40 5 3 12 1.30 -140.69 -305.38 -328.3243 0.05,0.3,0.13,0.05,0.46 -1.472786,-0.668003,-2.66109,0.227856 1|5;2|8;3|19;4|8;5|10 0.00000000
#> 41 5 4 11 1.49 -139.60 -301.20 -322.2323 0.31,0.14,0.09,0.33,0.13 1.52869,1.783527,1.056915,1.953415 1|13;2|4;3|4;4|14;5|15 0.00000000
#> 42 5 4 11 1.42 -141.32 -304.64 -325.6723 0.36,0.13,0.05,0.33,0.13 1.073164,1.166258,1.492443,1.331579 1|13;2|9;3|8;4|10;5|10 0.00000000
#> 43 5 4 11 1.43 -141.17 -304.34 -325.3723 0.35,0.14,0.05,0.33,0.13 1.013462,1.071242,1.233511,1.051077 1|13;2|4;3|8;4|10;5|15 0.00000000
#> 44 5 4 11 1.24 -139.70 -301.40 -322.4323 0.31,0.13,0.09,0.01,0.46 -0.638205,-0.50668,-2.686646,-2.285308 1|13;2|19;3|4;4|4;5|10 0.00000000
#> 45 5 4 11 1.14 -141.17 -304.34 -325.3723 0.03,0.46,0.37,0.01,0.13 1.399218,1.818312,1.365729,1.283677 1|13;2|10;3|8;4|4;5|15 0.00000000
#> 46 5 6 11 1.18 -141.17 -304.34 -325.3723 0.35,0.01,0.05,0.46,0.13 1.196523,1.306683,1.515869,1.692234 1|13;2|4;3|8;4|10;5|15 0.00000000
#> 47 5 6 11 1.38 -141.17 -304.34 -325.3723 0.03,0.33,0.37,0.14,0.13 1.537019,1.888057,1.515215,1.854318 1|13;2|10;3|8;4|4;5|15 0.00000000
#> 48 5 6 11 1.25 -139.60 -301.20 -322.2323 0.31,0.09,0.01,0.13,0.46 -0.705352,0.59871,-2.944075,-0.70181 1|13;2|4;3|4;4|15;5|14 0.00000000
#> 49 5 6 11 1.37 -141.32 -304.64 -325.6723 0.03,0.33,0.38,0.13,0.13 1.21288,1.470929,1.647752,1.398339 1|13;2|10;3|8;4|9;5|10 0.00000000
# Order solution(s) based on BIC (larger BIC correspond to better fits)
gg = grid_ith$GRID
gg = gg[order(-gg$BIC),]
head(gg)
#> cc kk ms entropy LL AIC BIC q unc_q0 alloc pi_eps
#> 10 4 1 10 1.21 -139.76 -299.52 -318.6402 0.44,0.09,0.33,0.13 1.836166,1.377129,1.943698 1|13;2|4;3|14;4|19 0
#> 23 4 3 10 1.21 -139.76 -299.52 -318.6402 0.31,0.09,0.46,0.13 1.637031,1.659007,1.995268 1|13;2|4;3|14;4|19 0
#> 5 3 1 9 0.98 -142.87 -303.74 -320.9482 0.51,0.36,0.13 1.743127,1.847057 1|13;2|18;3|19 0
#> 9 3 2 9 0.98 -142.87 -303.74 -320.9482 0.38,0.49,0.13 1.047088,1.478796 1|13;2|18;3|19 0
#> 15 4 1 10 1.14 -141.33 -302.66 -321.7802 0.49,0.05,0.33,0.13 1.658064,1.481153,1.212404 1|13;2|8;3|10;4|19 0
#> 24 4 3 10 1.08 -141.33 -302.66 -321.7802 0.03,0.33,0.13,0.51 -2.173503,-1.507991,-1.775524 1|13;2|10;3|19;4|8 0
# true cancer proportions
sim$q
#> [1] 0.4028888 0.4643963 0.1327149
# true entropy
-sum(sim$q * log(sim$q))
#> [1] 0.9904886
From the grid of solutions (grid_ith$GRID
), we can use AIC or BIC to score the model fit per solution. Sometimes the same configuration matrix can lead to multiple solutions. The column definitions are provided.
We can calculate a posterior probability to compare and visualize model fits with the following formula:
where \(IC_s\) corresponds to the \(s\)-th modelâs information criterion. The function logSumExp
from package smartr
will aid us here.
pp = vis_GRID(GRID = grid_ith$GRID)
print(pp)
The above figure provides a landscape of which solutions appear more favorable to others.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4