Atlas of Human Malformation Synd

2019-04-16  本文已影响0人  续袁

一、网站简介

一个由临床遗传学家、畸形学家和其他医学专家组成的国际小组共同创建了一个不同人群中人类畸形综合征图谱。本网站的目的是提供一个工具,易于使用,有助于临床医生诊断不同人群的综合征障碍。面部和其他相关身体部位的照片是网站的主要焦点。该网站将包括来自不同地理位置的个人照片和分子诊断,包括亚洲、印度次大陆、中东、南美和撒哈拉以南非洲的多个位置。我们预计,我们的电子图集将帮助临床医生将先天畸形与综合征联系起来,允许早期诊断和解决潜在的多重相关医学问题。

出生缺陷仍然是全球婴儿死亡率和儿童发病率的主要原因。准确和早期的综合征诊断至关重要,因为晚期诊断可能导致干预和治疗先天性心脏缺陷或内分泌紊乱等伴随的异常。2010年,世界卫生组织开始关注先天畸形,并宣布支持旨在通过各种措施预防先天畸形的公共卫生政策,并将出生缺陷视为公共卫生优先事项。随着实验室测序技术的日益普及,对畸形综合征的识别将在全球各地变得越来越重要。认识到先天性畸形的全球重要性,大多数临床医生都接受过以北欧血统患者为参照标准的临床遗传资源培训,在本网站上,我们向世界其他地区的患者介绍。

此网站上没有可识别的个人信息。一个人的私人基因突变极有可能作为一种独特的识别信息发挥作用;而且,由于面部特征对诊断至关重要,因此不可能掩盖面部特征。这意味着特定的患者可能是可识别的。然而,这种做法与目前临床遗传学和畸形综合征教科书中的做法并无不同。

我们预测,这种评估来自不同人群的畸形患者的工具将被世界各地的医生、基因咨询师和受训者广泛使用。网络资源在医疗提供者中正逐渐变得比纸质教科书更受欢迎,因为它们只需要一部手机就可以在护理点使用。该工具虽然不能取代优越的临床技能,但旨在将综合征的表现型扩大到不同的人群,并帮助受过培训的临床医生对这些人群进行诊断。

表达差异是畸形综合征的常见发现,因此,如果可能,本网站将尝试显示来自不同人群的多个个体,具有特定的综合征;但是,不可能显示每个综合征的变异。此外,大多数主要的畸形都与特定的综合征无关,因此本网站将尝试展示与综合征一致的畸形模式。

Variance in expression is a common finding in malformation syndromes, thus when possible, this website will attempt to show multiple individuals from various populations with a specific syndrome; however, it will not be possible to show every syndrome variation. Additionally, most major malformations are non-specific to a particular syndrome, thus this web site will attempt to show the pattern of malformations that are consistent with a syndrome.

二、遗传病人脸图片爬取

2.1 相关网址

https://research.nhgri.nih.gov/atlas/condition/

image.png
#!/usr/bin/python
# encoding:utf-8

import os
import re
import urllib3
import gzip
import sys
from bs4 import BeautifulSoup

data_url = "https://research.nhgri.nih.gov/atlas/condition/"

http = urllib3.PoolManager();
r = http.request('GET', data_url)
html_doc = r.data.decode()
#print(r.data.decode())
print("爬取网页结束!!!")
#print(r.status)
#把html内容保存到一个文件
'''
with open("1.txt","wb") as f:
    f.write(html_doc)
    f.close()

'''

syndrome__list ={}
#<div class="global_content">
soup = BeautifulSoup(html_doc, "html.parser")
content = soup.find_all('div',class_='global_content')
#print(content)

print("提取遗传病的列表:")
content_list = content[0].find_all('ul')
#print(content_list)
for ul in content_list:
    #print("list:")
    #print(ul)
    name_list = ul.find_all('li')
    for name in name_list:
        #print(name)
        #print(name.find('a'))
        if name.find('a') != None:
          #print(name.find('a').get_text())
          #print(name.find('a').get('href'))
          syndrome__list[name.get_text()] = name.find('a').get('href')
        else:
          syndrome__list[name.get_text()] = None
        #print(name.get_text())
#c1 = content[0].next_sibling.find_all('ul')

