GithubHelp home page GithubHelp logo

xihaoli / metastaar Goto Github PK

View Code? Open in Web Editor NEW
21.0 6.0 7.0 1.45 MB

An R package for performing MetaSTAAR procedure in whole-genome sequencing studies

License: GNU General Public License v3.0

R 95.83% C++ 4.17%
statistical-genetics whole-genome-sequencing meta-analysis functional-annotation rare-variant-analysis metastaar-procedure

metastaar's People

Contributors

xihaoli avatar zilinli1988 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

metastaar's Issues

Is it possible to perform meta-analysis for all variants in a chr?

Dear @xihaoli,
I've performed rare variant analysis by using the STAARpipeline for two different datasets. I have agds and obj_nullmodel files for each chromosome for each study.

I would like to perform a meta-analysis of the rare variants with their functional annotation as you provide with this R package. The first step is to create summary statistics and covariance files of each study, the outputs from MetaSTAAR_worker_sumstat.R and MetaSTAAR_worker_cov.R .

I would like to use all variants from the agds file chr by chr, instead of a selected variant list. You can see the code I used below!

agds.path <- agds_dir[chr]
genofile <- seqOpen(agds.path)

genotype <- as(as.matrix(readBED(paste0(input_path,"input_10k_chr",chr,"_hg38"), row = 1, col = 1, quiet = TRUE)), "dgCMatrix")

CHR <- as.numeric(seqGetData(genofile, "chromosome"))
position <- as.integer(seqGetData(genofile, "position"))
REF <- as.character(seqGetData(genofile, "$ref"))
ALT <- as.character(seqGetData(genofile, "$alt"))

variant_list <- as.data.frame(cbind.data.frame(CHR,position,REF,ALT))

sumstat <- MetaSTAAR_worker_sumstat(genotype, obj_nullmodel, variant_list, qc_label=NULL)
        
        Error in h(simpleError(msg, call)) : 
        error in evaluating the argument 'x' in selecting a method for function 'colSums': cannot allocate vector of size 17.6 Gb
        In addition: Warning message:
        In asMethod(object) :
        sparse->dense coercion: allocating vector of size 17.6 GiB

I wanted to reduce the vector size with a shorter variant list as below, however, it did not work.

n <- 1000
nr <- nrow(variant_list)
splited_data  <- split(variant_list, rep(1:ceiling(nr/n), each=n, length.out=nr))

sumstat_<- c()
for (kk in 1:(nr/n)){

variant_info <- splited_data[[kk]]

sumstat2 <- MetaSTAAR_worker_sumstat(genotype, obj_nullmodel, variant_list, qc_label=NULL)

sumstat <- rbind(sumstat, sumstat2)
}
      Error in MetaSTAAR_worker_sumstat(genotype, obj_nullmodel, variant_info,  : 
      Dimensions don't match for genotype and variant_info!
      In addition: Warning message:
      In asMethod(object) :
      sparse->dense coercion: allocating vector of size 17.6 GiB

Is it possible to perform for all variants in the chr? Do you have any suggestions to reduce the vector size?
Thank you!
Bests,
Pelin

Error in MetaSTAAR_worker_sumstat || use a sparse genetic relatedness matrix when fitting null model!

Dear Developers,

I am interested in using metaSTAAR to conduct meta-analysis from large-scale GWAS studies.

I fit null model using dense genetic relationship matrix (GRM) with STAAR R library. Later on I use null model object from STAAR library in metaSTAAR where I receive an error for using sparse GRM.

Fit null model:

CH_GWAS_obj_nullmodel<-fit_null_glmmkin( AD~ AGE+as.factor(SEX)+PC1+PC2+PC3+PC4,data=pheno,family=binomial(link="logit"),id="IID",kins=grm_all)

Move to metaSTAAR:

MetaSTAAR_worker_sumstat(df_genotype_ch,CH_GWAS_obj_nullmodel,df_snp_ch)

Error:

Error in MetaSTAAR::MetaSTAAR_worker_sumstat(as.matrix(df_genotype_ch),  :
  Please use a sparse genetic relatedness matrix when fitting the null model!

Can you please help?

I use tutorial from https://htmlpreview.github.io/?https://github.com/xihaoli/STAAR/blob/master/docs/STAAR_vignette.html

Library and R versions:

R 4.0
MetaSTAAR_0.9.6
STAAR_0.9.6

Error in MetaSTAAR_worker_sumstat || Cholmod error 'X and/or Y have wrong dimensions

Dear Developer,

With STAAR I fitted null model using sparse genetic relationship matrix.

CH_GWAS_obj_nullmodel_sparse <-  fit_null_glmmkin( CCD01 ~ AGE +as.factor(SEX)+PC1+PC3,
data= pheno_all,family=binomial(link="logit"),id="IID",kins=as(ch_grm_all,"dgCMatrix"))

Run using null model output:

MetaSTAAR::MetaSTAAR_worker_sumstat(as.matrix(df_genotype_ch), CH_GWAS_obj_nullmodel_sparse ,df_snp_ch)

Error:

Error in t(Geno) %*% obj_nullmodel$Sigma_iX :
  Cholmod error 'X and/or Y have wrong dimensions' at file ../MatrixOps/cholmod_sdmult.c, line 88

Genotype in ch_genotype has 12508 row (one per person) and one column, that is, at the moment only one SNP.

length(CH_GWAS_obj_nullmodel_sparse$Y)

9877

 length(CH_GWAS_obj_nullmodel_sparse$X)

69139

Can you please assist?

Thank you

What input should be provided to MetaSTAAR_merge?

Hello,

I've generated sumstat & cov files for my two cohorts using MetaSTAAR_worker_cov() & MetaSTAAR_worker_sumstat(), but I'm now unsure how to feed those files to MetaSTAAR_merge(), which seems to be the next step in the pipeline. The main point of my confusion is that MetaSTAAR_merge() has no argument where I can specify the name under which I saved the sumstat & cov files; it only has arguments where I can specify the directory. (For the record, I'm using version 0.9.6.3 of the R package.)

I also notice that the scripts that accompany your 2023 article don't seem to make use of MetaSTAAR_merge() at all, and rather use a custom MetaSTAAR_merge_simulation() function instead...

Could you shed some light on how these functions are supposed to be used?

Thanks !

Using summary statistics only

Dear MetaSTAAR team,

Apologies for the basic question but I was wondering if metaSTAAR would work with only summary statistics and no individual level data. I have summary stats from a SAIGE-GENE analysis in two cohort at both a gene and variant level but I do not have access to covariates or individual level patient data. Is there a way to get this to work with metaSTAAR as I all the inputs seem to require a covaraite file?

Many thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.