Skip to content

Commit

Permalink
update seqGDS2SNP() with 'ds.type'
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengxwen committed Aug 13, 2018
1 parent 1af80d7 commit 1d5ab05
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: SeqArray
Type: Package
Title: Big Data Management of Whole-genome Sequence Variant Calls
Version: 1.21.3
Date: 2018-07-29
Version: 1.21.4
Date: 2018-08-12
Depends: R (>= 3.3.0), gdsfmt (>= 1.10.1)
Imports: methods, parallel, IRanges, GenomicRanges, GenomeInfoDb, Biostrings,
S4Vectors
Expand Down
5 changes: 3 additions & 2 deletions R/Conversion.R
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ seqGDS2VCF <- function(gdsfile, vcf.fn, info.var=NULL, fmt.var=NULL,

seqGDS2SNP <- function(gdsfile, out.gdsfn, dosage=FALSE,
compress.geno="LZMA_RA", compress.annotation="LZMA_RA",
optimize=TRUE, verbose=TRUE)
ds.type=c("packedreal16", "float", "double"), optimize=TRUE, verbose=TRUE)
{
# check
stopifnot(is.character(gdsfile) | inherits(gdsfile, "SeqVarGDSClass"))
Expand All @@ -332,6 +332,7 @@ seqGDS2SNP <- function(gdsfile, out.gdsfn, dosage=FALSE,
stopifnot(is.character(compress.annotation), length(compress.annotation)==1L)
stopifnot(is.logical(optimize), length(optimize)==1L)
stopifnot(is.logical(verbose), length(verbose)==1L)
ds.type <- match.arg(ds.type)

if (verbose)
{
Expand Down Expand Up @@ -427,7 +428,7 @@ seqGDS2SNP <- function(gdsfile, out.gdsfn, dosage=FALSE,
FUN = .cfunction("FC_GDS2SNP"))
} else {
.cfunction("FC_SetNumSamp")(length(sampid))
gGeno <- add.gdsn(gfile, "genotype", storage="float32",
gGeno <- add.gdsn(gfile, "genotype", storage=ds.type,
valdim=c(length(sampid), 0L), compress=compress.geno)
put.attr.gdsn(gGeno, "sample.order")
seqApply(gdsfile, dosage, as.is=gGeno, .progress=verbose,
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Release Version: v1.20.1
* [Help Documents](http://zhengxwen.github.io/SeqArray/release/help/00Index.html)
* Tutorials: [Data Management](http://www.bioconductor.org/packages/release/bioc/vignettes/SeqArray/inst/doc/SeqArrayTutorial.html), [R Integration](http://www.bioconductor.org/packages/release/bioc/vignettes/SeqArray/inst/doc/R_Integration.html), [Overview Slides](http://www.bioconductor.org/packages/release/bioc/vignettes/SeqArray/inst/doc/OverviewSlides.html)

Development Version: v1.21.2
Development Version: v1.21.3

[http://www.bioconductor.org/packages/devel/bioc/html/SeqArray.html](http://www.bioconductor.org/packages/devel/bioc/html/SeqArray.html)

Expand Down
5 changes: 4 additions & 1 deletion man/seqGDS2SNP.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
}
\usage{
seqGDS2SNP(gdsfile, out.gdsfn, dosage=FALSE, compress.geno="LZMA_RA",
compress.annotation="LZMA_RA", optimize=TRUE, verbose=TRUE)
compress.annotation="LZMA_RA", ds.type=c("packedreal16", "float", "double"),
optimize=TRUE, verbose=TRUE)
}
\arguments{
\item{gdsfile}{character (GDS file name), or
Expand All @@ -20,6 +21,8 @@ seqGDS2SNP(gdsfile, out.gdsfn, dosage=FALSE, compress.geno="LZMA_RA",
\item{compress.annotation}{the compression method for the GDS variables,
except "genotype"; optional values are defined in the function
\code{add.gdsn}}
\item{ds.type}{applicable when import dosages, the data type for storing
dosages; see \code{\link{add.gdsn}}}
\item{optimize}{if \code{TRUE}, optimize the access efficiency by calling
\code{\link{cleanup.gds}}}
\item{verbose}{if \code{TRUE}, show information}
Expand Down
2 changes: 1 addition & 1 deletion src/ConvToGDS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ COREARRAY_DLL_EXPORT SEXP FC_SetNumSamp(SEXP num)

COREARRAY_DLL_EXPORT SEXP FC_GDS2Dosage(SEXP dosage)
{
int n = LENGTH(dosage);
int n = Rf_isNull(dosage) ? 0 : LENGTH(dosage);
if (n < FC_Num_Sample)
{
dosage = NEW_NUMERIC(FC_Num_Sample);
Expand Down

0 comments on commit 1d5ab05

Please # to comment.