Population
quick_haplo
quick_haplo (key:<function PRNGKey>, sim_param:chewc.sp.SimParam, n_ind:int, inbred:bool=False)
*Creates a new population with randomly generated haplotypes, analogous to AlphaSimR’s quickHaplo
function.
The structure of the genome (chromosomes, loci, ploidy) is defined by the provided SimParam object.
Args: key: A JAX random key. Must be provided by the user to ensure reproducibility. sim_param: A SimParam object that defines the genome structure. n_ind: Number of individuals to create. inbred: If True, individuals will be fully inbred (homozygous at all loci).
Returns: A new Population object with random founder individuals.*
Population
Population (geno:jax.Array, id:jax.Array, iid:jax.Array, mother:jax.Array, father:jax.Array, sex:jax.Array, pheno:jax.Array, fixEff:jax.Array, bv:Optional[jax.Array]=None, dd:Optional[jax.Array]=None, aa:Optional[jax.Array]=None, ebv:Optional[jax.Array]=None, gxe:Optional[jax.Array]=None, misc:Dict=<factory>, miscPop:Dict=<factory>)
*A container for all data related to a population of individuals, designed for JAX-based genetic simulations.
This structure is immutable. All operations that modify a population should return a new Population object.
Attributes: geno (jnp.ndarray): A 4D array representing the genotypes of the population. Shape: (nInd, nChr, ploidy, nLoci)
. dtype: jnp.uint8
.
id (jnp.ndarray): The primary, user-facing identifier for each individual.
These IDs may not be contiguous or sorted. Shape: `(nInd,)`.
iid (jnp.ndarray): The internal, zero-indexed, contiguous identifier.
Crucial for robust indexing in JAX operations. Shape: `(nInd,)`.
mother (jnp.ndarray): Array of internal IDs (`iid`) for the mother of each
individual. A value of -1 indicates no known mother. Shape: `(nInd,)`.
father (jnp.ndarray): Array of internal IDs (`iid`) for the father of each
individual. A value of -1 indicates no known father. Shape: `(nInd,)`.
sex (jnp.ndarray): The sex of each individual, represented numerically
(e.g., 0 for male, 1 for female). dtype: `jnp.int8`. Shape: `(nInd,)`.
pheno (jnp.ndarray): The phenotypic values for each individual.
Shape: `(nInd, nTraits)`.
fixEff (jnp.ndarray): The value of a fixed effect for each individual,
often used as an intercept in genomic selection models. Shape: `(nInd,)`.
bv (Optional[jnp.ndarray]): The true breeding values (additive genetic effects)
for each individual. Shape: `(nInd, nTraits)`.
dd (Optional[jnp.ndarray]): The true dominance deviations for each individual.
Shape: `(nInd, nTraits)`.
aa (Optional[jnp.ndarray]): The true additive-by-additive epistatic deviations
for each individual. Shape: `(nInd, nTraits)`.
ebv (Optional[jnp.ndarray]): The estimated breeding values for each
individual. Shape: `(nInd, nTraits)`.
gxe (Optional[jnp.ndarray]): Genotype-by-environment interaction effects.
Shape depends on the specific GxE model.
misc (Dict): A dictionary for storing miscellaneous, non-JAX-critical
metadata about individuals. Static.
miscPop (Dict): A dictionary for storing miscellaneous, non-JAX-critical
metadata about the entire population. Static.*