-
Notifications
You must be signed in to change notification settings - Fork 0
/
unit_tests.py
96 lines (61 loc) · 2.02 KB
/
unit_tests.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
# standard libraries
# nonstandard libraries
# homegrown libraries
# SAMPLE MODULE
from sample.sample import Sample
from sample.matter import Matter
from sample.sequence import Sequence
from sample.cell import Cell
from sample.solute import Solute
from sample.solution import Solution
from sample.buffer import Buffer
# DATABASE MODULE
from database.database import Database
# PROTOCOL MODULE
from protocols.miniprep import Miniprep
# UNITS
#from units import sum_units
def main(mode = 0):
if mode == 0:
""" CURRENT FOCUS """
print 'Loading database...'
db = Database()
#
plasmid = Sequence(name='MyPlasmid',mass='1 ug',sequence='ATCGGAGACTAGGCCATAGC',material='dsDNA')
cell = Cell(name='DH5a',species='E. coli')
cell.contents += [plasmid]
# create dilution solution
mybuffer = db.load('dH2O',volume = '50 uL')
mybuffer.volume = '50 uL'
# build sample
sample = cell + mybuffer
miniprep = Miniprep(db)
output = miniprep.io({'sample':sample})
print output['sample']
if mode == 1:
""" SAMPLE TESTING """
sequence = Sequence(name='Plasmid1',sequence="ATCTAG")
cell = Cell(name='DH5a',species="E.Coli")
solute = Solute(name='Tris',mass ='100 g')
solution = Solution(name='dH2O',volume='10 mL')
sample = Sample(container='10mL tube')
sample += sequence
sample += cell
sample += solute
sample += solution
print 'Cell+sequence:\n',cell+sequence
print 'Sample:\n',sample
sample.volume = '3 mL'
print 'Sample (rv):\n',sample
if mode == 2:
""" DATABASE TESTING """
db = Database()
db.sync_local(overwrite=True)
solution = db.load('dH2O',volume = (50,'uL'))
solute = db.load('Tris-Cl')
cells = db.load('DH5a')
buff = db.load('Buffer EB')
return
""" Unit tests """
if __name__ == "__main__":
main()