示例#1
0
def test_missing_network_file():
    project_name = 'test_missing_network_file'
    gene_list = os.path.join(TEST_RESOURCES, 'hgnc_symbols.txt')
    args = ArgparseMock(project_name,
                        gene_list,
                        'hgnc_symbol',
                        network_source='sif')
    place_resource_files()
    run_main(args)
示例#2
0
def test_default():
    project_name = 'test1'
    gene_list = os.path.join(HERE, 'resources', 'hgnc_symbols.txt')
    args = ArgparseMock(project_name, gene_list, 'hgnc_symbol')

    _place_files()

    run_main(args)

    assert os.path.exists(TEST_BASE_FOLDER)
    assert os.path.exists(
        os.path.join(TEST_BASE_FOLDER, project_name, 'genewalk_results.csv'))
示例#3
0
def test_default():
    project_name = 'test1'
    gene_list = os.path.join(TEST_RESOURCES, 'hgnc_symbols.txt')
    args = ArgparseMock(project_name, gene_list, 'hgnc_symbol')
    place_resource_files()
    run_main(args)

    assert os.path.exists(TEST_BASE_FOLDER)
    result_csv = os.path.join(TEST_BASE_FOLDER, project_name,
                              'genewalk_results.csv')
    assert os.path.exists(result_csv)
    df = pandas.read_csv(result_csv)
    assert 'MAP2K2' in set(df['hgnc_symbol']), df['hgnc_symbol']
示例#4
0
def test_edge_list():
    project_name = 'test_edge_list'
    gene_list = os.path.join(TEST_RESOURCES, 'hgnc_symbols.txt')
    el = os.path.join(TEST_RESOURCES, 'test_edge_list.txt')
    args = ArgparseMock(project_name,
                        gene_list,
                        'hgnc_symbol',
                        network_source='edge_list',
                        network_file=el)
    place_resource_files()
    run_main(args)
    assert os.path.exists(TEST_BASE_FOLDER)
    result_csv = os.path.join(TEST_BASE_FOLDER, project_name,
                              'genewalk_results.csv')
    assert os.path.exists(result_csv)
    df = pandas.read_csv(result_csv)
    assert 'MAP2K2' in set(df['hgnc_symbol']), df['hgnc_symbol']
    assert 'GO:0005515' in set(df['go_id'])
    assert 'GO:0001934' in set(df['go_id'])
    assert 'biological process' in set(df['go_domain'])
示例#5
0
def test_custom_genes():
    project_name = 'test_custom_genes'
    gene_list = os.path.join(TEST_RESOURCES, 'custom_gene_list.txt')
    sif = os.path.join(TEST_RESOURCES, 'test_sif_custom.sif')
    args = ArgparseMock(project_name,
                        gene_list,
                        'custom',
                        network_source='sif_annot',
                        network_file=sif)
    place_resource_files()
    run_main(args)
    assert os.path.exists(TEST_BASE_FOLDER)
    result_csv = os.path.join(TEST_BASE_FOLDER, project_name,
                              'genewalk_results.csv')
    assert os.path.exists(result_csv)
    df = pandas.read_csv(result_csv)
    assert 'CUSTOM:ABC' in set(df['custom']), df['custom']
    assert 'GO:0000186' in set(df['go_id'])
    # In this case we don't have this annotation in the SIF file
    assert 'GO:0001934' not in set(df['go_id'])
    assert 'biological process' in set(df['go_domain'])
示例#6
0
def test_sif_full():
    project_name = 'test_sif'
    gene_list = os.path.join(TEST_RESOURCES, 'hgnc_symbols.txt')
    sif = os.path.join(TEST_RESOURCES, 'test_sif_full.sif')
    args = ArgparseMock(project_name,
                        gene_list,
                        'hgnc_symbol',
                        network_source='sif_full',
                        network_file=sif)
    place_resource_files()
    run_main(args)
    assert os.path.exists(TEST_BASE_FOLDER)
    result_csv = os.path.join(TEST_BASE_FOLDER, project_name,
                              'genewalk_results.csv')
    assert os.path.exists(result_csv)
    df = pandas.read_csv(result_csv)
    assert 'MAP2K2' in set(df['hgnc_symbol']), df['hgnc_symbol']
    assert 'GO:0005515' in set(df['go_id'])
    # In this case we don't have this annotation in the SIF file
    assert 'GO:0001934' not in set(df['go_id'])
    # It's particularly important here that we have e.g., GO domains
    # since this means that node attributes are added correctly for
    # GO terms mentioned in the SIF file
    assert 'biological process' in set(df['go_domain'])