rice-phenotype-prediction

Predict rice agronomic traits (yield, plant height, heading date, grain size, etc.) from genotype and environmental data using pre-trained MMoE deep learning models. Use when the user asks about rice phenotype prediction, crop trait estimation, genotype-environment interaction, or environmental stress effects on rice. Supports Chinese and English. Trigger terms: 水稻, 表型, 预测, 株高, 产量, 粒长, 抽穗期, 千粒重, 结实率, rice, phenotype, yield, trait, stress.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "rice-phenotype-prediction" with this command: npx skills add qianlvdouhua/gain

Rice Phenotype Prediction

Self-contained skill for predicting 10 rice agronomic traits via pre-trained MMoE models. All models, data, and scripts are inside this directory — give users this one folder.

Setup

First-time check

python <SKILL_DIR>/scripts/check_env.py

This verifies Python dependencies and data integrity. If packages are missing:

pip install -r <SKILL_DIR>/requirements.txt

Required: torch>=2.0 numpy pandas scikit-learn scipy requests GPU is optional — CPU works (just slower). If GPU is present, cuda:0 is used automatically.

<SKILL_DIR> convention

Throughout this file, <SKILL_DIR> means the absolute path to this skill's root directory (the folder containing this SKILL.md). When running commands, substitute with the actual path. --base_dir is optional; if omitted, scripts auto-detect it from their own location.

Supported Traits

CodeChineseEnglishUnit
HD抽穗期Heading Datedays
PH株高Plant Heightcm
PL穗长Panicle Lengthcm
TN分蘖数Tiller Numbercount
GP每穗粒数Grains Per Paniclecount
SSR结实率Seed Setting Rate%
TGW千粒重Thousand Grain Weightg
GL粒长Grain Lengthmm
GW粒宽Grain Widthmm
Y产量Yieldkg/ha

Supported Locations (7 built-in stations)

CodeCityLatLon
km昆明25.02102.68
gzl六盘水26.59104.83
nn南宁22.82108.37
wh武汉30.58114.27
hf合肥31.82117.25
hz杭州30.25120.17
th通化41.73125.94

Any input lat/lon is auto-matched to the nearest station via Haversine distance. For locations with internet, daily weather data can also be fetched from NASA POWER API for the exact coordinates.

Stress Types

TypeChineseDefault effect
high_temp高温胁迫+3°C max / +2°C min
low_temp低温胁迫-3°C max / -2°C min
drought干旱胁迫90% precipitation reduction
flood涝害胁迫3x precipitation increase
low_light寡照胁迫60% PAR reduction

Prediction Commands

Full prediction (recommended)

python <SKILL_DIR>/scripts/predict.py --lat 30.5 --lon 114.3 --sample sample1

Genotype-only / environment-only

python <SKILL_DIR>/scripts/predict.py --lat 30.5 --lon 114.3 --sample sample1 --mode gene
python <SKILL_DIR>/scripts/predict.py --lat 30.5 --lon 114.3 --sample sample1 --mode env

Specific traits

python <SKILL_DIR>/scripts/predict.py --lat 30.5 --lon 114.3 --sample sample1 --trait PH,Y

With stress

python <SKILL_DIR>/scripts/predict.py --lat 30.5 --lon 114.3 --sample sample1 --stress high_temp
python <SKILL_DIR>/scripts/predict.py --lat 30.5 --lon 114.3 --sample sample1 --stress high_temp --stress_delta 5.0

Multiple samples

python <SKILL_DIR>/scripts/predict.py --lat 30.5 --lon 114.3 --sample "sample1,sample2,sample3"

Custom genotype file

python <SKILL_DIR>/scripts/predict.py --lat 30.5 --lon 114.3 --genotype_file /path/to/user_vae.csv

Format: CSV with 1024 columns (VAE-encoded features), first column = sample index.

Force CPU / specific device

python <SKILL_DIR>/scripts/predict.py --lat 30.5 --lon 114.3 --sample sample1 --device cpu
python <SKILL_DIR>/scripts/predict.py --lat 30.5 --lon 114.3 --sample sample1 --device cuda:0

Human-readable table

python <SKILL_DIR>/scripts/predict.py --lat 30.5 --lon 114.3 --sample sample1 --output table

All CLI arguments

