-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start with basic suite of functionality tests. [skip ci]
- Loading branch information
Showing
10 changed files
with
206 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
library(testthat) | ||
library(ggplot2) | ||
library(ggpubr) | ||
|
||
test_that("PAVER_combined_plot works correctly", { | ||
|
||
#Use vignette example data | ||
input = gsea_example | ||
|
||
embeddings = readRDS(url("https://github.com/willgryan/PAVER_embeddings/raw/main/2023-03-06/embeddings_2023-03-06.RDS")) | ||
|
||
ontology_index = readRDS(url("https://github.com/willgryan/PAVER_embeddings/raw/main/2023-03-06/ontology_2023-03-06.RDS")) | ||
|
||
PAVER_result <- prepare_data(input, embeddings, ontology_index) | ||
|
||
PAVER_result <- generate_themes(PAVER_result, minClusterSize = 40) | ||
|
||
# Run the function and catch the result | ||
p <- PAVER_combined_plot(PAVER_result) | ||
|
||
# Verify the function runs and produces a ggplot object | ||
expect_s3_class(p, "gg") | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
library(testthat) | ||
library(dplyr) | ||
library(tidyr) | ||
library(tibble) | ||
|
||
test_that("PAVER_export works correctly", { | ||
|
||
#Use vignette example data | ||
input = gsea_example | ||
|
||
embeddings = readRDS(url("https://github.com/willgryan/PAVER_embeddings/raw/main/2023-03-06/embeddings_2023-03-06.RDS")) | ||
|
||
ontology_index = readRDS(url("https://github.com/willgryan/PAVER_embeddings/raw/main/2023-03-06/ontology_2023-03-06.RDS")) | ||
|
||
PAVER_result <- prepare_data(input, embeddings, ontology_index) | ||
|
||
PAVER_result <- generate_themes(PAVER_result, minClusterSize = 40) | ||
|
||
# Test PAVER_export function | ||
export_result <- PAVER_export(PAVER_result) | ||
|
||
# Verify the structure and content of the output | ||
expect_s3_class(export_result, "tbl_df") | ||
expect_gte(ncol(export_result), 3) | ||
expect_equal(names(export_result)[1:3], c("GOID", "Cluster", "Term")) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
library(testthat) | ||
library(ggplot2) | ||
library(ggpubr) | ||
|
||
test_that("PAVER_hunter_plot works correctly", { | ||
|
||
#Use vignette example data | ||
input = gsea_example | ||
|
||
embeddings = readRDS(url("https://github.com/willgryan/PAVER_embeddings/raw/main/2023-03-06/embeddings_2023-03-06.RDS")) | ||
|
||
ontology_index = readRDS(url("https://github.com/willgryan/PAVER_embeddings/raw/main/2023-03-06/ontology_2023-03-06.RDS")) | ||
|
||
PAVER_result <- prepare_data(input, embeddings, ontology_index) | ||
|
||
PAVER_result <- generate_themes(PAVER_result, minClusterSize = 40) | ||
|
||
# Run the function and catch the result | ||
p <- PAVER_hunter_plot(PAVER_result) | ||
|
||
# Verify the function runs and produces a ggplot object | ||
expect_s4_class(p, "HeatmapList") | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
library(testthat) | ||
library(ggplot2) | ||
library(ggpubr) | ||
|
||
test_that("PAVER_interpretation_plot works correctly", { | ||
|
||
#Use vignette example data | ||
input = gsea_example | ||
|
||
embeddings = readRDS(url("https://github.com/willgryan/PAVER_embeddings/raw/main/2023-03-06/embeddings_2023-03-06.RDS")) | ||
|
||
ontology_index = readRDS(url("https://github.com/willgryan/PAVER_embeddings/raw/main/2023-03-06/ontology_2023-03-06.RDS")) | ||
|
||
PAVER_result <- prepare_data(input, embeddings, ontology_index) | ||
|
||
PAVER_result <- generate_themes(PAVER_result, minClusterSize = 40) | ||
|
||
# Run the function and catch the result | ||
p <- PAVER_interpretation_plot(PAVER_result) | ||
|
||
# Verify the function runs and produces a ggplot object | ||
expect_s3_class(p, "gg") | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
library(testthat) | ||
library(ggplot2) | ||
library(ggpubr) | ||
|
||
test_that("PAVER_regulation_plot works correctly", { | ||
|
||
#Use vignette example data | ||
input = gsea_example | ||
|
||
embeddings = readRDS(url("https://github.com/willgryan/PAVER_embeddings/raw/main/2023-03-06/embeddings_2023-03-06.RDS")) | ||
|
||
ontology_index = readRDS(url("https://github.com/willgryan/PAVER_embeddings/raw/main/2023-03-06/ontology_2023-03-06.RDS")) | ||
|
||
PAVER_result <- prepare_data(input, embeddings, ontology_index) | ||
|
||
PAVER_result <- generate_themes(PAVER_result, minClusterSize = 40) | ||
|
||
# Run the function and catch the result | ||
p <- PAVER_regulation_plot(PAVER_result) | ||
|
||
# Verify the function runs and produces a ggplot object | ||
expect_s3_class(p, "gg") | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
library(testthat) | ||
library(ggplot2) | ||
library(ggpubr) | ||
|
||
test_that("PAVER_theme_plot works correctly", { | ||
|
||
#Use vignette example data | ||
input = gsea_example | ||
|
||
embeddings = readRDS(url("https://github.com/willgryan/PAVER_embeddings/raw/main/2023-03-06/embeddings_2023-03-06.RDS")) | ||
|
||
ontology_index = readRDS(url("https://github.com/willgryan/PAVER_embeddings/raw/main/2023-03-06/ontology_2023-03-06.RDS")) | ||
|
||
PAVER_result <- prepare_data(input, embeddings, ontology_index) | ||
|
||
PAVER_result <- generate_themes(PAVER_result, minClusterSize = 40) | ||
|
||
# Run the function and catch the result | ||
p <- PAVER_theme_plot(PAVER_result) | ||
|
||
# Verify the function runs and produces a ggplot object | ||
expect_s3_class(p, "gg") | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
library(testthat) | ||
library(dplyr) | ||
library(tidyr) | ||
library(tibble) | ||
library(magrittr) | ||
library(umap) | ||
library(dynamicTreeCut) | ||
library(randomcoloR) | ||
|
||
test_that("generate_themes works correctly", { | ||
|
||
#Use vignette example data | ||
input = gsea_example | ||
|
||
embeddings = readRDS(url("https://github.com/willgryan/PAVER_embeddings/raw/main/2023-03-06/embeddings_2023-03-06.RDS")) | ||
|
||
ontology_index = readRDS(url("https://github.com/willgryan/PAVER_embeddings/raw/main/2023-03-06/ontology_2023-03-06.RDS")) | ||
|
||
PAVER_result <- prepare_data(input, embeddings, ontology_index) | ||
|
||
# Test generate_themes function | ||
result <- generate_themes(PAVER_result, minClusterSize = 40) | ||
|
||
# Verify output structure | ||
expect_type(result, "list") | ||
expect_named(result, c("prepared_data", "embedding_mat", "umap", "goterms_df", "clustering", "avg_cluster_embeddings", "mds", "colors")) | ||
expect_s3_class(result$clustering, "tbl_df") | ||
expect_s3_class(result$avg_cluster_embeddings, "tbl_df") | ||
expect_s3_class(result$mds, "smacof") | ||
expect_type(result$colors, "character") | ||
|
||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
library(testthat) | ||
library(dplyr) | ||
library(tidyr) | ||
library(tibble) | ||
library(magrittr) | ||
library(umap) | ||
|
||
test_that("prepare_data works correctly", { | ||
|
||
#Use vignette example data | ||
input = gsea_example | ||
|
||
embeddings = readRDS(url("https://github.com/willgryan/PAVER_embeddings/raw/main/2023-03-06/embeddings_2023-03-06.RDS")) | ||
|
||
ontology_index = readRDS(url("https://github.com/willgryan/PAVER_embeddings/raw/main/2023-03-06/ontology_2023-03-06.RDS")) | ||
|
||
# Test function | ||
result <- prepare_data(input, embeddings, ontology_index) | ||
|
||
# Verify output structure | ||
expect_type(result, "list") | ||
expect_named(result, c("prepared_data", "embedding_mat", "umap", "goterms_df")) | ||
expect_s3_class(result$prepared_data, "data.frame") | ||
expect_s3_class(result$embedding_mat, "tbl_df") | ||
expect_s3_class(result$umap, "umap") | ||
expect_s3_class(result$goterms_df, "tbl_df") | ||
|
||
}) | ||
|