-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathtest_module_ligate.py
executable file
·79 lines (67 loc) · 2.08 KB
/
test_module_ligate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# -*- coding: utf-8 -*-
import pytest
def test_ligate():
from pydna.ligate import ligate
from pydna.dseq import Dseq
from pydna.dseqrecord import Dseqrecord
a = Dseqrecord(
Dseq.from_representation(
"""
GATCaaa
tttTTCC"""
)
)
b = Dseqrecord(
Dseq.from_representation(
"""
AAGGatta
taatAGGA"""
)
)
c = Dseqrecord(
Dseq.from_representation(
"""
TCCTccact
ggtgaCTAG"""
)
)
d = Dseqrecord(
Dseq.from_representation(
"""
Tcgcgc
gcgcgC"""
)
)
e = Dseqrecord(
Dseq.from_representation(
"""
Gcaatt
gttaa"""
)
)
fragments = [a, b, c, d, e]
rcfragments = [a.rc(), b.rc(), c.rc(), d.rc(), e.rc()]
def list_combinations(a, b):
N = len(a)
combinations = []
for i in range(2**N):
current = []
for j in range(N):
if i & (1 << j):
current.append(a[j])
else:
current.append(b[j])
combinations.append(current)
return combinations
# Example usage:
combinations = list_combinations(fragments, rcfragments)
for frgs in combinations:
csequences, lsequences = ligate(frgs)
for cs in csequences:
assert cs.seguid() == "cdseguid=ogVOwoSZEk_4kUWnK1NCl5Dv1z4"
assert len(cs) == 24
for ss in lsequences:
assert ss.seguid() == "ldseguid=vBQxmszgfR4b84O0wI7d_ya9uDA"
assert len(ss) == 12
if __name__ == "__main__":
pytest.main([__file__, "-vv", "-s"])