From f3e5ce55bcf05d390fb5c6fe9d6a3a54ac37f729 Mon Sep 17 00:00:00 2001 From: Zilong-Li Date: Sun, 22 Sep 2024 10:54:10 +0200 Subject: [PATCH] v0.5.0 --- NEWS.md | 8 ++++++ README.Rmd | 24 ++++++++++++++--- README.md | 23 +++++++++++++--- docs/404.html | 2 +- docs/CONTRIBUTING.html | 2 +- docs/LICENSE-text.html | 2 +- docs/PULL_REQUEST_TEMPLATE.html | 2 +- .../concordance-of-two-vcf-files.html | 2 +- docs/articles/index.html | 2 +- docs/authors.html | 2 +- docs/index.html | 26 ++++++++++++++----- docs/news/index.html | 20 +++++++++++++- docs/pkgdown.yml | 2 +- docs/reference/index.html | 2 +- docs/reference/vcfcomp.html | 9 ++++--- docs/reference/vcfplot.html | 2 +- docs/reference/vcfpopgen.html | 2 +- docs/reference/vcfppR-package.html | 2 +- docs/reference/vcfreader.html | 7 ++++- docs/reference/vcfsummary.html | 2 +- docs/reference/vcftable.html | 2 +- docs/reference/vcfwriter.html | 2 +- docs/search.json | 2 +- 23 files changed, 113 insertions(+), 36 deletions(-) diff --git a/NEWS.md b/NEWS.md index c2948d9..7657fb9 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,11 @@ +# vcfppR 0.5.0 +* upgrade `vcfpp.h` to v0.5.1 +* add `bcfreader$updateSamples()` function +* `vcfcomp`: can take `vcftable` object as input +* `vcfcomp`: defaults changed `setid=FALSE` +* bug fix + + # vcfppR 0.4.6 * add `vcfplot` function * fix bug in `vcftable` when FORMAT has unaligned list diff --git a/README.Rmd b/README.Rmd index 891b272..e491cc0 100644 --- a/README.Rmd +++ b/README.Rmd @@ -88,14 +88,14 @@ Want to investigate the concordance between two VCF files? `vcfcomp` is the util ```{r r2} res <- vcfcomp(test = rawvcf, truth = phasedvcf, stats = "r2", region = "chr21:1-5100000", - formats = c("GT","GT")) + formats = c("GT","GT"), setid = TRUE) par(mar=c(5,5,2,2), cex.lab = 2) vcfplot(res, col = 2,cex = 2, lwd = 3, type = "b") ``` ```{r pse} res <- vcfcomp(test = rawvcf, truth = phasedvcf, - stats = "pse", + stats = "pse", setid = TRUE, region = "chr21:5000000-5500000", samples = "HG00673,NA10840", return_pse_sites = TRUE) @@ -124,9 +124,25 @@ vcfplot(res, main = "Structure Variant Counts", col = 1:7) ## R API of vcfpp.h -There are two classes i.e. ***vcfreader*** and ***vcfwriter*** offering the full R-bindings of vcfpp.h. Check out the examples in the [tests](tests/testthat) folder or refer to the manual. +There are two classes i.e. ***vcfreader*** and ***vcfwriter*** offering the full +R-bindings of vcfpp.h. Check out the examples in the [tests](tests/testthat) +folder or refer to the manual, e.g. `?vcfppR::vcfreader`. ```r -?vcfppR::vcfreader +library(testthat) +test_that("can change samples name and set genotypes for single sample", { + br <- vcfreader$new(svfile, "", "HG00096") + br$variant() + br$genotypes(F) + br$setGenotypes(c(1L,1L)) + outfile <- paste0(tempfile(), ".vcf.gz") + br$output(outfile) + br$updateSamples("ZZZZZ") + br$write() + br$close() + vcf <- vcftable(outfile) + expect_true(vcf$gt==2) + expect_true(vcf$samples=="ZZZZZ") +}) ``` diff --git a/README.md b/README.md index aa17402..6dae4c7 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ to calculate the genotype correlation between the test and the truth. ``` r res <- vcfcomp(test = rawvcf, truth = phasedvcf, stats = "r2", region = "chr21:1-5100000", - formats = c("GT","GT")) + formats = c("GT","GT"), setid = TRUE) par(mar=c(5,5,2,2), cex.lab = 2) vcfplot(res, col = 2,cex = 2, lwd = 3, type = "b") ``` @@ -106,7 +106,7 @@ vcfplot(res, col = 2,cex = 2, lwd = 3, type = "b") ``` r res <- vcfcomp(test = rawvcf, truth = phasedvcf, - stats = "pse", + stats = "pse", setid = TRUE, region = "chr21:5000000-5500000", samples = "HG00673,NA10840", return_pse_sites = TRUE) @@ -146,8 +146,23 @@ vcfplot(res, main = "Structure Variant Counts", col = 1:7) There are two classes i.e. ***vcfreader*** and ***vcfwriter*** offering the full R-bindings of vcfpp.h. Check out the examples in the -[tests](tests/testthat) folder or refer to the manual. +[tests](tests/testthat) folder or refer to the manual, +e.g. `?vcfppR::vcfreader`. ``` r -?vcfppR::vcfreader +library(testthat) +test_that("can change samples name and set genotypes for single sample", { + br <- vcfreader$new(svfile, "", "HG00096") + br$variant() + br$genotypes(F) + br$setGenotypes(c(1L,1L)) + outfile <- paste0(tempfile(), ".vcf.gz") + br$output(outfile) + br$updateSamples("ZZZZZ") + br$write() + br$close() + vcf <- vcftable(outfile) + expect_true(vcf$gt==2) + expect_true(vcf$samples=="ZZZZZ") +}) ``` diff --git a/docs/404.html b/docs/404.html index 9b9fc27..748c76b 100644 --- a/docs/404.html +++ b/docs/404.html @@ -24,7 +24,7 @@ vcfppR - 0.4.6 + 0.5.0