Пример #1
0
def generate_genemap2(genes, api_key):
    """Generate a reduced file with omim genemap2 information
    
    Args:
        genes(dict): A dictionary with hgnc_symbol as key and hgnc_id as value
        api_key(str)

    Yields:
        print_line(str): Lines from the reduced file
    """

    mim_files = fetch_mim_files(api_key, genemap2=True)
    genemap2_lines = mim_files['genemap2']

    # Yield the header lines
    for line in genemap2_lines:
        if line.startswith('#'):
            yield line
        else:
            break

    for gene_info in parse_genemap2(genemap2_lines):
        hgnc_symbol = gene_info.get('hgnc_symbol')
        if not hgnc_symbol:
            continue
        if hgnc_symbol in genes:
            yield gene_info['raw']
Пример #2
0
def test_parse_genemap_file(genemap_handle):
    # WHEN parsing a valid genemap handle
    i = 0
    for i, res in enumerate(parse_genemap2(genemap_handle)):
        assert "mim_number" in res
    # THEN items are returned
    assert i > 0
Пример #3
0
def generate_genemap2(genes, api_key):
    """Generate a reduced file with omim genemap2 information
    
    Args:
        genes(dict): A dictionary with hgnc_symbol as key and hgnc_id as value
        api_key(str)

    Yields:
        print_line(str): Lines from the reduced file
    """
    
    mim_files = fetch_mim_files(api_key, genemap2=True)
    genemap2_lines = mim_files['genemap2']
    
    # Yield the header lines
    for line in genemap2_lines:
        if line.startswith('#'):
            yield line
        else:
            break
    
    for gene_info in parse_genemap2(genemap2_lines):
        hgnc_symbol = gene_info.get('hgnc_symbol')
        if not hgnc_symbol:
            continue
        if hgnc_symbol in genes:
            yield gene_info['raw']
Пример #4
0
def test_parse_genemap():

    for res in parse_genemap2(GENEMAP_LINES):
        assert res['Chromosome'] == 'chr1'
        assert res['mim_number'] == 615291
        assert res['hgnc_symbol'] == 'B3GALT6'
        assert res['inheritance'] == set(['AR'])
        for phenotype in res['phenotypes']:
            assert phenotype['mim_number']
            assert phenotype['inheritance']
Пример #5
0
def test_parse_genemap(genemap_lines):

    for res in parse_genemap2(genemap_lines):
        assert res["Chromosome"] == "chr1"
        assert res["mim_number"] == 615291
        assert res["hgnc_symbol"] == "B3GALT6"
        assert res["inheritance"] == set(["AR"])
        for phenotype in res["phenotypes"]:
            assert phenotype["mim_number"]
            assert phenotype["inheritance"]
Пример #6
0
def test_parse_genemap():
    
    for res in parse_genemap2(GENEMAP_LINES):
        assert res['Chromosome'] == 'chr1'
        assert res['mim_number'] == 615291
        assert res['hgnc_symbol'] == 'B3GALT6'
        assert res['inheritance'] == set(['AR'])
        for phenotype in res['phenotypes']:
            assert phenotype['mim_number']
            assert phenotype['inheritance']
Пример #7
0
def test_parse_genemap_file(genemap_handle):
    for i, res in enumerate(parse_genemap2(genemap_handle)):
        assert 'mim_number' in res

    assert i > 0
Пример #8
0
def test_parse_genemap_file(genemap_handle):
    for i,res in enumerate(parse_genemap2(genemap_handle)):
        assert 'mim_number' in res
    
    assert i > 0