SNP的rsid匹配
在處理 Nealelab 中的summary data sets時,發現數據缺失SNP對應rs號:
可以看到數據中只有variant變量,這里提供了解決方案:https://www.biostars.org/p/349284/ ,實踐一下!
Getting Started
首先下載對應的SNP注釋信息
Common SNPs
VCFcommon=ftp://ftp.ncbi.nih.gov/snp/organisms/human_9606_b151_GRCh38p7/VCF/common_all_20180418.vcf.gz
wget -b -c ${VCFcommon}
All SNPs:
VCFall=ftp://ftp.ncbi.nih.gov/snp/organisms/human_9606_b151_GRCh38p7/VCF/All_20180418.vcf.gz
wget -b -c ${VCFall}
在R中讀取數據
下載了全部的數據以防萬一,VCF數據讀取(很慢。。。)
讀取數據很慢,讀取中是這樣顯示的:
15G讀不出來,換成common SNPs(1.5G):
成功了,導出txt格式方便使用
install.packages(“vcfR”)
library(vcfR)
vcf <- read.vcfR("common_20180418.vcf.gz")
vcf2 = vcf@fix[,1:3]
fwrite(vcf2,"common_all_20180418.txt",sep = "\t",quote = T,row.names = F,col.names = T)
Day 2
今天匹配的時候出問題了,全都匹配不上,查詢后發現可能是版本號不一致
數據中的RSid用的是hg19 (GRCh37) 而我下載的卻是hg38 (GRCh38),真坑,重新下載
Common SNPs
VCFcommon=ftp://ftp.ncbi.nih.gov/snp/organisms/human_9606_b151_GRCh37p13/VCF/common_all_20180423.vcf.gz
wget -b -c ${VCFcommon}
可以,成功與summary data匹配上!
在這發現一個新的方法,回頭再試一下:https://www.cnblogs.com/chenwenyan/p/13166529.html