#print(c1)
syndrome_type_list = soup.select("h3")
#print(syndrome_type_list)
print("提取遗传病的列表(名称和网址):")
#print(syndrome__list)
#print(len(syndrome__list))
count = 0
# https://research.nhgri.nih.gov/atlas/condition/turner-syndrome
# https://research.nhgri.nih.gov/atlas/condition/trisomy-21
website_root= "https://research.nhgri.nih.gov"
def get_image_url(website):
    image_list = {}
    image_count = 0
    count = 0
    if website!=None and count ==0:
        count =count+1
        image_link = website_root+website
        print(image_link)
        #image_link ="https://research.nhgri.nih.gov/atlas/condition/williams-syndrome"
        http = urllib3.PoolManager();
        htmlpage = http.request('GET', image_link)
        html_doc = htmlpage.data.decode()
        # print(r.data.decode())
        print("爬取网页结束!!!")
        soup = BeautifulSoup(html_doc, "html.parser")
        content = soup.find_all('div', class_='global_content')
        #print(content)
        print("提取遗传病图像的列表:")
        #atlas-accordion ui-accordion ui-widget ui-helper-reset
        continent_list = content[0].find_all('ul',class_="atlas-accordion")    # 按大洲解析
        #print(content_list)
        print("提取一个大洲遗传病图像的列表:")
        continent_count = 0
        for continent in continent_list:
            '''
            <li><a href="#">Africa</a>
           <div class="container-continent">
           <ul class="atlas-accordion africa">
            '''
            continent_count = continent_count + 1
            print("----------第"+str(continent_count)+"个大洲----------------")
            print("大洲不为空!")
            #print(continent)
            #country_name = continent_list.find_all('a', style_="list-style: none;")
            #continent_name = continent_list.find_all('a', href_="#")
            continent_name = continent.find_all(href=re.compile("#"))
            #print("国家的名字:")
            #print(country_name)
            #print(country_name[0].get("id"))
            print("大洲的名字:")
            print(continent_name)
            print(continent_name[0].get_text())

            # <li id="Egypt" style="list-style: none;"><a href="#">Egypt</a>
            for i in range(len(continent_name)-1):
                country_name = continent_name[i+1].get_text()
                print("国家的名字:")
                print(country_name)
                country = continent.find_all('li',id=country_name)
                #print(country)
                if country !=None :   #and continent_count == 0:  实验阶段对大洲数量进行限制,方便查找问题

                   #print("发现国家人脸图像3333333!!!!")    #<ul class="gallery">
                   country_face_list = country[0].find_all('ul', class_="gallery")
                   #print(country_face_list)
                   #print("结束!")
                   if country_face_list  :   #country != None  and country != []:
                       '''
                     <li><a data-lightbox="Uganda" href="/atlas/images/conditions/qh2weFuXhWv$9Hvsaf6NgmTMrbcW3z_fD.jpg" title="5 year old male.
                      Photo courtesy of Drs. Aliku Twalib, Emmanuel Tenywa and Emmy Okello."><img height="120" src="/atlas/images/conditions/thumb/qh2weFuXhWv$9Hvsaf6NgmTMrbcW3z_fD.jpg" width="120"/></a>
                    <p>Patient 10</p></li>
                       '''
                       print("国家不为空!")
                       #print(country_list)
                       for country in country_face_list:
                          name_list = country.find_all('li')
                          for name in name_list:
                            if name.find('a') != None:
                                image_count = image_count + 1
                                print(name.find('a').get("title"))
                                #print(name.find('a').get('href'))
                                image_list[continent_name[0].get_text()+"-"+country_name+"-"+name.find('a').get("title")+str(image_count)] = name.find('a').get('href')
                            else:
                               image_list[name.find('a').get("title")+str(image_count)] = None
                       print("国家图片数:")
                       print(image_count)
    return image_list


for key in syndrome__list:
    website = syndrome__list[key]
    image_list = get_image_url(website)
    print(count)
    print(len(image_list))
    print(image_list)
#https://research.nhgri.nih.gov/atlas/images/conditions/EBwK6nAS9EbdNqfKz.png

    file_path_root='E:/pyproj/face1/'+key+"/"
    count = 0
    for key_url in image_list:
        count =count+1
        print("key_url:",key_url)
        continent_name = key_url.split("-")[0]
        country_name = key_url.split("-")[1]
        file_path = file_path_root+continent_name+"/"+country_name+"/"
        filename = file_path+str(count)+".jpg"
        image_url_suffix = image_list[key_url]
        image_url = website_root+image_url_suffix
        #是否有这个路径
        if not os.path.exists(file_path):
        #创建路径
            os.makedirs(file_path)
        print(filename)
        # 下载单个imageURL的图片
        r = http.request('GET', image_url)
        data = r.data
        f = open(filename, 'wb+')
        f.write(data)
        print(u'正在保存的一张图片为:%s', filename)
        f.close()


#content = soup.find_all('ul')
#print("提取遗传病的列表:")
#print(content)


'''
#提取网页信息的正则表达式
pattern = re.compile('<h3>.+</h3><ul>(.+)</ul>',re.S)
items = re.findall(pattern,content)
print("提取遗传病的名称:")
print(items)
pattern_2 = re.compile('<li>.+</li> <li><a href="/atlas/condition/trisomy-21">Trisomy 21 (Down syndrome)</a></li> ',re.S)
items_2 = re.findall(pattern_2,items[0])
'''

参考资料

[1] https://research.nhgri.nih.gov/atlas/
[2] 按遗传病名称查询
[3] 按地理位置查询

[4] python爬虫——BeautifulSoup库函数find_all()
[5] python3 urllib3批量下载图片搜索结果
[6] python 之 BeautifulSoup标签查找与信息提取

上一篇 下一篇

猜你喜欢

热点阅读