Open Taylorwu98 opened 2 months ago
Hi!
Thanks for your message. This should not be happening, as all the function does with tophits_list
object is just collapse two exposure tables together: exposures <- bind_rows(tophits_list)
and then uses it to subset the outcomes: ull_gwas_list[[i]] <- full_gwas_list[[i]] %>% filter(SNP %in% exposures$SNP)
.
This is very interesting becauses I tried this with the official mv_extract_exposures_local() function from the twosampleMR package and it also gave me this error. The read order changed my result significantly
id_exposure <- c(LFP,BFP) exposure_dat <- mv_extract_exposures_local(
- id_exposure,
- sep = "\t",
- phenotype_col = "outcome",
- snp_col = "SNP",
- beta_col = "beta.outcome",
- se_col = "se.outcome",
- eaf_col = "eaf.outcome",
- effect_allele_col = "effect_allele.outcome",
- other_allele_col = "other_allele.outcome",
- pval_col = "pval.outcome",
- min_pval = 1e-200,
- pval_threshold = 5e-08,
- clump_r2 = 0.001,
- clump_kb = 10000,
- harmonise_strictness = 3
- )
outcome_dat <- extract_outcome_data(exposure_dat$SNP, "ebi-a-GCST003367") Extracting data for 319 SNP(s) from 1 GWAS(s) Finding proxies for 196 SNPs in outcome ebi-a-GCST003367 Extracting data for 196 SNP(s) from 1 GWAS(s)
dat <- mv_harmonise_data(exposure_dat, outcome_dat) Harmonising Left LFP (iLGTP2) and circulating leptin levels || id:ebi-a-GCST003367 (ebi-a-GCST003367) Removing the following SNPs for being palindromic with intermediate allele frequencies: rs10423928, rs10887578, rs11062590, rs116353685, rs11823635, rs1187415, rs12156460, rs1377184, rs1454687, rs1782508, rs2281819, rs2396625, rs254027, rs2644135, rs28457808, rs2914231, rs2972156, rs4547574, rs4894808, rs55685371, rs6021948, rs60661769, rs61826865, rs62396185, rs6561937, rs6860245, rs7206608, rs72891717, rs73213484, rs7442885, rs7577174, rs9304665, rs9788550, rs987469 res <- mv_multiple(dat,plots = T)
res$result id.exposure exposure id.outcome outcome nsnp b se pval 1 ICLoZX BFP ebi-a-GCST003367 circulating leptin levels || id:ebi-a-GCST003367 187 0.636455 0.2611178 0.0147923 2 iLGTP2 Left LFP ebi-a-GCST003367 circulating leptin levels || id:ebi-a-GCST003367 178 -0.121164 0.3297994 0.7133303
id_exposure <- c(BFP,LFP) exposure_dat <- mv_extract_exposures_local(
- id_exposure,
- sep = "\t",
- phenotype_col = "outcome",
- snp_col = "SNP",
- beta_col = "beta.outcome",
- se_col = "se.outcome",
- eaf_col = "eaf.outcome",
- effect_allele_col = "effect_allele.outcome",
- other_allele_col = "other_allele.outcome",
- pval_col = "pval.outcome",
- min_pval = 1e-200,
- pval_threshold = 5e-08,
- clump_r2 = 0.001,
- clump_kb = 10000,
- harmonise_strictness = 3
- )
outcome_dat <- extract_outcome_data(exposure_dat$SNP, "ebi-a-GCST003367") Extracting data for 325 SNP(s) from 1 GWAS(s) Finding proxies for 189 SNPs in outcome ebi-a-GCST003367 Extracting data for 189 SNP(s) from 1 GWAS(s)
dat <- mv_harmonise_data(exposure_dat, outcome_dat) Harmonising BFP (bDt4CM) and circulating leptin levels || id:ebi-a-GCST003367 (ebi-a-GCST003367) Removing the following SNPs for incompatible alleles: rs1013402, rs10209821, rs10278040, rs10423928, rs10496731, rs10756713, rs10801366, rs10830566, rs10840354, rs10848835, rs10854853, rs10938397, rs10999460, rs11012732, rs11042030, rs11043764, rs11079849, rs11173522, rs11205303, rs11222371, rs113019802, rs113670235, rs11584996, rs11619393, rs116353685, rs11642015, rs11782074, rs11782341, rs1182199, rs11873650, rs11943456, rs12031634, rs12037698, rs12039708, rs12367809, rs12533489, rs12619178, rs12724928, rs12890931, rs13062093, rs13107325, rs13109830, rs13174863, rs13275517, rs13389219, rs13427822, rs1486921, rs1503526, rs16916303, rs16934748, rs17016133, rs17024393, rs17036326, rs17055653, rs17390234, rs17522122, rs17704028, rs17770336, rs1804998, rs188955288, rs2002023, rs2020942, rs2043016, rs2052607, rs208477, rs2111281, rs2112347, rs217667, rs2281819, rs2291127, rs2306593, rs2370982, rs2371767, rs2396625, rs2398861, rs2410804, rs2494196, rs2503185, rs252749, rs254027, rs2678204, rs2702123, rs28613758, rs28726372, rs2978551, rs3218036, rs34045288, rs34061097, rs34483452, rs36090025, rs36174203, rs3736896, rs3754963, rs3764002, rs3766823, rs3817428, rs3911063, rs3923501, rs40067, rs4450871, rs4547574, rs4718964, rs4759318, rs479018, rs4790292, rs4800487, rs4889606, rs4894808, rs501038, rs538656, rs539515, rs55931203, rs56186137, rs56254492, rs56399737, rs57636386, rs57800857, rs58083390, rs58300328, rs6021948, rs60572790, rs60661769, rs61985887, rs62025831, rs620498, rs62178054, rs62396185, rs6491427, rs66679256, rs6752378, rs6860245, rs6973656, rs6973700, rs7133378, rs7229000, rs72697297, rs72820274, rs72891717, rs72995085, rs7305790, rs73213501, rs73236524, rs7442885, rs750090, rs75192636, rs7535335, rs75641275, rs7580600, rs7591494, rs7613261, rs7755574, rs7774, rs7934638, rs8042404, rs8078135, rs8087074, rs8096564, rs9289630, rs9295, rs9352694, rs947791, rs9515455, rs9568867, rs9686032, rs9788550, rs9861440, rs987469, rs9955276, rs9976423 Removing the following SNPs for being palindromic with intermediate allele frequencies: rs10887578, rs1377184, rs1454687, rs1782508, rs2613497, rs7020825, rs9304665, rs9770544
res <- mv_multiple(dat)
res$result id.exposure exposure id.outcome outcome nsnp b se pval 1 RjwB71 BFP ebi-a-GCST003367 circulating leptin levels || id:ebi-a-GCST003367 62 1.3648340 0.4730805 0.003914219 2 vEtd3h Left LFP ebi-a-GCST003367 circulating leptin levels || id:ebi-a-GCST003367 58 -0.9591139 0.5878121 0.102749568
Exact same thing happened when I used your function. I have been trying to figure it out why.
Hi Marina,
I came across your blog last week and I attempted to replicate your analysis using my own data. However, I notice a strange problem, in your get_mv_exposures function, if the order of the list is changed, it impacts the result.
For example, if the order of the tophits_list is c(2,1) instead of c(1,2), it changes the result.
I tried the mv_extract_exposures_local() function in the twosamplemr package as well, it has the same problem.
I am a first year master student, I am really confused on this.