tests/testthat/test_dataProcessPlotsPTM.R

library(grid)

test_that("Medians are equalized in ptm data to QC plot helper function", {
    mock_qc_all_plot_lf <- mock(rectGrob(), cycle = TRUE)
    stub(
        dataProcessPlotsPTM, ".qc.all.plot.lf",
        mock_qc_all_plot_lf, depth=2
    )
    dataProcessPlotsPTM(summary.data,
                        type = 'QCPLOT',
                        which.PTM = "allonly",
                        address = FALSE)
    calls <- mock_args(mock_qc_all_plot_lf)
    ptm_data <- calls[[1]][[1]]
    run_data = split(ptm_data, ptm_data$RUN)
    for (i in 1:length(run_data)){
        expect_equal(median(run_data[[i]]$ABUNDANCE, na.rm = TRUE), 22.028431)
    }
})
Vitek-Lab/MSstatsPTM documentation built on Dec. 19, 2024, 6:02 a.m.