Esempio n. 1
0
def test_insert_grouped_itree(FakeGroupedITree, gene_intervals_short):
    tree = itree.GroupedITree(key="annotation")
    fake_tree = FakeGroupedITree(key="annotation",
                                 intervals=gene_intervals_short)
    for node in gene_intervals_short:
        tree.insert(node)

    assert tree.search(gene_intervals_short[0]) == \
        fake_tree.search(gene_intervals_short[0])
Esempio n. 2
0
def test_create_grouped_itree(gene_intervals_short):
    tree = itree.GroupedITree(key='annotation',
                              intervals=gene_intervals_short)

    assert tree is not None

    expected = "GroupedITree(key=annotation, trees={'Chr10': ITree(root=(613874,621867))})"

    assert str(tree) == expected
Esempio n. 3
0
def test_search_grouped_itree_string(FakeGroupedITree, gene_intervals_short):
    tree = itree.GroupedITree(key=lambda node: node.annotation,
                              intervals=gene_intervals_short)

    assert tree is not None

    fake_tree = FakeGroupedITree(key=lambda node: node.annotation,
                                 intervals=gene_intervals_short)

    assert tree.search(gene_intervals_short[0]) == \
           fake_tree.search(gene_intervals_short[0])
Esempio n. 4
0
def test_remove_grouped_itree(FakeGroupedITree, gene_intervals_short):
    tree = itree.GroupedITree(key="annotation",
                              intervals=gene_intervals_short)
    fake_tree = FakeGroupedITree(key="annotation",
                                 intervals=gene_intervals_short)

    tree.remove(gene_intervals_short[0])
    fake_tree.remove(gene_intervals_short[0])

    assert tree.search(gene_intervals_short[0]) == \
           fake_tree.search(gene_intervals_short[0])
Esempio n. 5
0
def test_search_grouped_itree_nonexistent_key(FakeNode, gene_intervals_short):
    tree = itree.GroupedITree(key='annotation', intervals=gene_intervals_short)
    assert tree is not None

    assert tree.search(FakeNode(1,2,annotation='IAMNOTANANNOTATION')) == []
Esempio n. 6
0
def test_search_grouped_itree_callable(FakeGroupedITree, gene_intervals_short):
    tree = itree.GroupedITree(key='annotation',
                              intervals=gene_intervals_short)

    assert tree is not None
Esempio n. 7
0
def test_grouped_itree_non_string_non_callable_key():
    with pytest.raises(TypeError):
        itree.GroupedITree(key=1)
Esempio n. 8
0
def test_grouped_itree_too_short_key_signature():
    with pytest.raises(TypeError):
        itree.GroupedITree(key=lambda: None)
Esempio n. 9
0
def test_create_grouped_itree(gene_intervals_short):
    tree = itree.GroupedITree(key=lambda node: node.annotation,
                              intervals=gene_intervals_short)

    assert tree is not None