!!!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 |
constError <-cdsw$error()
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 |
quantileError <- cdsw$error()
Shifts window start and an to a mass range with few MS1 peaks.
knitr::kable(cdsw$optimizeWindows(maxbin=10,plot=TRUE))
| from | to | mid | width | counts |
|---|---|---|---|---|
| 349.63 | 381.05 | 365.340 | 31.42 | 5956 |
| 379.95 | 407.05 | 393.500 | 27.10 | 6211 |
| 405.45 | 429.35 | 417.400 | 23.90 | 6174 |
| 428.15 | 450.15 | 439.150 | 22.00 | 6143 |
| 448.65 | 470.15 | 459.400 | 21.50 | 6221 |
| 469.05 | 488.85 | 478.950 | 19.80 | 6110 |
| 487.45 | 508.15 | 497.800 | 20.70 | 6329 |
| 507.05 | 527.05 | 517.050 | 20.00 | 6184 |
| 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.15 | 672.45 | 659.800 | 25.30 | 6215 |
| 671.25 | 696.55 | 683.900 | 25.30 | 6121 |
| 695.45 | 723.15 | 709.300 | 27.70 | 6105 |
| 721.55 | 751.55 | 736.550 | 30.00 | 6175 |
| 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.65 | 1006.750 | 85.80 | 5931 |
| 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.72 | 190.860 | 32.09 | 6123 |
| 4% | 380.72 | 408.73 | 204.365 | 28.01 | 6423 |
| 8% | 407.73 | 432.75 | 216.375 | 25.02 | 6637 |
| 12% | 431.75 | 455.71 | 227.855 | 23.96 | 6653 |
| 16% | 454.71 | 477.28 | 238.640 | 22.57 | 6741 |
| 20% | 476.28 | 498.26 | 249.130 | 21.98 | 6767 |
| 24% | 497.26 | 519.71 | 259.855 | 22.45 | 6824 |
| 28% | 518.71 | 540.58 | 270.290 | 21.87 | 6735 |
| 32% | 539.58 | 561.83 | 280.915 | 22.25 | 6816 |
| 36% | 560.83 | 583.79 | 291.895 | 22.96 | 6818 |
| 40% | 582.79 | 605.84 | 302.920 | 23.05 | 6651 |
| 44% | 604.84 | 629.37 | 314.685 | 24.53 | 6686 |
| 48% | 628.37 | 653.36 | 326.680 | 24.99 | 6581 |
| 52% | 652.36 | 679.34 | 339.670 | 26.98 | 6501 |
| 56% | 678.34 | 705.90 | 352.950 | 27.56 | 6472 |
| 60% | 704.90 | 734.35 | 367.175 | 29.45 | 6287 |
| 64% | 733.35 | 764.40 | 382.200 | 31.05 | 6153 |
| 68% | 763.40 | 797.57 | 398.785 | 34.17 | 6130 |
| 72% | 796.57 | 833.85 | 416.925 | 37.28 | 5853 |
| 76% | 832.85 | 874.26 | 437.130 | 41.41 | 5615 |
| 80% | 873.26 | 919.65 | 459.825 | 46.39 | 5305 |
| 84% | 918.65 | 971.47 | 485.735 | 52.82 | 5044 |
| 88% | 970.47 | 1033.68 | 516.840 | 63.21 | 4445 |
| 92% | 1032.68 | 1106.72 | 553.360 | 74.04 | 3940 |
| 96% | 1105.72 | 1200.48 | 600.240 | 94.76 | 2861 |
mixedError <-cdsw$error()
barplot(c(const = constError$score1, quantile = quantileError$score1, mixed = mixedError$score1),ylab="Manhattan distance")
barplot(c(const = constError$score2, quantile = quantileError$score2, mixed = mixedError$score2),ylab="Euclidean distance")
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