forked from freudiandrip/igem-code-2016
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStopPseudocode.py
98 lines (95 loc) · 3.81 KB
/
StopPseudocode.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
"""
#####################################################################
Pseudocode for a stop codon identification programme
#####################################################################
Input: protein sequence, in frame
- should eventually be a regular .txt file or .fasta file
- should eventually be able to specify mutagenesis or de novo construction
Notes:
- look back over best algorithms for searching (esp. 2 lists)
- "Compare" section needs work to reduce code duplication
- should create helper function to do actual comparison
## Search ##
Iterate through the given sequence (while not null)
Keep a counter of the sequence position, seqPos
Add the next letter to codon string
If the length of codon == 3
If codon == CAG
Add seqPos to CAGmatches
If codon == CAA
# This is separate (not equivalent to CAGmatches) only if stop codon mutagenesis is used
Add seqPos to CAAmatches
If codon == TAG
# Simplified - other factors play into the role of the +6nt
If sequence + 6 == T or C
Add seqPos to betterTAG
Else
Add seqPos to TAGmatches
If codon == TAA
# Simplified - other factors play into the role of the +6nt
If sequence + 6 == T or C
# Again, this is only different (from betterTAG) with stop codon mutagenesis
Add seqPos to betterTAA
Else
Add seqPos to TAAmatches
If codon == TAC or TAT
# Simplified - other factors play into the role of the +6nt
If sequence + 6 == T or C
# Y is the symbol for C or T
Add seqPos to betterTAY
Else
Add seqPos to TAYmatches
Else go back to start
## Compare ##
If the length of CAGmatches == 0
If the length of CAAmatches == 0
Print you're SOL
Else
If the length of betterTAG == 0
If the length of TAGmatches == 0
print CAAmatches, say to look in more detail
Else
Iterate through TAGmatches
Iterate through CAAmatches
If TAGelement == (CAAelement - 3)
Add to bestOptions
If TAGelement == (CAAelement + 3)
Add to okayOptions
Else
Keep going through CAAmatches
# go to the next TAGelement
Else
Iterate through betterTAG
Iterate through CAAmatches
If TAGelement == (CAAelement - 3)
Add to bestOptions
If TAGelement == (CAAelement + 3)
Add to okayOptions
Else
Keep going through CAAmatches
# go to the next TAGelement
Else
If the length of betterTAG == 0
If the length of TAGmatches == 0
print CAGmatches, say to look in more detail
Else
Iterate through TAGmatches
Iterate through CAGmatches
If TAGelement == (CAGelement - 3)
Add to bestOptions
If TAGelement == (CAGelement + 3)
Add to okayOptions
Else
Keep going through CAGmatches
# go to the next TAGelement
Else
Iterate through betterTAG
Iterate through CAGmatches
If TAGelement == (CAGelement - 3)
Add to bestOptions
If TAGelement == (CAGelement + 3)
Add to okayOptions
Else
Keep going through CAGmatches
# go to the next TAGelement
"""