Example Datasets

The package ships three example datasets: john_alpha (a field trial), fa_met (a simulated multi-environment trial with its generating values in fa_met_params), and load_wheat_marker_100 (a genomic marker matrix).

torch_openreml.example_data.john_alpha

torch_openreml.example_data.john_alpha

Alpha lattice design of spring oats (re-exported from R agridat).

This dataset is a Python re-export of john.alpha from the R package agridat. It contains field trial data from a resolvable alpha lattice design conducted at Craibstone near Aberdeen.

The experiment includes 24 oat varieties evaluated across 3 replicates, with each replicate arranged into 6 incomplete blocks of size 4.

Shape: 72 rows × 7 columns

Example

from torch_openreml.example_data import john_alpha
print(john_alpha)
    plot rep block  gen   yield  row  col
0      1  R1    B1  G11  4.1172    1    1
1      2  R1    B1  G04  4.4461    2    1
2      3  R1    B1  G05  5.8757    3    1
3      4  R1    B1  G22  4.5784    4    1
4      5  R1    B2  G21  4.6540    5    1
..   ...  ..   ...  ...     ...  ...  ...
67    68  R3    B5  G24  3.5655   68    1
68    69  R3    B6  G03  2.8873   69    1
69    70  R3    B6  G05  4.1972   70    1
70    71  R3    B6  G20  3.7349   71    1
71    72  R3    B6  G07  3.6096   72    1

[72 rows x 7 columns]

Columns

Column

Type

Description

plot

int

Plot number.

rep

int

Replicate identifier (1–3).

block

int

Incomplete block within replicate.

gen

str

Genotype / variety identifier.

yield

float

Dry matter yield (tonnes/ha).

row

int

Field row coordinate (note: layout is linear, not grid-based).

col

int

Field column coordinate.

Design

Resolvable alpha lattice design with incomplete blocking structure.

Note

The tabular layout in John & Williams (1995, p. 146) does not represent the physical field layout (plots were arranged in a single line).

Source

Re-exported from R package agridat (john.alpha dataset).

References

    1. John & E. R. Williams (1995). Cyclic and computer generated designs. Chapman and Hall, London. Page 146.

torch_openreml.example_data.fa_met

torch_openreml.example_data.fa_met

Simulated multi-environment trial with a factor-analytic genotype-by-environment covariance.

The trial simulates 100 genotypes grown in six environments with two replicates per genotype-by-environment cell, giving 1,200 observations. The genotype-by-environment effects were generated from a factor-analytic covariance with two latent factors, \(\boldsymbol{\Sigma} = \boldsymbol{\Lambda}\boldsymbol{\Lambda}^\top + \boldsymbol{\Psi}\), and the residual variance was set to 0.3. The generating values are exposed separately as fa_met_params.

The genotype and environment labels are read as zero-padded strings (001–100 and 01–06), preserving the lexicographic ordering that DummyMatrix relies on.

Shape: 1200 rows × 5 columns

Example

from torch_openreml.example_data import fa_met

fa_met.head()
genotype environment rep yield genetic
0 001 01 1 4.779848 -0.231039
1 001 01 2 4.818141 -0.231039
2 001 02 1 4.614127 -0.638617
3 001 02 2 4.455589 -0.638617
4 001 03 1 5.057905 0.261934

Columns

Column

Type

Description

genotype

str

Genotype identifier (001–100).

environment

str

Environment identifier (01–06).

rep

int

Replicate within a genotype-by-environment cell (1 or 2).

yield

float

Observed yield.

genetic

float

Latent genotype-by-environment effect. Constant within a cell and repeated on both of its rows.

Simulation

The trial was simulated from environment means \((5.0, 5.2, 4.8, 5.1, 5.3, 4.9)\), a lower-triangular \(6 \times 2\) loading matrix, six uniquenesses, and a residual variance of 0.3. The factor structure and the fitted recovery are worked through in Factor Analysis of a Multi-Environment Trial.

Source

Simulated for the documentation; no external data are used.

torch_openreml.example_data.fa_met_params

torch_openreml.example_data.fa_met_params

Generating values of the fa_met trial, read from fa_met_params.json.

Because the trial is simulated, the truth is known and kept next to the observations. This allows the factor-analysis vignette to compare a fitted covariance, loadings, uniquenesses and environment means with the values that generated the data.

Type: dict with four keys

Key

Type

Description

means

list[float]

Six environment means.

loadings

list[list[float]]

\(6 \times 2\) lower-triangular factor-loading matrix.

uniqueness

list[float]

Six environment uniquenesses \(\psi_j\).

sigma2

float

Residual variance \(\sigma^2\).

Example

from torch_openreml.example_data import fa_met_params

fa_met_params
{'means': [5.0, 5.2, 4.8, 5.1, 5.3, 4.9],
 'loadings': [[0.9, 0.0],
  [0.7, 0.2],
  [0.6, 0.1],
  [0.5, 0.4],
  [0.3, 0.7],
  [0.1, 0.8]],
 'uniqueness': [0.5, 0.4, 0.5, 0.6, 0.4, 0.5],
 'sigma2': 0.3}

Source

Simulated for the documentation; no external data are used.

torch_openreml.example_data.load_wheat_marker_100

torch_openreml.example_data.load_wheat_marker_100()

Load the raw marker matrix of 100 wheat genotypes.

The function returns a DataFrame with one row per genotype and one column per marker. The values are raw allele scores, (AA, AB, BB) = (1, 0, -1), with some continuous imputed values; markers are not recoded, centred or scaled. Missing calls were imputed in the source data, so the matrix contains no missing values.

Shape: 100 rows × 17,115 columns (genotype plus 17,114 markers)

Example

from torch_openreml.example_data import load_wheat_marker_100

markers = load_wheat_marker_100()
markers.shape
(100, 17115)

Columns

Column

Type

Description

genotype

str

Genotype identifier.

marker columns

int or float

Raw allele scores in \([-1, 1]\). Integer columns are the original calls; float columns contain imputed values.

Use in a model

The matrix is the input to the genomic relationship kernels in Linear and Quadratic Kernel Models: convert the scores to dosages with \(\boldsymbol{D} = \boldsymbol{M} + 1\), centre them, and form the VanRaden linear kernel \(\boldsymbol{K}_1 = \boldsymbol{Z}\boldsymbol{Z}^\top / d\) and the quadratic kernel \(\boldsymbol{K}_2 = \boldsymbol{K}_1 \odot \boldsymbol{K}_1\).

Source and licence

Derived from Taylor, Fruzangohar, and Walter, Roseworthy 2014 Field trial phenotype data and matching 17K+ genotype data, Adelaide University, https://doi.org/10.25909/23949333.v1. The source is licensed under the Creative Commons Attribution 4.0 International licence (CC BY 4.0), https://creativecommons.org/licenses/by/4.0/.

This modified subset is redistributed under CC BY 4.0; the original authors do not endorse this derived work. Modifications: the first 100 genotype rows were retained; genotype identifiers were joined from the matching phenotype file; raw allele scores and imputed values are unchanged; marker names are unchanged. No phenotype, BLUP or deregressed-BLUP columns are included.