MRCIEU / TwoSampleMR

R package for performing 2-sample MR using MR-Base database
https://mrcieu.github.io/TwoSampleMR
Other
418 stars 176 forks source link

[BUG]: Error in mtfrm.default(list(url = "https://api.opengwas.io/api/ld/clump", : cannot mtfrm #495

Open DC-Jer opened 5 months ago

DC-Jer commented 5 months ago

Please make sure that this is a bug! If you have questions about how to use TwoSampleMR please use the Discussions function instead.

Describe the bug (required)

TwoSampleMR package can not query the IEU OpenGWAS database normally through API access.

截屏2024-03-30 13 52 13 截屏2024-03-30 13 53 57

Describe the current behaviour you observe (required)

Because of the API issue, TwoSampleMR package can not query any IEU OpenGWAS data online. Attachment is API status. FYI. 截屏2024-03-30 14 09 24

Describe the behaviour you expect (required)

ex_dat<-extract_instruments(outcomes="ukb-b-19953")

ex_clump<- clump_data( ex_dat, clump_kb = 10000, clump_r2 = 0.001, clump_p1 = 1, clump_p2 = 1, pop = "EUR")

Contribute a solution (optional)

Please submit a pull request and/or briefly describe your proposed solution

System information

macOS
platform aarch64-apple-darwin20
version.string R version 4.3.3 (2024-02-29) nickname Angel Food Cake

Additional context

Add any other context about the problem here

ehfuefeg commented 5 months ago

I have encountered the same issue, how should I handle it?

xhxingjinyi commented 5 months ago

I have encountered the same issue, how should I handle it?

huww1998 commented 5 months ago

I have encountered the same issue when I use the mv_extract_exposures_local function. Recently,when I use extract_outcome_data funciton, it always returns a NULL result even if it showed the message as below:

Extracting data for 10 SNP(s) from 1 GWAS(s)  
Finding proxies for 10 SNPs in outcome ebi-a-GCST90025956  
Extracting data for 10 SNP(s) from 1 GWAS(s)

May it was a server issue?

docZ9 commented 5 months ago

you can use this code:

options(ieugwasr_api = 'gwas-api.mrcieu.ac.uk/')

i believe you will appreciate me

xhxingjinyi commented 5 months ago

Thank you so much for your help!your code solute perfectly addressed my issues,I really appreciate it ---- Replied Message ---- | From | @.> | | Date | 04/02/2024 23:00 | | To | MRCIEU/TwoSampleMR @.> | | Cc | xhxingjinyi @.>, Comment @.> | | Subject | Re: [MRCIEU/TwoSampleMR] [BUG]: Error in mtfrm.default(list(url = "https://api.opengwas.io/api/ld/clump", : cannot mtfrm (Issue #495) |

you can use this code:

options(ieugwasr_api = 'gwas-api.mrcieu.ac.uk/')

i believe you will appreciate me

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

xhxingjinyi commented 5 months ago

options(ieugwasr_api = 'gwas-api.mrcieu.ac.uk/') You can try this code,a kind guy sent it to me. ---- Replied Message ---- | From | Student @.> | | Date | 04/02/2024 17:11 | | To | MRCIEU/TwoSampleMR @.> | | Cc | xhxingjinyi @.>, Comment @.> | | Subject | Re: [MRCIEU/TwoSampleMR] [BUG]: Error in mtfrm.default(list(url = "https://api.opengwas.io/api/ld/clump", : cannot mtfrm (Issue #495) |

I have encountered the same issue when I use the mv_extract_exposures_local function. Recently,when I use extract_outcome_data funciton, it always returns a NULL result even if it showed the message as below:

Extracting data for 10 SNP(s) from 1 GWAS(s)
Finding proxies for 10 SNPs in outcome ebi-a-GCST90025956
Extracting data for 10 SNP(s) from 1 GWAS(s)

May it was a server issue?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

huww1998 commented 5 months ago

Thanks a lot. I solved this problem. Now, I can run clump_data and mv_extract_exposures_local funtion smoothly.

you can use this code:

options(ieugwasr_api = 'gwas-api.mrcieu.ac.uk/')

i believe you will appreciate me

huww1998 commented 5 months ago

Thanks for your help. It works.

options(ieugwasr_api = 'gwas-api.mrcieu.ac.uk/') You can try this code,a kind guy sent it to me. ---- Replied Message ---- | From | Student @.> | | Date | 04/02/2024 17:11 | | To | MRCIEU/TwoSampleMR @.> | | Cc | xhxingjinyi @.>, Comment @.> | | Subject | Re: [MRCIEU/TwoSampleMR] [BUG]: Error in mtfrm.default(list(url = "https://api.opengwas.io/api/ld/clump", : cannot mtfrm (Issue #495) | I have encountered the same issue when I use the mv_extract_exposures_local function. Recently,when I use extract_outcome_data funciton, it always returns a NULL result even if it showed the message as below: Extracting data for 10 SNP(s) from 1 GWAS(s) Finding proxies for 10 SNPs in outcome ebi-a-GCST90025956 Extracting data for 10 SNP(s) from 1 GWAS(s) May it was a server issue? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

huww1998 commented 5 months ago

After I conducted the command options(ieugwasr_api = 'gwas-api.mrcieu.ac.uk/'), I check the api status using ieugwasr::api_status(), the result shows Total public datasets: 50044. That may mean I can acquire GWAS data from the server. image

YuxiaoRuoyao commented 5 months ago

Thanks for this solution and it works. But it needs to be input every time. Any way to make it as default?

yunjiang999 commented 5 months ago

Thanks a lot.

huww1998 commented 5 months ago

I only input the command options(ieugwasr_api = 'gwas-api.mrcieu.ac.uk/') once. And it always works. Maybe you can input this in .Rprofile?

Thanks for this solution and it works. But it needs to be input every time. Any way to make it as default?

ssxxmmm commented 5 months ago

I only input the command options(ieugwasr_api = 'gwas-api.mrcieu.ac.uk/') once. And it always works. Maybe you can input this in .Rprofile?

Thanks for this solution and it works. But it needs to be input every time. Any way to make it as default?

Thanks for your help. What should I do to get this code into .Rprofile? I don't know how to do this.

zkhamis commented 3 months ago

I am having the same error, after clumping using TwoSampleMR version 0.6.3 and packageVersion("ieugwasr") [1] ‘1.0.0’ how to solve this issue ? , tried the supplied code but it did not work

minirose2021 commented 3 months ago

you can use this code:

options(ieugwasr_api = 'gwas-api.mrcieu.ac.uk/')

i believe you will appreciate me

OMG, You are my god.

zkhamis commented 3 months ago

do you run this code before the packages or after, it did not work for me
please advice

No encoding supplied: defaulting to UTF-8. Error in mtfrm.default(list(url = "http://gwas-api.mrcieu.ac.uk/ld/clump", : cannot mtfrm

minirose2021 commented 3 months ago

I run this code after library package

---- Replied Message ---- | From | @.> | | Date | 06/10/2024 23:02 | | To | @.> | | Cc | @.>@.> | | Subject | Re: [MRCIEU/TwoSampleMR] [BUG]: Error in mtfrm.default(list(url = "https://api.opengwas.io/api/ld/clump", : cannot mtfrm (Issue #495) |

do you run this code before the packages or after, it did not work for me

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

zkhamis commented 3 months ago

I run this code after library package ---- Replied Message ---- | From | @.> | | Date | 06/10/2024 23:02 | | To | @.> | | Cc | @.>@.> | | Subject | Re: [MRCIEU/TwoSampleMR] [BUG]: Error in mtfrm.default(list(url = "https://api.opengwas.io/api/ld/clump", : cannot mtfrm (Issue #495) | do you run this code before the packages or after, it did not work for me — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

it is giving me the same error after traffic, tried several times

Please look at vignettes for options on running this locally if you need to run many instances of this command. Clumping xnJJrE, 2125 variants, using EUR population reference Server code: 503; Server is possibly experiencing traffic, trying again... Server code: 503; Server is possibly experiencing traffic, trying again... Server code: 503; Server is possibly experiencing traffic, trying again... Server code: 503; Server is possibly experiencing traffic, trying again... Server code: 503; Server is possibly experiencing traffic, trying again... Failed to retrieve results from server. See error status message in the returned object and contact the developers if the problem persists. No encoding supplied: defaulting to UTF-8. Error in mtfrm.default(list(url = "http://gwas-api.mrcieu.ac.uk/ld/clump", : cannot mtfrm

YF-93 commented 3 months ago

I have encountered the same issue when I use the mv_extract_exposures_local function. Recently,when I use extract_outcome_data funciton, it always returns a NULL result even if it showed the message as below:

Extracting data for 10 SNP(s) from 1 GWAS(s)  
Finding proxies for 10 SNPs in outcome ebi-a-GCST90025956  
Extracting data for 10 SNP(s) from 1 GWAS(s)

May it was a server issue?

I have a similar problem: "when I use extract_outcome_data funciton, it always returns a NULL result even if it showed the messages about 'Extracting data...' and 'Finding proxies...' ". I tried more than 70 GWASs, the outcome was still "NULL". --> Then, I tried to run this: "options(ieugwasr_api = 'gwas-api.mrcieu.ac.uk/')" before running extract_outcome_data function, and then I successfully obtained the outcome data.

I am not sure whether it is a good way to solve this problem.

joellepasman commented 3 months ago

I have tried putting it in my R environment but it doesn't work. Also, if you try running it in RMarkdown it doesn't work. If you run it on the console it works.

Right now even that is not working, I get the 'server is possibly experiencing traffic, trying again...' message until it stops and saus 'cannot mtfrm' again. But that DOES sound like a server issue ;) ?

joellepasman commented 3 months ago

As a fail safe backup it would be nice to get some guidance on what to specify under plink_bin and bfile (the same plink binaries for both?) if you want to use local reference files.

explodecomputer commented 2 months ago

Can anyone who is experiencing this issue provide a reproducible example? For example a list of SNPs and p-values that you are using that leads to the 'cannot mtfrm' error?

Taylorwu98 commented 2 months ago

experiencing the same problem

FLL_exp_dat <- clump_data(FLL_exp_dat) Please look at vignettes for options on running this locally if you need to run many instances of this command. Clumping VhC4Og, 10419 variants, using EUR population reference Server code: 502; Server is possibly experiencing traffic, trying again... Server code: 502; Server is possibly experiencing traffic, trying again... Server code: 502; Server is possibly experiencing traffic, trying again... Server code: 502; Server is possibly experiencing traffic, trying again... Server code: 502; Server is possibly experiencing traffic, trying again... Server code: 502; Server is possibly experiencing traffic, trying again... Server error: 502 Failed to retrieve results from server. See error status message in the returned object and contact the developers if the problem persists. Error in mtfrm.default(list(url = "http://gwas-api.mrcieu.ac.uk/ld/clump", : cannot mtfrm

This persists even when I input options(ieugwasr_api = 'gwas-api.mrcieu.ac.uk/'), this used to work until few days ago.

Same thing happen when I input ieugwasr::api_status()

ieugwasr::api_status() Server code: 502; Server is possibly experiencing traffic, trying again... Server code: 502; Server is possibly experiencing traffic, trying again... Server code: 502; Server is possibly experiencing traffic, trying again... Server code: 502; Server is possibly experiencing traffic, trying again... Server code: 502; Server is possibly experiencing traffic, trying again... Server code: 502; Server is possibly experiencing traffic, trying again... Server error: 502 Failed to retrieve results from server. See error status message in the returned object and contact the developers if the problem persists. url: http://gwas-api.mrcieu.ac.uk/status status_code: 502 headers: Error in cat(format(paste0(y, ":"), width = 30, justify = "right"), x[[y]], : argument 2 (type 'list') cannot be handled by 'cat'

Jega09 commented 1 month ago

you can use this code:

options(ieugwasr_api = 'gwas-api.mrcieu.ac.uk/')

i believe you will appreciate me

That's really helpful. But I still have thesame issue when I try to knit the Rmarkdown file. See the error below

Error in mtfrm.default(): ! cannot mtfrm Backtrace:

  1. TwoSampleMR::clump_data(...)
  2. ieugwasr::ld_clump(...)
  3. ieugwasr:::ld_clump_api(...)
  4. base::subset.data.frame(dat, !dat[["rsid"]] %in% res)
  5. base::eval(e, x, parent.frame())
  6. base::eval(e, x, parent.frame())
  7. dat[["rsid"]] %in% res
    1. base::mtfrm.default(<response>)
Jega09 commented 1 month ago

I have tried putting it in my R environment but it doesn't work. Also, if you try running it in RMarkdown it doesn't work. If you run it on the console it works.

Right now even that is not working, I get the 'server is possibly experiencing traffic, trying again...' message until it stops and saus 'cannot mtfrm' again. But that DOES sound like a server issue ;) ?

I am having the same issue when try to knit the Rmarkdown. Were you able to resolve it?

sure-yeah commented 16 hours ago

you can use this code:

options(ieugwasr_api = 'gwas-api.mrcieu.ac.uk/')

i believe you will appreciate me

Yes, I come here to thank you, and very much.