Пример #1
0
def test_single_read_queries():
    """
    Ensures that we can query a single leaf/single node tree
    """
    cuckoo_tree = CuckooBitTree(0.5, 3, 10, 8, 4, 500)
    read_1 = Read('a.fastq', 'a', None, 'GCGT', 'IIII')
    cuckoo_tree.insert([read_1])
    assert cuckoo_tree.query('AAAA') == []
    assert cuckoo_tree.query('GCGT') == ['a.fastq']
    assert cuckoo_tree.query('ACGT') == ['a.fastq']
    assert cuckoo_tree.query('GCGA') == ['a.fastq']
    cuckoo_tree.theta = 0.6
    assert cuckoo_tree.query('AAAA') == []
    assert cuckoo_tree.query('GCGT') == ['a.fastq']
    assert cuckoo_tree.query('ACGT') == []
    assert cuckoo_tree.query('GCGA') == []
Пример #2
0
def test_two_read_queries():
    """
    Ensures that we can query correctly through an internal node
    and that changing theta works accordingly
    """
    cuckoo_tree = CuckooBitTree(0.3, 3, 10, 8, 4, 500)
    # note: have 1  3mer in common
    read_1 = Read('a.fastq', 'a', None, 'ABCDE', 'IIII')
    read_2 = Read('b.fastq', 'b', None, 'CDEFG', 'IIII')
    cuckoo_tree.insert([read_1])
    cuckoo_tree.insert([read_2])
    assert cuckoo_tree.query('AAAAA') == []
    assert cuckoo_tree.query('BCDEF') == ['a.fastq', 'b.fastq']
    assert cuckoo_tree.query('CDEFG') == ['a.fastq', 'b.fastq']
    assert cuckoo_tree.query('ABCDE') == ['a.fastq', 'b.fastq']
    cuckoo_tree.theta = 0.6
    assert cuckoo_tree.query('AAAAA') == []
    assert cuckoo_tree.query('BCDEF') == ['a.fastq', 'b.fastq']
    assert cuckoo_tree.query('CDEFG') == ['b.fastq']
    assert cuckoo_tree.query('ABCDE') == ['a.fastq']
    cuckoo_tree.theta = 0.9
    assert cuckoo_tree.query('AAAAA') == []
    assert cuckoo_tree.query('BCDEF') == []
    assert cuckoo_tree.query('CDEFG') == ['b.fastq']
    assert cuckoo_tree.query('ABCDE') == ['a.fastq']