<jupyter_start><jupyter_text>Chickpea example  Setup<jupyter_code>import os
from mtml_model import mtmlModel
from dataset import Data, CVset
from pandas import read_csv
from optimisation import *
from semopy.efa import explore_cfa_model
from utils import *

path_data = 'data_cicer/'
file_phens = path_data + 'data_phens.txt'
file_snps = path_data + 'snp_2579_renamed.txt'
snp_pref = 'Ca'<jupyter_output><empty_output><jupyter_text>Read data<jupyter_code>data_phens = read_csv(file_phens, sep='\t', index_col=0)

print(data_phens.isna().sum(axis=0))

# Remove missing data
data_phens = data_phens.loc[data_phens.isna().sum(axis=1) == 0, :]
data_phens = data_phens.iloc[:, list(data_phens.nunique() > 2)]
data_snps = read_csv(file_snps, sep='\t', index_col=0)

# Create data object
data = Data(d_snps=data_snps, d_phens=data_phens)
print(data.n_samples)<jupyter_output>Germ            0
GBegF           0
BegFEndF        0
EndFBegM        0
BegMEndM        0
FloCol          0
StemCol         0
BushShape       0
LeafSize        0
FlowStemCol     0
AscoRes         0
StemBr          0
StemL1ord       0
StemBr1ord      0
StemBr2ord      0
PodD            0
PodS            0
Height          0
Hlp             0
NoPodsWeight    0
PodsWeight      0
PodsNumber      0
SeedsNumber     0
SeedsWeight     0
PodShape        0
PodLength       0
PodWidth        0
SeedShape       0
SeedCol         0
Seed1000W       0
dtype: int64
Imputation of phenotypes..
Imputation of snps..
Imputation is done.
404<jupyter_text>Create model<jupyter_code>model = mtmlModel(data=data)
model.get_lat_struct()
model.show_mod()<jupyter_output>Type of the latent structure is unconnected
======== show models ========
# Model mod0
F0 =~ PodsWeight + PodsNumber + SeedsNumber + SeedsWeight
# Model mod1
F1 =~ NoPodsWeight + PodShape + PodLength + PodWidth + Seed1000W
# Model mod2
F2 =~ FloCol + StemCol + SeedShape + SeedCol
# Model mod3
F3 =~ BegFEndF + EndFBegM
# Model mod4
F4 =~ Height + Hlp
=============================<jupyter_text>Add SNPs<jupyter_code>model = model.add_snps(snp_pref=snp_pref)<jupyter_output>-----------
F0 =~ 1.0 * PodsWeight
F0 =~ 1.9931617663512406 * PodsNumber
F0 =~ 1.8888180364762814 * SeedsNumber
F0 =~ 1.9501172418497341 * SeedsWeight
Skip 0 SNPs
2.102206266840767e-07
F0 =~ 1.0 * PodsWeight
F0 =~ 1.9931617663512406 * PodsNumber
F0 =~ 1.8888180364762814 * SeedsNumber
F0 =~ 1.9501172418497341 * SeedsWeight
F0 ~ -0.18387218392912857*Ca5_39720969
Skip 2099 SNPs
1.0916242310088364e-07
F0 =~ 1.0 * PodsWeight
F0 =~ 1.9931617663512406 * PodsNumber
F0 =~ 1.8888180364762814 * SeedsNumber
F0 =~ 1.9501172418497341 * SeedsWeight
F0 ~ -0.18387218392912857*Ca5_39720969
F0 ~ -0.15693182798338923*Ca7_30930779
Skip 2255 SNPs
3.552713678800501e-15
F0 =~ 1.0 * PodsWeight
F0 =~ 1.9931617663512406 * PodsNumber
F0 =~ 1.8888180364762814 * SeedsNumber
F0 =~ 1.9501172418497341 * SeedsWeight
F0 ~ -0.18387218392912857*Ca5_39720969
F0 ~ -0.15693182798338923*Ca7_30930779
F0 ~ 0.146226707816762*Ca3_10062634
Skip 2263 SNPs
NO SNPs added
-----------
-----------
-----------
F0 =~ 1.0 * PodsWeight
F0 =[...]
{'fraction_non_alphanumeric': 0.11502423263327949, 'fraction_numerical': 0.17189014539579967, 'mean_word_length': 3.607142857142857, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '369112', 'license': 'MIT', 'n_tokens_mistral': 1555, 'n_tokens_neox': 1267, 'n_words': 263, 'path': 'example_cicer.ipynb', 'repo_name': 'iganna/mtmlSEM', 'size': '3095'}