Skip to content

Implement structured genotype-to-phenotype expression#3

Open
Spbd1 wants to merge 1 commit into
codex/implement-128-bit-genome-encoding-layerfrom
codex/implement-genotype-to-phenotype-conversion
Open

Implement structured genotype-to-phenotype expression#3
Spbd1 wants to merge 1 commit into
codex/implement-128-bit-genome-encoding-layerfrom
codex/implement-genotype-to-phenotype-conversion

Conversation

@Spbd1

@Spbd1 Spbd1 commented May 7, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Provide a deterministic mapping from the compact 128-bit computational genotype into a structured, typed phenotype object covering coat, pattern, morphology, mobility, cognition, thermal/camouflage traits and circadian tendency.
  • Ensure numeric phenotype values are normalized to the inclusive 0–1 range and remain compatible with the older abstract gene Genome representation.

Description

  • Added pishiegen/phenotype/traits.py which defines a Phenotype dataclass, PHENOTYPE_FIELDS, a clamp helper, traits serialization and a numeric value() accessor that returns continuous trait values for fitness scoring.
  • Added pishiegen/phenotype/dominance.py implementing coat-allele decoding, a simple dominance ranking and dilution-as-modifier behavior.
  • Reworked pishiegen/phenotype/expression.py to accept pishiegen.genome.encoding.Genome or a raw 128-bit integer, decode schema fields, and compute coat, hidden coat, pattern/agouti, pattern intensity, fur length/type, ear type/size, tail type, polydactyly, colorpoint/albino status, health risk, cold/heat tolerance (modified by fur and ear size), biome-relevant camouflage/wetland mobility, agility (tail and polydactyly modifiers), sensory acuity (ear modifiers), intelligence, and circadian type, while preserving extra_traits when expressing the older abstract gene Genome.
  • Exported the phenotype API from pishiegen/phenotype/__init__.py and added tests/test_phenotype_expression.py which checks a known compact genome, agouti suppression, polydactyly behavior, required output fields, and 0–1 clamping for normalized scores.

Testing

  • Ran the full test suite with python -m pytest -q, which executed the new tests/test_phenotype_expression.py along with existing tests and completed successfully.
  • Ran python -m compileall pishiegen tests to ensure modules compile without errors and it succeeded.

Codex Task

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant