-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseqmak.py
executable file
·114 lines (92 loc) · 3.73 KB
/
seqmak.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#######################################################################
# Copyright 2012 Junghoon Kim
# jfkimberly@skku.edu
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#######################################################################
import commands
def main():
""" Main function to determine what command to enter """
segment_list = []
while True:
command = raw_input("Enter a command (type 'help' or 'h' for help):\n")
if command == 'exit':
break
# 'help' command
# prints a list of possible commands
elif command == 'help' or command == 'h':
commands.help()
# 'newarm (na)' command
# creates newarms and their corresponding segment sequences in a
# dictionary 'arms'
elif command == 'newarms' or command == 'na':
arms = commands.newarms()
# 'show (s)' command
# prints out the created arms
elif command == 'show' or command == 's':
try:
commands.show(arms)
except UnboundLocalError:
print "Generate your arms first!"
# 'link (l)' command
elif command == 'link' or command == 'l':
linker_list = commands.linker()
# 'crunch (c)' command
# produces random sequences of
elif command == 'crunch' or command == 'c':
try:
strands
except UnboundLocalError:
print "Maybe you should generate your strands first ('strandgen')?"
else:
try:
arms, strands, segment_list =\
commands.crunch(arms, strands, linker_list, segment_list)
print segment_list
except TypeError:
print "Something's not right. Try 'crunch' again."
# 'strandgen (sg)' command
elif command == 'strandgen' or command == 'sg':
try:
strands = commands.strandgen(arms, linker_list)
except UnboundLocalError:
print "Something's wrong. Maybe you missed a step?"
# 'repeatcheck (rp) command
elif command == 'repeatcheck' or command == 'rp':
try:
commands.repeatcheck(strands)
except UnboundLocalError:
print "Something's wrong. Maybe you missed a step?"
# 'dyadcheck (dc) command
elif command == 'dyadcheck' or command == 'dc':
try:
commands.dyadcheck(strands)
except UnboundLocalError:
print "Something's wrong. Maybe you missed a step?"
# 'save (sv)' command
elif command == 'save' or command == 'sv':
try:
commands.save(arms, strands)
except UnboundLocalError:
print "Something's wrong. Maybe you missed a step?"
elif command == 'load' or command == 'ld':
try:
strands = commands.load()
except (UnboundLocalError, TypeError):
print "Try again?"
else:
print "What? Retype command!"
return None
if __name__ == '__main__':
main()