Skip to content

Commit

Permalink
unit test for predict_gt_pca
Browse files Browse the repository at this point in the history
  • Loading branch information
dramanica committed May 8, 2024
1 parent 427c9c0 commit e16cdf9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/testthat/test_gt_pca.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
test_that("fit_gt_pca_and_predict",{
bed_file <- system.file("extdata", "example-missing.bed", package = "bigsnpr")
missing_gt <- gen_tibble(bed_file, backingfile = tempfile("missing_"),quiet=TRUE)
expect_error( missing_gt %>% gt_pca_partialSVD(),
"You can't have missing")
missing_gt <- gt_impute_simple(missing_gt)
missing_pca <- missing_gt %>% gt_pca_partialSVD()
expect_true(all.equal(predict(missing_pca),
predict(missing_pca, new_data = missing_gt),
check.attributes=FALSE))
})

0 comments on commit e16cdf9

Please sign in to comment.