<jupyter_start><jupyter_text>--- Zebrafish Alemany_Fin<jupyter_code>alemany_fin = cb.data.ExprDataSet.read_dataset("../../Datasets/data/Alemany_Fin/data.h5")
utils.peek(alemany_fin, "build/fin/Alemany_Fin")
alemany_fin.obs.head()
alemany_fin.obs["ClusterID"] = "cluster_" + alemany_fin.obs["ClusterID"].astype(int).astype(str)
alemany_fin.obs.dtypes
opt_model_kwargs = dict(batch_effect="donor")
alemany_fin_model = cb.directi.fit_DIRECTi(
    alemany_fin, alemany_fin.uns["seurat_genes"],
    **fixed_model_kwargs, **opt_model_kwargs
)
alemany_fin.latent = alemany_fin_model.inference(alemany_fin)
ax = alemany_fin.visualize_latent("cell_ontology_class", scatter_kws=dict(rasterized=True))
ax.get_figure().savefig("build/fin/Alemany_Fin/cell_ontology_class.svg", dpi=utils.DPI, bbox_inches="tight")
ax = alemany_fin.visualize_latent("cell_type1", scatter_kws=dict(rasterized=True))
ax.get_figure().savefig("build/fin/Alemany_Fin/cell_type1.svg", dpi=utils.DPI, bbox_inches="tight")
ax = alemany_fin.visualize_latent("ClusterID", scatter_kws=dict(rasterized=True))
ax.get_figure().savefig("build/fin/Alemany_Fin/ClusterID.svg", dpi=utils.DPI, bbox_inches="tight")
ax = alemany_fin.visualize_latent("donor", scatter_kws=dict(rasterized=True))
ax.get_figure().savefig("build/fin/Alemany_Fin/donor.svg", dpi=utils.DPI, bbox_inches="tight")
ax = alemany_fin.visualize_latent("free_annotation", scatter_kws=dict(rasterized=True))
ax.get_figure().savefig("build/fin/Alemany_Fin/free_annotation.svg", dpi=utils.DPI, bbox_inches="tight")
alemany_fin.write_dataset("build/fin/Alemany_Fin/Alemany_Fin.h5")
%%capture capio
alemany_fin_models = [alemany_fin_model]
opt_model_kwargs = dict(batch_effect="donor")
for i in range(1, cb.config.N_JOBS):
    print("==== Model %d ====" % i)
    alemany_fin_models.append(cb.directi.fit_DIRECTi(
        alemany_fin, alemany_fin.uns["seurat_genes"],
        **fixed_model_kwargs, **opt_model_kwargs,
        random_seed=i
    ))
alemany_fin_blast = cb.blast.BLAST(alemany_fin_models, alemany_fin)
alemany_fin_blast.save("build/fin/Alemany_Fin")
with open("build/fin/Alemany_Fin/stdout.txt", "w") as f:
    f.write(capio.stdout)
with open("build/fin/Alemany_Fin/stderr.txt", "w") as f:
    f.write(capio.stderr)
utils.self_projection(alemany_fin_blast, "build/fin/Alemany_Fin")
%%writefile build/fin/Alemany_Fin/predictable.txt
cell_ontology_class
cell_type1
ClusterID<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14956736711990112, 'fraction_numerical': 0.002472187886279357, 'mean_word_length': 7.893772893772894, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '276131', 'license': 'MIT', 'n_tokens_mistral': 1006, 'n_tokens_neox': 989, 'n_words': 96, 'path': 'Notebooks/Database/fin.ipynb', 'repo_name': 'gao-lab/Cell_BLAST', 'size': '2427'}