Example #1
0
def build_database(connection):
    """Build the hpo database
    
        Args:
            conn (sqlite3.connect): A database connection object
    """
    logger.info("Fetching disease to gene file")
    disease_to_genes = getreader('utf-8')(gzip.open(disease_to_genes_path),
                                          errors='replace')

    logger.info("Fetching phenotypes file")
    phenotype_to_genes = getreader('utf-8')(gzip.open(phenotypes_path),
                                            errors='replace')

    logger.info("Fetching genes file")
    genes = getreader('utf-8')(gzip.open(genes_path), errors='replace')

    logger.info("Parsing phenotypes to gene file")
    phenotypes = parse_phenotypes(phenotype_to_genes)
    logger.info("Parsing disease to gene file")
    diseases = parse_diseases(disease_to_genes)
    logger.info("Parsing genes  file")
    genes = parse_genes(genes)

    logger.info("Populating hpo table")
    populate_hpo(connection=connection, hpo_terms=phenotypes)
    logger.debug("Hpo table populated")

    logger.info("Populating disease table")
    populate_disease(connection=connection, disease_terms=diseases)
    logger.debug("Disease table populated")

    logger.info("Populating gene table")
    populate_genes(connection=connection, genes=genes)
    logger.debug("Gene table populated")
Example #2
0
def mim_terms(request):
    """Get mim terms"""
    mim_lines = [
        "#Format: diseaseId<tab>gene-symbol<tab>gene-id(entrez)<tab>HPO-ID<tab>HPO-term-name",
        "OMIM:600920\tSCARF2\t91179\tHP:0000767\tPectus excavatum",
        "OMIM:600920\tSCARF2\t91179\tHP:0003042\tElbow dislocation",
        "OMIM:600920\tSCARF2\t91179\tHP:0005280\tDepressed nasal bridge",
        "OMIM:600920\tSCARF2\t91179\tHP:0001363\tCraniosynostosis",
        "OMIM:600920\tSCARF2\t91179\tHP:0000772\tAbnormality of the ribs",
        "OMIM:600920\tSCARF2\t91179\tHP:0001195\tSingle umbilical artery",
        "OMIM:600920\tSCARF2\t91179\tHP:0002987\tElbow flexion contracture",
        "OMIM:613376\tHSPB3\t8988\tHP:0000006\tAutosomal dominant inheritance",
        "OMIM:613376\tHSPB3\t8988\tHP:0002355\tDifficulty walking",
        "OMIM:613376\tHSPB3\t8988\tHP:0002600\tHyporeflexia of lower limbs",
        "OMIM:613376\tHSPB3\t8988\tHP:0003445\tEMG: neuropathic changes",
        "OMIM:613376\tHSPB3\t8988\tHP:0009830\tPeripheral neuropathy",
        "OMIM:613376\tHSPB3\t8988\tHP:0003376\tSteppage gait",
        "OMIM:613376\tHSPB3\t8988\tHP:0009053\tDistal lower limb muscle weakness",
        "OMIM:613376\tHSPB3\t8988\tHP:0008959\tDistal upper limb muscle weakness",
        "OMIM:613376\tHSPB3\t8988\tHP:0002522\tAreflexia of lower limbs",
        "OMIM:613376\tHSPB3\t8988\tHP:0003677\tSlow progression",
        "OMIM:613376\tHSPB3\t8988\tHP:0003202\tSkeletal muscle atrophy",
        "OMIM:615206\tCARD11\t84433\tHP:0004313\tDecreased antibody level in blood",
        "OMIM:615206\tCARD11\t84433\tHP:0003593\tInfantile onset",
        "OMIM:615206\tCARD11\t84433\tHP:0002205\tRecurrent respiratory infections",
        "OMIM:615206\tCARD11\t84433\tHP:0002721\tImmunodeficiency",
        "OMIM:615206\tCARD11\t84433\tHP:0000007\tAutosomal recessive inheritance",
    ]
    return parse_diseases(mim_lines)
Example #3
0
def build_database(connection):
    """Build the hpo database
    
        Args:
            conn (sqlite3.connect): A database connection object
    """
    logger.info("Fetching disease to gene file")
    disease_to_genes = getreader('utf-8')(
        gzip.open(disease_to_genes_path), errors='replace')
    
    logger.info("Fetching phenotypes file")
    phenotype_to_genes = getreader('utf-8')(
        gzip.open(phenotypes_path), errors='replace')

    logger.info("Fetching genes file")
    genes = getreader('utf-8')(
        gzip.open(genes_path), errors='replace')
    
    logger.info("Parsing phenotypes to gene file")    
    phenotypes = parse_phenotypes(phenotype_to_genes)
    logger.info("Parsing disease to gene file")    
    diseases = parse_diseases(disease_to_genes)
    logger.info("Parsing genes  file")    
    genes = parse_genes(genes)
    

    logger.info("Populating hpo table")
    populate_hpo(
        connection=connection, 
        hpo_terms=phenotypes
    )
    logger.debug("Hpo table populated")
    
    logger.info("Populating disease table")    
    populate_disease(
        connection=connection, 
        disease_terms=diseases
    )
    logger.debug("Disease table populated")

    logger.info("Populating gene table")    
    populate_genes(
        connection=connection, 
        genes=genes
    )
    logger.debug("Gene table populated")