-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathtest_module_fusionpcr.py
96 lines (75 loc) · 2.6 KB
/
test_module_fusionpcr.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# -*- coding: utf-8 -*-
import pytest
from pydna.dseq import Dseq
from pydna.dseqrecord import Dseqrecord
from pydna.utils import eq
from Bio.SeqFeature import SeqFeature, SimpleLocation
from pydna.fusionpcr import fuse_by_pcr
x = Dseqrecord(
Dseq("tctggtcaagctgaagggtattc"), features=[SeqFeature(SimpleLocation(5, 10, strand=1), type="misc_feature")]
)
y = Dseqrecord(Dseq("tattcgtacacagatg"), features=[SeqFeature(SimpleLocation(5, 10, strand=1), type="misc_feature")])
z = Dseqrecord(Dseq("acagatgacgtgt"), features=[SeqFeature(SimpleLocation(5, 10, strand=1), type="misc_feature")])
n = Dseqrecord(Dseq("cgatcaaaaaaacc"))
r = Dseqrecord(Dseq("tctggtcaagctgaagggtattcgtacacagatgacgtgt"))
def test_simple_case():
result, *rest = fuse_by_pcr((x, y, z), limit=5)
assert eq(result, r)
def test_fusionpcr1():
"""
tctggtcaagctgaagggtattcgtacacagatgacgtgt (40bp)
tctggtcaagctgaagggtattc
agaccagttcgacttcccataag
tattcgtacacagatg
ataagcatgtgtctac
acagatgacgtgt
tgtctactgcaca
"""
seqtuples = [
(x, y, z),
(x, z, y),
(y, x, z),
(y, z, x),
(z, x, y),
(z, y, x),
(x.rc(), y.rc(), z.rc()),
(x.rc(), z.rc(), y.rc()),
(y.rc(), x.rc(), z.rc()),
(y.rc(), z.rc(), x.rc()),
(z.rc(), x.rc(), y.rc()),
(z.rc(), y.rc(), x.rc()),
]
for arg in seqtuples:
result = fuse_by_pcr(arg, limit=5).pop()
assert eq(result, r)
def test_fusionpcr2():
seqtuples = [
(x.rc(), y, z),
(x, z.rc(), y),
(y, x, z.rc()),
(y.rc(), z, x),
(z, x.rc(), y),
(z, y, x.rc()),
]
seqtuples = [(x, y, z.rc())]
for arg in seqtuples:
result = fuse_by_pcr(arg, limit=5).pop()
assert eq(result, r)
def test_fusionpcr3():
seqtuples = [
(x, y, z, n),
]
for arg in seqtuples:
result = fuse_by_pcr(arg, limit=5).pop()
assert eq(result, r)
from Bio.SeqFeature import SeqFeature, SimpleLocation
x = Dseqrecord(
Dseq("tctggtcaagctgaagggtattc"), features=[SeqFeature(SimpleLocation(5, 10, strand=1), type="misc_feature")]
)
y = Dseqrecord(Dseq("tattcgtacacagatg"), features=[SeqFeature(SimpleLocation(5, 10, strand=1), type="misc_feature")])
z = Dseqrecord(Dseq("acagatgacgtgt"), features=[SeqFeature(SimpleLocation(5, 10, strand=1), type="misc_feature")])
seqtuples = [(x, y, z)]
for arg in seqtuples:
result = fuse_by_pcr(arg, limit=5).pop()
if __name__ == "__main__":
pytest.main([__file__, "-vv", "-s"])