This file aims to reproduce the findings of Buckler et al 2009, “The Genetic Architecture of Maize Flowering Time”.
It used data from panzea - Phenotypic data panzea_etal_2009_Science_flowering_time_data-090807
- Genotypic Data panzea7_publicSamples_imputedV5_AGPv4-181023.vcf.gz - Genomic Data …
use_gpu_num =1import osimport pandas as pdimport numpy as npimport reimport torchfrom torch.utils.data import Datasetfrom torch.utils.data import DataLoaderfrom torch import nn# TODO fixmedevice ="cuda"if torch.cuda.is_available() else"cpu"if use_gpu_num in [0, 1]: torch.cuda.set_device(use_gpu_num)print(f"Using {device} device")import tqdmimport plotly.graph_objects as goimport plotly.express as px# [e for e in os.listdir() if re.match(".+\\.txt", e)]
/home/labmember/mambaforge/envs/pytorch_mamba/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
from .autonotebook import tqdm as notebook_tqdm
/home/labmember/mambaforge/envs/pytorch_mamba/lib/python3.10/site-packages/plotly/express/_core.py:279: FutureWarning: iteritems is deprecated and will be removed in a future version. Use .items instead.
dims = [
d2a = np.array(data['days2anthesis'])d2s = np.array(data['days2silk'])asi = np.array(data['asi'])xs = np.array(data.drop(columns = ['days2anthesis', 'days2silk', 'asi', 'pop', 'Geno_Code']))n_obs = xs.shape[0]np_seed =9070707rng = np.random.default_rng(np_seed) # can be called without a seedtest_pr =0.2test_n =round(n_obs*test_pr)idxs = np.linspace(0, n_obs-1, num = n_obs).astype(int)rng.shuffle(idxs)test_idxs = idxs[0:test_n]train_idxs = idxs[test_n:-1]
# make up tensorsdef calc_cs(x): return [np.mean(x, axis =0), np.std(x, axis =0)]