Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eas #12

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Eas #12

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions scripts/extract_rsids.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
##
library(data.table)
library(readxl)
library(dplyr)

mdd_targets <- read_xlsx("C:/Users/Mutema/Downloads/41591_2021_1310_MOESM3_ESM (1).xlsx",sheet= 'ST4', skip = 2 )

#select the 18 genes from the list
mdd <-c("GABRA1","GRIN1","CACNA1H","ESR1","ADRA2A","VDR","DRD2","SRD5A1",
"CHRM3","COMT","HTR1D","HTR2A","HRH1","PPARG","GRIA1","CACNA2D1",
"CACNA1C","PDE10A")
fileterd_mdd_targets <-mdd_targets %>% filter(`gene name`%in% mdd)

#read in the db SNP reference
#ref <- fread("./data/dbsnp.v153.b37.vcf") # warning,this is a huge file of 78gb

# we used bcftools query to extract the Chr, Pos and rsid and saved the data as plain text file.

#bcftools query -f '%CHROM %POS %ID\n' dbsnp.v153.b37.vcf > mdd_snps.txt

#we then merged the filtered_mdd_targets with the mdd_snps.txt by position.

mdd_snps <- read.csv("mdd_snps.txt", sep = "\t")

# Perform the join and retain only the desired columns
result <- fileterd_mdd_targets %>%
left_join(mdd_snps, by = c("chr", "pos")) %>%
select(chr, pos, rsid, effect_allele, other_allele, beta, se, pvalue)