A weighted AMMI algorithm to study genotype-by-environment interaction and QTL-by-environment interaction