Skip to content

Commit

Permalink
MetaSTAAR v0.9.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
xihaoli committed Feb 5, 2024
1 parent addd956 commit fabe581
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
24 changes: 12 additions & 12 deletions R/MetaSTAAR_merge_cond.R
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,8 @@ MetaSTAAR_merge_cond <- function(chr,start.loc,end.loc,study.names,sample.sizes,
if (effect.cond == "homogeneous") {
U.rare.merge <- Reduce("+", lapply(sumstat.merge.list, function(x) {x[rv.index,][-ex.index,]$U}))
U.adj.merge <- Reduce("+", U_adj.list)
cov.rare.adj.merge <- Reduce("+", lapply(GTPG_cond.list, function(x) {x[var.rare.index,]}))
cov.adj.merge <- Reduce("+", lapply(GTPG_cond.list, function(x) {x[var.adj.index,]}))
cov.rare.adj.merge <- Reduce("+", lapply(GTPG_cond.list, function(x) {x[var.rare.index,,drop=FALSE]}))
cov.adj.merge <- Reduce("+", lapply(GTPG_cond.list, function(x) {x[var.adj.index,,drop=FALSE]}))
cov.rare.merge <- Reduce("+", mapply(function(x,y) {
(x - as.matrix(y[,12:dim(y)[2]]) %*% t(as.matrix(y[,12:dim(y)[2]])))[rv.index, rv.index][-ex.index,-ex.index]
}, x = cov.merge.list, y = sumstat.merge.list, SIMPLIFY = FALSE))
Expand All @@ -391,24 +391,24 @@ MetaSTAAR_merge_cond <- function(chr,start.loc,end.loc,study.names,sample.sizes,
}else{
U.merge <- Reduce("+", mapply(function(x,y,z) {
x <- x[rv.index,][-ex.index,]$U
z.rare <- z[var.rare.index,]
z.adj <- z[var.adj.index,]
z.rare <- z[var.rare.index,,drop=FALSE]
z.adj <- z[var.adj.index,,drop=FALSE]
return(x-z.rare%*%ginv(z.adj)%*%y) # Do not use solve()
}, x = sumstat.merge.list, y = U_adj.list, z = GTPG_cond.list, SIMPLIFY = FALSE))

cov.merge <- Reduce("+", mapply(function(x,y,z) {
cov <- (x - as.matrix(y[,12:dim(y)[2]]) %*% t(as.matrix(y[,12:dim(y)[2]])))[rv.index, rv.index][-ex.index,-ex.index]
z.rare <- z[var.rare.index,]
z.adj <- z[var.adj.index,]
z.rare <- z[var.rare.index,,drop=FALSE]
z.adj <- z[var.adj.index,,drop=FALSE]
return(cov-z.rare%*%ginv(z.adj)%*%t(z.rare))
}, x = cov.merge.list, y = sumstat.merge.list, z = GTPG_cond.list, SIMPLIFY = FALSE))
}
}else{
if (effect.cond == "homogeneous") {
U.rare.merge <- Reduce("+", lapply(sumstat.merge.list, function(x) {x[rv.index,]$U}))
U.adj.merge <- Reduce("+", U_adj.list)
cov.rare.adj.merge <- Reduce("+", lapply(GTPG_cond.list, function(x) {x[var.rare.index,]}))
cov.adj.merge <- Reduce("+", lapply(GTPG_cond.list, function(x) {x[var.adj.index,]}))
cov.rare.adj.merge <- Reduce("+", lapply(GTPG_cond.list, function(x) {x[var.rare.index,,drop=FALSE]}))
cov.adj.merge <- Reduce("+", lapply(GTPG_cond.list, function(x) {x[var.adj.index,,drop=FALSE]}))
cov.rare.merge <- Reduce("+", mapply(function(x,y) {
(x - as.matrix(y[,12:dim(y)[2]]) %*% t(as.matrix(y[,12:dim(y)[2]])))[rv.index, rv.index]
}, x = cov.merge.list, y = sumstat.merge.list, SIMPLIFY = FALSE))
Expand All @@ -418,15 +418,15 @@ MetaSTAAR_merge_cond <- function(chr,start.loc,end.loc,study.names,sample.sizes,
}else{
U.merge <- Reduce("+", mapply(function(x,y,z) {
x <- x[rv.index,]$U
z.rare <- z[var.rare.index,]
z.adj <- z[var.adj.index,]
z.rare <- z[var.rare.index,,drop=FALSE]
z.adj <- z[var.adj.index,,drop=FALSE]
return(x-z.rare%*%ginv(z.adj)%*%y) # Do not use solve()
}, x = sumstat.merge.list, y = U_adj.list, z = GTPG_cond.list, SIMPLIFY = FALSE))

cov.merge <- Reduce("+", mapply(function(x,y,z) {
cov <- (x - as.matrix(y[,12:dim(y)[2]]) %*% t(as.matrix(y[,12:dim(y)[2]])))[rv.index, rv.index]
z.rare <- z[var.rare.index,]
z.adj <- z[var.adj.index,]
z.rare <- z[var.rare.index,,drop=FALSE]
z.adj <- z[var.adj.index,,drop=FALSE]
return(cov-z.rare%*%ginv(z.adj)%*%t(z.rare))
}, x = cov.merge.list, y = sumstat.merge.list, z = GTPG_cond.list, SIMPLIFY = FALSE))
}
Expand Down
24 changes: 12 additions & 12 deletions R/MetaSTAAR_merge_varlist_cond.R
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,8 @@ MetaSTAAR_merge_varlist_cond <- function(chr,variant_pos,study.names,sample.size
if (effect.cond == "homogeneous") {
U.rare.merge <- Reduce("+", lapply(sumstat.merge.list, function(x) {x[rv.index,][-ex.index,]$U}))
U.adj.merge <- Reduce("+", U_adj.list)
cov.rare.adj.merge <- Reduce("+", lapply(GTPG_cond.list, function(x) {x[var.rare.index,]}))
cov.adj.merge <- Reduce("+", lapply(GTPG_cond.list, function(x) {x[var.adj.index,]}))
cov.rare.adj.merge <- Reduce("+", lapply(GTPG_cond.list, function(x) {x[var.rare.index,,drop=FALSE]}))
cov.adj.merge <- Reduce("+", lapply(GTPG_cond.list, function(x) {x[var.adj.index,,drop=FALSE]}))
cov.rare.merge <- Reduce("+", mapply(function(x,y) {
(x - as.matrix(y[,12:dim(y)[2]]) %*% t(as.matrix(y[,12:dim(y)[2]])))[rv.index, rv.index][-ex.index,-ex.index]
}, x = cov.merge.list, y = sumstat.merge.list, SIMPLIFY = FALSE))
Expand All @@ -436,24 +436,24 @@ MetaSTAAR_merge_varlist_cond <- function(chr,variant_pos,study.names,sample.size
}else{
U.merge <- Reduce("+", mapply(function(x,y,z) {
x <- x[rv.index,][-ex.index,]$U
z.rare <- z[var.rare.index,]
z.adj <- z[var.adj.index,]
z.rare <- z[var.rare.index,,drop=FALSE]
z.adj <- z[var.adj.index,,drop=FALSE]
return(x-z.rare%*%ginv(z.adj)%*%y) # Do not use solve()
}, x = sumstat.merge.list, y = U_adj.list, z = GTPG_cond.list, SIMPLIFY = FALSE))

cov.merge <- Reduce("+", mapply(function(x,y,z) {
cov <- (x - as.matrix(y[,12:dim(y)[2]]) %*% t(as.matrix(y[,12:dim(y)[2]])))[rv.index, rv.index][-ex.index,-ex.index]
z.rare <- z[var.rare.index,]
z.adj <- z[var.adj.index,]
z.rare <- z[var.rare.index,,drop=FALSE]
z.adj <- z[var.adj.index,,drop=FALSE]
return(cov-z.rare%*%ginv(z.adj)%*%t(z.rare))
}, x = cov.merge.list, y = sumstat.merge.list, z = GTPG_cond.list, SIMPLIFY = FALSE))
}
}else{
if (effect.cond == "homogeneous") {
U.rare.merge <- Reduce("+", lapply(sumstat.merge.list, function(x) {x[rv.index,]$U}))
U.adj.merge <- Reduce("+", U_adj.list)
cov.rare.adj.merge <- Reduce("+", lapply(GTPG_cond.list, function(x) {x[var.rare.index,]}))
cov.adj.merge <- Reduce("+", lapply(GTPG_cond.list, function(x) {x[var.adj.index,]}))
cov.rare.adj.merge <- Reduce("+", lapply(GTPG_cond.list, function(x) {x[var.rare.index,,drop=FALSE]}))
cov.adj.merge <- Reduce("+", lapply(GTPG_cond.list, function(x) {x[var.adj.index,,drop=FALSE]}))
cov.rare.merge <- Reduce("+", mapply(function(x,y) {
(x - as.matrix(y[,12:dim(y)[2]]) %*% t(as.matrix(y[,12:dim(y)[2]])))[rv.index, rv.index]
}, x = cov.merge.list, y = sumstat.merge.list, SIMPLIFY = FALSE))
Expand All @@ -463,15 +463,15 @@ MetaSTAAR_merge_varlist_cond <- function(chr,variant_pos,study.names,sample.size
}else{
U.merge <- Reduce("+", mapply(function(x,y,z) {
x <- x[rv.index,]$U
z.rare <- z[var.rare.index,]
z.adj <- z[var.adj.index,]
z.rare <- z[var.rare.index,,drop=FALSE]
z.adj <- z[var.adj.index,,drop=FALSE]
return(x-z.rare%*%ginv(z.adj)%*%y) # Do not use solve()
}, x = sumstat.merge.list, y = U_adj.list, z = GTPG_cond.list, SIMPLIFY = FALSE))

cov.merge <- Reduce("+", mapply(function(x,y,z) {
cov <- (x - as.matrix(y[,12:dim(y)[2]]) %*% t(as.matrix(y[,12:dim(y)[2]])))[rv.index, rv.index]
z.rare <- z[var.rare.index,]
z.adj <- z[var.adj.index,]
z.rare <- z[var.rare.index,,drop=FALSE]
z.adj <- z[var.adj.index,,drop=FALSE]
return(cov-z.rare%*%ginv(z.adj)%*%t(z.rare))
}, x = cov.merge.list, y = sumstat.merge.list, z = GTPG_cond.list, SIMPLIFY = FALSE))
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Please see the <a href="docs/MetaSTAAR_manual.pdf">**MetaSTAAR** user manual</a>
## 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.6.3 (November 18, 2023).
The current version is 0.9.6.3 (February 5, 2024).
## Citation
If you use **MetaSTAAR** for your work, please cite:

Expand Down

0 comments on commit fabe581

Please sign in to comment.