Skip to content

Commit

Permalink
add online tests for static association endpoint functions
Browse files Browse the repository at this point in the history
  • Loading branch information
rmgpanw committed Jun 25, 2024
1 parent dc2f9bf commit cf07b9f
Show file tree
Hide file tree
Showing 10 changed files with 270 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/testthat/get_significant_single_tissue_isqtls.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
test_that("`get_significant_single_tissue_isqtls()` returns tibble with expected colnames",
{
skip_if_offline()
result <-
get_significant_single_tissue_isqtls(gencodeIds = "ENSG00000203782.5", itemsPerPage = 1) |>
suppressWarnings()

expect_s3_class(result, "tbl_df")

expect_identical(
names(result),
c(
"snpId",
"bGISE",
"pos",
"snpIdUpper",
"pValueG",
"pValueGI",
"geneSymbol",
"geneSymbolUpper",
"pValueI",
"bGI",
"tissueSiteDetailId",
"ontologyId",
"chromosome",
"tissueCellType",
"tssDistance",
"bGSE",
"variantId",
"maf",
"bISE",
"datasetId",
"bG",
"pValueAdjustedBH",
"bI",
"gencodeId",
"phenotypeId"
)
)
})
22 changes: 22 additions & 0 deletions tests/testthat/test-get_eqtl_genes.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
test_that("`get_eqtl_genes()` returns tibble with expected colnames", {
skip_if_offline()
result <- suppressWarnings(get_eqtl_genes("Whole_Blood", itemsPerPage = 1))

expect_s3_class(result, "tbl_df")

expect_identical(
names(result),
c(
"tissueSiteDetailId",
"ontologyId",
"datasetId",
"empiricalPValue",
"gencodeId",
"geneSymbol",
"log2AllelicFoldChange",
"pValue",
"pValueThreshold",
"qValue"
)
)
})
21 changes: 21 additions & 0 deletions tests/testthat/test-get_fine_mapping.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
test_that("`get_fine_mapping()` returns tibble with expected colnames", {
skip_if_offline()
result <- suppressWarnings(get_fine_mapping(gencodeIds = "ENSG00000203782.5", itemsPerPage = 1))

expect_s3_class(result, "tbl_df")

expect_identical(
names(result),
c(
"datasetId",
"gencodeId",
"method",
"pip",
"setId",
"setSize",
"tissueSiteDetailId",
"ontologyId",
"variantId"
)
)
})
27 changes: 27 additions & 0 deletions tests/testthat/test-get_independent_eqtl.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
test_that("`get_independent_eqtl()` returns tibble with expected colnames",
{
skip_if_offline()
result <- suppressWarnings(get_independent_eqtl(gencodeIds = "ENSG00000203782.5", itemsPerPage = 1))

expect_s3_class(result, "tbl_df")

expect_identical(
names(result),
c(
"gencodeId",
"geneSymbol",
"variantId",
"snpId",
"tissueSiteDetailId",
"ontologyId",
"rank",
"tssDistance",
"maf",
"pValue",
"nes",
"chromosome",
"pos",
"datasetId"
)
)
})
10 changes: 10 additions & 0 deletions tests/testthat/test-get_multi_tissue_eqtls.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
test_that("`get_multi_tissue_eqtls()` returns tibble with expected colnames",
{
skip_if_offline()
result <- suppressWarnings(get_multi_tissue_eqtls(gencodeIds = "ENSG00000203782.5", itemsPerPage = 1))

expect_s3_class(result, "tbl_df")

expect_identical(names(result),
c("gencodeId", "datasetId", "metaP", "variantId", "tissues"))
})
28 changes: 28 additions & 0 deletions tests/testthat/test-get_significant_single_tissue_eqtls.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
test_that("`get_significant_single_tissue_eqtls()` returns tibble with expected colnames",
{
skip_if_offline()
result <- suppressWarnings(
get_significant_single_tissue_eqtls(gencodeIds = "ENSG00000132693.12", itemsPerPage = 1)
)

expect_s3_class(result, "tbl_df")

expect_identical(
names(result),
c(
"snpId",
"pos",
"snpIdUpper",
"variantId",
"geneSymbol",
"pValue",
"geneSymbolUpper",
"datasetId",
"tissueSiteDetailId",
"ontologyId",
"chromosome",
"gencodeId",
"nes"
)
)
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
test_that(
"`get_significant_single_tissue_eqtls_by_location()` returns tibble with expected colnames",
{
skip_if_offline()
result <-
get_significant_single_tissue_eqtls_by_location(
tissueSiteDetailId = "Artery_Aorta",
start = 240000,
end = 250000,
chromosome = "chr11"
)

expect_s3_class(result, "tbl_df")

expect_identical(
names(result),
c(
"chromosome",
"datasetId",
"gencodeId",
"geneSymbol",
"geneSymbolUpper",
"nes",
"pValue",
"pos",
"snpId",
"tissueSiteDetailId",
"variantId"
)
)
}
)
39 changes: 39 additions & 0 deletions tests/testthat/test-get_significant_single_tissue_ieqtls.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
test_that("`get_significant_single_tissue_ieqtls()` returns tibble with expected colnames",
{
skip_if_offline()
result <-
get_significant_single_tissue_ieqtls(gencodeIds = "ENSG00000203782.5", itemsPerPage = 1) |>
suppressWarnings()

expect_s3_class(result, "tbl_df")

expect_identical(
names(result),
c(
"snpId",
"bGISE",
"pos",
"snpIdUpper",
"pValueG",
"pValueGI",
"geneSymbol",
"geneSymbolUpper",
"pValueI",
"bGI",
"tissueSiteDetailId",
"ontologyId",
"chromosome",
"tissueCellType",
"tssDistance",
"bGSE",
"variantId",
"maf",
"bISE",
"datasetId",
"bG",
"pValueAdjustedBH",
"bI",
"gencodeId"
)
)
})
28 changes: 28 additions & 0 deletions tests/testthat/test-get_significant_single_tissue_sqtls.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
test_that("`get_significant_single_tissue_sqtls()` returns tibble with expected colnames",
{
skip_if_offline()
result <-
get_significant_single_tissue_sqtls(gencodeIds = "ENSG00000203782.5")

expect_s3_class(result, "tbl_df")

expect_identical(
names(result),
c(
"snpId",
"pos",
"snpIdUpper",
"variantId",
"geneSymbol",
"pValue",
"geneSymbolUpper",
"datasetId",
"tissueSiteDetailId",
"ontologyId",
"chromosome",
"gencodeId",
"nes",
"phenotypeId"
)
)
})
23 changes: 23 additions & 0 deletions tests/testthat/test-get_sqtl_genes.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
test_that("`get_sqtl_genes()` returns tibble with expected colnames", {
skip_if_offline()
result <- suppressWarnings(get_sqtl_genes("Whole_Blood", itemsPerPage = 1))

expect_s3_class(result, "tbl_df")

expect_identical(
names(result),
c(
"nPhenotypes",
"pValueThreshold",
"phenotypeId",
"geneSymbol",
"pValue",
"datasetId",
"empiricalPValue",
"tissueSiteDetailId",
"ontologyId",
"qValue",
"gencodeId"
)
)
})

0 comments on commit cf07b9f

Please sign in to comment.