コード例 #1
0
import sqlite3
from phizz.database import (populate_hpo, populate_disease, get_cursor)
from phizz.log import configure_stream

configure_stream(level="DEBUG")

schema_filename = "tests/fixtures/schema.sql"


def test_populate_hpo(connection, hpo_terms, mim_terms):
    """docstring for test_populate_hpo"""
    populate_hpo(
        connection=connection,
        hpo_terms=hpo_terms,
    )

    cursor = get_cursor(connection=connection)

    cursor.execute("SELECT * from hpo where hpo_id = '1459'")

    for row in cursor.fetchmany():
        assert row['description'] == "1-3 toe syndactyly"
        assert row['name'] == "HP:0001459"


def test_get_hpo_from_omim(connection, hpo_terms, mim_terms):
    """docstring for test_get_description"""
    populate_disease(
        connection=connection,
        disease_terms=mim_terms,
    )
コード例 #2
0
ファイル: prepare_files.py プロジェクト: dowing/phizz
"""Functions to prepare infiles from different sources to phizz format"""
import os
import sys
import logging
import gzip
import logging
from codecs import open

import click

from phizz.log import configure_stream

from phizz.utils import parse_genes

configure_stream('INFO')

logger = logging.getLogger(__name__)

def uniqify_phenotypes(lines):
    """Produce a new resource with phenotypes and descriptions
    
        Args:
            lines (Iterator): The lines of the file
        
        Returns:
            hpo_terms(generator(dict)): The hpoterms
    """
    hpo_terms = {}
    for line in lines:
        if not line.startswith('#'):
            line = line.rstrip().split('\t')
コード例 #3
0
import sqlite3
from phizz.database import (populate_hpo, populate_disease, get_cursor)
from phizz.log import configure_stream

configure_stream(level="DEBUG")

schema_filename = "tests/fixtures/schema.sql"


def test_populate_hpo(connection, hpo_terms, mim_terms):
    """docstring for test_populate_hpo"""
    populate_hpo(
        connection=connection, 
        hpo_terms=hpo_terms, 
    )

    cursor = get_cursor(connection=connection)
    
    cursor.execute("SELECT * from hpo where hpo_id = '1459'")

    for row in cursor.fetchmany():
        assert row['description'] == "1-3 toe syndactyly"
        assert row['name'] == "HP:0001459"
    

def test_get_hpo_from_omim(connection, hpo_terms, mim_terms):
    """docstring for test_get_description"""
    populate_disease(
        connection=connection, 
        disease_terms=mim_terms, 
    )
コード例 #4
0
import sqlite3
import pytest
from phizz.database import (populate_hpo, populate_disease, populate_genes, 
                            get_database)
from phizz.utils import (parse_phenotypes, parse_diseases, parse_genes)

from phizz.log import configure_stream

logger = configure_stream(level="DEBUG")


SCHEMA = 'tests/fixtures/schema.sql'

@pytest.fixture(scope="function")
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",