{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "<style>.container { width:100% !important; }</style>" ], "text/plain": [ "<IPython.core.display.HTML object>" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from IPython.core.display import display, HTML\n", "display(HTML(\"<style>.container { width:100% !important; }</style>\"))" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import json\n", "import os, sys\n", "import pandas as pd\n", "import numpy as np" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Cell Number per population from BBP S1 model" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "Epops= ['L23_PC', 'L4_PC', 'L4_SS', 'L4_SP', \n", " 'L5_TTPC1', 'L5_TTPC2', 'L5_STPC', 'L5_UTPC',\n", " 'L6_TPC_L1', 'L6_TPC_L4', 'L6_BPC', 'L6_IPC', 'L6_UTPC']\n", "\n", "with open('anatomy/S1-cells-distributions-Rat.txt') as mtype_file:\n", " mtype_content = mtype_file.read() \n", "\n", "popParamLabels = []\n", "Ipops = []\n", "\n", "for line in mtype_content.split('\\n')[:-1]:\n", " metype, mtype, etype, n, m = line.split()\n", " if mtype not in popParamLabels:\n", " popParamLabels.append(mtype)\n", " if mtype not in Epops:\n", " Ipops.append(mtype)\n", "n2 = 0\n", "metag = {}\n", "popNumber2 = {}\n", "cellNumber = {} \n", "popLabel = {} \n", "popLabelEl = {} \n", "meParamLabels = {} \n", "for line in mtype_content.split('\\n')[:-1]:\n", " metype, mtype, etype, n, m = line.split()\n", " cellNumber[metype] = int(n)\n", " popLabel[metype] = mtype\n", " popLabelEl[metype] = etype\n", " popNumber2[mtype] = int(m)\n", " metag[metype] = n2 \n", " n2 = n2 + 1\n", "\n", "with open('anatomy/mtype_map.tsv') as mtype_map_file:\n", " mtype_map_content = mtype_map_file.read() \n", "mtype_map = {}\n", "mtype_map2 = {}\n", "for line in mtype_map_content.split('\\n')[:-1]:\n", " n, mtype = line.split()\n", " mtype_map[mtype] = int(n)\n", " mtype_map2[int(n)] = mtype " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Anatomy pathways from Netconnections_mean.json (Cell2015)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "# initialize prob and weight matrices\n", "# format: pmat[presynaptic_pop][postsynaptic_pop] \n", "data = {}\n", "data['BBP_S1'] = {}\n", "with open('anatomy/Netconnections_mean.json', 'r') as f:\n", " data['BBP_S1']['connProb'] = json.load(f) \n", "connDataSource = {}\n", "connDataSource['E->E/I'] = 'BBP_S1' \n", "connDataSource['I->E/I'] = 'BBP_S1' \n", "pmat = {} # probability of connection matrix full mc2\n", "connNumber = {} # ~ \"total_conn_count\"\n", "lmat = {} # length constant (lambda) for exp decaying prob conn (um) matrix\n", "a0mat = {} # probability of connection matrix dist 2D = 0 um\n", "d0 = {} # matrix min to fit exp dist 2D [12.5,25,...,150]\n", "dfinal = {} # matrix max to fit exp dist 2D [125,...,375]\n", "pmat12um = {} # probability of connection matrix dist 2D -> 12.5um +- 12.5um\n", "pmat25um = {} # probability of connection matrix dist 2D -> 25um +- 25um\n", "pmat50um = {}\n", "pmat75um = {}\n", "pmat100um = {}\n", "pmat125um = {}\n", "pmat150um = {}\n", "pmat175um = {}\n", "pmat200um = {}\n", "pmat225um = {}\n", "pmat250um = {}\n", "pmat275um = {}\n", "pmat300um = {}\n", "pmat325um = {}\n", "pmat350um = {}\n", "pmat375um = {} \n", "\n", "lmat_exp = {} # single exp fit\n", "a0mat_exp = {}\n", "d0_exp = {} \n", "\n", "lmat_gauss = {} # length constant (lambda) for gaussian decaying prob conn (um) matrix\n", "a0mat_gauss = {} # probability in 0 um gaussian decay\n", "x0_gauss = {} # constant x0 in the gaussian decay\n", "d0_gauss = {} # \n", "\n", "best_fit = {} # 'expl' (153), 'exp' (485), 'gauss' (1303)\n", "\n", "\n", "for p in Epops + Ipops:\n", " pmat[p] = {}\n", " connNumber[p] = {} \n", " lmat[p] = {}\n", " a0mat[p] = {} \n", " d0[p] = {}\n", " dfinal[p] = {}\n", " pmat12um[p] = {}\n", " pmat25um[p] = {}\n", " pmat50um[p] = {}\n", " pmat75um[p] = {}\n", " pmat100um[p] = {}\n", " pmat125um[p] = {}\n", " pmat150um[p] = {}\n", " pmat175um[p] = {}\n", " pmat200um[p] = {}\n", " pmat225um[p] = {}\n", " pmat250um[p] = {}\n", " pmat275um[p] = {}\n", " pmat300um[p] = {}\n", " pmat325um[p] = {}\n", " pmat350um[p] = {}\n", " pmat375um[p] = {} \n", " \n", " lmat_exp[p] = {}\n", " a0mat_exp[p] = {} \n", " d0_exp[p] = {}\n", " \n", " lmat_gauss[p] = {}\n", " a0mat_gauss[p] = {}\n", " x0_gauss[p] = {}\n", " d0_gauss[p] = {}\n", " best_fit[p] = {} #" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "synperconnNumber = {} # ~ \"mean_number_of_synapse_per_connection\"\n", "synperconnNumberStd = {} \n", "for p in Epops + Ipops: \n", " synperconnNumber[p] = {}\n", " synperconnNumberStd[p] = {}\n", "\n", "for pre in Epops+Ipops:\n", " for post in Epops+Ipops:\n", " proj = '%s:%s' % (pre, post)\n", " if proj in data['BBP_S1']['connProb']:\n", " synperconnNumber[pre][post] = 0\n", " synperconnNumberStd[pre][post] = 0" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "# LOAD DATA FROM .TSV files resume\n", "with open('anatomy/synNumberperconex.dat') as synNumber_file:\n", " synNumber_content = synNumber_file.read()\n", " \n", "for line in synNumber_content.split('\\n')[:-1]:\n", " n, m, mean, stdev, synNumber, proj = line.split()\n", " pre = mtype_map2[int(n)]\n", " post = mtype_map2[int(m)] \n", " proj = '%s:%s' % (pre, post)\n", " if proj in data['BBP_S1']['connProb']: \n", " synperconnNumber[pre][post] = np.ceil(float(mean))\n", " synperconnNumberStd[pre][post] = float(stdev)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "<div>\n", "<style scoped>\n", " .dataframe tbody tr th:only-of-type {\n", " vertical-align: middle;\n", " }\n", "\n", " .dataframe tbody tr th {\n", " vertical-align: top;\n", " }\n", "\n", " .dataframe thead th {\n", " text-align: right;\n", " }\n", "</style>\n", "<table border=\"1\" class=\"dataframe\">\n", " <thead>\n", " <tr style=\"text-align: right;\">\n", " <th></th>\n", " <th>From Cell</th>\n", " <th>To Cell</th>\n", " <th>mean_number_of_synapse_per_connection</th>\n", " <th>number_of_synapse_per_connection_std</th>\n", " </tr>\n", " </thead>\n", " <tbody>\n", " <tr>\n", " <th>1616</th>\n", " <td>L1_DAC</td>\n", " <td>L1_SLAC</td>\n", " <td>12.0</td>\n", " <td>3.9</td>\n", " </tr>\n", " <tr>\n", " <th>839</th>\n", " <td>L1_DAC</td>\n", " <td>L1_HAC</td>\n", " <td>15.0</td>\n", " <td>6.3</td>\n", " </tr>\n", " <tr>\n", " <th>558</th>\n", " <td>L1_DAC</td>\n", " <td>L23_NGC</td>\n", " <td>7.0</td>\n", " <td>1.9</td>\n", " </tr>\n", " <tr>\n", " <th>1768</th>\n", " <td>L1_DAC</td>\n", " <td>L4_SP</td>\n", " <td>5.7</td>\n", " <td>1.7</td>\n", " </tr>\n", " <tr>\n", " <th>1769</th>\n", " <td>L1_DAC</td>\n", " <td>L4_SS</td>\n", " <td>6.1</td>\n", " <td>2.7</td>\n", " </tr>\n", " </tbody>\n", "</table>\n", "</div>" ], "text/plain": [ " From Cell To Cell mean_number_of_synapse_per_connection \\\n", "1616 L1_DAC L1_SLAC 12.0 \n", "839 L1_DAC L1_HAC 15.0 \n", "558 L1_DAC L23_NGC 7.0 \n", "1768 L1_DAC L4_SP 5.7 \n", "1769 L1_DAC L4_SS 6.1 \n", "\n", " number_of_synapse_per_connection_std \n", "1616 3.9 \n", "839 6.3 \n", "558 1.9 \n", "1768 1.7 \n", "1769 2.7 " ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# LOAD WITH PANDAS DATA FROM json files \n", "anatomy_data = json.loads(open(\"anatomy/pathways_anatomy_factsheets_simplified.json\").read())\n", "columnNames2 = [\"total_synapse_count\", \"mean_number_of_synapse_per_connection\", \"number_of_convergent_neuron_mean\"]\n", "columnNames = [\"From Cell\", \"To Cell\"] + list(anatomy_data[list(anatomy_data.keys() )[0]].keys())\n", "df = pd.DataFrame(columns=columnNames, data = [[k.split(\":\")[0], k.split(\":\")[1]] + list(v.values()) for k, v in anatomy_data.items() ])\n", "df = df.sort_values(by=['From Cell'])\n", "df = df.drop(columns=['number_of_convergent_neuron_std', 'connection_probability', 'number_of_divergent_neuron_std', 'total_synapse_count',\n", " 'common_neighbor_bias', 'number_of_convergent_neuron_mean', 'number_of_divergent_neuron_mean'])\n", "for conn in range(1932):\n", " pre = df[\"From Cell\"][conn]\n", " post = df[\"To Cell\"][conn]\n", " proj = '%s:%s' % (pre, post)\n", " if proj in data['BBP_S1']['connProb']:\n", " synperconnNumber[pre][post] = np.ceil(df[\"mean_number_of_synapse_per_connection\"][conn])\n", " synperconnNumberStd[pre][post] = df[\"number_of_synapse_per_connection_std\"][conn]\n", "df.head()" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "# For missing data use mean of Layer-Type:Layer-Type projections\n", "layersT = ['L1e', 'L2e', 'L4e', 'L5e', 'L6e', 'L1i', 'L2i', 'L4i', 'L5i', 'L6i']\n", "synperconnNumberT = {}\n", "synperconnNumberN = {}\n", "for pre in layersT:\n", " synperconnNumberT[pre] = {}\n", " synperconnNumberN[pre] = {}\n", " for post in layersT:\n", " synperconnNumberT[pre][post] = 0\n", " synperconnNumberN[pre][post] = 0 \n", " \n", "for pre in Epops+Ipops:\n", " for post in Epops+Ipops:\n", " proj = '%s:%s' % (pre, post)\n", " if proj in data['BBP_S1']['connProb']:\n", "\n", " if pre in Epops:\n", " pre2 = str(pre[0:2]) + 'e'\n", " else:\n", " pre2 = str(pre[0:2]) + 'i'\n", " if post in Epops:\n", " post2 = str(post[0:2]) + 'e'\n", " else:\n", " post2 = str(post[0:2]) + 'i'\n", "\n", " if synperconnNumber[pre][post] > 0:\n", " synperconnNumberT[pre2][post2] = synperconnNumberT[pre2][post2] + synperconnNumber[pre][post]\n", " synperconnNumberN[pre2][post2] = synperconnNumberN[pre2][post2] + 1\n", "\n", "for pre in Epops+Ipops:\n", " for post in Epops+Ipops:\n", " proj = '%s:%s' % (pre, post)\n", " if proj in data['BBP_S1']['connProb']:\n", " if synperconnNumber[pre][post] == 0:\n", " if pre in Epops:\n", " pre2 = str(pre[0:2]) + 'e'\n", " else:\n", " pre2 = str(pre[0:2]) + 'i'\n", "\n", " if post in Epops:\n", " post2 = str(post[0:2]) + 'e'\n", " else:\n", " post2 = str(post[0:2]) + 'i'\n", "\n", " synperconnNumber[pre][post] = np.ceil(synperconnNumberT[pre2][post2]/synperconnNumberN[pre2][post2]) #mean of Layer-Type:Layer-Type projections" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "syn total Exc = 27614163\n" ] } ], "source": [ "number = 0 \n", "for pre in Epops:\n", " for post in Epops+Ipops:\n", " proj = '%s:%s' % (pre, post)\n", " if proj in data['BBP_S1']['connProb']: \n", " number = number + synperconnNumber[pre][post] * float(data['BBP_S1']['connProb'][proj]['conn_total'])\n", "print('syn total Exc = %.0f' % number)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "syn total Inh = 10423033\n" ] } ], "source": [ "numberI = 0 \n", "for pre in Ipops:\n", " for post in Epops+Ipops:\n", " proj = '%s:%s' % (pre, post)\n", " if proj in data['BBP_S1']['connProb']: \n", " numberI = numberI + synperconnNumber[pre][post] * float(data['BBP_S1']['connProb'][proj]['conn_total'])\n", "print('syn total Inh = %.0f' % numberI)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "syn total Inh = 9684711\n" ] } ], "source": [ "for conn in range(1932): # decrease to compare to Cell2015 - synperconnNumber not avaliable (estimated from .TSV and . JSON files)\n", " pre = df[\"From Cell\"][conn]\n", " post = df[\"To Cell\"][conn]\n", " proj = '%s:%s' % (pre, post)\n", " if proj in data['BBP_S1']['connProb']:\n", " if pre in Ipops and synperconnNumber[pre][post]>1.0:\n", " synperconnNumber[pre][post] = synperconnNumber[pre][post]-1\n", "\n", "numberI = 0 \n", "for pre in Ipops:\n", " for post in Epops+Ipops:\n", " proj = '%s:%s' % (pre, post)\n", " if proj in data['BBP_S1']['connProb']: \n", " numberI = numberI + synperconnNumber[pre][post] * float(data['BBP_S1']['connProb'][proj]['conn_total'])\n", "print('syn total Inh = %.0f' % numberI)" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1941" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "number = 0 \n", "for pre in Epops+Ipops:\n", " for post in Epops+Ipops: \n", " proj = '%s:%s' % (pre, post)\n", " if proj in data['BBP_S1']['connProb']: \n", " if synperconnNumber[pre][post] > 0:\n", " number = number + 1\n", "number" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Physiology pathways from Cell2015 (table S6 and portal data)" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "scrolled": false }, "outputs": [ { "data": { "text/html": [ "<div>\n", "<style scoped>\n", " .dataframe tbody tr th:only-of-type {\n", " vertical-align: middle;\n", " }\n", "\n", " .dataframe tbody tr th {\n", " vertical-align: top;\n", " }\n", "\n", " .dataframe thead th {\n", " text-align: right;\n", " }\n", "</style>\n", "<table border=\"1\" class=\"dataframe\">\n", " <thead>\n", " <tr style=\"text-align: right;\">\n", " <th></th>\n", " <th>Connection</th>\n", " <th>From Cell</th>\n", " <th>From Layer</th>\n", " <th>From Type</th>\n", " <th>To Cell</th>\n", " <th>To Layer</th>\n", " <th>To Type</th>\n", " <th>gsyn_mean</th>\n", " <th>epsp_mean</th>\n", " <th>risetime_std</th>\n", " <th>...</th>\n", " <th>space_clamp_correction_factor</th>\n", " <th>latency_std</th>\n", " <th>decay_std</th>\n", " <th>cv_psp_amplitude_std</th>\n", " <th>risetime_mean</th>\n", " <th>cv_psp_amplitude_mean</th>\n", " <th>epsp_std</th>\n", " <th>d_mean</th>\n", " <th>f_mean</th>\n", " <th>failures_std</th>\n", " </tr>\n", " </thead>\n", " <tbody>\n", " <tr>\n", " <th>1558</th>\n", " <td>L1_DAC:L1_DAC</td>\n", " <td>L1_DAC</td>\n", " <td>L1</td>\n", " <td>DAC</td>\n", " <td>L1_DAC</td>\n", " <td>L1</td>\n", " <td>DAC</td>\n", " <td>0.36</td>\n", " <td>2.1</td>\n", " <td>0.85</td>\n", " <td>...</td>\n", " <td>Synaptic conductance not measured experimentally</td>\n", " <td>0.6500</td>\n", " <td>11.0</td>\n", " <td>0.120</td>\n", " <td>5.5</td>\n", " <td>0.49</td>\n", " <td>0.45</td>\n", " <td>750</td>\n", " <td>22.0</td>\n", " <td>7.8</td>\n", " </tr>\n", " <tr>\n", " <th>1841</th>\n", " <td>L1_DAC:L1_DLAC</td>\n", " <td>L1_DAC</td>\n", " <td>L1</td>\n", " <td>DAC</td>\n", " <td>L1_DLAC</td>\n", " <td>L1</td>\n", " <td>DLAC</td>\n", " <td>0.41</td>\n", " <td>2.2</td>\n", " <td>0.00</td>\n", " <td>...</td>\n", " <td>Synaptic conductance not measured experimentally</td>\n", " <td>0.0000</td>\n", " <td>0.0</td>\n", " <td>0.000</td>\n", " <td>6.1</td>\n", " <td>0.39</td>\n", " <td>0.00</td>\n", " <td>820</td>\n", " <td>24.0</td>\n", " <td>0.0</td>\n", " </tr>\n", " <tr>\n", " <th>1405</th>\n", " <td>L1_DAC:L1_HAC</td>\n", " <td>L1_DAC</td>\n", " <td>L1</td>\n", " <td>DAC</td>\n", " <td>L1_HAC</td>\n", " <td>L1</td>\n", " <td>HAC</td>\n", " <td>0.37</td>\n", " <td>2.4</td>\n", " <td>0.90</td>\n", " <td>...</td>\n", " <td>Synaptic conductance not measured experimentally</td>\n", " <td>0.4700</td>\n", " <td>2.5</td>\n", " <td>0.100</td>\n", " <td>5.8</td>\n", " <td>0.46</td>\n", " <td>0.94</td>\n", " <td>770</td>\n", " <td>22.0</td>\n", " <td>4.6</td>\n", " </tr>\n", " <tr>\n", " <th>662</th>\n", " <td>L1_DAC:L1_NGC-DA</td>\n", " <td>L1_DAC</td>\n", " <td>L1</td>\n", " <td>DAC</td>\n", " <td>L1_NGC-DA</td>\n", " <td>L1</td>\n", " <td>NGC-DA</td>\n", " <td>0.26</td>\n", " <td>2.6</td>\n", " <td>0.29</td>\n", " <td>...</td>\n", " <td>Synaptic conductance not measured experimentally</td>\n", " <td>0.0033</td>\n", " <td>1.7</td>\n", " <td>0.026</td>\n", " <td>3.8</td>\n", " <td>0.62</td>\n", " <td>0.52</td>\n", " <td>610</td>\n", " <td>19.0</td>\n", " <td>3.3</td>\n", " </tr>\n", " <tr>\n", " <th>513</th>\n", " <td>L1_DAC:L1_NGC-SA</td>\n", " <td>L1_DAC</td>\n", " <td>L1</td>\n", " <td>DAC</td>\n", " <td>L1_NGC-SA</td>\n", " <td>L1</td>\n", " <td>NGC-SA</td>\n", " <td>0.33</td>\n", " <td>2.6</td>\n", " <td>0.58</td>\n", " <td>...</td>\n", " <td>Synaptic conductance not measured experimentally</td>\n", " <td>0.5900</td>\n", " <td>3.3</td>\n", " <td>0.036</td>\n", " <td>4.4</td>\n", " <td>0.58</td>\n", " <td>0.75</td>\n", " <td>710</td>\n", " <td>21.0</td>\n", " <td>1.6</td>\n", " </tr>\n", " </tbody>\n", "</table>\n", "<p>5 rows × 29 columns</p>\n", "</div>" ], "text/plain": [ " Connection From Cell From Layer From Type To Cell To Layer \\\n", "1558 L1_DAC:L1_DAC L1_DAC L1 DAC L1_DAC L1 \n", "1841 L1_DAC:L1_DLAC L1_DAC L1 DAC L1_DLAC L1 \n", "1405 L1_DAC:L1_HAC L1_DAC L1 DAC L1_HAC L1 \n", "662 L1_DAC:L1_NGC-DA L1_DAC L1 DAC L1_NGC-DA L1 \n", "513 L1_DAC:L1_NGC-SA L1_DAC L1 DAC L1_NGC-SA L1 \n", "\n", " To Type gsyn_mean epsp_mean risetime_std ... \\\n", "1558 DAC 0.36 2.1 0.85 ... \n", "1841 DLAC 0.41 2.2 0.00 ... \n", "1405 HAC 0.37 2.4 0.90 ... \n", "662 NGC-DA 0.26 2.6 0.29 ... \n", "513 NGC-SA 0.33 2.6 0.58 ... \n", "\n", " space_clamp_correction_factor latency_std \\\n", "1558 Synaptic conductance not measured experimentally 0.6500 \n", "1841 Synaptic conductance not measured experimentally 0.0000 \n", "1405 Synaptic conductance not measured experimentally 0.4700 \n", "662 Synaptic conductance not measured experimentally 0.0033 \n", "513 Synaptic conductance not measured experimentally 0.5900 \n", "\n", " decay_std cv_psp_amplitude_std risetime_mean cv_psp_amplitude_mean \\\n", "1558 11.0 0.120 5.5 0.49 \n", "1841 0.0 0.000 6.1 0.39 \n", "1405 2.5 0.100 5.8 0.46 \n", "662 1.7 0.026 3.8 0.62 \n", "513 3.3 0.036 4.4 0.58 \n", "\n", " epsp_std d_mean f_mean failures_std \n", "1558 0.45 750 22.0 7.8 \n", "1841 0.00 820 24.0 0.0 \n", "1405 0.94 770 22.0 4.6 \n", "662 0.52 610 19.0 3.3 \n", "513 0.75 710 21.0 1.6 \n", "\n", "[5 rows x 29 columns]" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# LOAD WITH PANDAS DATA FROM json files \n", "physiology_data = json.loads(open(\"physiology/pathways_physiology_factsheets_simplified.json\").read())\n", "physColumnNames = [\"Connection\", \"From Cell\", \"From Layer\", \"From Type\", \"To Cell\", \"To Layer\", \"To Type\"] + list(physiology_data[list(physiology_data.keys() )[0]].keys())\n", "df2 = pd.DataFrame(columns=physColumnNames, data = [[k, k.split(\":\")[0], k.split(\":\")[0].split(\"_\")[0], k.split(\":\")[0].split(\"_\")[1], k.split(\":\")[1], k.split(\":\")[1].split(\"_\")[0], k.split(\":\")[1].split(\"_\")[1]] + list(v.values()) for k, v in physiology_data.items() ])\n", "df2 = df2.sort_values(by=['Connection'])\n", "df2.head()" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'ConnType'" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "with open('physiology/physiology_synTypes.dat') as physiology_file:\n", " physiology_content = physiology_file.read()\n", "\n", "parameters_name = {} \n", "ConnTypeNumber = -1 \n", "parameters_syn = {}\n", "syntypes = {}\n", "for line in physiology_content.split('\\n')[:-1]: \n", " if ConnTypeNumber < 0:\n", " n2 = 0\n", " parameters_list = line.split() \n", " for parameter in parameters_list:\n", " parameters_name[n2] = str(parameter)\n", " n2 = n2 + 1 \n", " else:\n", " n2 = 0\n", " parameters_list = line.split() \n", " for parameter in parameters_list:\n", " if n2 == 0:\n", " parameters_syn[parameters_name[n2],ConnTypeNumber] = int(parameter)\n", " syntypes[ConnTypeNumber] = int(parameter)\n", " elif n2 > 10:\n", " parameters_syn[parameters_name[n2],ConnTypeNumber] = str(parameter) \n", " else:\n", " parameters_syn[parameters_name[n2],ConnTypeNumber] = float(parameter)\n", " n2 = n2 + 1\n", " \n", " ConnTypeNumber = ConnTypeNumber + 1\n", " \n", "parameters_name[0]" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "scrolled": false }, "outputs": [ { "data": { "text/html": [ "<div>\n", "<style scoped>\n", " .dataframe tbody tr th:only-of-type {\n", " vertical-align: middle;\n", " }\n", "\n", " .dataframe tbody tr th {\n", " vertical-align: top;\n", " }\n", "\n", " .dataframe thead th {\n", " text-align: right;\n", " }\n", "</style>\n", "<table border=\"1\" class=\"dataframe\">\n", " <thead>\n", " <tr style=\"text-align: right;\">\n", " <th></th>\n", " <th>ConnType</th>\n", " <th>gsyn</th>\n", " <th>gsynStd</th>\n", " <th>decay</th>\n", " <th>decayStd</th>\n", " <th>use</th>\n", " <th>useStd</th>\n", " <th>dep</th>\n", " <th>depStd</th>\n", " <th>fac</th>\n", " <th>facStd</th>\n", " <th>s-types</th>\n", " <th>type</th>\n", " </tr>\n", " </thead>\n", " <tbody>\n", " <tr>\n", " <th>0</th>\n", " <td>0</td>\n", " <td>0.83</td>\n", " <td>0.2</td>\n", " <td>10.4</td>\n", " <td>6.1</td>\n", " <td>0.16</td>\n", " <td>0.1</td>\n", " <td>45.0</td>\n", " <td>21.0</td>\n", " <td>376.0</td>\n", " <td>253.0</td>\n", " <td>I1</td>\n", " <td>IE</td>\n", " </tr>\n", " <tr>\n", " <th>1</th>\n", " <td>1</td>\n", " <td>0.83</td>\n", " <td>0.55</td>\n", " <td>8.3</td>\n", " <td>2.2</td>\n", " <td>0.25</td>\n", " <td>0.13</td>\n", " <td>706.0</td>\n", " <td>405.0</td>\n", " <td>21.0</td>\n", " <td>9.0</td>\n", " <td>I2</td>\n", " <td>II</td>\n", " </tr>\n", " <tr>\n", " <th>2</th>\n", " <td>3</td>\n", " <td>0.91</td>\n", " <td>0.61</td>\n", " <td>10.4</td>\n", " <td>6.1</td>\n", " <td>0.16</td>\n", " <td>0.1</td>\n", " <td>45.0</td>\n", " <td>21.0</td>\n", " <td>376.0</td>\n", " <td>253.0</td>\n", " <td>I1</td>\n", " <td>IE</td>\n", " </tr>\n", " <tr>\n", " <th>3</th>\n", " <td>4</td>\n", " <td>0.91</td>\n", " <td>0.61</td>\n", " <td>8.3</td>\n", " <td>2.2</td>\n", " <td>0.25</td>\n", " <td>0.13</td>\n", " <td>706.0</td>\n", " <td>405.0</td>\n", " <td>21.0</td>\n", " <td>9.0</td>\n", " <td>I2</td>\n", " <td>IE</td>\n", " </tr>\n", " <tr>\n", " <th>4</th>\n", " <td>5</td>\n", " <td>0.91</td>\n", " <td>0.61</td>\n", " <td>6.44</td>\n", " <td>1.7</td>\n", " <td>0.32</td>\n", " <td>0.14</td>\n", " <td>144.0</td>\n", " <td>80.0</td>\n", " <td>62.0</td>\n", " <td>31.0</td>\n", " <td>I3</td>\n", " <td>IE</td>\n", " </tr>\n", " <tr>\n", " <th>5</th>\n", " <td>8</td>\n", " <td>0.75</td>\n", " <td>0.32</td>\n", " <td>8.3</td>\n", " <td>2.2</td>\n", " <td>0.25</td>\n", " <td>0.13</td>\n", " <td>706.0</td>\n", " <td>405.0</td>\n", " <td>21.0</td>\n", " <td>9.0</td>\n", " <td>I2</td>\n", " <td>IE</td>\n", " </tr>\n", " <tr>\n", " <th>6</th>\n", " <td>9</td>\n", " <td>0.75</td>\n", " <td>0.32</td>\n", " <td>8.3</td>\n", " <td>2.2</td>\n", " <td>0.3</td>\n", " <td>0.08</td>\n", " <td>1250.0</td>\n", " <td>520.0</td>\n", " <td>2.0</td>\n", " <td>4.0</td>\n", " <td>I2</td>\n", " <td>IE</td>\n", " </tr>\n", " <tr>\n", " <th>7</th>\n", " <td>10</td>\n", " <td>0.91</td>\n", " <td>0.61</td>\n", " <td>8.3</td>\n", " <td>2.2</td>\n", " <td>0.14</td>\n", " <td>0.05</td>\n", " <td>875.0</td>\n", " <td>285.0</td>\n", " <td>22.0</td>\n", " <td>5.0</td>\n", " <td>I2</td>\n", " <td>IE</td>\n", " </tr>\n", " <tr>\n", " <th>8</th>\n", " <td>11</td>\n", " <td>0.83</td>\n", " <td>0.2</td>\n", " <td>10.4</td>\n", " <td>6.1</td>\n", " <td>0.25</td>\n", " <td>0.13</td>\n", " <td>706.0</td>\n", " <td>405.0</td>\n", " <td>21.0</td>\n", " <td>9.0</td>\n", " <td>I3</td>\n", " <td>IE</td>\n", " </tr>\n", " <tr>\n", " <th>9</th>\n", " <td>12</td>\n", " <td>0.91</td>\n", " <td>0.61</td>\n", " <td>8.3</td>\n", " <td>2.2</td>\n", " <td>0.25</td>\n", " <td>0.13</td>\n", " <td>706.0</td>\n", " <td>405.0</td>\n", " <td>21.0</td>\n", " <td>9.0</td>\n", " <td>I2</td>\n", " <td>IE</td>\n", " </tr>\n", " <tr>\n", " <th>10</th>\n", " <td>13</td>\n", " <td>0.75</td>\n", " <td>0.32</td>\n", " <td>10.4</td>\n", " <td>6.1</td>\n", " <td>0.32</td>\n", " <td>0.14</td>\n", " <td>144.0</td>\n", " <td>80.0</td>\n", " <td>690.0</td>\n", " <td>5.0</td>\n", " <td>I2</td>\n", " <td>IE</td>\n", " </tr>\n", " <tr>\n", " <th>11</th>\n", " <td>114</td>\n", " <td>0.43</td>\n", " <td>0.28</td>\n", " <td>1.74</td>\n", " <td>0.18</td>\n", " <td>0.09</td>\n", " <td>0.12</td>\n", " <td>138.0</td>\n", " <td>211.0</td>\n", " <td>670.0</td>\n", " <td>830.0</td>\n", " <td>E1</td>\n", " <td>EI</td>\n", " </tr>\n", " <tr>\n", " <th>12</th>\n", " <td>115</td>\n", " <td>0.72</td>\n", " <td>0.5</td>\n", " <td>1.74</td>\n", " <td>0.18</td>\n", " <td>0.09</td>\n", " <td>0.12</td>\n", " <td>138.0</td>\n", " <td>211.0</td>\n", " <td>670.0</td>\n", " <td>830.0</td>\n", " <td>E1</td>\n", " <td>EI</td>\n", " </tr>\n", " <tr>\n", " <th>13</th>\n", " <td>116</td>\n", " <td>0.72</td>\n", " <td>0.5</td>\n", " <td>1.74</td>\n", " <td>0.18</td>\n", " <td>0.5</td>\n", " <td>0.02</td>\n", " <td>671.0</td>\n", " <td>17.0</td>\n", " <td>17.0</td>\n", " <td>5.0</td>\n", " <td>E2</td>\n", " <td>EE</td>\n", " </tr>\n", " <tr>\n", " <th>14</th>\n", " <td>117</td>\n", " <td>0.43</td>\n", " <td>0.28</td>\n", " <td>1.74</td>\n", " <td>0.18</td>\n", " <td>0.5</td>\n", " <td>0.02</td>\n", " <td>671.0</td>\n", " <td>17.0</td>\n", " <td>17.0</td>\n", " <td>5.0</td>\n", " <td>E2</td>\n", " <td>EI</td>\n", " </tr>\n", " <tr>\n", " <th>15</th>\n", " <td>118</td>\n", " <td>0.72</td>\n", " <td>0.5</td>\n", " <td>1.74</td>\n", " <td>0.18</td>\n", " <td>0.5</td>\n", " <td>0.02</td>\n", " <td>671.0</td>\n", " <td>17.0</td>\n", " <td>17.0</td>\n", " <td>5.0</td>\n", " <td>E2</td>\n", " <td>EI</td>\n", " </tr>\n", " <tr>\n", " <th>16</th>\n", " <td>119</td>\n", " <td>0.68</td>\n", " <td>0.46</td>\n", " <td>1.74</td>\n", " <td>0.18</td>\n", " <td>0.46</td>\n", " <td>0.26</td>\n", " <td>671.0</td>\n", " <td>17.0</td>\n", " <td>17.0</td>\n", " <td>5.0</td>\n", " <td>E2</td>\n", " <td>EE</td>\n", " </tr>\n", " <tr>\n", " <th>17</th>\n", " <td>120</td>\n", " <td>0.68</td>\n", " <td>0.45</td>\n", " <td>1.74</td>\n", " <td>0.18</td>\n", " <td>0.86</td>\n", " <td>0.09</td>\n", " <td>671.0</td>\n", " <td>17.0</td>\n", " <td>17.0</td>\n", " <td>5.0</td>\n", " <td>E2</td>\n", " <td>EE</td>\n", " </tr>\n", " <tr>\n", " <th>18</th>\n", " <td>121</td>\n", " <td>0.19</td>\n", " <td>0.12</td>\n", " <td>1.74</td>\n", " <td>0.18</td>\n", " <td>0.79</td>\n", " <td>0.04</td>\n", " <td>671.0</td>\n", " <td>17.0</td>\n", " <td>17.0</td>\n", " <td>5.0</td>\n", " <td>E2</td>\n", " <td>EE</td>\n", " </tr>\n", " <tr>\n", " <th>19</th>\n", " <td>122</td>\n", " <td>0.8</td>\n", " <td>0.53</td>\n", " <td>1.74</td>\n", " <td>0.18</td>\n", " <td>0.39</td>\n", " <td>0.03</td>\n", " <td>671.0</td>\n", " <td>17.0</td>\n", " <td>17.0</td>\n", " <td>5.0</td>\n", " <td>E2</td>\n", " <td>EE</td>\n", " </tr>\n", " <tr>\n", " <th>20</th>\n", " <td>123</td>\n", " <td>1.5</td>\n", " <td>1.05</td>\n", " <td>1.74</td>\n", " <td>0.18</td>\n", " <td>0.5</td>\n", " <td>0.02</td>\n", " <td>671.0</td>\n", " <td>17.0</td>\n", " <td>17.0</td>\n", " <td>5.0</td>\n", " <td>E2</td>\n", " <td>EE</td>\n", " </tr>\n", " <tr>\n", " <th>21</th>\n", " <td>126</td>\n", " <td>0.8</td>\n", " <td>0.53</td>\n", " <td>1.74</td>\n", " <td>0.18</td>\n", " <td>0.29</td>\n", " <td>0.03</td>\n", " <td>329.0</td>\n", " <td>53.0</td>\n", " <td>326.0</td>\n", " <td>66.0</td>\n", " <td>E3</td>\n", " <td>EE</td>\n", " </tr>\n", " <tr>\n", " <th>22</th>\n", " <td>127</td>\n", " <td>0.8</td>\n", " <td>0.53</td>\n", " <td>1.74</td>\n", " <td>0.18</td>\n", " <td>0.29</td>\n", " <td>0.03</td>\n", " <td>329.0</td>\n", " <td>53.0</td>\n", " <td>326.0</td>\n", " <td>66.0</td>\n", " <td>E3</td>\n", " <td>EE</td>\n", " </tr>\n", " <tr>\n", " <th>23</th>\n", " <td>128</td>\n", " <td>0.8</td>\n", " <td>0.53</td>\n", " <td>1.74</td>\n", " <td>0.18</td>\n", " <td>0.29</td>\n", " <td>0.03</td>\n", " <td>329.0</td>\n", " <td>53.0</td>\n", " <td>326.0</td>\n", " <td>66.0</td>\n", " <td>E3</td>\n", " <td>EE</td>\n", " </tr>\n", " <tr>\n", " <th>24</th>\n", " <td>129</td>\n", " <td>0.8</td>\n", " <td>0.53</td>\n", " <td>1.74</td>\n", " <td>0.18</td>\n", " <td>0.29</td>\n", " <td>0.03</td>\n", " <td>329.0</td>\n", " <td>53.0</td>\n", " <td>326.0</td>\n", " <td>66.0</td>\n", " <td>E3</td>\n", " <td>EE</td>\n", " </tr>\n", " <tr>\n", " <th>25</th>\n", " <td>131</td>\n", " <td>0.72</td>\n", " <td>0.5</td>\n", " <td>1.74</td>\n", " <td>0.18</td>\n", " <td>0.29</td>\n", " <td>0.03</td>\n", " <td>329.0</td>\n", " <td>53.0</td>\n", " <td>326.0</td>\n", " <td>66.0</td>\n", " <td>E3</td>\n", " <td>EE</td>\n", " </tr>\n", " <tr>\n", " <th>26</th>\n", " <td>132</td>\n", " <td>0.72</td>\n", " <td>0.5</td>\n", " <td>1.74</td>\n", " <td>0.18</td>\n", " <td>0.29</td>\n", " <td>0.03</td>\n", " <td>329.0</td>\n", " <td>53.0</td>\n", " <td>326.0</td>\n", " <td>66.0</td>\n", " <td>E3</td>\n", " <td>EE</td>\n", " </tr>\n", " <tr>\n", " <th>27</th>\n", " <td>133</td>\n", " <td>0.11</td>\n", " <td>0.08</td>\n", " <td>1.74</td>\n", " <td>0.18</td>\n", " <td>0.09</td>\n", " <td>0.12</td>\n", " <td>138.0</td>\n", " <td>211.0</td>\n", " <td>670.0</td>\n", " <td>830.0</td>\n", " <td>E1</td>\n", " <td>EI</td>\n", " </tr>\n", " <tr>\n", " <th>28</th>\n", " <td>134</td>\n", " <td>0.72</td>\n", " <td>0.5</td>\n", " <td>1.74</td>\n", " <td>0.18</td>\n", " <td>0.72</td>\n", " <td>0.12</td>\n", " <td>227.0</td>\n", " <td>70.0</td>\n", " <td>13.0</td>\n", " <td>24.0</td>\n", " <td>E2</td>\n", " <td>EI</td>\n", " </tr>\n", " </tbody>\n", "</table>\n", "</div>" ], "text/plain": [ " ConnType gsyn gsynStd decay decayStd use useStd dep depStd fac \\\n", "0 0 0.83 0.2 10.4 6.1 0.16 0.1 45.0 21.0 376.0 \n", "1 1 0.83 0.55 8.3 2.2 0.25 0.13 706.0 405.0 21.0 \n", "2 3 0.91 0.61 10.4 6.1 0.16 0.1 45.0 21.0 376.0 \n", "3 4 0.91 0.61 8.3 2.2 0.25 0.13 706.0 405.0 21.0 \n", "4 5 0.91 0.61 6.44 1.7 0.32 0.14 144.0 80.0 62.0 \n", "5 8 0.75 0.32 8.3 2.2 0.25 0.13 706.0 405.0 21.0 \n", "6 9 0.75 0.32 8.3 2.2 0.3 0.08 1250.0 520.0 2.0 \n", "7 10 0.91 0.61 8.3 2.2 0.14 0.05 875.0 285.0 22.0 \n", "8 11 0.83 0.2 10.4 6.1 0.25 0.13 706.0 405.0 21.0 \n", "9 12 0.91 0.61 8.3 2.2 0.25 0.13 706.0 405.0 21.0 \n", "10 13 0.75 0.32 10.4 6.1 0.32 0.14 144.0 80.0 690.0 \n", "11 114 0.43 0.28 1.74 0.18 0.09 0.12 138.0 211.0 670.0 \n", "12 115 0.72 0.5 1.74 0.18 0.09 0.12 138.0 211.0 670.0 \n", "13 116 0.72 0.5 1.74 0.18 0.5 0.02 671.0 17.0 17.0 \n", "14 117 0.43 0.28 1.74 0.18 0.5 0.02 671.0 17.0 17.0 \n", "15 118 0.72 0.5 1.74 0.18 0.5 0.02 671.0 17.0 17.0 \n", "16 119 0.68 0.46 1.74 0.18 0.46 0.26 671.0 17.0 17.0 \n", "17 120 0.68 0.45 1.74 0.18 0.86 0.09 671.0 17.0 17.0 \n", "18 121 0.19 0.12 1.74 0.18 0.79 0.04 671.0 17.0 17.0 \n", "19 122 0.8 0.53 1.74 0.18 0.39 0.03 671.0 17.0 17.0 \n", "20 123 1.5 1.05 1.74 0.18 0.5 0.02 671.0 17.0 17.0 \n", "21 126 0.8 0.53 1.74 0.18 0.29 0.03 329.0 53.0 326.0 \n", "22 127 0.8 0.53 1.74 0.18 0.29 0.03 329.0 53.0 326.0 \n", "23 128 0.8 0.53 1.74 0.18 0.29 0.03 329.0 53.0 326.0 \n", "24 129 0.8 0.53 1.74 0.18 0.29 0.03 329.0 53.0 326.0 \n", "25 131 0.72 0.5 1.74 0.18 0.29 0.03 329.0 53.0 326.0 \n", "26 132 0.72 0.5 1.74 0.18 0.29 0.03 329.0 53.0 326.0 \n", "27 133 0.11 0.08 1.74 0.18 0.09 0.12 138.0 211.0 670.0 \n", "28 134 0.72 0.5 1.74 0.18 0.72 0.12 227.0 70.0 13.0 \n", "\n", " facStd s-types type \n", "0 253.0 I1 IE \n", "1 9.0 I2 II \n", "2 253.0 I1 IE \n", "3 9.0 I2 IE \n", "4 31.0 I3 IE \n", "5 9.0 I2 IE \n", "6 4.0 I2 IE \n", "7 5.0 I2 IE \n", "8 9.0 I3 IE \n", "9 9.0 I2 IE \n", "10 5.0 I2 IE \n", "11 830.0 E1 EI \n", "12 830.0 E1 EI \n", "13 5.0 E2 EE \n", "14 5.0 E2 EI \n", "15 5.0 E2 EI \n", "16 5.0 E2 EE \n", "17 5.0 E2 EE \n", "18 5.0 E2 EE \n", "19 5.0 E2 EE \n", "20 5.0 E2 EE \n", "21 66.0 E3 EE \n", "22 66.0 E3 EE \n", "23 66.0 E3 EE \n", "24 66.0 E3 EE \n", "25 66.0 E3 EE \n", "26 66.0 E3 EE \n", "27 830.0 E1 EI \n", "28 24.0 E2 EI " ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "physColumnNames = [parameters_name[x] for x in parameters_name]\n", "dfS6 = pd.DataFrame(index=syntypes, columns=physColumnNames)\n", "for syntype in syntypes:\n", " for name in physColumnNames: \n", " dfS6.loc[syntype][name] = parameters_syn[name,syntype]\n", "dfS6" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [], "source": [ "with open('physiology/matrixsyntypes.dat') as synNumber_file:\n", " synNumber_content = synNumber_file.read()\n", "\n", "ConnTypes = {}\n", "ConnTypesNumber = {} \n", "for p in Epops + Ipops: \n", " ConnTypesNumber[p] = {}\n", " ConnTypes[p] = {}\n", "\n", "for pre in Epops+Ipops:\n", " for post in Epops+Ipops:\n", " proj = '%s:%s' % (pre, post)\n", " if proj in data['BBP_S1']['connProb']:\n", " ConnTypesNumber[pre][post] = 0\n", " ConnTypes[pre][post] = 0\n", " \n", "for line in synNumber_content.split('\\n')[:-1]:\n", " n, m, number, number2, number3, number4 = line.split()\n", " pre = mtype_map2[int(n)]\n", " post = mtype_map2[int(m)]\n", " proj = '%s:%s' % (pre, post)\n", " if proj in data['BBP_S1']['connProb']:\n", " if int(number3)!=50:\n", " ConnTypesNumber[pre][post] = 3\n", " ConnTypes[pre][post] = [int(number), int(number2), int(number3)]\n", " elif int(number2)!=50:\n", " ConnTypesNumber[pre][post] = 2\n", " ConnTypes[pre][post] = [int(number), int(number2)]\n", " elif int(number)!=50:\n", " ConnTypesNumber[pre][post] = 1\n", " ConnTypes[pre][post] = [int(number)]" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [], "source": [ "# ConnTypes II\n", "for pre in Ipops:\n", " for post in Ipops:\n", " proj = '%s:%s' % (pre, post)\n", " if proj in data['BBP_S1']['connProb']: \n", " if ConnTypesNumber[pre][post] == 0:\n", "# print ('ConnNumberTypes[%s][%s] = %d' % (pre, post, ConnTypesNumber[pre][post])) \n", " ConnTypesNumber[pre][post] = 1\n", " ConnTypes[pre][post] = [1] " ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [], "source": [ "# ConnTypes IE\n", "for pre in Ipops: # L1 \n", " for post in Epops:\n", " proj = '%s:%s' % (pre, post)\n", " if proj in data['BBP_S1']['connProb']: \n", " if str(pre[0:2]) == 'L1':\n", " ConnTypesNumber[pre][post] = 1\n", " ConnTypes[pre][post] = [1] \n", " \n", "for pre in Ipops:\n", " for post in Epops:\n", " proj = '%s:%s' % (pre, post)\n", " if proj in data['BBP_S1']['connProb']: \n", " if str(pre[-3:]) == 'NGC':\n", " ConnTypesNumber[pre][post] = 1\n", " ConnTypes[pre][post] = [11] \n", " \n", "ConnTypesNumber['L23_MC']['L6_IPC'] = 1\n", "ConnTypes['L23_MC']['L6_IPC'] = [9]\n", "\n", "ConnTypesNumber['L6_DBC']['L6_SBC'] = 1\n", "ConnTypes['L6_DBC']['L6_SBC'] = [0]\n", "\n", "for pre in Ipops:\n", " for post in Epops:\n", " proj = '%s:%s' % (pre, post)\n", " if proj in data['BBP_S1']['connProb']: \n", " if str(pre[-3:]) == 'ChC':\n", " ConnTypesNumber[pre][post] = 1\n", " ConnTypes[pre][post] = [12] \n", "\n", "for pre in Ipops:\n", " for post in Epops:\n", " proj = '%s:%s' % (pre, post)\n", " if proj in data['BBP_S1']['connProb']: \n", " if str(pre[-3:]) == 'DBC' or str(pre[-3:]) == '_BP' or str(pre[-3:]) == 'BTC':\n", " ConnTypesNumber[pre][post] = 1\n", " ConnTypes[pre][post] = [8] \n", "for pre in Ipops:\n", " for post in Epops:\n", " proj = '%s:%s' % (pre, post)\n", " if proj in data['BBP_S1']['connProb']: \n", " if str(pre[-3:]) == 'SBC':\n", " ConnTypesNumber[pre][post] = 3\n", " ConnTypes[pre][post] = [4, 5, 3] \n", " \n", "for pre in Ipops:\n", " for post in Epops:\n", " proj = '%s:%s' % (pre, post)\n", " if proj in data['BBP_S1']['connProb']: \n", " if str(pre[-3:]) == 'LBC' or str(pre[-3:]) == 'NBC':\n", " ConnTypesNumber[pre][post] = 2\n", " ConnTypes[pre][post] = [5, 10]" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [], "source": [ "# ConnTypes EI\n", "ConnTypesNumber['L4_SS']['L1_HAC'] = 1\n", "ConnTypes['L4_SS']['L1_HAC'] = [117]\n", "ConnTypesNumber['L5_TTPC1']['L1_HAC'] = 1\n", "ConnTypes['L5_TTPC1']['L1_HAC'] = [117]\n", "ConnTypesNumber['L5_TTPC2']['L1_HAC'] = 1\n", "ConnTypes['L5_TTPC2']['L1_HAC'] = [117]\n", "ConnTypesNumber['L5_UTPC']['L1_DAC'] = 1\n", "ConnTypes['L5_UTPC']['L1_DAC'] = [117]\n", "ConnTypesNumber['L6_TPC_L1']['L23_NGC'] = 1\n", "ConnTypes['L6_TPC_L1']['L23_NGC'] = [117]" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[117] [117] [117] 1 1 1\n", "[117, 114] [117, 114] [117, 114] 2 2 2\n" ] } ], "source": [ "for pre in Epops:\n", " for post in Ipops:\n", " proj = '%s:%s' % (pre, post)\n", " if proj in data['BBP_S1']['connProb']: \n", " if ConnTypesNumber[pre][post] == 2:\n", " if 117 in ConnTypes[pre][post]:\n", " ConnTypes[pre][post] = [117, 114]\n", " elif 134 in ConnTypes[pre][post]:\n", " ConnTypes[pre][post] = [134, 115] \n", "\n", "print(ConnTypes['L4_PC']['L23_BP'],\n", "ConnTypes['L5_STPC']['L23_DBC'],\n", "ConnTypes['L5_UTPC']['L23_DBC'],\n", "ConnTypesNumber['L4_PC']['L23_BP'],\n", "ConnTypesNumber['L5_STPC']['L23_DBC'],\n", "ConnTypesNumber['L5_UTPC']['L23_DBC'])\n", "\n", "ConnTypes['L4_PC']['L23_BP'].append(114)\n", "ConnTypes['L5_STPC']['L23_DBC'].append(114)\n", "ConnTypes['L5_UTPC']['L23_DBC'].append(114)\n", "ConnTypesNumber['L4_PC']['L23_BP'] = 2\n", "ConnTypesNumber['L5_STPC']['L23_DBC'] = 2\n", "ConnTypesNumber['L5_UTPC']['L23_DBC'] = 2\n", "\n", "print(ConnTypes['L4_PC']['L23_BP'],\n", "ConnTypes['L5_STPC']['L23_DBC'],\n", "ConnTypes['L5_UTPC']['L23_DBC'],\n", "ConnTypesNumber['L4_PC']['L23_BP'],\n", "ConnTypesNumber['L5_STPC']['L23_DBC'],\n", "ConnTypesNumber['L5_UTPC']['L23_DBC'])" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1941" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "number = 0\n", "for pre in Epops+Ipops:\n", " for post in Epops+Ipops:\n", " proj = '%s:%s' % (pre, post)\n", " if proj in data['BBP_S1']['connProb']: \n", " if ConnTypesNumber[pre][post] > 0:\n", "# print ('ConnNumberTypes[%s][%s] = %d' % (pre, post, ConnTypesNumber[pre][post])) \n", "# print (ConnTypes[pre][post])\n", " number = number + 1\n", "number " ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/plain": [ "1941" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# initialize Phys parameters matrix\n", "gsyn = {} \n", "decay = {} \n", "use = {}\n", "dep = {}\n", "fac = {}\n", "gsynStd = {} \n", "decayStd = {} \n", "useStd = {}\n", "depStd = {}\n", "facStd = {}\n", "stypes = {}\n", "EItype = {} \n", "\n", "for p in Epops + Ipops:\n", " gsyn[p] = {} \n", " decay[p] = {} \n", " use[p] = {} \n", " dep[p] = {} \n", " fac[p] = {} \n", " gsynStd[p] = {} \n", " decayStd[p] = {} \n", " useStd[p] = {} \n", " depStd[p] = {} \n", " facStd[p] = {} \n", " stypes[p] = {} \n", " EItype[p] = {} \n", " \n", "connType = {}\n", "for conn in range(29):\n", " connType[parameters_syn['ConnType',conn]] = conn\n", " \n", "number = 0\n", "for pre in Epops+Ipops:\n", " for post in Epops+Ipops:\n", " proj = '%s:%s' % (pre, post)\n", " if proj in data['BBP_S1']['connProb']: \n", " \n", " conn = connType[ConnTypes[pre][post][0]]\n", " \n", " gsyn[pre][post] = parameters_syn['gsyn',conn]\n", " gsynStd[pre][post] = parameters_syn['gsynStd',conn]\n", " decay[pre][post] = parameters_syn['decay',conn]\n", " decayStd[pre][post] =parameters_syn['decayStd',conn]\n", " use[pre][post] = parameters_syn['use',conn]\n", " useStd[pre][post] = parameters_syn['useStd',conn]\n", " dep[pre][post] = parameters_syn['dep',conn]\n", " depStd[pre][post] =parameters_syn['depStd',conn]\n", " fac[pre][post] = parameters_syn['fac',conn]\n", " facStd[pre][post] = parameters_syn['facStd',conn]\n", " stypes[pre][post] = parameters_syn['s-types',conn]\n", " EItype[pre][post] = parameters_syn['type',conn]\n", " \n", " number = number + 1\n", "number " ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [], "source": [ "# if connDataSource['E->E/I'] == 'BBP_S1': \n", "if connDataSource['I->E/I'] == 'BBP_S1': \n", " for pre in popParamLabels:\n", " for post in popParamLabels:\n", " proj = '%s:%s' % (pre, post)\n", " if proj in data['BBP_S1']['connProb']:\n", " pmat[pre][post] = data['BBP_S1']['connProb'][proj]['conn_prob_full']\n", " connNumber[pre][post] = data['BBP_S1']['connProb'][proj]['conn_total']\n", "\n", " lmat[pre][post] = data['BBP_S1']['connProb'][proj]['shape']\n", " a0mat[pre][post] = data['BBP_S1']['connProb'][proj]['A0']\n", " d0[pre][post] = data['BBP_S1']['connProb'][proj]['d_init']\n", " dfinal[pre][post] = data['BBP_S1']['connProb'][proj]['d_final']\n", "\n", " pmat12um[pre][post] = data['BBP_S1']['connProb'][proj]['conn_prob_12.5um'] \n", " pmat25um[pre][post] = data['BBP_S1']['connProb'][proj]['conn_prob_25um'] \n", " pmat50um[pre][post] = data['BBP_S1']['connProb'][proj]['conn_prob_50um'] \n", " pmat75um[pre][post] = data['BBP_S1']['connProb'][proj]['conn_prob_75um'] \n", " pmat100um[pre][post] = data['BBP_S1']['connProb'][proj]['conn_prob_100um']\n", " pmat125um[pre][post] = data['BBP_S1']['connProb'][proj]['conn_prob_125um']\n", " pmat150um[pre][post] = data['BBP_S1']['connProb'][proj]['conn_prob_150um']\n", " pmat175um[pre][post] = data['BBP_S1']['connProb'][proj]['conn_prob_175um']\n", " pmat200um[pre][post] = data['BBP_S1']['connProb'][proj]['conn_prob_200um']\n", " pmat225um[pre][post] = data['BBP_S1']['connProb'][proj]['conn_prob_225um']\n", " pmat250um[pre][post] = data['BBP_S1']['connProb'][proj]['conn_prob_250um']\n", " pmat275um[pre][post] = data['BBP_S1']['connProb'][proj]['conn_prob_275um']\n", " pmat300um[pre][post] = data['BBP_S1']['connProb'][proj]['conn_prob_300um']\n", " pmat325um[pre][post] = data['BBP_S1']['connProb'][proj]['conn_prob_325um']\n", " pmat350um[pre][post] = data['BBP_S1']['connProb'][proj]['conn_prob_350um']\n", " pmat375um[pre][post] = data['BBP_S1']['connProb'][proj]['conn_prob_375um']\n", " \n", " lmat_exp[pre][post] = data['BBP_S1']['connProb'][proj]['singleexp_shape']\n", " a0mat_exp[pre][post] = data['BBP_S1']['connProb'][proj]['singleexp_A0']\n", " d0_exp[pre][post] = data['BBP_S1']['connProb'][proj]['singleexp_d_init']\n", " \n", " lmat_gauss[pre][post] = data['BBP_S1']['connProb'][proj]['singlegauss_shapeg']\n", " a0mat_gauss[pre][post] = data['BBP_S1']['connProb'][proj]['singlegauss_A0g']\n", " x0_gauss[pre][post] = data['BBP_S1']['connProb'][proj]['singlegauss_x0g']\n", " d0_gauss[pre][post] = data['BBP_S1']['connProb'][proj]['singlegauss_d_init'] \n", " \n", " best_fit[pre][post] = data['BBP_S1']['connProb'][proj]['best_fit'] \n", " \n", " else:\n", " connNumber[pre][post] = 0 " ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "<matplotlib.colorbar.Colorbar at 0x7fe56b6c3390>" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAWAAAADyCAYAAABzuB+wAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAa2klEQVR4nO3df/BddZ3f8eeLCEQBxRCEkGRXdHEsy66h/S7iqLOKKNF1xE63FrTWnWGabUc6urhU0A4q3U61/mCdWeo2KhV3VETUmrHZRoI41s4KhBWRwKrhh2tiMCKwBh2BfL+v/nHOl718c7/fc773nnvPuTevx8yZ7z3nfu7nvM/3e/nwyeenbBMREeN3WNsBREQcqlIAR0S0JAVwRERLUgBHRLQkBXBEREtSAEdEtOQpbQcQETEq57z8KP/8wdnKdLfe/ug22xvHENKTpACOiKn1wIOz3LRtXWW6w9fcvXoM4RwkBXBETC1jHnd1DbgtKYAjYqrNMdd2CItKARwRU8uY2Q4vtzDUKAhJGyV9X9IuSZc0FVRERFPmcOXRloFrwJJWAFcCrwR2A7dI2mL7zsU+c+yqFT5x3fRVun/yvaOedH7S7/yypUgm28Lf47CG+TvU+ZsOE2/d/Oo8Q9O/t67Yz0MP2D5+mDwMzLZYw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akgI4IqIl/x/q7xkKQegWngAAAABJRU5ErkJggg==\n", "text/plain": [ "<Figure size 432x288 with 2 Axes>" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "%matplotlib inline\n", "import matplotlib.pyplot as plt\n", "import matplotlib.image as mpimg\n", "number = 0\n", "matrix = np.zeros((42, 55)) #13 + 42\n", "for pre in Ipops:\n", " number2 = 0\n", " for post in Epops+Ipops:\n", " if float(connNumber[pre][post]) > 0:\n", " matrix[number][number2] = gsyn[pre][post] \n", " else:\n", " matrix[number][number2] = 0 \n", " number2 = number2 + 1 \n", " number = number + 1\n", "\n", "# np.savetxt('matrix_gsyn.txt',matrix, fmt='%.2f', delimiter=\" \")\n", "plt.imshow(matrix)\n", "plt.colorbar()" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of cells = 31346\n" ] } ], "source": [ "#------------------------------------------------------------------------------\n", "# Cells\n", "#------------------------------------------------------------------------------\n", "# Load 55 Morphological Names-> L1:6 L23:10 L4:12 L5:13 L6:14\n", "# Load 207 Morpho-electrical Names-> L1:14 L23:43 L4:46 L5:52 L6:52\n", "\n", "rootFolder = '/home/fernando/S1_netpyne'\n", "with open(rootFolder + '/info/anatomy/S1-cells-distributions-Rat.txt') as metype_file:\n", " metype_content = metype_file.read() \n", "\n", "MtypeNumberRat = {}\n", "NRat = 0\n", "for line in metype_content.split('\\n')[:-1]:\n", " metype, mtype, etype, n, m = line.split()\n", " MtypeNumberRat[mtype] = int(m)\n", "\n", " NRat = NRat + int(n)\n", " \n", "print ('Number of cells = %d' % NRat)" ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "G_Exc = 693.32 nS (880), G_Inh = 257.91 nS (308)\n", "mean G_Exc = 0.79 nS, mean G_Inh = 0.83 nS \n" ] } ], "source": [ "addQuantalSyn = 1 \n", "#------------------------------------------------------------------------------\n", "# NetStim inputs to simulate Spontaneous synapses + background\n", "#------------------------------------------------------------------------------\n", "if addQuantalSyn: \n", " synperNeuronE = {}\n", " synperNeuronI = {}\n", " GsynE = {}\n", " GsynI = {}\n", " for post in Ipops + Epops:\n", " synperNeuronE[post] = 0\n", " synperNeuronI[post] = 0 \n", " GsynE[post] = 0\n", " GsynI[post] = 0\n", " \n", " for post in Ipops + Epops:\n", " for pre in Ipops:\n", " if float(connNumber[pre][post]) > 0:\n", " synTotal = float(connNumber[pre][post])*synperconnNumber[pre][post] \n", " synperNeuron = synTotal/MtypeNumberRat[post]\n", " synperNeuronI[post] = synperNeuronI[post] + synperNeuron\n", " GsynI[post] = GsynI[post] + gsyn[pre][post] * synperNeuron\n", "\n", " for pre in Epops:\n", " if float(connNumber[pre][post]) > 0:\n", " synTotal = float(connNumber[pre][post])*synperconnNumber[pre][post] \n", " synperNeuron = synTotal/MtypeNumberRat[post]\n", " synperNeuronE[post] = synperNeuronE[post] + synperNeuron\n", " GsynE[post] = GsynE[post] + gsyn[pre][post] * synperNeuron\n", "\n", " GsynTotalE = 0\n", " GsynTotalI = 0\n", " synTotalE = 0\n", " synTotalI = 0\n", " for post in Ipops + Epops:\n", " for pre in Ipops:\n", " if float(connNumber[pre][post]) > 0:\n", " synTotal = float(connNumber[pre][post])*synperconnNumber[pre][post] \n", " GsynTotalI = GsynTotalI + gsyn[pre][post] * synTotal \n", " synTotalI = synTotalI + synTotal \n", " for pre in Epops:\n", " if float(connNumber[pre][post]) > 0:\n", " synTotal = float(connNumber[pre][post])*synperconnNumber[pre][post] \n", " GsynTotalE = GsynTotalE + gsyn[pre][post] * synTotal \n", " synTotalE = synTotalE + synTotal\n", " \n", "print ('G_Exc = %.2f nS (%.d), G_Inh = %.2f nS (%.d)' % (GsynTotalE/NRat, synTotalE/NRat, GsynTotalI/NRat, synTotalI/NRat)) \n", "print ('mean G_Exc = %.2f nS, mean G_Inh = %.2f nS ' % (GsynTotalE/synTotalE, GsynTotalI/synTotalI))" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "G_Exc = 750.00 nS (882), G_Inh = 250.00 nS (297)\n", "mean G_Exc = 0.85 nS, mean G_Inh = 0.84 nS \n" ] } ], "source": [ "# If do not use np.ceil() and decrease by 1 the synperconnNumber Inh\n", "# G_Exc = 622.97 nS (789), G_Inh = 275.95 nS (330)\n", "# mean G_Exc = 0.79 nS, mean G_Inh = 0.83 nS \n", "\n", "# Cell 2015\n", "# The predicted average total synaptic conductance for single neurons was \u00181000 nS (\u0018750 nS excitatory and\n", "# 250 nS inhibitory conductance; based on all synapses in BioM). Predicted average quantal conductance was \n", "# 0.85 ± 0.44 nS for excitatory synapses and 0.84 ± 0.29 nS for inhibitory synapses. \n", "print ('G_Exc = %.2f nS (%.d), G_Inh = %.2f nS (%.d)' % (750, 750/0.85, 250, 250/0.84))\n", "print ('mean G_Exc = %.2f nS, mean G_Inh = %.2f nS ' % (0.85, 0.84))" ] }, { "cell_type": "code", "execution_count": 28, "metadata": { "scrolled": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "input_L1_DAC : Inh = 175 syn, G = 144.9 nS (0.83 nS), Exc = 41 syn, G = 17.6 nS (0.43 nS)\n", "input_L1_DLAC : Inh = 175 syn, G = 145.4 nS (0.83 nS), Exc = 31 syn, G = 13.5 nS (0.43 nS)\n", "input_L1_HAC : Inh = 124 syn, G = 102.8 nS (0.83 nS), Exc = 18 syn, G = 7.7 nS (0.43 nS)\n", "input_L1_NGC-DA : Inh = 97 syn, G = 80.2 nS (0.83 nS), Exc = 16 syn, G = 6.8 nS (0.43 nS)\n", "input_L1_NGC-SA : Inh = 93 syn, G = 77.5 nS (0.83 nS), Exc = 16 syn, G = 6.9 nS (0.43 nS)\n", "input_L1_SLAC : Inh = 101 syn, G = 84.1 nS (0.83 nS), Exc = 22 syn, G = 9.4 nS (0.43 nS)\n", "input_L23_BP : Inh = 16 syn, G = 13.5 nS (0.83 nS), Exc = 18 syn, G = 7.8 nS (0.43 nS)\n", "input_L23_BTC : Inh = 245 syn, G = 203.0 nS (0.83 nS), Exc = 262 syn, G = 112.6 nS (0.43 nS)\n", "input_L23_ChC : Inh = 220 syn, G = 182.6 nS (0.83 nS), Exc = 207 syn, G = 149.3 nS (0.72 nS)\n", "input_L23_DBC : Inh = 55 syn, G = 45.5 nS (0.83 nS), Exc = 59 syn, G = 25.3 nS (0.43 nS)\n", "input_L23_LBC : Inh = 244 syn, G = 202.2 nS (0.83 nS), Exc = 283 syn, G = 203.8 nS (0.72 nS)\n", "input_L23_MC : Inh = 343 syn, G = 284.9 nS (0.83 nS), Exc = 266 syn, G = 29.3 nS (0.11 nS)\n", "input_L23_NBC : Inh = 261 syn, G = 216.2 nS (0.83 nS), Exc = 251 syn, G = 180.8 nS (0.72 nS)\n", "input_L23_NGC : Inh = 102 syn, G = 84.4 nS (0.83 nS), Exc = 109 syn, G = 47.0 nS (0.43 nS)\n", "input_L23_SBC : Inh = 200 syn, G = 165.8 nS (0.83 nS), Exc = 227 syn, G = 163.7 nS (0.72 nS)\n", "input_L4_BP : Inh = 6 syn, G = 5.2 nS (0.83 nS), Exc = 14 syn, G = 6.0 nS (0.43 nS)\n", "input_L4_BTC : Inh = 166 syn, G = 137.8 nS (0.83 nS), Exc = 443 syn, G = 190.7 nS (0.43 nS)\n", "input_L4_ChC : Inh = 196 syn, G = 162.9 nS (0.83 nS), Exc = 553 syn, G = 398.1 nS (0.72 nS)\n", "input_L4_DBC : Inh = 67 syn, G = 55.3 nS (0.83 nS), Exc = 172 syn, G = 73.9 nS (0.43 nS)\n", "input_L4_LBC : Inh = 224 syn, G = 186.2 nS (0.83 nS), Exc = 579 syn, G = 416.5 nS (0.72 nS)\n", "input_L4_MC : Inh = 276 syn, G = 228.7 nS (0.83 nS), Exc = 772 syn, G = 84.9 nS (0.11 nS)\n", "input_L4_NBC : Inh = 220 syn, G = 182.9 nS (0.83 nS), Exc = 563 syn, G = 405.6 nS (0.72 nS)\n", "input_L4_NGC : Inh = 81 syn, G = 67.6 nS (0.83 nS), Exc = 228 syn, G = 98.1 nS (0.43 nS)\n", "input_L4_SBC : Inh = 182 syn, G = 150.8 nS (0.83 nS), Exc = 475 syn, G = 342.3 nS (0.72 nS)\n", "input_L5_BP : Inh = 33 syn, G = 27.3 nS (0.83 nS), Exc = 171 syn, G = 73.3 nS (0.43 nS)\n", "input_L5_BTC : Inh = 212 syn, G = 176.0 nS (0.83 nS), Exc = 857 syn, G = 368.6 nS (0.43 nS)\n", "input_L5_ChC : Inh = 163 syn, G = 135.5 nS (0.83 nS), Exc = 724 syn, G = 521.3 nS (0.72 nS)\n", "input_L5_DBC : Inh = 64 syn, G = 53.4 nS (0.83 nS), Exc = 264 syn, G = 113.6 nS (0.43 nS)\n", "input_L5_LBC : Inh = 189 syn, G = 157.0 nS (0.83 nS), Exc = 833 syn, G = 599.7 nS (0.72 nS)\n", "input_L5_MC : Inh = 183 syn, G = 152.2 nS (0.83 nS), Exc = 864 syn, G = 95.0 nS (0.11 nS)\n", "input_L5_NBC : Inh = 160 syn, G = 133.1 nS (0.83 nS), Exc = 714 syn, G = 514.1 nS (0.72 nS)\n", "input_L5_NGC : Inh = 18 syn, G = 14.6 nS (0.83 nS), Exc = 124 syn, G = 53.4 nS (0.43 nS)\n", "input_L5_SBC : Inh = 115 syn, G = 95.3 nS (0.83 nS), Exc = 524 syn, G = 377.6 nS (0.72 nS)\n", "input_L6_BP : Inh = 25 syn, G = 20.7 nS (0.83 nS), Exc = 138 syn, G = 59.5 nS (0.43 nS)\n", "input_L6_BTC : Inh = 141 syn, G = 116.6 nS (0.83 nS), Exc = 876 syn, G = 376.6 nS (0.43 nS)\n", "input_L6_ChC : Inh = 102 syn, G = 84.9 nS (0.83 nS), Exc = 636 syn, G = 457.6 nS (0.72 nS)\n", "input_L6_DBC : Inh = 36 syn, G = 30.1 nS (0.83 nS), Exc = 226 syn, G = 121.5 nS (0.54 nS)\n", "input_L6_LBC : Inh = 115 syn, G = 95.4 nS (0.83 nS), Exc = 696 syn, G = 501.1 nS (0.72 nS)\n", "input_L6_MC : Inh = 135 syn, G = 111.7 nS (0.83 nS), Exc = 832 syn, G = 91.5 nS (0.11 nS)\n", "input_L6_NBC : Inh = 104 syn, G = 86.0 nS (0.83 nS), Exc = 628 syn, G = 451.9 nS (0.72 nS)\n", "input_L6_NGC : Inh = 16 syn, G = 13.4 nS (0.83 nS), Exc = 121 syn, G = 52.1 nS (0.43 nS)\n", "input_L6_SBC : Inh = 79 syn, G = 65.8 nS (0.83 nS), Exc = 492 syn, G = 354.1 nS (0.72 nS)\n", "input_L23_PC : Inh = 295 syn, G = 243.3 nS (0.83 nS), Exc = 245 syn, G = 164.2 nS (0.67 nS)\n", "input_L4_PC : Inh = 344 syn, G = 285.4 nS (0.83 nS), Exc = 741 syn, G = 525.5 nS (0.71 nS)\n", "input_L4_SS : Inh = 291 syn, G = 242.0 nS (0.83 nS), Exc = 701 syn, G = 493.4 nS (0.70 nS)\n", "input_L4_SP : Inh = 270 syn, G = 224.9 nS (0.83 nS), Exc = 606 syn, G = 426.8 nS (0.70 nS)\n", "input_L5_TTPC1 : Inh = 750 syn, G = 623.6 nS (0.83 nS), Exc = 2055 syn, G = 2014.6 nS (0.98 nS)\n", "input_L5_TTPC2 : Inh = 818 syn, G = 678.2 nS (0.83 nS), Exc = 2100 syn, G = 2055.6 nS (0.98 nS)\n", "input_L5_STPC : Inh = 556 syn, G = 463.4 nS (0.83 nS), Exc = 1619 syn, G = 1168.5 nS (0.72 nS)\n", "input_L5_UTPC : Inh = 374 syn, G = 312.6 nS (0.84 nS), Exc = 1391 syn, G = 1001.5 nS (0.72 nS)\n", "input_L6_TPC_L1 : Inh = 197 syn, G = 167.2 nS (0.85 nS), Exc = 1008 syn, G = 747.8 nS (0.74 nS)\n", "input_L6_TPC_L4 : Inh = 207 syn, G = 175.7 nS (0.85 nS), Exc = 1014 syn, G = 749.8 nS (0.74 nS)\n", "input_L6_BPC : Inh = 194 syn, G = 166.4 nS (0.86 nS), Exc = 1052 syn, G = 768.8 nS (0.73 nS)\n", "input_L6_IPC : Inh = 114 syn, G = 98.2 nS (0.86 nS), Exc = 665 syn, G = 489.5 nS (0.74 nS)\n", "input_L6_UTPC : Inh = 239 syn, G = 203.4 nS (0.85 nS), Exc = 1211 syn, G = 871.9 nS (0.72 nS)\n" ] } ], "source": [ "GsynStimI = {}\n", "GsynStimE = {}\n", "for post in Ipops + Epops:\n", " GsynStimI[post] = GsynI[post]/synperNeuronI[post]\n", " GsynStimE[post] = GsynE[post]/synperNeuronE[post] \n", " print ('input_%s : Inh = %.0f syn, G = %.1f nS (%.2f nS), Exc = %.0f syn, G = %.1f nS (%.2f nS)' % (post,synperNeuronI[post],GsynI[post],GsynI[post]/synperNeuronI[post],synperNeuronE[post],GsynE[post],GsynE[post]/synperNeuronE[post]))\n", " \n", "synperNeuronStimI = synperNeuronI\n", "synperNeuronStimE = synperNeuronE" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## ME conn diversity" ] }, { "cell_type": "code", "execution_count": 29, "metadata": { "scrolled": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "number od path with conn diversity (all) = 370\n" ] } ], "source": [ "number = 0\n", "for pre in Ipops+Epops:\n", " for post in Ipops+Epops:\n", " if float(connNumber[pre][post]) > 0 and ConnTypesNumber[pre][post] > 1:\n", "# print(pre,post,ConnTypesNumber[pre][post], ConnTypes[pre][post])\n", " number += 1\n", "print('number od path with conn diversity (all) = ',number)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### path Exc -> Inh" ] }, { "cell_type": "code", "execution_count": 30, "metadata": {}, "outputs": [], "source": [ "connEItype = {}\n", "postEIconnDiversity =['NBC', 'LBC', 'BP', 'DBC', 'BTC']\n", "for mtype in postEIconnDiversity:\n", " connEItype[mtype] = {}\n", " \n", "# E1 - Excitatory, facilitating\t#\t\t\n", "for eletric in ['cAC', 'cIR', 'bAC', 'bIR', 'cNA']:\n", " connEItype['NBC'][eletric] = 115\n", " connEItype['LBC'][eletric] = 115\n", " \n", "connEItype['BP']['cAC'] = 114\n", "connEItype['DBC']['cAC'] = 114 \n", "connEItype['BTC']['cAC'] =114\n", "\n", "# E2 - Excitatory, depressing \t#\n", "for eletric in ['bST', 'dNA', 'bNA', 'bST', 'cST', 'dST']:\n", " connEItype['NBC'][eletric] = 134\n", " connEItype['LBC'][eletric] = 134\n", " \n", "for eletric in ['cNA','bNA','bAC','bIR','dST']:\n", " connEItype['BP'][eletric] = 117\n", "\n", "for eletric in ['cNA','bNA','bAC','bIR','bST', 'cIR']:\n", " connEItype['DBC'][eletric] = 117 \n", " \n", "for eletric in ['bAC', 'cNA', 'bIR','bNA','bST','dNA']:\n", " connEItype['BTC'][eletric] =117" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### paht Inh -> Exc" ] }, { "cell_type": "code", "execution_count": 31, "metadata": {}, "outputs": [], "source": [ "connIEtype = {}\n", "preIEconnDiversity =['SBC', 'LBC', 'NBC']\n", "for mtype in preIEconnDiversity:\n", " connIEtype[mtype] = {}\n", " \n", "# I1 - Inhibitory, facilitating\n", "connIEtype['SBC']['cAC'] = 3\n", "\n", "# I2 - Inhibitory, depressing\n", "connIEtype['SBC']['dNA'] = 4\n", "for eletric in ['bAC', 'cAC', 'bNA', 'dNA', 'cIR', 'bIR']:\n", " connIEtype['LBC'][eletric] = 10\n", " connIEtype['NBC'][eletric] = 10\n", " \n", "# I3 - Inhibitory, pseudo-linear\n", "connIEtype['SBC']['bNA'] = 5\n", "for eletric in ['cNA', 'dST', 'cST', 'bST']:\n", " connIEtype['LBC'][eletric] = 5\n", " connIEtype['NBC'][eletric] = 5" ] }, { "cell_type": "code", "execution_count": 32, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'SBC': {'cAC': 3, 'dNA': 4, 'bNA': 5},\n", " 'LBC': {'bAC': 10,\n", " 'cAC': 10,\n", " 'bNA': 10,\n", " 'dNA': 10,\n", " 'cIR': 10,\n", " 'bIR': 10,\n", " 'cNA': 5,\n", " 'dST': 5,\n", " 'cST': 5,\n", " 'bST': 5},\n", " 'NBC': {'bAC': 10,\n", " 'cAC': 10,\n", " 'bNA': 10,\n", " 'dNA': 10,\n", " 'cIR': 10,\n", " 'bIR': 10,\n", " 'cNA': 5,\n", " 'dST': 5,\n", " 'cST': 5,\n", " 'bST': 5}}" ] }, "execution_count": 32, "metadata": {}, "output_type": "execute_result" } ], "source": [ "connIEtype" ] }, { "cell_type": "code", "execution_count": 33, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'NBC': {'cAC': 115,\n", " 'cIR': 115,\n", " 'bAC': 115,\n", " 'bIR': 115,\n", " 'cNA': 115,\n", " 'bST': 134,\n", " 'dNA': 134,\n", " 'bNA': 134,\n", " 'cST': 134,\n", " 'dST': 134},\n", " 'LBC': {'cAC': 115,\n", " 'cIR': 115,\n", " 'bAC': 115,\n", " 'bIR': 115,\n", " 'cNA': 115,\n", " 'bST': 134,\n", " 'dNA': 134,\n", " 'bNA': 134,\n", " 'cST': 134,\n", " 'dST': 134},\n", " 'BP': {'cAC': 114,\n", " 'cNA': 117,\n", " 'bNA': 117,\n", " 'bAC': 117,\n", " 'bIR': 117,\n", " 'dST': 117},\n", " 'DBC': {'cAC': 114,\n", " 'cNA': 117,\n", " 'bNA': 117,\n", " 'bAC': 117,\n", " 'bIR': 117,\n", " 'bST': 117,\n", " 'cIR': 117},\n", " 'BTC': {'cAC': 114,\n", " 'bAC': 117,\n", " 'cNA': 117,\n", " 'bIR': 117,\n", " 'bNA': 117,\n", " 'bST': 117,\n", " 'dNA': 117}}" ] }, "execution_count": 33, "metadata": {}, "output_type": "execute_result" } ], "source": [ "connEItype" ] }, { "cell_type": "code", "execution_count": 34, "metadata": { "scrolled": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "number od path with conn diversity (IE) = 148\n", "number od path with conn diversity (IE+EI+EXCEPTIONS) = 379\n", "\n", "EXCEPTIONS\n", "L6_IPC L6_DBC 1 [131]\n", "L6_IPC L6_LBC 1 [131]\n", "L6_IPC L6_NBC 1 [131]\n", "L6_IPC L6_SBC 1 [131]\n", "L6_TPC_L1 L6_DBC 1 [132]\n", "L6_TPC_L1 L6_LBC 1 [132]\n", "L6_TPC_L1 L6_NBC 1 [132]\n", "L6_TPC_L1 L6_SBC 1 [132]\n", "L6_TPC_L4 L6_DBC 1 [132]\n", "L6_TPC_L4 L6_LBC 1 [132]\n", "L6_TPC_L4 L6_NBC 1 [132]\n", "L6_TPC_L4 L6_SBC 1 [132]\n", "number od path with conn diversity (all) = 367\n" ] } ], "source": [ "number = 0\n", "for pre in Ipops:\n", " for post in Epops:\n", " if 'SBC' in pre or 'LBC' in pre or 'NBC' in pre:\n", " if float(connNumber[pre][post]) > 0:\n", "# print(pre,post,eletric,connIEtype[eletric])\n", " number += 1\n", "print('number od path with conn diversity (IE) = ',number)\n", "\n", "# number = 0\n", "for pre in Epops:\n", " for post in Ipops:\n", " if 'BP' in post or 'DBC' in post or 'BTC' in post or 'LBC' in post or 'NBC' in post:\n", " if float(connNumber[pre][post]) > 0:\n", "# print(pre,post,eletric,connEItype[eletric])\n", " number += 1\n", "print('number od path with conn diversity (IE+EI+EXCEPTIONS) = ',number)\n", "\n", "\n", "# EXCEPTIONS\n", "print('\\nEXCEPTIONS')\n", "# L6_IPC:L6_(DBC-LBC-NBC-SBC)\t131\n", "# L6_TPC_L:L6_(DBC-LBC-NBC-SBC)\t132\n", "for pre in ['L6_IPC', 'L6_TPC_L1', 'L6_TPC_L4']:\n", " for post in ['L6_DBC', 'L6_LBC', 'L6_NBC', 'L6_SBC']:\n", " if float(connNumber[pre][post]) > 0:\n", " print(pre, post, ConnTypesNumber[pre][post], ConnTypes[pre][post])\n", " number -= 1\n", "print('number od path with conn diversity (all) = ',number)" ] }, { "cell_type": "code", "execution_count": 35, "metadata": {}, "outputs": [], "source": [ "# 'ConnTypesNumber': ConnTypesNumber, 'ConnTypes': ConnTypes, 'connIEtype': connIEtype, 'connEItype': connEItype," ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Syn fisiology with STP" ] }, { "cell_type": "code", "execution_count": 36, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "ConnType 0\n", "ConnType 1\n", "ConnType 3\n", "ConnType 4\n", "ConnType 5\n", "ConnType 8\n", "ConnType 9\n", "ConnType 10\n", "ConnType 11\n", "ConnType 12\n", "ConnType 13\n", "ConnType 114\n", "ConnType 115\n", "ConnType 116\n", "ConnType 117\n", "ConnType 118\n", "ConnType 119\n", "ConnType 120\n", "ConnType 121\n", "ConnType 122\n", "ConnType 123\n", "ConnType 126\n", "ConnType 127\n", "ConnType 128\n", "ConnType 129\n", "ConnType 131\n", "ConnType 132\n", "ConnType 133\n", "ConnType 134\n" ] } ], "source": [ "parameters_syn2 = {} # invert ConnType Label\n", "for n,n2 in parameters_syn: \n", "# print(n,n2,parameters_syn[n,n2])\n", " parameters_syn2[n,parameters_syn['ConnType',n2]] = parameters_syn[n,n2]\n", " if n == 'ConnType':\n", " parameters_syn2[n,parameters_syn['ConnType',n2]] = n2\n", " print(n,parameters_syn[n,n2])\n", "\n", "# for n,n2 in parameters_syn: \n", "# print(n,n2,parameters_syn[n,n2],parameters_syn['ConnType',n2],parameters_syn2[n,parameters_syn['ConnType',n2]])\n", "\n", "# parameters_syn2" ] }, { "cell_type": "code", "execution_count": 37, "metadata": {}, "outputs": [], "source": [ "# Save data to pkl file\n", "savePickle = 1\n", "\n", "if savePickle:\n", " import pickle\n", " with open('conn.pkl', 'wb') as f:\n", " pickle.dump({'pmat': pmat, 'lmat': lmat, 'a0mat': a0mat, 'd0': d0, 'dfinal': dfinal, 'pmat12um': pmat12um, 'pmat25um': pmat25um, 'pmat50um': pmat50um, \n", " 'pmat75um': pmat75um, 'pmat100um': pmat100um, 'pmat125um': pmat125um, 'pmat150um': pmat150um, 'pmat175um': pmat175um, 'pmat200um': pmat200um, \n", " 'pmat225um': pmat225um, 'pmat250um': pmat250um, 'pmat275um': pmat275um, 'pmat300um': pmat300um, 'pmat325um': pmat325um, 'pmat350um': pmat350um,\n", " 'pmat375um': pmat375um,'connNumber': connNumber, 'synperconnNumber': synperconnNumber, 'use': use, 'dep': dep, 'fac': fac, 'useStd': useStd, \n", " 'depStd': depStd, 'facStd': facStd, 'stypes': stypes, 'EItype': EItype, 'synperconnNumberStd': synperconnNumberStd, 'decay': decay, \n", " 'decayStd': decayStd, 'gsyn': gsyn, 'gsynStd': gsynStd, 'synperNeuronStimE': synperNeuronStimE, 'synperNeuronStimI': synperNeuronStimI, \n", " 'GsynStimE': GsynStimE, 'GsynStimI': GsynStimI, 'connDataSource': connDataSource, 'ConnTypesNumber': ConnTypesNumber, 'ConnTypes': ConnTypes, \n", " 'connIEtype': connIEtype, 'connEItype': connEItype, 'parameters_syn': parameters_syn2, 'lmat_exp': lmat_exp, 'a0mat_exp': a0mat_exp, 'd0_exp': d0_exp, \n", " 'lmat_gauss': lmat_gauss, 'a0mat_gauss': a0mat_gauss, 'x0_gauss': x0_gauss, 'd0_gauss': d0_gauss, 'best_fit': best_fit}, f)" ] }, { "cell_type": "code", "execution_count": 38, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "number od path with conn diversity (II+EE) = 0\n" ] } ], "source": [ "number = 0\n", "for pre in Ipops:\n", " for post in Ipops:\n", " if float(connNumber[pre][post]) > 0 and ConnTypesNumber[pre][post] > 1:\n", " print(pre,post,ConnTypesNumber[pre][post], ConnTypes[pre][post])\n", " number += 1\n", " \n", " \n", "number = 0\n", "for pre in Epops:\n", " for post in Epops:\n", " if float(connNumber[pre][post]) > 0 and ConnTypesNumber[pre][post] > 1:\n", " print(pre,post,ConnTypesNumber[pre][post], ConnTypes[pre][post])\n", " number += 1 \n", "print('number of path with conn diversity (II+EE) = ',number)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.7.11" } }, "nbformat": 4, "nbformat_minor": 4 }