SciganticGuidesTopicsExplore

How to open the Genomes to Fields (G2F) maize genotype by environment data in a Jupyter notebook

The trial data are CSV files that pandas reads directly, starting with Training_data/1_Training_Trait_Data_2014_2023.csv for plot-level yield. In a Scigantic notebook the two G2F prediction-competition packages are mounted at /mnt/archive, with phenotypes, weather, soil, genotypes and environmental covariates side by side.

The code on this page runs in a Scigantic hosted notebook, where the dataset is mounted read-only at /mnt/archive. The same path is in the SCIGANTIC_MOUNT_PATH environment variable and linked from ~/archive. The public source is s3://scigantic-g2f-maize (AWS us-east-1, public, no account needed).

Open Genomes to Fields maize GxE data on Scigantic

Code

Read the trait table and plot one hybrid across environments

# Start here: click this cell, press Shift+Enter.
HYBRID = None                  # None picks the most widely grown hybrid

import os
from pathlib import Path
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib_inline.backend_inline import set_matplotlib_formats
set_matplotlib_formats("jpeg", pil_kwargs={"quality": 80})
plt.rcParams["figure.dpi"] = 72

ARCHIVE = Path(os.environ.get("SCIGANTIC_MOUNT_PATH", Path.home() / "archive"))
P2024 = ARCHIVE / "prediction-competition-2024"

trait = pd.read_csv(P2024 / "Training_data/1_Training_Trait_Data_2014_2023.csv",
                    low_memory=False).dropna(subset=["Yield_Mg_ha", "Hybrid"])

counts = trait.groupby("Hybrid").Env.nunique().sort_values(ascending=False)
if HYBRID is None:
    HYBRID = counts.index[0]
print(f"{len(trait):,} harvested plots, {trait.Env.nunique()} environments, "
      f"{trait.Hybrid.nunique():,} hybrids, {trait.Year.min()}-{trait.Year.max()}")
print(f"most widely grown hybrids: {', '.join(counts.index[:5])}")

one = (trait[trait.Hybrid == HYBRID].groupby("Env").Yield_Mg_ha.mean()
       .sort_values())
print(f"\n{HYBRID}: grown in {len(one)} environments, "
      f"{one.min():.1f} to {one.max():.1f} Mg/ha "
      f"({one.max() / max(one.min(), 0.1):.1f}x)")

fig, ax = plt.subplots(figsize=(11, max(3, len(one) * 0.22)))
ax.barh(one.index, one.values, color="#3b6ea5")
ax.axvline(one.mean(), color="#b4553b", lw=1.5,
           label=f"mean {one.mean():.1f} Mg/ha")
ax.set_xlabel("grain yield, Mg/ha at 15.5% moisture")
ax.set_title(f"One hybrid, many places: {HYBRID}")
ax.legend(loc="lower right")
ax.spines[["top", "right"]].set_visible(False)
fig.tight_layout()
plt.show()

Copied from this dataset's starter notebook on Scigantic, the one that opens when you start a notebook from the archive page (one cell, unchanged).

What the files are

Genomes to Fields grows a shared set of maize hybrids across dozens of field sites each season. This archive mirrors the two open prediction-competition packages: the 2024 edition (training years 2014 to 2023, 22 held-out 2024 environments) and the 2022 edition (2014 to 2021 against the 2022 season).

Each package holds plot-level phenotypes with grain yield in Mg per hectare at 15.5 percent moisture, trial metadata with coordinates and planting dates, soil chemistry, daily NASA POWER weather, hybrid genotypes as a VCF and a numeric marker matrix, and 654 environmental covariates. Both include the organizers' observed values for the held-out year.

How the files are laid out

Path under the mountWhat it holds
prediction-competition-2024/Training_data/Training tables for 2014 to 2023. 1_Training_Trait_Data_2014_2023.csv is the plot-level phenotype table with Env, Hybrid, Year and Yield_Mg_ha.
prediction-competition-2022/Testing_data/Held-out season files for the 2022 edition: 1_Submission_Template_2022.csv, 2_Testing_Meta_Data_2022.csv, 3_Testing_Soil_Data_2022.csv, 4_Testing_Weather_Data_2022.csv, 6_Testing_EC_Data_2022.csv.

Size, format and license

FormatCSV tables; genotypes as VCF and a numeric marker matrix
SizeTwo competition packages (2022 and 2024 editions)
LicensePDDL 1.0 (public domain dedication)
ProviderGenomes to Fields Initiative; mirrored by Scigantic
Public sources3://scigantic-g2f-maize (AWS us-east-1, public, no account needed)

Things to know before you read it

Run it

Start a notebook from the Genomes to Fields maize GxE data archive page. The data is mounted when the notebook opens, so the code above runs as written and nothing is downloaded first.

Related guides

Last checked 2026-11-21. All dataset guides.