コード例 #1
0
ファイル: figure_2.py プロジェクト: mhturner/SC-FC
            ax[ind_1-1, ind_2].axvline(0, color='k', alpha=0.5, linestyle='-')
            if ind_2==0:
                ax[ind_1-1, ind_2].set_ylabel(bridge.displayName(eg1), fontsize=10)
            if ind_1==3:
                ax[ind_1-1, ind_2].set_xlabel(bridge.displayName(eg2), fontsize=10)
fig2_2.subplots_adjust(hspace=0.02, wspace=0.02)

plotting.addScaleBars(ax[0, 0], dT=-30, dF=0.25, T_value=time[-1], F_value=-0.15)
sns.despine(top=True, right=True, left=True, bottom=True)
fig2_0.savefig(os.path.join(analysis_dir, 'figpanels', 'fig2_0.svg'), format='svg', transparent=True, dpi=save_dpi)
fig2_1.savefig(os.path.join(analysis_dir, 'figpanels', 'fig2_1.svg'), format='svg', transparent=True, dpi=save_dpi)
fig2_2.savefig(os.path.join(analysis_dir, 'figpanels', 'fig2_2.svg'), format='svg', transparent=True, dpi=save_dpi)

# %%
# Plot heatmaps, ordered by TSP seriation
Structural_Matrix = anatomical_connectivity.getAtlasConnectivity(include_inds_ito, name_list_ito, 'ito')
np.fill_diagonal(Structural_Matrix.to_numpy(), 0)

response_filepaths = glob.glob(os.path.join(data_dir, 'ito_responses') + '/' + '*.pkl')
Functional_Matrix, cmats_z = functional_connectivity.getCmat(response_filepaths, include_inds_ito, name_list_ito)
Fxn_tmp = Functional_Matrix.to_numpy().copy()
np.fill_diagonal(Fxn_tmp, 1)

sort_inds = seriate(pdist(Structural_Matrix))
sort_keys = np.array(name_list_ito)[sort_inds]
np.fill_diagonal(Structural_Matrix.to_numpy(), np.nan)

SC_ordered = pd.DataFrame(data=np.zeros_like(Structural_Matrix), columns=sort_keys, index=sort_keys)
FC_ordered = pd.DataFrame(data=np.zeros_like(Functional_Matrix), columns=sort_keys, index=sort_keys)
for r_ind, r_key in enumerate(sort_keys):
    for c_ind, c_key in enumerate(sort_keys):
コード例 #2
0
from matplotlib import rcParams
rcParams.update({'font.size': 10})
rcParams.update({'figure.autolayout': True})
rcParams.update({'axes.spines.right': False})
rcParams.update({'axes.spines.top': False})
rcParams['svg.fonttype'] = 'none' # let illustrator handle the font type

data_dir = bridge.getUserConfiguration()['data_dir']
analysis_dir = bridge.getUserConfiguration()['analysis_dir']

plot_colors = plt.get_cmap('tab10')(np.arange(8)/8)
save_dpi = 400

# %% ~Lognormal distribtution of connection strengths
include_inds_ito, name_list_ito = bridge.getItoNames()
ConnectivityCount = anatomical_connectivity.getAtlasConnectivity(include_inds_ito, name_list_ito, 'ito', metric='cellcount')
ConnectivityTBars = anatomical_connectivity.getAtlasConnectivity(include_inds_ito, name_list_ito, 'ito', metric='tbar')


pull_region = 'AL_R'

fig1_0, ax = plt.subplots(2, 1, figsize=(4.5, 3.5))
ax = ax.ravel()
fig1_0.tight_layout(w_pad=2, h_pad=8)

figS1_0, axS1 = plt.subplots(10, 4, figsize=(8, 9))
axS1 = axS1.ravel()
[x.set_axis_off() for x in axS1]

z_scored_cell = []
z_scored_tbar = []
コード例 #3
0
ファイル: figure_3.py プロジェクト: mhturner/SC-FC
analysis_dir = bridge.getUserConfiguration()['analysis_dir']

plot_colors = plt.get_cmap('tab10')(np.arange(8) / 8)
save_dpi = 400

# %% get adjacency matrices for graphs
atlas_path = os.path.join(data_dir, 'atlas_data', 'vfb_68_Original.nii.gz')
include_inds_ito, name_list_ito = bridge.getItoNames()
coms, roi_size, DistanceMatrix, SizeMatrix = functional_connectivity.getRegionGeometry(
    atlas_path, include_inds_ito, name_list_ito)

anat_position = {}
for r in range(len(coms)):
    anat_position[r] = coms[r, :]

Structural_Matrix = anatomical_connectivity.getAtlasConnectivity(
    include_inds_ito, name_list_ito, 'ito').to_numpy().copy()
adjacency_anat = (Structural_Matrix + Structural_Matrix.T) / 2  # symmetrize
np.fill_diagonal(adjacency_anat, 0)

response_filepaths = glob.glob(
    os.path.join(data_dir, 'ito_responses') + '/' + '*.pkl')
Functional_Matrix, _ = functional_connectivity.getCmat(response_filepaths,
                                                       include_inds_ito,
                                                       name_list_ito)
adjacency_fxn = Functional_Matrix.to_numpy().copy()
np.fill_diagonal(adjacency_fxn, 0)

# normalize each adjacency
adjacency_anat = adjacency_anat / adjacency_anat.max()
adjacency_fxn = adjacency_fxn / adjacency_fxn.max()
コード例 #4
0
"""
Turner, Mann, Clandinin:

https://github.com/mhturner/SC-FC
[email protected]
"""
from scfc import bridge, anatomical_connectivity
import os

data_dir = bridge.getUserConfiguration()['data_dir']

include_inds_branson, name_list_branson = bridge.getBransonNames()
Branson_JRC2018 = anatomical_connectivity.getAtlasConnectivity(
    include_inds_branson, name_list_branson, 'branson')

# Shortest path distance:
shortest_path_dist = bridge.getShortestPathStats(Branson_JRC2018)

# save
shortest_path_dist.to_pickle(
    os.path.join(data_dir, 'Branson_ShortestPathDistance.pkl'))