=== Emitted products ===
{% if product_groups %}
Exact products written by this run. Positions are zero-based, end-exclusive amino-acid positions in the peptide or encoded protein.
{% for group in product_groups %}

{{ group.modality }}: constructs {{ group.counts.constructs }} ({{ group.counts.unique_construct_sequences }} unique sequences); antigen slots {{ group.counts.antigen_slots }}; unique antigen sequences {{ group.counts.unique_antigen_sequences if group.counts.unique_antigen_sequences is not none else 'unavailable' }}.
{% if selection_policy and group.modality in selection_policy.modalities %}{% set settings = selection_policy.modalities[group.modality] %}
{{ settings.origin }}:
{% for label, value in settings.rows %}  {{ label }}: {{ value }}
{% endfor %}{% endif %}
{% if group.counts.source_candidates %}
Recorded source events: {{ group.counts.source_events }}; candidate mappings without a recorded event: {{ group.counts.source_candidates_without_event }}.
Related alternative sequences do not establish independent target coverage.
{% endif %}
{% if group.files %}Product files (relative to the run output directory): {{ group.files | join(', ') }}.
{% endif %}
{% if group.assembly_decisions is defined %}{% if group.assembly_decisions is not none %}
Assembly order: {{ group.assembly_decisions.order | replace('_', ' ') }}.
{% if group.assembly_decisions.allocation %}{% if group.assembly_decisions.allocation.policy.mode == 'balanced' %}This saved design used the retired category-balancing policy.{% else %}Antigens follow the configured ranking, subject to explicit type goals and caps.{% endif %} One count per unique antigen sequence, attributed to its first ranked source type.
Emitted by type: {% for kind, count in group.assembly_decisions.allocation.emitted_counts.items() %}{{ kind }}: {{ count }}; {% else %}none{% endfor %}
{% for goal in group.assembly_decisions.allocation.unmet_goals %}Unmet {{ goal.kind }} goal: {{ goal.emitted }} / {{ goal.requested }}; {{ goal.reason | replace('_', ' ') }} ({{ goal.available }} eligible unique sequences).
{% endfor %}{% endif %}
Identical final amino-acid sequences share one antigen slot, retaining all mappings. Distinct overlapping sequences remain separate; source-event counts are reported above.
{% for decision in group.assembly_decisions.rows %}  {{ decision.order }}. {{ decision.sequence }}; sources {{ decision.sources | join(', ') }}; {{ decision.mapping_count }} candidate mappings: {{ decision.outcome | replace('_', ' ') }}{% if decision.products %} ({{ decision.products | join(', ') }}){% endif %}.
{% if decision.length_constraint %}     Assembled length {{ decision.length_constraint.length }} {{ decision.length_constraint.unit }}; limit {{ decision.length_constraint.limit }} {{ decision.length_constraint.unit }}.
{% endif %}{% endfor %}{% else %}Historical assembly ordering, deduplication and capacity decisions were not recorded. Product mappings describe the saved result.
{% endif %}{% endif %}
{% for product in group.products %}

