MRCIEU / TwoSampleMR

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

multivariable MR #45

Open zqcrystal325 opened 5 years ago

zqcrystal325 commented 5 years ago

Hi, I am trying to harmonise data in multivariable MR and get the error below

Error in data_frame(A1 = A1, A2 = A2, B1 = B1, B2 = B2, keep = keep) : could not find function "data_frame"

My exposure and outcome data are as follows; id_exposure <- c(1095, 1004, 1090,90,91,92,961,813) id_outcome <- 980

Do you know how to solve this problem?

BTW, is there any chance we can use our own dataset for multivariable MR?

Thanks.

mightyphil2000 commented 5 years ago

It sounds like you are missing some required packages. Could you try installing the dplyr R package and see if that helps? If that doesn't help could you try installing the tibble package?

Yes, you can use your own summary data (for either the exposure or outcome or both).


From: zqcrystal325 notifications@github.com Sent: 15 December 2018 16:46:24 To: MRCIEU/TwoSampleMR Cc: Subscribed Subject: [MRCIEU/TwoSampleMR] multivariable MR (#45)

Hi, I am trying to harmonise data in multivariable MR and get the error below

Error in data_frame(A1 = A1, A2 = A2, B1 = B1, B2 = B2, keep = keep) : could not find function "data_frame"

My exposure and outcome data are as follows; id_exposure <- c(1095, 1004, 1090,90,91,92,961,813) id_outcome <- 980

Do you know how to solve this problem?

BTW, is there any chance we can use our own dataset for multivariable MR?

Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/MRCIEU/TwoSampleMR/issues/45, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AKQwPlGC6JvroaEA7g-JgDrwUrZhSo2cks5u5SdggaJpZM4ZUzvk.

Suus0509 commented 4 years ago

Hi,

I am trying to perform a multivariable MR with my own summary exposure data, but I did not succeed yet.

Yes, you can use your own summary data (for either the exposure or outcome or both).

Can you help me how to do it? After opening the TwoSampleMR-package, I ran the following codes:

create vector with my own exposure summary data

a <- 'own_exposure_summary_data.txt'

search through available GWA Studies and create a vector with the id of the exposures which I wanted to use

id_exposure <- c('a','UKB-a:360')

Afterwards I created the right exposure data format

Exposure_dat <- mv_extract_exposures(id_exposure, clump_r2 = 0.001, clump_kb = 10000, harmonise_strictness = 2, access_token = ieugwasr::check_access_token(), find_proxies = TRUE, force_server = FALSE)

However, I keep receiving the following error

Requesting default values. Extracting from pre-clumped data 1 out of 2 requested outcomes have pre-calculated instruments. Extracting data from 1 GWAS(s) and performing LD clumping [>] 1 of 1 Clumping 1, 167 SNPs Extracting data for 167 SNP(s) from 2 GWAS(s) Finding proxies for 167 SNPs in outcome oestradiol.txt Extracting data for 167 SNP(s) from 1 GWAS(s) Error in $<-.data.frame(*tmp*, "mr_keep.outcome", value = TRUE) : replacement has 1 row, data has 0

I used the same exposure data in a conventional MR as well, and I did not have any trouble with the data.frame there. I hope you can help me out. Thanks in advance.

0631g commented 4 years ago

Hi, I am trying to perform a multivariable MR with my own summary outcome data, but I did not succeed yet. outcome_dat <- read_outcome_data(filename = "gwas_summary.csv", snps = bmi_exp_dat$SNP,
sep = ",", snp_col = "SNP", beta_col = "beta", se_col = "se", effect_allele_col = "effect_allele", other_allele_col = "other_allele", eaf_col = "eaf", pval_col = "P-value", samplesize_col = "samplesize") Error in $<-.data.frame(*tmp*, "mr_keep.outcome", value = TRUE) : replacement has 1 row, data has 0

Do you know how to solve this problem?

rak128 commented 2 years ago

0631g

I have the same issue- did you ever figure out the solution? Thanks!