Revamp AnimalBreeding platform implementation - #8
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
| animals = sort!(collect(ancestors); by = x -> (_pedigree_depth(x, pedmap), x)) | ||
| index = Dict(animal => i for (i, animal) in enumerate(animals)) | ||
| n = length(animals) | ||
| A = zeros(Float64, n, n) | ||
| for (animal, i) in pairs(index) | ||
| sire, dam = get(pedmap, animal, (nothing, nothing)) | ||
| sidx = sire === nothing ? 0 : get(index, sire, 0) | ||
| didx = dam === nothing ? 0 : get(index, dam, 0) | ||
| for j in 1:i-1 | ||
| val = 0.5 * ((sidx == 0 ? 0.0 : A[sidx, j]) + (didx == 0 ? 0.0 : A[didx, j])) |
There was a problem hiding this comment.
Iterate pedigree rows in deterministic ancestor order
The additive relationship matrix is built by looping over pairs(index), but dictionaries in Julia are unordered. When an offspring row is processed before its parents, the loop uses zero rows for the parents in A[sidx, :] and A[didx, :], producing incorrect relationship coefficients that are never corrected later. Iterating the animals vector directly (which was already sorted by pedigree depth) avoids this nondeterministic ordering and ensures ancestors are filled before descendants.
Useful? React with 👍 / 👎.
Summary
AnimalBreedingand rewrite the data management, modeling, evaluation, Bayesian, machine learning, interface, and performance modules into production-ready implementationsTesting
julia --project -e 'using Pkg; Pkg.test()'(fails: julia binary not available in container)https://chatgpt.com/codex/tasks/task_e_68dca407c6ec8321b696c1ef8e260d01