Example #1
0
File: test.py Project: roryk/vcf2db
def test_load_expand():
    expand = ['gt_types', 'gt_ref_depths', 'gt_alt_depths']
    v = VCFDB(vcf, db, ped, expand=expand)

    eng = sql.create_engine(get_dburl(db))
    metadata = sql.MetaData(bind=eng)
    metadata.reflect()

    for e in expand:
        yield check_expanded_length, metadata, e

        yield check_expanded_columns, metadata, e
Example #2
0
def test_load():

    v = VCFDB(vcf, db, ped)

    eng = sql.create_engine(get_dburl(db))
    metadata = sql.MetaData(bind=eng)
    metadata.reflect()

    res, = next(iter(eng.execute("select count(*) from variants")))
    assert res == n_variants, res

    assert "variants" in metadata.tables
    assert "variant_impacts" in metadata.tables
    assert "samples" in metadata.tables
    assert "vcf_header" in metadata.tables

    yield check_header, metadata
    yield check_samples, metadata
    yield check_variants, metadata
    yield check_aaf, metadata
Example #3
0
def test_extra_impacts():
    db = "tests/xx-impacts.db"
    impacts_extras = ["MQ", "QD", "HRun", "M-CAP_pred"]
    v = VCFDB(vcf, db, ped, impacts_extras=impacts_extras)
    eng = sql.create_engine(get_dburl(db))
    metadata = sql.MetaData(bind=eng)
    metadata.reflect()

    yield check_header, metadata
    yield check_samples, metadata
    yield check_variants, metadata
    yield check_aaf, metadata
    yield check_cap, metadata

    vi = metadata.tables["variant_impacts"]
    ixs = list(map(clean, impacts_extras))

    # check that all of the impacts_extras are in the variant_impacts table.
    cs = {c.name: c for c in vi.columns}
    for c in ixs:
        assert c in cs