diff --git a/R/gen_tibble.R b/R/gen_tibble.R index 10eedf63..80f2750a 100644 --- a/R/gen_tibble.R +++ b/R/gen_tibble.R @@ -357,14 +357,8 @@ check_allele_alphabet <- function(x, } -# make all missing value equal to 0 +# set all missing values to NA # loci_info is usually from show_loci() -#harmonise_missing_values <- function (loci_info, missing_alleles =c("0",".")){ -# loci_info$allele_ref[loci_info$allele_ref %in% missing_alleles]<-"0" -# loci_info$allele_alt[loci_info$allele_alt %in% missing_alleles]<-"0" -# return(loci_info) -#} - harmonise_missing_values <- function (loci_info, missing_alleles =c("0",".")){ # 0 is always considered as a missing value if ("0" %in% missing_alleles){ diff --git a/tests/testthat/test_gen_tibble.R b/tests/testthat/test_gen_tibble.R index 4c9c31c4..950e9781 100644 --- a/tests/testthat/test_gen_tibble.R +++ b/tests/testthat/test_gen_tibble.R @@ -16,9 +16,6 @@ bed_path <- gt_write_bed_from_dfs(genotypes = test_genotypes, path_out = tempfile('test_data_')) test_gt <- gen_tibble(bed_path, quiet = TRUE) -# we now replace NA with 0 for the test_loci -#test_loci[is.na(test_loci)]<-"0" - # this also tests show_genotypes and show_loci test_that("create gen_tibble from bed",{ expect_true(inherits(test_gt,"gen_tbl")) diff --git a/tests/testthat/test_gen_tibble_save_load.R b/tests/testthat/test_gen_tibble_save_load.R index d61208b5..73cedc90 100644 --- a/tests/testthat/test_gen_tibble_save_load.R +++ b/tests/testthat/test_gen_tibble_save_load.R @@ -16,9 +16,6 @@ bed_path <- gt_write_bed_from_dfs(genotypes = test_genotypes, path_out = tempfile('test_data_')) test_gt <- gen_tibble(bed_path, quiet = TRUE) -# we now replace NA with 0 for the test_loci -#test_loci[is.na(test_loci)]<-"0" - # this also tests show_genotypes and show_loci test_that("save and load gt",{ expect_true(inherits(test_gt,"gen_tbl")) @@ -43,9 +40,12 @@ test_that("save and load gt",{ expect_true(file.copy(from=all_file_names[3], to=file.path(new_dir, basename(all_file_names[3])))) expect_true(file.remove(all_file_names[2])) + #expect_true(file.remove(all_file_names[3])) #TODO the above test fails on Windows, #needs a fix after response to bistatsr issue + + # loading should fail expect_error(new_test_gt2 <- gt_load(all_file_names[1])) # this should now work: diff --git a/tests/testthat/test_show_loci.R b/tests/testthat/test_show_loci.R index 1b492072..2a61b305 100644 --- a/tests/testthat/test_show_loci.R +++ b/tests/testthat/test_show_loci.R @@ -16,10 +16,6 @@ test_that("show_loci gets and sets information",{ path_out = tempfile('test_data_')) test_gt <- gen_tibble(bed_path, quiet = TRUE) - # we now replace NA with 0 for the test_loci - #test_loci[is.na(test_loci)]<-"0" - - # check that we retrieve the info we put in (as a tibble) expect_identical(show_loci(test_gt) %>% select(-big_index),as_tibble(test_loci)) # now change it directly on the genotype column