{{ product.name }}: {{ product.length }} {{ product.unit }}
{% if product.window_decisions %}Recorded window rationale: {{ product.window_decisions | join(', ') }}.
{% else %}A window-selection rationale was not recorded for this product.
{% endif %}{% if product.junction %}Linker decisions: {{ product.junction.status }}.
{% for label, value in product.junction.rows %}  {{ label }}: {{ value }}
{% endfor %}{% if product.junction.rows and not product.junction.decisions %}The recorded comparison is for the complete construct. Independent per-junction benefit was not recorded.
{% endif %}{% for linker in product.junction.linkers %}  Junction {{ linker.junction_index }}: {{ linker.name }}; {{ linker.aa }}; encoded protein [{{ linker.start_aa }}, {{ linker.end_aa }}).
{% endfor %}{% endif %}
{% if product.junction and product.junction.decisions %}Per-junction preference minimizes strong count, mild count, negative minimum rank, then candidate order. The complete construct comparison determines whether preferred linkers or the shared default are emitted.
{% for decision in product.junction.decisions %}  Junction {{ decision.junction_index }}: preferred {{ decision.preferred_linker }}, emitted {{ decision.emitted_linker }}.
{% for alternative in decision.candidates %}    {{ alternative.linker }}: key {{ alternative.key | tojson }}, order {{ alternative.candidate_order }}.
{% endfor %}{% endfor %}{% endif %}
{% if product.unit == 'aa' %}N-terminal acetylation: {{ 'yes' if product.n_terminal_acetylation else 'no' }}; C-terminal amidation: {{ 'yes' if product.c_terminal_amidation else 'no' }}.
{% endif %}
{{ 'Full nucleotide sequence, including polyA' if product.unit == 'nt' else 'Manufactured amino-acid sequence' }}:
{{ product.sequence | wordwrap(70, break_long_words=True) }}
{% if product.protein %}Encoded protein:
{{ product.protein | wordwrap(70, break_long_words=True) }}
{% endif %}
{% for antigen in product.antigens %}
  Antigen {{ loop.index }} / {{ antigen.display_name }}: [{{ antigen.start }}, {{ antigen.end }}), {{ antigen.length }} aa
  Full antigen label: see Methods and provenance, {{ group.modality }} / {{ product.name }} / antigen {{ loop.index }}.
{% for label in antigen.context_labels %}    Source context: {{ label }}
{% endfor %}
  {{ antigen.sequence }}
{% if antigen.target_intervals %}  Targetable regions within this antigen: {% for start, end in antigen.target_intervals %}[{{ start }}, {{ end }}){% if not loop.last %}, {% endif %}{% endfor %}.
{% else %}  Target coordinates unavailable or differ across sources.
{% endif %}
  Source mappings: {{ antigen.sources if antigen.sources is not none else "unavailable" }} candidates, {{ antigen.transcripts if antigen.transcripts is not none else "unavailable" }} transcripts; genes: {{ antigen.genes or 'unavailable' }}.
{% if antigen.sources and antigen.sources > 1 %}  Shared emitted sequence; {{ antigen.candidate_contexts }} distinct candidate contexts. {{ antigen.protein_identity_note }}
{% if antigen.protein_groups %}  Source-protein groups ({{ antigen.protein_groups | length }}): {% for pg in antigen.protein_groups %}{{ pg.genes }}{% if pg.proteins %} ({{ pg.proteins }}){% elif pg.transcripts %} ({{ pg.transcripts }}){% endif %} [{{ pg.completeness }}{% if pg.length_aa %}, {{ pg.length_aa }} aa{% endif %}]{% if not loop.last %}; {% endif %}{% endfor %}.
{% endif %}{% if antigen.representative %}  Allocation source: {{ antigen.representative.name }}; ranking and RNA evidence: {{ antigen.representative.source_ids | join(', ') if antigen.representative.source_ids else 'source mapping unavailable' }}. Scores and RNA measurements remain source-specific.
{% endif %}{% for origin in antigen.origin_summaries %}  {{ 'Displayed representative' if origin.is_representative else 'Alternative origin' }}: {{ origin.name }}{% if origin.identifiers %} ({{ origin.identifiers }}){% endif %}{% if origin.source_ids %} [{{ origin.source_ids | join(', ') }}]{% endif %}; source sequence {{ origin.completeness }}; score {{ origin.score }}{% if origin.admission %}; admission {{ origin.admission }}{% endif %}{% if origin.evidence %}; {{ origin.evidence }}{% endif %}.
{% endfor %}{% endif %}{% if antigen.source_ids %}  Report sources: {{ antigen.source_ids | join(', ') }}.
{% endif %}
{% else %}Historical product: antigen placement/source mappings were not recorded. Labels: {{ product.antigen_names | join(', ') }}.
{% endfor %}
{% if include_manufacturability and product.manufacturability %}Manufacturability:
{% for key, value in product.manufacturability.items() %}  {{ key | replace('_', ' ') }}: {{ value }}
{% endfor %}{% endif %}
{% else %}No {{ group.modality }} products were emitted.
{% endfor %}
{% endfor %}
{% else %}No construct files were emitted. Use --output-dir to request product assembly. Candidate windows below are analysis results.
{% endif %}
