Esempio n. 1
0
def test_linked_matches_property():
    """Accessing matches property of non-anchored linked adapters"""
    # Issue #265
    front_adapter = FrontAdapter("GGG")
    back_adapter = BackAdapter("TTT")
    la = LinkedAdapter(front_adapter, back_adapter, front_required=False, back_required=False, name='name')
    assert la.match_to("AAAATTTT").matches == 3
Esempio n. 2
0
def test_linked_adapter():
    linked_adapter = LinkedAdapter('AAAA', 'TTTT')
    sequence = Sequence(name='seq', sequence='AAAACCCCCTTTT')
    match = linked_adapter.match_to(sequence)
    trimmed = linked_adapter.trimmed(match)
    assert trimmed.name == 'seq'
    assert trimmed.sequence == 'CCCCC'
Esempio n. 3
0
def test_linked_adapter():
	linked_adapter = LinkedAdapter('AAAA', 'TTTT')
	sequence = Sequence(name='seq', sequence='AAAACCCCCTTTT')
	match = linked_adapter.match_to(sequence)
	trimmed = linked_adapter.trimmed(match)
	assert trimmed.name == 'seq'
	assert trimmed.sequence == 'CCCCC'
Esempio n. 4
0
def test_issue_265():
    """Crash when accessing the matches property of non-anchored linked adapters"""
    s = Sequence('name', 'AAAATTTT')
    front_adapter = Adapter('GGG', where=Where.FRONT)
    back_adapter = Adapter('TTT', where=Where.BACK)
    la = LinkedAdapter(front_adapter, back_adapter, front_required=False, back_required=False, name='name')
    assert la.match_to(s).matches == 3
Esempio n. 5
0
def test_issue_265():
    """Crash when accessing the matches property of non-anchored linked adapters"""
    s = Sequence('name', 'AAAATTTT')
    front_adapter = SingleAdapter('GGG', where=Where.FRONT)
    back_adapter = SingleAdapter('TTT', where=Where.BACK)
    la = LinkedAdapter(front_adapter, back_adapter, front_required=False, back_required=False, name='name')
    assert la.match_to(s).matches == 3
Esempio n. 6
0
def test_issue_265():
    """Crash when accessing the matches property of non-anchored linked adapters"""
    s = Sequence('name', 'AAAATTTT')
    la = LinkedAdapter('GGG',
                       'TTT',
                       front_restriction=None,
                       back_restriction=None)
    assert la.match_to(s).matches == 3
Esempio n. 7
0
def test_linked_adapter():
    linked_adapter = LinkedAdapter('AAAA', 'TTTT', min_overlap=4)
    assert linked_adapter.front_adapter.min_overlap == 4
    assert linked_adapter.back_adapter.min_overlap == 4

    sequence = Sequence(name='seq', sequence='AAAACCCCCTTTT')
    trimmed = linked_adapter.match_to(sequence).trimmed()
    assert trimmed.name == 'seq'
    assert trimmed.sequence == 'CCCCC'
Esempio n. 8
0
def test_linked_adapter():
    front_adapter = PrefixAdapter('AAAA', min_overlap=4)
    back_adapter = BackAdapter('TTTT', min_overlap=3)

    linked_adapter = LinkedAdapter(
        front_adapter, back_adapter, front_required=True, back_required=False, name='name')
    assert linked_adapter.front_adapter.min_overlap == 4
    assert linked_adapter.back_adapter.min_overlap == 3

    read = Sequence(name='seq', sequence='AAAACCCCCTTTT')
    trimmed = linked_adapter.match_to(read.sequence).trimmed(read)
    assert trimmed.name == 'seq'
    assert trimmed.sequence == 'CCCCC'
Esempio n. 9
0
def test_linked_adapter():
    front_adapter = Adapter('AAAA', where=Where.PREFIX, min_overlap=4)
    back_adapter = Adapter('TTTT', where=Where.BACK, min_overlap=3)

    linked_adapter = LinkedAdapter(
        front_adapter, back_adapter, front_required=True, back_required=False, name='name')
    assert linked_adapter.front_adapter.min_overlap == 4
    assert linked_adapter.back_adapter.min_overlap == 3

    sequence = Sequence(name='seq', sequence='AAAACCCCCTTTT')
    trimmed = linked_adapter.match_to(sequence).trimmed()
    assert trimmed.name == 'seq'
    assert trimmed.sequence == 'CCCCC'
Esempio n. 10
0
def test_linked_adapter():
    front_adapter = SingleAdapter('AAAA', where=Where.PREFIX, min_overlap=4)
    back_adapter = SingleAdapter('TTTT', where=Where.BACK, min_overlap=3)

    linked_adapter = LinkedAdapter(
        front_adapter, back_adapter, front_required=True, back_required=False, name='name')
    assert linked_adapter.front_adapter.min_overlap == 4
    assert linked_adapter.back_adapter.min_overlap == 3

    sequence = Sequence(name='seq', sequence='AAAACCCCCTTTT')
    trimmed = linked_adapter.match_to(sequence).trimmed()
    assert trimmed.name == 'seq'
    assert trimmed.sequence == 'CCCCC'
Esempio n. 11
0
def test_linked_action_retain(s, expected):
    front = FrontAdapter("GGTTAACC")
    back = BackAdapter("AACCGG")
    adapters: List[Adapter] = [
        LinkedAdapter(front,
                      back,
                      front_required=False,
                      back_required=False,
                      name="linked")
    ]
    ac = AdapterCutter(adapters, action="retain")
    seq = Sequence("r1", s)
    info = ModificationInfo(seq)
    trimmed = ac(seq, info)
    assert expected == trimmed.sequence