Pular para o conteúdo principal

persona_db/engines/genetics.py

Genetic trait inheritance engine.

Owned by Agent 3. Public API consumed by generators and validators. All randomness flows through SeededRNG (duck-typed parameter).

:::info Fonte Módulo persona_db.engines.genetics — 278 linhas · 1 classe(s) · 0 função(ões) pública(s). Ver no GitHub :::

Classes​

class GeneticEngine​

Fachada única para herança genética de traços físicos.

Atributo de classeValor
PHENOTYPE_ENUMS{'cor_olhos': ['castanho', 'azul', 'verde', 'avela', 'cinza', 'ambar'], 'cor_cabelo': ['preto', 'castanho', '…

__init__()​

def __init__(self, rng: SeededRNG)

persona_db/engines/genetics.py:47

eye_color_chart()​

@staticmethod

def eye_color_chart(parent1_gt: tuple[str, str], parent2_gt: tuple[str, str]) -> dict

Tabela completa de Punnett -> {fenótipo: probabilidade}.

persona_db/engines/genetics.py:56

genotype_sample()​

def genotype_sample(self) -> tuple[str, str]

Amostra um genótipo com frequências populacionais realistas.

persona_db/engines/genetics.py:65

draw_eye_color()​

def draw_eye_color(self, gt_pai: tuple[str, str], gt_mae: tuple[str, str], ancestry_african_pct: float | None=None) -> str

persona_db/engines/genetics.py:80

hair_color()​

def hair_color(self, hair_pai_str: str, hair_mae_str: str, ancestry_european_pct: float=0.0) -> str

Dominância: preto > castanho > loiro > ruivo, com modificadores de ancestralidade.

persona_db/engines/genetics.py:105

handedness_prob()​

@staticmethod

def handedness_prob(pai_canhoto: bool, mae_canhota: bool) -> float

Modelo logístico: logit(P) = -2.1 + 0.69pai + 0.55mae.

persona_db/engines/genetics.py:134

handedness()​

def handedness(self, pai_canhoto: bool, mae_canhota: bool) -> str

persona_db/engines/genetics.py:139

punnett_abo()​

@classmethod

def punnett_abo(cls, tipo_pai: str, tipo_mae: str) -> dict

Probabilidades de fenótipo ABO filho via Punnett completo.

persona_db/engines/genetics.py:173

rh_punnett()​

@classmethod

def rh_punnett(cls, rh_pai: str, rh_mae: str) -> dict

Punnett simplificado para Rh (D dominante).

persona_db/engines/genetics.py:195

herdar_tipo_sanguineo()​

def herdar_tipo_sanguineo(self, tipo_pai: str, tipo_mae: str, rh_pai: str, rh_mae: str) -> str

persona_db/engines/genetics.py:216

validate_child_blood()​

@classmethod

def validate_child_blood(cls, tipo_pai, tipo_mae, rh_pai, rh_mae, tipo_filho) -> bool

Validador: tipo de sangue filho é possível dados os pais.

persona_db/engines/genetics.py:230

expected_child_height()​

def expected_child_height(self, altura_pai_cm: float, altura_mae_cm: float, sex_filho: str) -> float

persona_db/engines/genetics.py:241

peso_from_height()​

def peso_from_height(self, altura_cm: float, sex: str, disease_chronic: bool=False) -> float

persona_db/engines/genetics.py:250

prs_risk()​

def prs_risk(self, condition: str, family_effects: dict | None=None, genotypes: dict | None=None) -> float

persona_db/engines/genetics.py:266

has_hereditary_disease()​

def has_hereditary_disease(self, prs: float, threshold: float=0.5) -> bool

persona_db/engines/genetics.py:277