File size: 857 Bytes
e8f1a22 84c4480 e8f1a22 84c4480 e8f1a22 84c4480 e8f1a22 84c4480 e8f1a22 84c4480 | 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 | # mutation_analysis.py
STOP_CODONS = {"UAA", "UAG", "UGA"}
def classify_mutation(wt_protein: str, mutant_protein: str) -> str:
"""
依照正確的分子生物學邏輯分類突變型態
"""
# 1️⃣ Nonsense mutation:出現提前終止
# (翻譯後蛋白中出現 STOP 或明顯提前終止)
if len(mutant_protein) < len(wt_protein):
# 若是「提前終止」但 reading frame 未被打亂 → nonsense
return "nonsense mutation"
# 2️⃣ Frameshift mutation:reading frame 改變
# (長度變化且非單一替換)
if len(mutant_protein) != len(wt_protein):
return "frameshift mutation"
# 3️⃣ Missense mutation:長度相同但胺基酸不同
if wt_protein != mutant_protein:
return "missense mutation"
# 4️⃣ 沒有變化
return "no mutation"
|