Skip to content
This repository was archived by the owner on Nov 1, 2026. It is now read-only.
This repository was archived by the owner on Nov 1, 2026. It is now read-only.

Translate: RNA input passes validation, then fails with UnboundLocalError #7

Open

Description

@dpc00

Claude reports: Translate on the selection AUGGCCAUU shows the dialog Codon 'AUG' is invalid and then raises:

File ".../BioPythonUtils.py", line 327, in run
    seqout.append(str(aa_seq))
UnboundLocalError: cannot access local variable 'aa_seq' where it is not associated with a value

validate_nt() accepts U (it unions the DNA and RNA letters, lines 486-487), but the sequence is built as Seq(nt_str, IUPAC.unambiguous_dna) (line 315), so translate() rejects AUG. After the except at line 323 the code carries on and uses aa_seq, which was never assigned. The FASTA branch (lines 278-283) has the same pattern.

Fix: translate RNA with IUPAC.unambiguous_rna (or replace U with T), and return / continue after the error dialog.

Tested on Sublime Text build 4215 (portable, Windows), plugin host Python 3.14, installed through the Package Control Install Package picker (BioPythonUtils 2017.12.18.15.00.45, which already contains the fixes for #3), then removed again. Line numbers are those of BioPythonUtils.py on master (de058c4).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions