Beispiel #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])
Beispiel #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
Beispiel #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])
Beispiel #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])
Beispiel #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')) == []
Beispiel #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
Beispiel #7
0
def test_grouped_itree_non_string_non_callable_key():
    with pytest.raises(TypeError):
        itree.GroupedITree(key=1)
Beispiel #8
0
def test_grouped_itree_too_short_key_signature():
    with pytest.raises(TypeError):
        itree.GroupedITree(key=lambda: None)
Beispiel #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