{ "cells": [ { "cell_type": "markdown", "id": "00a96048", "metadata": {}, "source": [ "# DNN Model Training\n", "\n", "This notebook is used to train DNN models.\n", "\n", "\n", "### Introduction\n", "\n", "##### Model architecture\n", "\n", "- Recognizing the distinct transcriptomic profiles between cortical and subcortical regions and the higher functional differentiation in human cortical regions, we trained a detached deep neural network model.\n", "- **Cortical model** took separately normalized data of the cortex as input, with an input layer dimension of 4,542 and an output layer of 105 cortical region labels (for BN atlas).\n", "- **Subcortical model** took separately normalized data of the subcortex as input, with an input layer dimension of 5,063 and an output layer of 22 subcortical region labels.\n", "\n", "\n", "##### Region-specific embeddings\n", "\n", "- We fed the regional average expression matrices into the model and extracted the outputs from the final hidden layer, which served as the foundation for constructing the homologous mapping relationships.\n" ] }, { "cell_type": "code", "execution_count": 1, "id": "130922d9-4d60-4bb4-ac01-4ba258fa527b", "metadata": {}, "outputs": [], "source": [ "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 2, "id": "ae1b1ddf-c3a4-4b69-9756-cd12d89bb848", "metadata": {}, "outputs": [], "source": [ "homo_mouse_region_cortex=['PL','PL','ACAd','ACAv','ACAd','ACAv','ACAd','ACAv','ACAd','ACAv','RSPd','RSPd','RSPv','RSPv','ORBl','ORBl','ORBl','ORBl','ORBm','ORBm','ORBm','ORBm','ORBvl','ORBvl','ORBvl','ORBvl','MOp','MOp','MOp','MOp','SSp-ul',\n", " 'SSp-m','SSp-ll','SSp-tr','VISp','VISp','VISp','VISp','AId','AIv','AUDp']\n", "homo_human_region_cortex=['A32p','A32sg','A32p','A32p','A32sg','A32sg','A24rv','A24rv','A24cd','A24cd','A23d','A23v','A23d','A23v','A11l','A11m','A12/47o','A12/47l','A11l','A11m','A12/47o','A12/47l','A11l','A11m','A12/47o','A12/47l','A4hf','A4t','A4ul','A4ll','A1/2/3ulhf',\n", " 'A1/2/3tonIa','A1/2/3ll','A1/2/3tru','cCunG','rCunG','cLinG','rLinG','dIa','vIa','TE1.0 and TE1.2']" ] }, { "cell_type": "code", "execution_count": 3, "id": "ea8897a1-20b1-4081-a950-47f8ced1b5e5", "metadata": {}, "outputs": [], "source": [ "homo_mouse_region_subcortex = ['DG','CP','PAL','CA1','SUB','CA2','CA3','ACB','MED']\n", "homo_human_region_subcortex = ['CA4DG','body of caudate','external segment of globus pallidus','CA1','subiculum','CA2CA3','CA2CA3','nucleus accumbens','mPFtha']" ] }, { "cell_type": "code", "execution_count": 4, "id": "9bbf819f-f067-4444-9ffe-bec348759950", "metadata": {}, "outputs": [], "source": [ "homo_cortex = pd.DataFrame()\n", "homo_cortex['human_region'] = homo_human_region_cortex\n", "homo_cortex['mouse_region'] = homo_mouse_region_cortex\n", "homo_cortex.to_csv('./files/homo_cortex.csv')" ] }, { "cell_type": "code", "execution_count": 5, "id": "db0fe449-dba3-4cba-ba74-6ea43a08bfe7", "metadata": {}, "outputs": [], "source": [ "homo_subcortex = pd.DataFrame()\n", "homo_subcortex['human_region'] = homo_human_region_subcortex\n", "homo_subcortex['mouse_region'] = homo_mouse_region_subcortex\n", "homo_subcortex.to_csv('./files/homo_subcortex.csv')" ] }, { "cell_type": "code", "execution_count": 6, "id": "593a15a2-4359-4e8e-af07-83cad360a1e9", "metadata": {}, "outputs": [], "source": [ "homo_all = pd.DataFrame()\n", "homo_all['human_region'] = homo_human_region_cortex+homo_human_region_subcortex\n", "homo_all['mouse_region'] = homo_mouse_region_cortex+homo_mouse_region_subcortex\n", "homo_all.to_csv('./files/homo_all.csv')" ] }, { "cell_type": "markdown", "id": "00b47d65-3d1e-4ac0-9d96-581cffa280e4", "metadata": {}, "source": [ "## cortical train" ] }, { "cell_type": "code", "execution_count": 7, "id": "c53965cc", "metadata": {}, "outputs": [], "source": [ "# ! python ../code/dnn/main.py -n 10 -iu 4542 -ou 105 -g_path ./files/common_stable_genes_cortex.csv -d_path ../datasets/integrated_dataset/cortical_integrated/Integrated_dataset_0.h5ad -s_path ./dnn_result/detached_model/cortical_model -m_trans_path ../datasets/processeddata/mouse_st/Mouse_trans_data_cortex.h5ad -h_trans_path ../datasets/processeddata/human_ahba/Human_trans_data_cortex.h5ad -hm_path ./files/homo_cortex.csv" ] }, { "cell_type": "markdown", "id": "52139976-a876-4883-bc87-67c7076eb483", "metadata": {}, "source": [ "## subcortical train" ] }, { "cell_type": "code", "execution_count": 8, "id": "6e37ddd0", "metadata": {}, "outputs": [], "source": [ "# ! python ../code/dnn/main.py -n 10 -iu 5063 -ou 22 -g_path ./files/common_stable_genes_subcortex.csv -d_path ../datasets/integrated_dataset/subcortical_integrated/Integrated_dataset_0.h5ad -s_path ./dnn_result/detached_model/subcortical_model -m_trans_path ../datasets/processeddata/mouse_st/Mouse_trans_data_subcortex.h5ad -h_trans_path ../datasets/processeddata/human_ahba/Human_trans_data_subcortex.h5ad -hm_path ./files/homo_subcortex.csv" ] } ], "metadata": { "kernelspec": { "display_name": "transbrain_test", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.5" } }, "nbformat": 4, "nbformat_minor": 5 }