コード例 #1
0
ファイル: test_taxonomy.py プロジェクト: TatyanaV/taxtastic
def test_species_below():
    engine = create_engine('sqlite:///../testfiles/taxonomy.db', echo=False)
    tax = Taxonomy(engine, taxtastic.ncbi.RANKS)
    t = tax.species_below('1239')
    parent_id, rank = tax._node(t)
    for t in [None, '1239', '186801', '1117']:
        s = tax.species_below(t)
        assert t is None or s is None or tax.is_ancestor_of(s, t)
        assert s is None or tax.rank(s) == 'species'
コード例 #2
0
ファイル: test_lonely.py プロジェクト: josephhughes/taxtastic
def test_lonely_company():
    if not(os.path.exists('../testfiles/taxonomy.db')):
        return
    engine = create_engine('sqlite:///../testfiles/taxonomy.db', echo=False)
    tax = Taxonomy(engine, ncbi.ranks)
    print tax.lineage(49896)
    lonely_tax_ids = [None, 816, 1239]
    for a,t in zip(lonely_tax_ids, lonely_company(tax, lonely_tax_ids)):
        assert a is None or t is None or tax.is_ancestor_of(t, tax.parent_id(a))
        assert t is None or tax.rank(t) == 'species'
コード例 #3
0
ファイル: test_taxonomy.py プロジェクト: TatyanaV/taxtastic
def test_is_ancestor_of():
    engine = create_engine('sqlite:///../testfiles/taxonomy.db', echo=False)
    tax = Taxonomy(engine, taxtastic.ncbi.RANKS)
    assert tax.is_ancestor_of('1280', '1239')
    assert tax.is_ancestor_of(None, '1239') is False
    assert tax.is_ancestor_of('1239', None) is False