Last active
February 24, 2021 15:58
-
-
Save explodecomputer/c732f569bd16db737b2ab86bf3d4aee1 to your computer and use it in GitHub Desktop.
MDD OpenGWAS upload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(GwasDataImport) | |
library(data.table) | |
library(ieugwasr) | |
library(dplyr) | |
# Download the Howard et al 2019 MDD GWAS from https://datashare.ed.ac.uk/handle/10283/3203 | |
a <- data.table::fread("https://datashare.ed.ac.uk/bitstream/handle/10283/3203/PGC_UKB_depression_genome-wide.txt?sequence=3&isAllowed=y") | |
# It doesn't have chr/pos, so let's look them up on OpenGWAS (a bit slow!) | |
b <- get_positions(a$MarkerName) | |
# Merge in the chr/pos | |
ab <- dplyr::inner_join(a, b, by=c("MarkerName"="rsid")) | |
# Write the file | |
data.table::fwrite(ab, "PGC_UKB_depression_genome-wide_chrpos.txt.gz", sep=" ", quote=FALSE, row=FALSE, col=TRUE) | |
# Initialise | |
x <- Dataset$new(filename="PGC_UKB_depression_genome-wide_chrpos.txt.gz") | |
# Specify columns | |
x$determine_columns(list(chr_col=8, snp_col=1, pos_col=9, oa_col=3, ea_col=2, eaf_col=4, beta_col=5, se_col=6, pval_col=7)) | |
# Process dataset | |
x$format_dataset() | |
# Input metadata | |
x$collect_metadata(list( | |
trait="Major depression", | |
author="Howard DM", | |
consortium="PGC", | |
year="2019", | |
pmid="30718901", | |
build="HG19/GRCh37", | |
category="Disease", | |
subcategory="NA", | |
group_name="public", | |
population="European", | |
sex="Males and Females", | |
note='UKBiobank and PGC (excluding 23andme)', | |
ontology="EFO:0003761;MONDO:0002009", | |
ncase=170756, | |
ncontrol=329443, | |
unit="logOR")) | |
# Upload metadata | |
x$api_metadata_upload() | |
# Upload summary data | |
x$api_gwasdata_upload() | |
# View report | |
x$api_report() | |
# Release dataset | |
x$api_gwas_release() | |
# Delete wd | |
x$delete_wd() | |
x <- Dataset$new(igd_id="ieu-b-102") | |
x$api_report() | |
x$collect_metadata(list( | |
trait="Major depression", | |
author="Howard DM", | |
consortium="PGC", | |
year="2019", | |
pmid="30718901", | |
build="HG19/GRCh37", | |
category="Disease", | |
subcategory="NA", | |
group_name="public", | |
population="European", | |
sex="Males and Females", | |
note='UKBiobank and PGC (excluding 23andme)', | |
ontology="EFO:0003761;MONDO:0002009", | |
ncase=170756, | |
ncontrol=329443, | |
unit="logOR")) | |
x$api_metadata_edit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment