MRCIEU / TwoSampleMR

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

Design instruments by calling the GWAS catalog API #297

Open mightyphil2000 opened 3 years ago

mightyphil2000 commented 3 years ago

Describe the feature you would like to see

A new function that creates instruments using the GWAS catalog by calling the gwasrapidd R package (this package accesses the GWAS catalog API) https://github.com/ramiromagno/gwasrapidd This could replace the current system whereby we load a local copy of the GWAS catalog using the mrinstruments package. This would allow one to design instruments using the most up-to-date version of the GWAS catalog.

Describe the anticipated value of this feature to the wider research community

It would allow users to create instruments based on the latest version of the GWAS catalog. We wouldn't have to periodically download and format the GWAS catalog for incorporation into the mrinstruments package.

Contribute a solution

I've already created a function for the CheckSumStats package that calls gwasrapidd that could be repurposed for this new instrument function

mightyphil2000 commented 1 year ago

I've created a new branch called instrument_from_gwascatalog that extracts genetic associations from the EBI GWAS catalog and formats these into the expected exposure format for the harmonise_data function: https://github.com/MRCIEU/TwoSampleMR/tree/instrument_from_gwascatalog

NaomiHuntley commented 4 months ago

@mightyphil2000 Hello - Is there any documentation showing how to use this function? Thank you.

mightyphil2000 commented 4 months ago

Hi Naomi

The function is still in development but to use it you have to switch to the instrument_from_gwascatalog branch of the github repository.

The function is defined within instruments.R. The name of the function is : extract_instruments_gwas_catalog(trait=NULL,efo=NULL,efo_id=NULL,map_association_to_study=TRUE)

' Create instruments using the NHGRI-EBI GWAS Catalog

'

' This function extracts associations from the GWAS catalog and converts them into the expected exposure format for the harmonise_data function. It does not, however, check that the associations are independent. After running this function, consider using clump_data to ensure the associations are independent. This function may take a few minutes to run, especially for traits with hundreds of genetic associations identified in multiple studies

'

' @param trait the trait of interest as reported in the GWAS catalog

' @param efo_id identifier for the trait of interest in the experimental factor ontology

' @param efo trait of interest in the experimental factor ontology

' @param map_association_to_study map the genetic association results to study level information in the GWAS catalog, including GWAS catalog study identifiers and reported ancestry. Setting this argument to FALSE will speed up the function but will also result in more biased instruments and biased Mendelian randomization results. Hence it should only be set to FALSE by expert users. Default = TRUE

'

'

' @importFrom magrittr %>%

' @export

' @return data frame


From: Naomi Huntley @.> Sent: 29 April 2024 22:47 To: MRCIEU/TwoSampleMR @.> Cc: Philip Haycock @.>; Mention @.> Subject: Re: [MRCIEU/TwoSampleMR] Design instruments by calling the GWAS catalog API (#297)

@mightyphil2000https://github.com/mightyphil2000 Hello - Is there any documentation showing how to use this function? Thank you.

— Reply to this email directly, view it on GitHubhttps://github.com/MRCIEU/TwoSampleMR/issues/297#issuecomment-2083739814, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACSDAPQAVLGS7RZBMD6UTFLY725W3AVCNFSM5B44Z3T2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBYGM3TGOJYGE2A. You are receiving this because you were mentioned.Message ID: @.***>