Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_multi_prefix_adapter_incorrect_type():
with pytest.raises(ValueError):
MultiPrefixAdapter([
PrefixAdapter("GAAC", indels=False),
SuffixAdapter("TGCT", indels=False),
])
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'
def test_multi_prefix_adapter():
adapters = [
PrefixAdapter("GAAC", indels=False),
PrefixAdapter("TGCT", indels=False),
]
ma = MultiPrefixAdapter(adapters)
match = ma.match_to("GAACTT")
assert match.adapter is adapters[0]
match = ma.match_to("TGCTAA")
assert match.adapter is adapters[1]
def test_multi_suffix_adapter_incorrect_type():
with pytest.raises(ValueError):
MultiSuffixAdapter([
SuffixAdapter("GAAC", indels=False),
PrefixAdapter("TGCT", indels=False),
])
def test_multi_prefix_adapter():
adapters = [
PrefixAdapter("GAAC", indels=False),
PrefixAdapter("TGCT", indels=False),
]
ma = MultiPrefixAdapter(adapters)
match = ma.match_to("GAACTT")
assert match.adapter is adapters[0]
match = ma.match_to("TGCTAA")
assert match.adapter is adapters[1]
def test_prefix_match_with_n_wildcard_in_read():
adapter = PrefixAdapter("NNNACGT", indels=False)
match = adapter.match_to("TTTACGTAAAA")
assert match is not None and (0, 7) == (match.rstart, match.rstop)
match = adapter.match_to("NTTACGTAAAA")
assert match is not None and (0, 7) == (match.rstart, match.rstop)