
HGG.SNV數(shù)據(jù)庫(kù)批量獲取信息
HGG.SNV是一個(gè)了解不同人群中人類單核苷酸變異的進(jìn)化和醫(yī)學(xué)意義的數(shù)據(jù)庫(kù)。這個(gè)數(shù)據(jù)庫(kù)的亮點(diǎn)是它綜合了很多項(xiàng)目的各種測(cè)序數(shù)據(jù),其中包括HGDP、HapMap、gnomAD.genomes、SGDP等項(xiàng)目數(shù)據(jù)。其中包括220147份基因組數(shù)據(jù),古人基因組1018份,覆蓋了977個(gè)族群的268890619個(gè)位點(diǎn)。另一個(gè)亮點(diǎn)是有多種線上工具,操作方便。
?
網(wǎng)站鏈接:https://www.pggsnv.org/
?
但是當(dāng)我們要查詢的數(shù)據(jù)量十分龐大時(shí)會(huì)比較費(fèi)時(shí)間,所以我們寫(xiě)一段python腳本來(lái)批量獲取數(shù)據(jù)。
首先使用chrome對(duì)該網(wǎng)站的基本情況進(jìn)行分析。使用Chrome的開(kāi)發(fā)者工具對(duì)傳輸數(shù)據(jù)進(jìn)行監(jiān)控,并將傳輸數(shù)據(jù)篩選為fetch和XHR模式,發(fā)現(xiàn)該網(wǎng)站的前后端是通過(guò)json傳輸?shù)?,屬于前后端分離的情況,所以我們可以直接向網(wǎng)站拉去請(qǐng)求獲取json。
?
我們將其中的json打開(kāi),發(fā)現(xiàn)里面確實(shí)含有位點(diǎn)相關(guān)信息,所以雙擊該json文件獲取url。
?
url:https://www.pggsnv.org/snvSvr/distribute?key=1:231557623-G-C
?
接著我們對(duì)url進(jìn)行解析。通過(guò)對(duì)比已知位點(diǎn)數(shù)據(jù)可知該url中的key應(yīng)該是以這樣的格式組成的:染色體號(hào):堿基對(duì)位置-ref-alt
我們以《Nature-Genetics》期刊上的《Investigating the genetic architecture of noncognitive skills using GWAS-by-subtraction》【1】這篇文章的數(shù)據(jù)為例
設(shè)計(jì)出的爬蟲(chóng)腳本如下:
?
爬取效果如下:
?
reference:
【1】Demange, P.A., Malanchini, M., Mallard, T.T.?et al.?Investigating the genetic architecture of noncognitive skills using GWAS-by-subtraction.?Nat Genet?53,?35–44 (2021). https://doi.org/10.1038/s41588-020-00754-2
【2】Chao Zhang#, Yang Gao#, Zhilin Ning#, Yan Lu#, Xiaoxi Zhang, Jiaojiao Liu, Bo Xie, Zhe Xue, Xiaoji Wang, Kai Yuan, Xueling Ge, Yuwen Pan, Chang Liu, Lei Tian, Yuchen Wang, Dongsheng Lu, Boon-Peng Hoh, Shuhua Xu*. PGG.SNV: understanding the evolutionary and medical implications of human single nucleotide variations in diverse populations. Genome Biology (2019), 20:215.?https://doi.org/10.1186/s13059-019-1838-5
?
代碼:
https://github.com/yhlhhhhh/HGG.SNV_Reptile
?
網(wǎng)站鏈接:https://www.pggsnv.org/
?
但是當(dāng)我們要查詢的數(shù)據(jù)量十分龐大時(shí)會(huì)比較費(fèi)時(shí)間,所以我們寫(xiě)一段python腳本來(lái)批量獲取數(shù)據(jù)。
首先使用chrome對(duì)該網(wǎng)站的基本情況進(jìn)行分析。使用Chrome的開(kāi)發(fā)者工具對(duì)傳輸數(shù)據(jù)進(jìn)行監(jiān)控,并將傳輸數(shù)據(jù)篩選為fetch和XHR模式,發(fā)現(xiàn)該網(wǎng)站的前后端是通過(guò)json傳輸?shù)?,屬于前后端分離的情況,所以我們可以直接向網(wǎng)站拉去請(qǐng)求獲取json。
?
我們將其中的json打開(kāi),發(fā)現(xiàn)里面確實(shí)含有位點(diǎn)相關(guān)信息,所以雙擊該json文件獲取url。
?
url:https://www.pggsnv.org/snvSvr/distribute?key=1:231557623-G-C
?
接著我們對(duì)url進(jìn)行解析。通過(guò)對(duì)比已知位點(diǎn)數(shù)據(jù)可知該url中的key應(yīng)該是以這樣的格式組成的:染色體號(hào):堿基對(duì)位置-ref-alt
我們以《Nature-Genetics》期刊上的《Investigating the genetic architecture of noncognitive skills using GWAS-by-subtraction》【1】這篇文章的數(shù)據(jù)為例
設(shè)計(jì)出的爬蟲(chóng)腳本如下:
?
爬取效果如下:
?
reference:
【1】Demange, P.A., Malanchini, M., Mallard, T.T.?et al.?Investigating the genetic architecture of noncognitive skills using GWAS-by-subtraction.?Nat Genet?53,?35–44 (2021). https://doi.org/10.1038/s41588-020-00754-2
【2】Chao Zhang#, Yang Gao#, Zhilin Ning#, Yan Lu#, Xiaoxi Zhang, Jiaojiao Liu, Bo Xie, Zhe Xue, Xiaoji Wang, Kai Yuan, Xueling Ge, Yuwen Pan, Chang Liu, Lei Tian, Yuchen Wang, Dongsheng Lu, Boon-Peng Hoh, Shuhua Xu*. PGG.SNV: understanding the evolutionary and medical implications of human single nucleotide variations in diverse populations. Genome Biology (2019), 20:215.?https://doi.org/10.1186/s13059-019-1838-5
?
代碼:
https://github.com/yhlhhhhh/HGG.SNV_Reptile
2 個(gè)回復(fù)
贊同來(lái)自:
贊同來(lái)自:
要回復(fù)問(wèn)題請(qǐng)先登錄或注冊(cè)