xihaoli / MetaSTAAR

An R package for performing MetaSTAAR procedure in whole-genome sequencing studies
GNU General Public License v3.0
21 stars 7 forks source link

Question about MetaSTAAR_merge function #7

Closed light26 closed 1 month ago

light26 commented 1 month ago

Dear MetaSTAAR Developer,

I have encountered an error while using the MetaSTAAR_merge function.

My workflow was as follows:

  1. I performed the 'Prefitting stage' using the STAAR package.

    • Input files (gds, phenotype data, grm) were already created using GENESIS.
    • The null model was generated using the STAAR package.
  2. I generated sumstat and cov files using MetaSTAAR_worker_sumstat and MetaSTAAR_worker_cov.

    • These files were named according to the source code format, e.g., 'summary.stat.diagnosis.WES.chr21.segment22.Rdata' and 'summary.stat.diagnosis.WGS.chr21.segment22.Rdata'.
    • I also attempted using the .rds format, but this was unsuccessful as well.
  3. When attempting to use MetaSTAAR_merge, I encountered the following error:

chr21_start <- 10541113  # 21chr starting point
chr21_end <- 46664370  # 21chr end point

# MetaSTAAR_merge function
merged_data <- MetaSTAAR_merge(
  chr = 21,
  start.loc = chr21_start,
  end.loc = chr21_end,
  study.names = c("WES", "WGS"),  # Study names
  sample.sizes = c(nrow(genotype1_sparse_21), nrow(genotype2_sparse_21)),  # Sample sizes of each study
  sumstat.dir = sumstat_dir,  # Directory for summary statistics files
  cov.dir = cov_dir,  # Directory for covariance files
  rare_maf_cutoff = 0.01,  # MAF cutoff to define rare variants
  cov_maf_cutoff = c(0.01, 0.01),  # MAF cutoff for covariance in each study, same as MetaSTAAR_worker_cov
  trait = "diagnosis",  
  segment.size = 5e+05,  # same as MetaSTAAR_worker_cov
  check_qc_label = FALSE  # Whether to check QC label
)

**Error in MetaSTAAR_merge(chr = 21, start.loc = chr21_start, end.loc = chr21_end,  : 
  object 'sumstat.merge.list' not found**

I can confirm that all the directories (sumstat_dir, cov_dir) have been correctly created and my covariance matrix is rectangular. Could you please advise on why the 'sumstat.merge.list' object is not being found and how I might resolve this issue? Thank you for your time and assistance. Best regards, Jang

xihaoli commented 1 month ago

Hi Jang,

Thanks for letting me know. I see that you used segment.size = 5e+05, but start.loc and end.loc refer to a local region so it should be at most as large as the segment.size. However, the width between chr21_start <- 10541113 and chr21_end <- 46664370 seem too large.

Best, Xihao

light26 commented 1 month ago

Dear, Xihao I am grateful to your real fast response. Your prompt attention and willingness to help are truly appreciated for my research progress.

Best, Jang