Skip to content

Commit

Permalink
STAAR v0.9.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
xihaoli committed Nov 14, 2024
1 parent e2cbf6a commit c9717bd
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 6 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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 <xihaoli@unc.edu>, Zilin Li <lizl@nenu.edu.cn>
Description: An R package for performing STAAR procedure in whole-genome sequencing studies.
Expand Down
9 changes: 8 additions & 1 deletion R/STAAR.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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!")
Expand All @@ -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]
Expand Down
7 changes: 7 additions & 0 deletions R/STAAR_Binary_SPA.R
Original file line number Diff line number Diff line change
Expand Up @@ -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").
Expand Down Expand Up @@ -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){

Expand Down Expand Up @@ -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]
Expand Down
8 changes: 7 additions & 1 deletion R/STAAR_cond.R
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Please see the <a href="docs/STAAR_manual.pdf">**STAAR** user manual</a> 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:

Expand Down
Binary file modified docs/STAAR_manual.pdf
Binary file not shown.
6 changes: 5 additions & 1 deletion man/STAAR.Rd

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

4 changes: 4 additions & 0 deletions man/STAAR_Binary_SPA.Rd

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

4 changes: 4 additions & 0 deletions man/STAAR_cond.Rd

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

0 comments on commit c9717bd

Please sign in to comment.