tests/testthat/test-do-variability-list.R

context("test-do-variability_list_RSD")

test_that("Check sonsistency of doRSD function output", {
  out <- do_variability_list (testData$data, testData$class)
  expect_equal(out , testData$doRSD)
})

test_that("do_variability_list returns error for unsuported method.", {
    expect_error(do_variability_list (testData$data, testData$class,
        method="MEAN"), regexp="Method specified is not supported.")
})

test_that("do_variability_list output for methode none", {
    out <- do_variability_list (testData$data, testData$class, method="none")
    expect_equal(out, 
        list(QC = c(72606.7877604, 40598.2070312, 194066.242188, NA, 
                5947.39371745, 9320.12402344, 5052.18579102, 67698.4791667,
                15018.4475911, 36261.6516927, 27412.7884115, NA, 35233.125,
                6198.89567057, 8628.86352539, 7377.01586914, 10186.9944661,
                17655.9329427, 551874.927083, 13457.8085938, NA, 4808.13598633,
                NA, 24105.6077474, 13946.6835938, 15614.4127604, NA,
                20536.5566406, 22905782, 52216.8203125, 157720.59375,
                8194.5694987, 23987.4570312, 10630.031901, 3249.17814128, NA,
                4083.93562826, 12304.1178385, 3488.61279297, NA, 68124.2513021,
                15360.1225586, 92541.890625, NA, NA, 32938.9407552,
                11951.5600586, 19531.2932943, 967582.645833, 23307.7239583,
                25337.9134115, 4161.64257812, 10139.6137695, NA, NA,
                20529.171875, 21692.6656901, 43937.1223958, 12800026.3333,
                163905.130208, 88597.3333333, 10773.3072917, 182302.171875, NA,
                NA, 9308.53727214, 4786.49430339, 24825.9589844, 3855.48632812,
                NA, 31570.9518229, 14880.7783203, 36771.8359375, 4030.69978841,
                14019.1235352, 7537.70410156, 12944.4833984, 22116.0673828,
                456101.864583, 12008.3011068, 15722.594401, 8222.67447917,
                15179.6147461, 27620.5501302, NA, 17456.4029948, 15212.8183594,
                16011.0205078, 21073282, 65616.03125),
            Blank = c(173120.838542, 4564.66040039, 159945.653646, NA, NA,
                9874.76953125, 4530.19555664, 62168.8763021, NA, NA,
                38351.7526042, NA, 37062.6191406, 4910.61287435, 15200.9833984,
                12226.5136719, 17335.9182943, 21533.9908854, 347425.447917, NA,
                14176.8779297, 7673.20882161, 10140.2874349, 21174.2747396, NA,
                12038.9622396, 22026.9492188, 21986.0358073, 19687556,
                94323.4869792, 87132.4296875, 26781.5299479, NA, 8394.82324219,
                NA, NA, 5252.04370117, 61329.1510417, 9198.6007487,
                16579.6106771, 15626.116862, 17676.7753906, 39836.421875, NA,
                NA, 6312.7179362, 12363.7102865, 17720.655599, 571801.46875,
                18422.2786458, 8964.36376953, 5131.08618164, 8131.26464844,
                6141.79638672, 18578.2740885, 17536.7213542, NA, 21641.4257812,
                18139629.6667, 52912.1666667),
            Sample = c(101142.601562, 25833.7063802, NA, 8283.25830078,
                5504.36930339, NA, 4735.09008789, 70414.1770833, 8763.37597656,
                16122.750651, 23241.9947917, 14401.9267578, 46214.5195312, NA,
                12434.1728516, 9846.91341146, 17041.4544271, 27639.9238281,
                632021.041667, 23157.9479167, 12540.5328776, NA, 9436.55501302,
                6923.89046224, 13642.0120443, 25742.6022135, 12648.0465495,
                21316.921224, 16169485.6667, 71523.7682292, NA, 60628.1705729,
                170160.609375, 12282.4003906, 12583.4479167, 9499.49902344, NA,
                34666.4876302, 15376.7786458, 24847.6471354, 21662.4140625,
                15414.2727865, 32739.8235677, 5265.00708008, 15188.2093099, NA,
                14430.3404948, 15830.0904948, 565866.5, 19328.8795573,
                7902.7902832, NA, NA, 25581.3522135, 8934.39632161,
                17628.1419271, NA, 31342.7825521, 20144269.3333, 72823.0520833,
                101219.84375, 27282.7760417, NA, 8745.4296875, 6419.76513672,
                NA, 5114.56518555, 50432.84375, 9903.87760417, 17586.3483073,
                21554.1217448, NA, 47212.5091146, NA, 10406.0073242,
                7900.93717448, 14443.139974, 23702.3001302, 667275.479167,
                26421.3561198, 10146.3128255, NA, 9620.72314453, 8053.23697917,
                15683.8691406, 17736.0651042, 10595.2843424, 25644.9739583,
                15644277.6667, 78376.0833333, 50257.7597656, 29438.5820312,
                197241.546875, NA, 8433.89233398, 9409.94791667, 4697.17057292,
                39912.5716146, 8655.74723307, 37561.7552083, 28781.96875,
                12087.2126465, 47401.8307292, 6099.12915039, 13444.6520182, NA,
                18701.9863281, 18814.8411458, 416747.1875, 14251.4052734,
                8327.05810547, 4915.23746745, 16068.3208008, 28059.2610677,
                12933.513916, 17567.0403646, NA, 14074.781901, 23290585.3333,
                61954.0429688),
            variability_method = "none"))
})
computational-metabolomics/qcrms documentation built on Jan. 18, 2021, 1:46 a.m.