A Python library for Statistical Analysis and Simulations of Plant Breeding Experiments, designed specifically for researchers and students who are new to programming but want to understand field design concepts through practical implementation.
dgNova ("Designs Nova") makes it easy to:
- Simulate field experiments with realistic spatial patterns
- Analyze unreplicated field trials using moving grid methods
- Visualize spatial patterns and adjustments
- Learn experimental design concepts through interactive simulations
dgNova is built using robust scientific Python libraries:
- NumPy: For efficient numerical computations and array operations
- Pandas: For data manipulation and analysis
- Matplotlib: For creating static visualizations and plots
- Seaborn: For enhanced statistical visualizations
- Pillow: For image processing and animation support
These dependencies are automatically installed when you install dgNova using pip.
The library is in active development. Currently implemented:
- Moving Grid Design (fully functional)
- Unreplicated Trial Analysis (UNREP class)
Future implementations will include:
- RCBD (Randomized Complete Block Design)
- Alpha-Lattice Design
- Augmented Design
- Split-Plot Design
- Mating Design
- Fieldbook Generation
- Spatial Analysis
pip install dgNova
from dgNova import UNREP
# Load and analyze real field data
unrep = UNREP(
data='test_data/UNREP_Triticale_Unreplicated_Trial_Moving_Grids.csv',
response='Yield', # yield measurements
row='Row', # row positions
column='Column', # column positions
genotype='Genotype', # genotype labels
plot='Plot', # plot identifiers
design='moving_grid' # analysis method
)
# Run analysis
results = unrep.analyze()
# Simulate a field experiment
unrep_sim = UNREP(
row=15, # field dimensions
column=20,
heterogeneity=0.8, # spatial trend intensity (0-1)
mean=5.3, # base yield level
sd=0, # random variation
ne=1, # neighbor effects (0-1)
design='moving_grid'
)
# Analyze simulated data
unrep_sim.analyze()
data
: CSV file, DataFrame, or None (for simulation)response
: Name of response variable columnrow
,column
: Field dimensions or column namesgenotype
: Genotype identifier columnplot
: Plot identifier columndesign
: Analysis method (currently 'moving_grid')
heterogeneity
: Spatial trend intensity (0-1)mean
: Base response levelsd
: Random variationne
: Neighbor effects strength (0-1)
-
analyze()
: Performs moving grid analysis- Adjusts for spatial trends
- Calculates efficiency metrics
- Returns adjusted values and statistics
-
Visualization Methods:
# Plot spatial distribution unrep_sim.plot_spatial_analysis() # Animate adjustment process unrep_sim.animate(frames=100, interval=100) # Show detailed regions unrep_sim.plot_zoomed_regions()
- Mean response
- Standard deviation
- Regression coefficient
- CV% (Adjusted)
- Relative efficiency
- Error variance
- LSD (5%)
Using the Triticale trial data:
unrep = UNREP(data='UNREP_Triticale_Unreplicated_Trial_Moving_Grids.csv')
results = unrep.analyze()
# Sample output:
# Mean: 3.89
# Std: 1.14
# CV% (Adjusted): 29.37
# Relative Efficiency: 1.07
# Error Variance: 1.3040
# LSD (5%): 2.49
The moving grid method adjusts plot values based on local spatial patterns by:
- Analyzing neighboring plots
- Detecting systematic field trends
- Adjusting values to account for spatial variation
- Providing more accurate genotype estimates
-
Spatial Analysis Plot:
unrep.plot_spatial_analysis(use_adjusted=True)
- Shows raw vs adjusted values
- Highlights spatial patterns
- Displays adjustment effects
-
Animation of Adjustment Process:
unrep.animate(frames=100, interval=100)
- Visualizes gradual transformation
- Helps understand adjustment mechanism
dgNova is in active development. Contributions are welcome! Areas of focus:
- Additional design implementations
- Enhanced visualization options
- Documentation improvements
- Test cases and examples
MIT License
- Author: Nadim Khan
- Email: nfornadim@gmail.com
- Website: https://nadimkhan.org
- GitHub: https://github.com/nfornadimkhan/dgNova