Skip to content

Commit

Permalink
add vcfreader@samples()
Browse files Browse the repository at this point in the history
  • Loading branch information
Zilong-Li committed Jan 4, 2024
1 parent d99d313 commit ac824c9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# vcfppR 0.3.7

* add vcfreader@samples()

# vcfppR 0.3.6

* add `vcfreader::line`
Expand Down
1 change: 1 addition & 0 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ heterozygosity <- function(vcffile, region = "", samples = "-", pass = FALSE, qu
#' @field hasOTHER Test if current variant has a OTHER or not
#' @field hasOVERLAP Test if current variant has a OVERLAP or not
#' @field nsamples Return the number of samples
#' @field samples Return a vector of samples id
#' @field header Return the raw string of the vcf header
#' @field string Return the raw string of current variant including newline
#' @field line Return the raw string of current variant without newline
Expand Down
2 changes: 2 additions & 0 deletions man/vcfreader.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/vcf-reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ using namespace std;
//' @field hasOTHER Test if current variant has a OTHER or not
//' @field hasOVERLAP Test if current variant has a OVERLAP or not
//' @field nsamples Return the number of samples
//' @field samples Return a vector of samples id
//' @field header Return the raw string of the vcf header
//' @field string Return the raw string of current variant including newline
//' @field line Return the raw string of current variant without newline
Expand Down Expand Up @@ -245,6 +246,7 @@ class vcfreader {
return v.size() / nsamples();
}
inline std::string header() const { return br.header.asString(); }
inline std::vector<std::string> samples() const { return br.header.getSamples(); }
inline std::string string() const { return var.asString(); }
inline std::string line() {
std::string s = var.asString();
Expand Down Expand Up @@ -363,6 +365,7 @@ RCPP_MODULE(vcfreader) {
.method("hasOTHER", &vcfreader::hasOTHER)
.method("hasOVERLAP", &vcfreader::hasOVERLAP)
.method("nsamples", &vcfreader::nsamples)
.method("samples", &vcfreader::samples)
.method("header", &vcfreader::header)
.method("string", &vcfreader::string)
.method("line", &vcfreader::line)
Expand Down

0 comments on commit ac824c9

Please sign in to comment.