I download a VCF file + index (https://gwas.mrcieu.ac.uk/datasets/ebi-a-GCST90001942/) I tried to open it on R (see below script). However, R would only load and not open my file. I extracted the VCF as a csv file, and R can it read. However, now I need to obtain the summary statistics (beta, SE, EA, non-EA, EA frequency. I am doing the following
install.packages("tidyverse")
install.packages("remotes")
install.packages("gwasrapidd")
library(tidyverse)
library(remotes)
library(gwasrapidd)
remotes::install_github("mrcieu/ieugwasr")
remotes::install_github("MRCIEU/TwoSampleMR")
remotes::install_github("MRCIEU/gwasvcf")
remotes::install_github("MRCIEU/gwasglue")
library(ieugwasr)
library(TwoSampleMR)
library(gwasvcf)
library(gwasglue)
Using GWAS VCF files
library(gwasvcf)
set_bcftools('/path/to/bcftools')
set_plink('/path/to/plink')
remotes::install_github('mrcieu/genetics.binaRies', force = TRUE)
set_plink()
set_bcftools()
suppressWarnings(suppressPackageStartupMessages({
library(gwasvcf)
library(VariantAnnotation)
library(dplyr)
library(magrittr)
}))
set_bcftools()
Reading in everything
To read an entire dataset use the readVcf function.
vcffile <- "/Users/path/Desktop/ebi-a-GCST90001942.vcf.gz"
vcf_data <- readVcf(vcffile)
R loads forever and does not open...
I haven't tried
gwasvcfpackage, but did try converting the summaryvcffile you provided withMungeSumstatsR package and it worked fine.After installing the
MungeSumstatspackage, you could simplythe package automatically converts the
vcfinto standard summary statistic file.the final output is what you expected
hope it helps.