diff --git a/DESCRIPTION b/DESCRIPTION index 8bee7a3..21d94bb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: STAAR Type: Package Title: STAAR Procedure for Dynamic Incorporation of Multiple Functional Annotations in Whole-Genome Sequencing Studies -Version: 0.9.7.1 -Date: 2024-08-09 +Version: 0.9.7.2 +Date: 2024-11-14 Author: Xihao Li [aut, cre], Zilin Li [aut, cre], Han Chen [aut] Maintainer: Xihao Li , Zilin Li Description: An R package for performing STAAR procedure in whole-genome sequencing studies. diff --git a/R/STAAR.R b/R/STAAR.R index 46cee35..1c20dbb 100644 --- a/R/STAAR.R +++ b/R/STAAR.R @@ -25,6 +25,8 @@ #' defining rare variants (default = 0.01). #' @param rv_num_cutoff the cutoff of minimum number of variants of analyzing #' a given variant-set (default = 2). +#' @param rv_num_cutoff_max the cutoff of maximum number of variants of analyzing +#' a given variant-set (default = 1e+09). #' @return A list with the following members: #' @return \code{num_variant}: the number of variants with minor allele frequency > 0 and less than #' \code{rare_maf_cutoff} in the given variant-set that are used for performing the @@ -81,7 +83,8 @@ #' @export STAAR <- function(genotype,obj_nullmodel,annotation_phred=NULL, - rare_maf_cutoff=0.01,rv_num_cutoff=2){ + rare_maf_cutoff=0.01,rv_num_cutoff=2, + rv_num_cutoff_max=1e9){ if(!inherits(genotype, "matrix") && !inherits(genotype, "Matrix")){ stop("genotype is not a matrix!") @@ -108,6 +111,10 @@ STAAR <- function(genotype,obj_nullmodel,annotation_phred=NULL, gc() annotation_phred <- annotation_phred[RV_label,,drop=FALSE] + if(sum(RV_label) >= rv_num_cutoff_max){ + stop(paste0("Number of rare variant in the set is more than ",rv_num_cutoff_max,"!")) + } + if(sum(RV_label) >= rv_num_cutoff){ G <- as(Geno_rare,"dgCMatrix") MAF <- MAF[RV_label] diff --git a/R/STAAR_Binary_SPA.R b/R/STAAR_Binary_SPA.R index 02203f4..15c5bf7 100644 --- a/R/STAAR_Binary_SPA.R +++ b/R/STAAR_Binary_SPA.R @@ -23,6 +23,8 @@ #' defining rare variants (default = 0.01). #' @param rv_num_cutoff the cutoff of minimum number of variants of analyzing #' a given variant-set (default = 2). +#' @param rv_num_cutoff_max the cutoff of maximum number of variants of analyzing +#' a given variant-set (default = 1e+09). #' @param tol a positive number specifying tolerance, the difference threshold for parameter #' estimates in saddlepoint apporximation algorithm below which iterations should be stopped (default = ".Machine$double.eps^0.25"). #' @param max_iter a positive integers pecifying the maximum number of iterations for applying the saddlepoint approximation algorithm (default = "1000"). @@ -66,6 +68,7 @@ STAAR_Binary_SPA <- function(genotype,obj_nullmodel,annotation_phred=NULL, rare_maf_cutoff=0.01,rv_num_cutoff=2, + rv_num_cutoff_max=1e9, tol=.Machine$double.eps^0.25,max_iter=1000, SPA_p_filter=FALSE,p_filter_cutoff=0.05){ @@ -95,6 +98,10 @@ STAAR_Binary_SPA <- function(genotype,obj_nullmodel,annotation_phred=NULL, # gc() annotation_phred <- annotation_phred[RV_label,,drop=FALSE] + if(sum(RV_label) >= rv_num_cutoff_max){ + stop(paste0("Number of rare variant in the set is more than ",rv_num_cutoff_max,"!")) + } + if(sum(RV_label) >= rv_num_cutoff){ # G <- as(Geno_rare,"dgCMatrix") MAF <- MAF[RV_label] diff --git a/R/STAAR_cond.R b/R/STAAR_cond.R index a30be40..dc37baa 100644 --- a/R/STAAR_cond.R +++ b/R/STAAR_cond.R @@ -31,6 +31,8 @@ #' defining rare variants (default = 0.01). #' @param rv_num_cutoff the cutoff of minimum number of variants of analyzing #' a given variant-set (default = 2). +#' @param rv_num_cutoff_max the cutoff of maximum number of variants of analyzing +#' a given variant-set (default = 1e+09). #' @param method_cond a character value indicating the method for conditional analysis. #' \code{optimal} refers to regressing residuals from the null model on \code{genotype_adj} #' as well as all covariates used in fitting the null model (fully adjusted) and taking the residuals; @@ -95,7 +97,7 @@ #' @export STAAR_cond <- function(genotype,genotype_adj,obj_nullmodel,annotation_phred=NULL, - rare_maf_cutoff=0.01,rv_num_cutoff=2, + rare_maf_cutoff=0.01,rv_num_cutoff=2,rv_num_cutoff_max=1e9, method_cond=c("optimal","naive")){ method_cond <- match.arg(method_cond) # evaluate choices @@ -132,6 +134,10 @@ STAAR_cond <- function(genotype,genotype_adj,obj_nullmodel,annotation_phred=NULL gc() annotation_phred <- annotation_phred[RV_label,,drop=FALSE] + if(sum(RV_label) >= rv_num_cutoff_max){ + stop(paste0("Number of rare variant in the set is more than ",rv_num_cutoff_max,"!")) + } + if(sum(RV_label) >= rv_num_cutoff){ G <- as(Geno_rare,"dgCMatrix") MAF <- MAF[RV_label] diff --git a/README.md b/README.md index e2036fd..0c6f6e5 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Please see the **STAAR** user manual for det ## Data Availability The whole-genome functional annotation data assembled from a variety of sources and the precomputed annotation principal components are available at the [Functional Annotation of Variant - Online Resource (FAVOR)](https://favor.genohub.org) site and [FAVOR Essential Database](https://doi.org/10.7910/DVN/1VGTJI). ## Version -The current version is 0.9.7.1 (August 9, 2024). +The current version is 0.9.7.2 (November 14, 2024). ## Citation If you use **STAAR** for your work, please cite: diff --git a/docs/STAAR_manual.pdf b/docs/STAAR_manual.pdf index 2a46c99..86321bd 100644 Binary files a/docs/STAAR_manual.pdf and b/docs/STAAR_manual.pdf differ diff --git a/man/STAAR.Rd b/man/STAAR.Rd index 7275a54..dc6e3e7 100644 --- a/man/STAAR.Rd +++ b/man/STAAR.Rd @@ -9,7 +9,8 @@ STAAR( obj_nullmodel, annotation_phred = NULL, rare_maf_cutoff = 0.01, - rv_num_cutoff = 2 + rv_num_cutoff = 2, + rv_num_cutoff_max = 1e+09 ) } \arguments{ @@ -35,6 +36,9 @@ defining rare variants (default = 0.01).} \item{rv_num_cutoff}{the cutoff of minimum number of variants of analyzing a given variant-set (default = 2).} + +\item{rv_num_cutoff_max}{the cutoff of maximum number of variants of analyzing +a given variant-set (default = 1e+09).} } \value{ A list with the following members: diff --git a/man/STAAR_Binary_SPA.Rd b/man/STAAR_Binary_SPA.Rd index a09fe97..a515e29 100644 --- a/man/STAAR_Binary_SPA.Rd +++ b/man/STAAR_Binary_SPA.Rd @@ -10,6 +10,7 @@ STAAR_Binary_SPA( annotation_phred = NULL, rare_maf_cutoff = 0.01, rv_num_cutoff = 2, + rv_num_cutoff_max = 1e+09, tol = .Machine$double.eps^0.25, max_iter = 1000, SPA_p_filter = FALSE, @@ -39,6 +40,9 @@ defining rare variants (default = 0.01).} \item{rv_num_cutoff}{the cutoff of minimum number of variants of analyzing a given variant-set (default = 2).} +\item{rv_num_cutoff_max}{the cutoff of maximum number of variants of analyzing +a given variant-set (default = 1e+09).} + \item{tol}{a positive number specifying tolerance, the difference threshold for parameter estimates in saddlepoint apporximation algorithm below which iterations should be stopped (default = ".Machine$double.eps^0.25").} diff --git a/man/STAAR_cond.Rd b/man/STAAR_cond.Rd index d725f8b..28e3b87 100644 --- a/man/STAAR_cond.Rd +++ b/man/STAAR_cond.Rd @@ -11,6 +11,7 @@ STAAR_cond( annotation_phred = NULL, rare_maf_cutoff = 0.01, rv_num_cutoff = 2, + rv_num_cutoff_max = 1e+09, method_cond = c("optimal", "naive") ) } @@ -43,6 +44,9 @@ defining rare variants (default = 0.01).} \item{rv_num_cutoff}{the cutoff of minimum number of variants of analyzing a given variant-set (default = 2).} +\item{rv_num_cutoff_max}{the cutoff of maximum number of variants of analyzing +a given variant-set (default = 1e+09).} + \item{method_cond}{a character value indicating the method for conditional analysis. \code{optimal} refers to regressing residuals from the null model on \code{genotype_adj} as well as all covariates used in fitting the null model (fully adjusted) and taking the residuals;