Skip to content

[SPRINT-02-05] Consolidate Plasmid model and remove duplicate wrapper logic #92

@Gonza10V

Description

@Gonza10V

Parent sprint: #87
Depends on: #88, #89, #90, #91
Recommended order: 5
Codex-ready: yes

Goal

Make buildcompiler.plasmid.Plasmid the single runtime wrapper for indexed plasmids/backbones and remove or deprecate the duplicate Plasmid class in abstract_translator.py.

Background

The current codebase has at least two Plasmid concepts:

  • src/buildcompiler/plasmid.py defines Plasmid with plasmid_definition, strain/plasmid implementations, fusion sites, name, and antibiotic resistance.
  • src/buildcompiler/abstract_translator.py also defines a Plasmid wrapper with a different constructor and fields.

This increases the risk that indexing, compatibility matching, assembly, and transformation disagree on object shape, fusion-site ordering, antibiotic detection, or equality semantics.

Scope

  • Choose buildcompiler.plasmid.Plasmid as the canonical runtime wrapper.
  • Update abstract_translator.py helpers to import and use the canonical Plasmid, or rename the old helper class to avoid runtime confusion if it cannot yet be removed.
  • Add tests for canonical Plasmid construction from fixture SBOL objects.
  • Add tests for fusion-site extraction, antibiotic resistance extraction, equality, hashing, and repr/debug output.
  • Ensure assembly code still accepts the canonical Plasmid object.

Non-goals

  • Do not redesign the entire inventory system.
  • Do not change SBOL biological semantics unless current tests prove the old behavior was wrong.
  • Do not rewrite Assembly internals in this issue.

Acceptance criteria

  • There is one canonical Plasmid wrapper used by indexing, route selection, and assembly paths.
  • abstract_translator.py no longer defines a conflicting runtime Plasmid class, or it is clearly renamed/private and not used by active runtime paths.
  • Fusion-site matching is covered by tests using fixture SBOL.
  • Antibiotic detection is covered by tests using fixture SBOL.
  • Equality/hash behavior uses stable SBOL identity semantics.
  • Existing assembly path still runs with the canonical object shape.

Verification

Run:

pytest -k "plasmid or fusion or antibiotic or assembly"
ruff check .

Codex implementation notes

  • Keep this as a mechanical consolidation PR where possible.
  • If old code paths are unused, remove them with tests proving the active path still works.
  • If old code paths are still used, update them incrementally rather than making a giant rewrite.
  • Prefer identities/display IDs in assertions rather than raw object equality where SBOL object identity is unstable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions