Skip to content

make_mag_summary crashes with NameError: full_classification referenced before assignment #1

Description

@DanielSprockett

Bug

resources/scripts/make_mag_summary.py crashes immediately with:

NameError: name 'full_classification' is not defined

Location

In the per-bin loop (current main, resources/scripts/make_mag_summary.py):

tax_entry = tax_map.get(
    bin_name, (parse_gtdbtk_classification(''), '', '', ''))
if bin_name not in tax_map or not str(full_classification).strip():
    missing_tax.append(bin_name)
tax_dict, full_classification, msa_percent, gtdbtk_warnings = tax_entry

full_classification is referenced in the if condition one line before it is unpacked from tax_entry. This fails on every invocation that reaches this code path, independent of input data — it blocked Stage 2 completion (make_mag_summary -> rename_mags) on an arm where every upstream stage (CheckM2, GTDB-Tk, GUNC, Binette) had already produced valid output for all samples.

Fix

Move the unpacking line before the if check:

tax_entry = tax_map.get(
    bin_name, (parse_gtdbtk_classification(''), '', '', ''))
tax_dict, full_classification, msa_percent, gtdbtk_warnings = tax_entry
if bin_name not in tax_map or not str(full_classification).strip():
    missing_tax.append(bin_name)

Context

Hit on the WF27_MGX_LAI arm, pinned at commit 697daa1. That short SHA does not currently resolve via the GitHub API against this repo, which may mean it's no longer reachable from any branch (rewritten history?) — worth checking separately. Patched locally on the running clone to unblock; filing here so it's fixed upstream for other arms.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions