diff --git a/DESCRIPTION b/DESCRIPTION index a1f027c..f4c6607 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -3,7 +3,7 @@ Type: Package Title: Parallel Computing Toolset for Relatedness and Principal Component Analysis of SNP Data Version: 1.37.2 -Date: 2024-03-08 +Date: 2024-03-26 Depends: R (>= 2.15), gdsfmt (>= 1.8.3) LinkingTo: gdsfmt Imports: methods diff --git a/NEWS b/NEWS index d8e4013..a71c579 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,10 @@ UTILITIES o new option 'autosave' in `snpgdsLDpruning()` + o new option `start.pos="random.f500"` in `snpgdsLDpruning()`, allowing + faster genotype scanning (it is used by default now). To be compatible + with the previous versions, please specify `start.pos="random"` manually + o Fix the welcome message when running in a non x86 system diff --git a/R/LD.R b/R/LD.R index e1dd5b9..d55af19 100755 --- a/R/LD.R +++ b/R/LD.R @@ -100,7 +100,8 @@ snpgdsLDMat <- function(gdsobj, sample.id=NULL, snp.id=NULL, slide=250L, snpgdsLDpruning <- function(gdsobj, sample.id=NULL, snp.id=NULL, autosome.only=TRUE, remove.monosnp=TRUE, maf=0.005, missing.rate=0.05, method=c("composite", "r", "dprime", "corr"), slide.max.bp=500000L, - slide.max.n=NA, ld.threshold=0.2, start.pos=c("random", "first", "last"), + slide.max.n=NA, ld.threshold=0.2, + start.pos=c("random.f500", "random", "first", "last"), num.thread=1L, autosave=NULL, verbose=TRUE) { # check @@ -123,9 +124,8 @@ snpgdsLDpruning <- function(gdsobj, sample.id=NULL, snp.id=NULL, if (length(autosave)!=1L || anyNA(autosave) || autosave=="") stop("'autosave' should be NULL or a file name.") } - stopifnot(is.logical(verbose), length(verbose)==1L) - start.pos <- match.arg(start.pos) + stopifnot(is.logical(verbose), length(verbose)==1L) if (verbose) { @@ -196,6 +196,7 @@ snpgdsLDpruning <- function(gdsobj, sample.id=NULL, snp.id=NULL, # call LD prune for this chromosome startidx <- switch(start.pos, + random.f500 = sample.int(min(n.tmp, 500L), 1L), random = sample.int(n.tmp, 1L), first = 1L, last = n.tmp) diff --git a/man/snpgdsLDpruning.Rd b/man/snpgdsLDpruning.Rd index 6a246f8..81a5f29 100644 --- a/man/snpgdsLDpruning.Rd +++ b/man/snpgdsLDpruning.Rd @@ -10,7 +10,8 @@ snpgdsLDpruning(gdsobj, sample.id=NULL, snp.id=NULL, autosome.only=TRUE, remove.monosnp=TRUE, maf=0.005, missing.rate=0.05, method=c("composite", "r", "dprime", "corr"), slide.max.bp=500000L, - slide.max.n=NA, ld.threshold=0.2, start.pos=c("random", "first", "last"), + slide.max.n=NA, ld.threshold=0.2, + start.pos=c("random.f500", "random", "first", "last"), num.thread=1L, autosave=NULL, verbose=TRUE) } \arguments{ @@ -31,8 +32,10 @@ snpgdsLDpruning(gdsobj, sample.id=NULL, snp.id=NULL, autosome.only=TRUE, \item{slide.max.bp}{the maximum basepairs in the sliding window} \item{slide.max.n}{the maximum number of SNPs in the sliding window} \item{ld.threshold}{the LD threshold} - \item{start.pos}{"random": a random starting position; "first": start from - the first position; "last": start from the last position} + \item{start.pos}{"random.f500", a starting postion randomly selected from + the first 500 markers (by default); "random": a random starting + position; "first": start from the first position; "last": start from + the last position. "random.f500" is applicable for >= v1.37.2} \item{num.thread}{the number of (CPU) cores used; if \code{NA}, detect the number of cores automatically} \item{autosave}{NULL or a file name for autosaving a single R object