ArgDefaultDescription
--latrequiredLatitude
--lonrequiredLongitude
--sampleNoneBuilt-in sample ID(s), comma-separated (sample1..sample3925)
--genotype_fileNoneCustom 1024-dim VAE CSV path
--modefullgene, env, or full
--traitallComma-separated trait codes or all
--stressNoneStress type name
--stress_deltaNoneOverride temperature delta
--deviceautoauto, cpu, or cuda:0
--year2024Year for environmental data
--outputjsonjson or table
--base_dirautoOverride skill directory path

Handling User Requests

1. Extract location

  • "经纬度30.5, 114.3" → --lat 30.5 --lon 114.3
  • "武汉" → --lat 30.58 --lon 114.27
  • "北纬25度,东经103度" → --lat 25 --lon 103

2. Map trait names

  • 株高/plant height → PH
  • 产量/yield → Y
  • 粒长/grain length → GL
  • 抽穗期/heading date → HD
  • 千粒重/1000-grain weight → TGW
  • 穗长/panicle length → PL
  • 结实率/seed setting rate → SSR
  • 每穗粒数/grains per panicle → GP
  • 粒宽/grain width → GW
  • 分蘖数/tiller number → TN

3. Map stress requests

  • 高温/heat → high_temp
  • 低温/cold/chilling → low_temp
  • 干旱/drought → drought
  • 洪涝/flooding → flood
  • 阴天/寡照/low light → low_light
  • "高温+5度" → --stress high_temp --stress_delta 5.0

4. Genotype data

  • Built-in samples: --sample sample1 (3925 available: sample1..sample3925)
  • User file: --genotype_file /path/to/file.csv

5. Interpreting output

JSON contains: location, genotype_prediction, environment_prediction, stress_prediction, trait_info.

Report environment_prediction as primary (has environmental context). Compare genotype_prediction as baseline. For stress, compare normal vs stressed values.

Rounding: HD/TN/GP → integer, PH/PL/TGW/SSR → 1 decimal, GL/GW → 2 decimals, Y → integer.

Directory Structure

rice_prediction/                   ← give users this folder
├── SKILL.md                       ← this file
├── requirements.txt               ← pip dependencies
├── data/
│   ├── grid_points.json           ← 7 station coordinates
│   ├── vae_features.csv           ← 3925 built-in genotype samples (1024-dim VAE)
│   ├── season_history.csv         ← historical season data for normalization
│   ├── env_cache/                 ← cached daily weather (auto-populated)
│   ├── models_env/                ← 10 trait-specific env+gene models (~4.6MB each)
│   └── models_gene/               ← 7 location-specific genotype models (~8MB each)
└── scripts/
    ├── predict.py                 ← main entry point
    ├── check_env.py               ← dependency checker
    ├── model_def.py               ← MMoE model architectures
    ├── grid_manager.py            ← nearest grid point finder
    ├── env_data_fetcher.py        ← NASA POWER API fetcher + cache
    ├── env_processor.py           ← environmental feature engineering
    └── stress_simulator.py        ← stress scenario simulation

Architecture (for reference)

  • Model: Multi-gate Mixture-of-Experts (MMoE) with ResidualMLP experts
  • Genotype features: 1024-dim VAE latent encoding of genomic data
  • Environment features: 53 season-aggregated variables from daily weather
  • Environmental data: NASA POWER API (auto-fetched and cached locally)

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Gigo Lobster Taster

🦞 GIGO · gigo-lobster-taster: 正式试吃模式:跑完整评测,默认上传云端、生成个人结果页并进入排行榜。 Triggers: 试吃我的龙虾 / 品鉴我的龙虾 / lobster taste / lobster taster.

Registry SourceRecently Updated
General

Invoice Generator

Creates professional invoices in markdown and HTML

Registry SourceRecently Updated
92001kalin
General

backstage companion

Anti-drift protocol script. Ensures parity between docs and system. Triggers: 'bom dia PROJECT' / 'good morning PROJECT' (load project context with health ch...

Registry SourceRecently Updated
General

stratos-storage

Upload and download files to/from Stratos Decentralized Storage (SDS) network. Use when the user wants to store files on Stratos, retrieve files from Stratos, upload to decentralized storage, or download from SDS.

Registry SourceRecently Updated