LDolanLDolan commited on
Commit ·
7711248
1
Parent(s): dedb9bb
Fix indentation errors in codon_table.py
Browse files- codon_table.py +5 -4
codon_table.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
|
| 2 |
CODON_TABLE = {
|
| 3 |
# Start codon
|
| 4 |
'ATG': {'amino_acid': 'Methionine', 'type': 'start', 'description': 'The universal start codon - where protein synthesis begins'},
|
|
@@ -190,14 +190,15 @@ def translate_dna_to_text(sequence, reading_frame=0, detailed=True):
|
|
| 190 |
if protein_sequence:
|
| 191 |
protein_str = ''.join(protein_sequence)
|
| 192 |
output.append("🧪 **Resulting Protein Sequence:**")
|
| 193 |
-
output.append(f"{protein_str}")
|
| 194 |
output.append("")
|
| 195 |
|
| 196 |
# Count amino acids
|
| 197 |
start_codons = sum(1 for codon in codons if len(codon) == 3 and CODON_TABLE.get(codon, {}).get('type') == 'start')
|
| 198 |
stop_codons = sum(1 for codon in codons if len(codon) == 3 and CODON_TABLE.get(codon, {}).get('type') == 'stop')
|
| 199 |
|
| 200 |
-
|
|
|
|
| 201 |
return "\n".join(output)
|
| 202 |
|
| 203 |
def get_example_sequences():
|
|
@@ -207,4 +208,4 @@ def get_example_sequences():
|
|
| 207 |
"Insulin Gene (partial)": "ATG GCC CTG TGG ATG CGC CTC CTG CCC CTG CTG GCG CTG CTG GCC CTG TGG GGG ACC TCG TCG",
|
| 208 |
"Beta-globin (partial)": "ATG GTG CAC CTG ACT CCT GAG GAG AAG TCT",
|
| 209 |
"Green Fluorescent Protein (partial)": "ATG AGC AAG GGC GAG GAG CTG TTC ACC GGG GTG GTG CCC ATC CTG GTG GAG CTG"
|
| 210 |
-
}
|
|
|
|
| 1 |
+
# Complete genetic code dictionary with biological context
|
| 2 |
CODON_TABLE = {
|
| 3 |
# Start codon
|
| 4 |
'ATG': {'amino_acid': 'Methionine', 'type': 'start', 'description': 'The universal start codon - where protein synthesis begins'},
|
|
|
|
| 190 |
if protein_sequence:
|
| 191 |
protein_str = ''.join(protein_sequence)
|
| 192 |
output.append("🧪 **Resulting Protein Sequence:**")
|
| 193 |
+
output.append(f"`{protein_str}`")
|
| 194 |
output.append("")
|
| 195 |
|
| 196 |
# Count amino acids
|
| 197 |
start_codons = sum(1 for codon in codons if len(codon) == 3 and CODON_TABLE.get(codon, {}).get('type') == 'start')
|
| 198 |
stop_codons = sum(1 for codon in codons if len(codon) == 3 and CODON_TABLE.get(codon, {}).get('type') == 'stop')
|
| 199 |
|
| 200 |
+
output.append(f"📈 **Summary:** {start_codons} start codon(s), {stop_codons} stop codon(s)")
|
| 201 |
+
|
| 202 |
return "\n".join(output)
|
| 203 |
|
| 204 |
def get_example_sequences():
|
|
|
|
| 208 |
"Insulin Gene (partial)": "ATG GCC CTG TGG ATG CGC CTC CTG CCC CTG CTG GCG CTG CTG GCC CTG TGG GGG ACC TCG TCG",
|
| 209 |
"Beta-globin (partial)": "ATG GTG CAC CTG ACT CCT GAG GAG AAG TCT",
|
| 210 |
"Green Fluorescent Protein (partial)": "ATG AGC AAG GGC GAG GAG CTG TTC ACC GGG GTG GTG CCC ATC CTG GTG GAG CTG"
|
| 211 |
+
}
|