SNP的rs号和染色体位置信息相互转换

BiocManager::install("SNPlocs.Hsapiens.dbSNP144.GRCh37")
library(SNPlocs.Hsapiens.dbSNP144.GRCh37)
snps<-SNPlocs.Hsapiens.dbSNP144.GRCh37
for (i in unique(BMI2$Chr)){
  my_pos<-BMI2$Position[BMI2$Chr==i]
  chr_snps<-snpsBySeqname(snps, as.character(i))
  idx<-match(my_pos,pos(chr_snps))
  rsids<-mcols(chr_snps)$RefSNP_id[idx]
  BMI2$rsid[BMI2$Chr==i]<-rsids
  print(paste(as.character(i),"is ok"))
}

37/38自主选择

你可能感兴趣的:(MR,r语言)