testthat::context("Datasets after intraomics statistics")
stat_intra.mset <- phenomis::reading(LATMX2::statistics_intraomics_dir.c())
testthat::test_that("dimensions", {
stat_intra_dim.mn <- t(sapply(names(stat_intra.mset),
function(set.c) dim(stat_intra.mset[[set.c]])))
# paste(paste(rownames(stat_intra_dim.mn),
# apply(stat_intra_dim.mn, 1, function(x) paste(x, collapse = "|")),
# sep = "|"),
# collapse = "', '")
test_dim.vc <- c("clinics|213|42",
"proteomics_liver|2187|42",
"proteomics_plasma|446|36")
# test_dim.vc <- c('liv_met_annot_sac|99|42',
# 'liv_met_c18n_theix|519|42',
# 'liv_met_c18p_sac|8939|42',
# 'liv_met_c18p_theix|2060|42',
# 'liv_met_hiln_sac|3630|42',
# 'liv_prot_F|2187|22',
# 'liv_prot_M|2187|20',
# 'liv_prot_stra|2187|42',
# 'pheno_phenomin|213|42',
# 'plas_met_annot_sac|83|42',
# 'plas_met_c18n_theix|1920|42',
# 'plas_met_c18p_sac|9149|42',
# 'plas_met_c18p_theix|3276|42',
# 'plas_met_hiln_sac|3402|42',
# 'plas_prot_toul|446|36')
test_dim.mn <- sapply(test_dim.vc, function(x) unlist(strsplit(x, "|", fixed = TRUE))[c(2, 3)])
mode(test_dim.mn) <- "integer"
dimnames(test_dim.mn) <- list(c("Features", "Samples"),
sapply(test_dim.vc, function(x) unlist(strsplit(x, "|", fixed = TRUE))[1], USE.NAMES = FALSE))
test_dim.mn <- t(test_dim.mn)
testthat::expect_identical(stat_intra_dim.mn,
test_dim.mn)
})
testthat::test_that("significant", {
stat_intra_signif.mn <- t(sapply(names(stat_intra.mset),
function(set.c) {
set_fda.df <- Biobase::fData(stat_intra.mset[[set.c]])
if (set.c == "proteomics_liver") {
return(apply(set_fda.df[, c("limmaM_WT.LAT_signif",
"limmaF_WT.LAT_signif",
"limma2ways_WT.MX2_signif")],
2,
function(y) sum(y, na.rm = TRUE)))
} else {
return(c(sum(set_fda.df[, c("limma2ways_WT.LAT_signif")], na.rm = TRUE),
NA,
sum(set_fda.df[, c("limma2ways_WT.MX2_signif")], na.rm = TRUE)))
}
}))
colnames(stat_intra_signif.mn) <- c("LAT(_M)", "LAT_F", "MX2")
# paste(paste(rownames(stat_intra_signif.mn),
# apply(stat_intra_signif.mn, 1, function(x) paste(x, collapse = "|")),
# sep = "|"),
# collapse = "', '")
test_signif.vc <- c("clinics|0|NA|1",
"proteomics_liver|1|258|263",
"proteomics_plasma|7|NA|19")
# test_signif.vc <- c('liv_met_annot_sac|26|0',
# 'liv_met_c18n_theix|0|0',
# 'liv_met_c18p_sac|2309|28',
# 'liv_met_c18p_theix|0|0',
# 'liv_met_hiln_sac|1167|7',
# 'liv_prot_F|263|NA',
# 'liv_prot_M|1|NA',
# 'liv_prot_stra|71|160',
# 'pheno_phenomin|0|1',
# 'plas_met_annot_sac|3|1',
# 'plas_met_c18n_theix|0|0',
# 'plas_met_c18p_sac|1|109',
# 'plas_met_c18p_theix|9|22',
# 'plas_met_hiln_sac|294|58',
# 'plas_prot_toul|5|6')
test_signif.mn <- sapply(test_signif.vc, function(x) unlist(strsplit(x, "|", fixed = TRUE))[2:4])
suppressWarnings(mode(test_signif.mn) <- "integer")
dimnames(test_signif.mn) <- list(c("LAT(_M)", "LAT_F", "MX2"),
sapply(test_signif.vc, function(x) unlist(strsplit(x, "|", fixed = TRUE))[1], USE.NAMES = FALSE))
test_signif.mn <- t(test_signif.mn)
testthat::expect_identical(stat_intra_signif.mn,
test_signif.mn)
})
testthat::test_that("proteomics_liver", {
proteomics_liver.eset <- stat_intra.mset[["proteomics_liver"]]
proteoliv_WL.eset <- ProMetIA::sub_eset(proteomics_liver.eset,
set.c = "proteomics_liver",
genes.vc = c("WT", "LAT"))
testthat::expect_equal(Biobase::dims(proteoliv_WL.eset )["Features", ],
2098)
proteoliv_mWL.eset <- ProMetIA::sub_eset(proteomics_liver.eset,
set.c = "proteomics_liver",
genes.vc = c("WT", "LAT"),
sex.vc = "M")
testthat::expect_equal(Biobase::dims(proteoliv_mWL.eset )["Features", ],
2120)
proteoliv_fWL.eset <- ProMetIA::sub_eset(proteomics_liver.eset,
set.c = "proteomics_liver",
genes.vc = c("WT", "LAT"),
sex.vc = "F")
testthat::expect_equal(Biobase::dims(proteoliv_fWL.eset )["Features", ],
2139)
proteoliv_mfW.eset <- ProMetIA::sub_eset(proteomics_liver.eset,
set.c = "proteomics_liver",
genes.vc = "WT")
testthat::expect_equal(Biobase::dims(proteoliv_mfW.eset )["Features", ],
2126)
proteoliv_mfL.eset <- ProMetIA::sub_eset(proteomics_liver.eset,
set.c = "proteomics_liver",
genes.vc = "LAT")
testthat::expect_equal(Biobase::dims(proteoliv_mfL.eset )["Features", ],
2145)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.