!!!Caution work in progress!!!
Function optimizes Extraction windows so we have the same number of precursor per window. To do it uses spectral library or nonredundant blib.
cdsw <- Cdsw(masses)
cdsw$plot()
knitr::kable(cdsw$asTable())
| from | to | mid | width | counts |
|---|---|---|---|---|
| 349.63 | 384.62 | 192.310 | 34.99 | 6688 |
| 383.62 | 418.62 | 209.310 | 35.00 | 8357 |
| 417.62 | 452.61 | 226.305 | 34.99 | 9661 |
| 451.61 | 486.61 | 243.305 | 35.00 | 10452 |
| 485.61 | 520.60 | 260.300 | 34.99 | 10725 |
| 519.60 | 554.59 | 277.295 | 34.99 | 10837 |
| 553.59 | 588.59 | 294.295 | 35.00 | 10433 |
| 587.59 | 622.58 | 311.290 | 34.99 | 9750 |
| 621.58 | 656.58 | 328.290 | 35.00 | 9276 |
| 655.58 | 690.57 | 345.285 | 34.99 | 8406 |
| 689.57 | 724.56 | 362.280 | 34.99 | 7848 |
| 723.56 | 758.56 | 379.280 | 35.00 | 7116 |
| 757.56 | 792.55 | 396.275 | 34.99 | 6355 |
| 791.55 | 826.55 | 413.275 | 35.00 | 5666 |
| 825.55 | 860.54 | 430.270 | 34.99 | 4923 |
| 859.54 | 894.53 | 447.265 | 34.99 | 4359 |
| 893.53 | 928.53 | 464.265 | 35.00 | 3807 |
| 927.53 | 962.52 | 481.260 | 34.99 | 3344 |
| 961.52 | 996.52 | 498.260 | 35.00 | 2724 |
| 995.52 | 1030.51 | 515.255 | 34.99 | 2357 |
| 1029.51 | 1064.50 | 532.250 | 34.99 | 2042 |
| 1063.50 | 1098.50 | 549.250 | 35.00 | 1807 |
| 1097.50 | 1132.49 | 566.245 | 34.99 | 1313 |
| 1131.49 | 1166.49 | 583.245 | 35.00 | 1088 |
| 1165.49 | 1200.48 | 600.240 | 34.99 | 881 |
tmp <-cdsw$error()
tmp$score1
## [1] 0.4466212
tmp$score2
## [1] 0.02027801
quantileSame number of MS1 precursors in each window
cdsw$quantile_breaks()
cdsw$plot()
knitr::kable(cdsw$asTable())
| from | to | mid | width | counts | |
|---|---|---|---|---|---|
| 0% | 349.63 | 381.03 | 190.515 | 31.40 | 5956 |
| 4% | 380.03 | 406.71 | 203.355 | 26.68 | 6131 |
| 8% | 405.71 | 429.24 | 214.620 | 23.53 | 6070 |
| 12% | 428.24 | 450.05 | 225.025 | 21.81 | 6086 |
| 16% | 449.05 | 470.06 | 235.030 | 21.01 | 6095 |
| 20% | 469.06 | 488.80 | 244.400 | 19.74 | 6107 |
| 24% | 487.80 | 508.12 | 254.060 | 20.32 | 6173 |
| 28% | 507.12 | 526.81 | 263.405 | 19.69 | 6150 |
| 32% | 525.81 | 545.79 | 272.895 | 19.98 | 6166 |
| 36% | 544.79 | 565.29 | 282.645 | 20.50 | 6123 |
| 40% | 564.29 | 584.80 | 292.400 | 20.51 | 6139 |
| 44% | 583.80 | 605.12 | 302.560 | 21.32 | 6121 |
| 48% | 604.12 | 626.34 | 313.170 | 22.22 | 6113 |
| 52% | 625.34 | 648.36 | 324.180 | 23.02 | 6108 |
| 56% | 647.36 | 672.34 | 336.170 | 24.98 | 6074 |
| 60% | 671.34 | 696.53 | 348.265 | 25.19 | 6082 |
| 64% | 695.53 | 722.89 | 361.445 | 27.36 | 6054 |
| 68% | 721.89 | 751.40 | 375.700 | 29.51 | 6053 |
| 72% | 750.40 | 782.43 | 391.215 | 32.03 | 6023 |
| 76% | 781.43 | 817.40 | 408.700 | 35.97 | 5982 |
| 80% | 816.40 | 857.96 | 428.980 | 41.56 | 6026 |
| 84% | 856.96 | 905.62 | 452.810 | 48.66 | 5971 |
| 88% | 904.62 | 964.93 | 482.465 | 60.31 | 5943 |
| 92% | 963.93 | 1049.48 | 524.740 | 85.55 | 5903 |
| 96% | 1048.48 | 1200.48 | 600.240 | 152.00 | 5863 |
tmp <-cdsw$error()
tmp$score1
## [1] 0.002159576
tmp$score2
## [1] 4.484344e-05
Shifts window start and an to a mass range with few MS1 peaks.
knitr::kable(cdsw$optimizeWindows())
| from | to | mid | width | counts |
|---|---|---|---|---|
| 349.63 | 381.05 | 365.340 | 31.42 | 5956 |
| 379.95 | 406.95 | 393.450 | 27.00 | 6208 |
| 405.65 | 429.35 | 417.500 | 23.70 | 6153 |
| 428.15 | 450.15 | 439.150 | 22.00 | 6143 |
| 448.85 | 470.15 | 459.500 | 21.30 | 6137 |
| 469.05 | 488.85 | 478.950 | 19.80 | 6110 |
| 487.65 | 508.15 | 497.900 | 20.50 | 6284 |
| 507.05 | 526.85 | 516.950 | 19.80 | 6154 |
| 525.45 | 546.05 | 535.750 | 20.60 | 6391 |
| 544.45 | 565.45 | 554.950 | 21.00 | 6322 |
| 564.15 | 585.05 | 574.600 | 20.90 | 6267 |
| 583.55 | 605.15 | 594.350 | 21.60 | 6199 |
| 604.05 | 626.45 | 615.250 | 22.40 | 6144 |
| 625.15 | 648.45 | 636.800 | 23.30 | 6217 |
| 647.25 | 672.45 | 659.850 | 25.20 | 6215 |
| 671.25 | 696.55 | 683.900 | 25.30 | 6121 |
| 695.45 | 723.15 | 709.300 | 27.70 | 6105 |
| 721.75 | 751.55 | 736.650 | 29.80 | 6134 |
| 750.25 | 782.55 | 766.400 | 32.30 | 6076 |
| 781.25 | 817.55 | 799.400 | 36.30 | 6086 |
| 816.25 | 858.05 | 837.150 | 41.80 | 6062 |
| 856.85 | 905.65 | 881.250 | 48.80 | 6007 |
| 904.55 | 965.05 | 934.800 | 60.50 | 5967 |
| 963.85 | 1049.55 | 1006.700 | 85.70 | 5927 |
| 1048.45 | 1200.48 | 1124.465 | 152.03 | 5867 |
cdsw$sampling_breaks(maxwindow = 100,plot = TRUE)
cdsw$plot()
knitr::kable(cdsw$asTable())
| from | to | mid | width | counts | |
|---|---|---|---|---|---|
| 0% | 349.63 | 381.69 | 190.845 | 32.06 | 6098 |
| 4% | 380.69 | 408.26 | 204.130 | 27.57 | 6377 |
| 8% | 407.26 | 432.42 | 216.210 | 25.16 | 6603 |
| 12% | 431.42 | 455.10 | 227.550 | 23.68 | 6612 |
| 16% | 454.10 | 476.73 | 238.365 | 22.63 | 6677 |
| 20% | 475.73 | 497.28 | 248.640 | 21.55 | 6721 |
| 24% | 496.28 | 518.14 | 259.070 | 21.86 | 6659 |
| 28% | 517.14 | 538.81 | 269.405 | 21.67 | 6773 |
| 32% | 537.81 | 559.81 | 279.905 | 22.00 | 6677 |
| 36% | 558.81 | 581.30 | 290.650 | 22.49 | 6745 |
| 40% | 580.30 | 603.30 | 301.650 | 23.00 | 6655 |
| 44% | 602.30 | 626.31 | 313.155 | 24.01 | 6590 |
| 48% | 625.31 | 650.11 | 325.055 | 24.80 | 6582 |
| 52% | 649.11 | 675.28 | 337.640 | 26.17 | 6394 |
| 56% | 674.28 | 701.40 | 350.700 | 27.12 | 6489 |
| 60% | 700.40 | 729.19 | 364.595 | 28.79 | 6292 |
| 64% | 728.19 | 758.93 | 379.465 | 30.74 | 6203 |
| 68% | 757.93 | 791.43 | 395.715 | 33.50 | 6121 |
| 72% | 790.43 | 826.93 | 413.465 | 36.50 | 5870 |
| 76% | 825.93 | 866.84 | 433.420 | 40.91 | 5689 |
| 80% | 865.84 | 911.96 | 455.980 | 46.12 | 5455 |
| 84% | 910.96 | 963.44 | 481.720 | 52.48 | 5142 |
| 88% | 962.44 | 1026.51 | 513.255 | 64.07 | 4700 |
| 92% | 1025.51 | 1100.57 | 550.285 | 75.06 | 4140 |
| 96% | 1099.57 | 1200.48 | 600.240 | 100.91 | 3126 |
tmp <-cdsw$error()
tmp$score1
## [1] 0.09535936
tmp$score2
## [1] 0.005544713
Here is the output of sessionInfo() on the system on which this document was compiled:
## R version 3.3.0 (2016-05-03)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 8.1 x64 (build 9600)
##
## locale:
## [1] LC_COLLATE=English_United Kingdom.1252
## [2] LC_CTYPE=English_United Kingdom.1252
## [3] LC_MONETARY=English_United Kingdom.1252
## [4] LC_NUMERIC=C
## [5] LC_TIME=English_United Kingdom.1252
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] cdsw_0.1.0 BiocStyle_2.0.2
##
## loaded via a namespace (and not attached):
## [1] magrittr_1.5 formatR_1.4 tools_3.3.0 htmltools_0.3.5
## [5] yaml_2.1.13 Rcpp_0.12.7 stringi_1.1.1 rmarkdown_0.9.6
## [9] highr_0.6 knitr_1.13 stringr_1.0.0 digest_0.6.10
## [13] evaluate_0.9