-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtest_assembly.py
53 lines (41 loc) · 1.37 KB
/
test_assembly.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
from sbol import *
setHomespace('http://sys-bio.org')
doc = Document()
gene = ComponentDefinition('gene_example')
promoter = ComponentDefinition('R0010')
CDS = ComponentDefinition('B0032')
RBS = ComponentDefinition('E0040')
terminator = ComponentDefinition('B0012')
promoter.roles = SO_PROMOTER
CDS.roles = SO_CDS
RBS.roles = SO_RBS
terminator.roles = SO_TERMINATOR
doc.addComponentDefinition(gene)
doc.addComponentDefinition(promoter)
doc.addComponentDefinition(CDS)
doc.addComponentDefinition(RBS)
doc.addComponentDefinition(terminator)
gene.assemblePrimaryStructure([ promoter, RBS, CDS, terminator ])
first = gene.getFirstComponent()
print(first.identity)
last = gene.getLastComponent()
print(last.identity)
promoter_seq = Sequence('R0010', 'ggctgca')
RBS_seq = Sequence('B0032', 'aattatataaa')
CDS_seq = Sequence('E0040', "atgtaa")
terminator_seq = Sequence('B0012', 'attcga')
gene_seq = Sequence('BB0001')
doc.addSequence([promoter_seq, CDS_seq, RBS_seq, terminator_seq, gene_seq])
promoter.sequences = promoter_seq.identity
CDS.sequences = CDS_seq.identity
RBS.sequences = RBS_seq.identity
terminator.sequences = terminator_seq.identity
gene.sequences = gene_seq.identity
gene_seq.assemble()
print(promoter_seq.elements)
print(RBS_seq.elements)
print(CDS_seq.elements)
print(terminator_seq.elements)
print(gene_seq.elements)
result = doc.write('gene_cassette.xml')
print(result)