Skip to content

Commit

Permalink
v0.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Zilong-Li committed Mar 25, 2024
1 parent 4ddb509 commit 470acaf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: vcfppR
Title: Rapid Manipulation of the Variant Call Format (VCF)
Version: 0.4.1
Version: 0.4.2
Authors@R: c(
person("Zilong", "Li", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-5859-2078")),
Expand Down
10 changes: 5 additions & 5 deletions tests/testthat/test-modify-vcf.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ test_that("modify the genotypes", {
## tests
br <- vcfreader$new(outvcf)
br$variant() ## get a variant record
(g0 <- br$genotypes(F))
g0 <- br$genotypes(F)
## if you wanna change the phasing of genotypes,
## call setPhasing before setGenotypes
br$setPhasing(c(1L, 1L))
g1 <- c(1L, 1L, NA, 0L)
br$setGenotypes(g1)
(g2 <- br$genotypes(F))
g2 <- br$genotypes(F)
expect_false(isTRUE(all.equal(g0, g2)))
expect_identical(g1, g2)
br$close()
## the original vcf can not be modified
br <- vcfreader$new(outvcf)
br$variant() ## get a variant record
(g3 <- br$genotypes(F))
g3 <- br$genotypes(F)
expect_identical(g0, g3)
})

Expand Down Expand Up @@ -63,7 +63,7 @@ test_that("modify item in FORMAT", {
br$addFORMAT("DS", "1", "Float", "Diploid dosage")
br$addFORMAT("AC", "1", "Integer", "Allele counts")
br$addFORMAT("STR", "1", "String", "Test String type")
print(br$header())
## print(br$header())
## set DS in FORMAT now
br$setFormatFloat("DS", ds)
## test if DS presents
Expand All @@ -72,5 +72,5 @@ test_that("modify item in FORMAT", {
br$setFormatInt("AC", c(3L, 4L))
expect_false(br$setFormatStr("STR","HHH,JJJ")) ## length(s) %% nsamples != 0
expect_true(br$setFormatStr("STR","HHHJJJ")) ## length(s) %% nsamples == 0
print(br$string())
## print(br$string())
})
2 changes: 1 addition & 1 deletion tests/testthat/test-vcf-reader.R
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ test_that("vcfreader: reading variant only", {
expect_identical(br$filter(), "VQSRTrancheSNP99.80to100.00")
expect_identical(br$info(), "AC=2;AF=0.000616523;AN=3244;DP=2498;FS=0;MLEAC=1;MLEAF=0.0003083;MQ=17.07;MQ0=0;QD=17.52;SOR=3.258;VQSLOD=-32.6;culprit=MQ;AN_EUR=658;AN_EAS=548;AN_AMR=520;AN_SAS=624;AN_AFR=894;AF_EUR=0;AF_EAS=0;AF_AMR=0.00384615;AF_SAS=0;AF_AFR=0;AC_EUR=0;AC_EAS=0;AC_AMR=2;AC_SAS=0;AC_AFR=0;AC_Het_EUR=0;AC_Het_EAS=0;AC_Het_AMR=0;AC_Het_SAS=0;AC_Het_AFR=0;AC_Het=0;AC_Hom_EUR=0;AC_Hom_EAS=0;AC_Hom_AMR=2;AC_Hom_SAS=0;AC_Hom_AFR=0;AC_Hom=2;HWE_EUR=1;ExcHet_EUR=1;HWE_EAS=1;ExcHet_EAS=1;HWE_AMR=0.00192678;ExcHet_AMR=1;HWE_SAS=1;ExcHet_SAS=1;HWE_AFR=1;ExcHet_AFR=1;HWE=0.000308356;ExcHet=1;ME=0;AN_EUR_unrel=508;AN_EAS_unrel=448;AN_AMR_unrel=330;AN_SAS_unrel=484;AN_AFR_unrel=666;AF_EUR_unrel=0;AF_EAS_unrel=0;AF_AMR_unrel=0;AF_SAS_unrel=0;AF_AFR_unrel=0;AC_EUR_unrel=0;AC_EAS_unrel=0;AC_AMR_unrel=0;AC_SAS_unrel=0;AC_AFR_unrel=0;AC_Het_EUR_unrel=0;AC_Het_EAS_unrel=0;AC_Het_AMR_unrel=0;AC_Het_SAS_unrel=0;AC_Het_AFR_unrel=0;AC_Hom_EUR_unrel=0;AC_Hom_EAS_unrel=0;AC_Hom_AMR_unrel=0;AC_Hom_SAS_unrel=0;AC_Hom_AFR_unrel=0")
br$rmInfoTag("AC")
print(br$info())
print(br$infoInt("AC")) ## TODO: AC value still exists
print(br$info())
af <- br$infoFloat("AF")
## expect_equal(0.00061652297, 0.00061652300, tolerance = 1e-6)
expect_equal(af, 0.000616523, tolerance = 1e-6)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-vcf-writer.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test_that("vcfwriter: writing variant works", {
## tests
skip_on_os(c("windows"), arch = NULL)
br <- vcfreader$new(outvcf)
print(br$header())
## print(br$header())
br$variant()
expect_identical(br$chr(), "chr20")
s2 <- br$line()
Expand Down

0 comments on commit 470acaf

Please sign in to comment.