neurogenomics / MAGMA_Celltyping

Find causal cell-types underlying complex trait genetics
https://neurogenomics.github.io/MAGMA_Celltyping
70 stars 31 forks source link

MAGMA.Celltyping::import_magma_files issue #137

Open sofiapuvogelvittini opened 1 year ago

sofiapuvogelvittini commented 1 year ago

1. Bug description

I was previously using the following code to extract the GWAS summaries of 1) Biological insights from 108 schizophrenia-associated genetic loci. Nature, 2014 2) Genome-wide association study identifies 30 loci associated with bipolar disorder. Nature Genetics, 2019 3) Meta-analysis of GWAS of over 16,000 individuals with autism spectrum disorder highlights a novel locus at 10q24.32 and a significant overlap with schizophrenia. Molecular Autism, 2017. 4) Liu, J.Z., S. van Sommeren, H. Huang, et al., Association analyses identify 38 susceptibility loci for inflammatory bowel disease and highlight shareed genetic risk across populations. Nat Genet, 2015

diseases<-c("ieu-a-22","ieu-b-41","ieu-a-1185","ieu-a-12") magma_dirs <- MAGMA.Celltyping::import_magma_files(ids = diseases)

However, it's not working anymore. Also, if I try with each dissease per separate, magma_dirs <- MAGMA.Celltyping::import_magma_files(ids = c("ieu-a-22")), I obtain the same error message.

Could you pleas help me to understand what migh be going wrong? Thank you very much

Console output

Error in download.file(url = x, destfile = destfile): cannot open URL 'https://github.com/neurogenomics/MAGMA_Files_Public/raw/master/data/MAGMA_Files/ieu-a-22.tsv.gz.35UP.10DOWN/ieu-a-22.tsv.gz.35UP.10DOWN.genes.out' Traceback:

  1. MAGMA.Celltyping::import_magma_files(ids = c("ieu-a-22"))
  2. github_download_files(filelist = magma_files, save_dir = fix_path(save_dir), . nThread = nThread, overwrite = overwrite, verbose = verbose)
  3. unlist(parallel::mclapply(filelist, function(x) { . branch <- stringr::str_split(string = x, pattern = "/")[[1]][7] . folder_structure <- paste(stringr::str_split(string = x, . pattern = "/")[[1]][-c(seq(1, 7))], collapse = "/") . destfile <- file.path(save_dir, folder_structure) . dir.create(dirname(destfile), showWarnings = FALSE, recursive = TRUE) . if (!file.exists(destfile) | isTRUE(overwrite)) { . message_parallel("Downloading file ==> ", destfile) . download.file(url = x, destfile = destfile) . } . else { . message_parallel("Importing previously downloaded file: ", . destfile) . } . return(destfile) . }, mc.cores = nThread))
  4. parallel::mclapply(filelist, function(x) { . branch <- stringr::str_split(string = x, pattern = "/")[[1]][7] . folder_structure <- paste(stringr::str_split(string = x, . pattern = "/")[[1]][-c(seq(1, 7))], collapse = "/") . destfile <- file.path(save_dir, folder_structure) . dir.create(dirname(destfile), showWarnings = FALSE, recursive = TRUE) . if (!file.exists(destfile) | isTRUE(overwrite)) { . message_parallel("Downloading file ==> ", destfile) . download.file(url = x, destfile = destfile) . } . else { . message_parallel("Importing previously downloaded file: ", . destfile) . } . return(destfile) . }, mc.cores = nThread)
  5. lapply(X, FUN, ...)
  6. FUN(X[[i]], ...)
  7. download.file(url = x, destfile = destfile)
bschilder commented 1 year ago

Those files were removed bc of some issues I discovered with how many non-biallelic SNPs were being dropped by MungeSumStats (up to 50% of all SNPs), which had some unknown degree of effect on the MAGMA files. Once I sort this out, I am working on regenerating these MAGMA files.

In the meantime, you can always create new MAGMA files yourself with map_snps_to_genes