Al-Murphy / MungeSumstats

Rapid standardisation and quality control of GWAS or QTL summary statistics
https://doi.org/doi:10.18129/B9.bioc.MungeSumstats
75 stars 15 forks source link

How to load local chain files #172

Closed sfgfdasd closed 10 months ago

sfgfdasd commented 1 year ago

Thank you for the powerful R package your team has provided. I have encountered some issues while using it and hope to get your help. Every time I open R and use the format_sumstats() or loftover() functions, I need to re-download the liftover chain file, which sometimes fails. Is there a way to use a chain file that has already been downloaded locally? I noticed that the package includes two files, hg38ToHg19 and hg19ToHg38, which can be used when there is no internet connection. How do I call them?

Al-Murphy commented 1 year ago

Hi,

It should catch errors downloading these files automatically and just use the saved versions if this happens. Are you sure this isn't what's happening for you?

Can you send the output of the error along with the version of MSS you are using?

Thanks, Alan.

sfgfdasd commented 1 year ago

Hello,

I encounter the following error message when I fail to download the liftover chain file:

"Performing data liftover from hg38 to hg19. Converting summary statistics to GenomicRanges. Note that you are fetching the UCSC chain file, which requires a licence for commercial use. Downloading chain file from UCSC Genome Browser. Trying URL 'ftp://hgdownload.cse.ucsc.edu/goldenPath/hg38/liftOver/hg38ToHg19.over.chain.gz' Content type 'unknown' length 1246411 bytes (1.2 MB) Error in get_chain_file(from = query_ucsc, to = target_ucsc, chain_source = chain_source, : Download of chain file from UCSC Genome Browser failed, use ensembl chain file (chain_source='ensembl') for an offline solution. In addition: Warning message: In file.remove(local_path) : cannot remove file 'C:\Users\AISAKA~1\AppData\Local\Temp\RtmpINtuW0/hg38ToHg19.over.chain.gz', reason 'Permission denied'."

If the download fails, MungeSumstats does not use the local chain file and stops running directly. I am using version 1.8.0 of MungeSumstats.

Al-Murphy commented 1 year ago

The code is running as expected, see the error message:

Download of chain file from UCSC Genome Browser failed, use ensembl chain file (chain_source='ensembl')
for an offline solution.

We can't store a local version of UCSC due to copyright issues so if you want to use the liftover functionality offline, use ensembl (the parameter chain_source = "ensembl" will do this for you).

Also, there seems to be a permissions issue with your machine that R code can't remove files:

cannot remove file 'C:\Users\AISAKA~1\AppData\Local\Temp\RtmpINtuW0/hg38ToHg19.over.chain.gz', reason 'Permission denied'."

This isn't likely to be the cause of MSS throwing the error but if you sort that it might help?

sfgfdasd commented 1 year ago

Thank you for your reply. Maybe I can try again after reinstalling or upgrading R.

Al-Murphy commented 1 year ago

Thank you for your reply. Maybe I can try again after reinstalling or upgrading R.

Let me know if that works!

Al-Murphy commented 10 months ago

closing just based on the time elapse, feel free to open again if problem persists.