DOI: 10.57760/sciencedb.07756
title: Altered excitatory-inhibitory balance and network communication coincident with visual hallucinations elicited by stimulation
title: Altered excitatory-inhibitory balance and network communication coincident with visual hallucinations elicited by stimulation

description: Here are the relevant codes and data used in the analysis process of this article. To facilitate your better understanding of the entire process, we have organized the analysis code according to the analysis process and retained the analysis results of major steps.This folder includes several main directories, here is a brief introduction to their functions, and then a detailed introduction to the contents of each folder:(1)  ./brain_atlas, this contains some brain structural atlas used in the analysis, and another part of the brain structural atlas are in ./Phi_Analysis/brain_atlas(2)  ./myfun, this folder contains some general functions used in programming(3)  ./dataForEI, the data used in the E/I anlaysis(4)  ./01_EI_hallucinationTrial_stimulation_vs_baseline, in this folder, we compare the E/I difference between the electrical stimulation period and the baseline period for the visual hallucination trials(5)  ./02_EI_controlTrial_stimulation_vs_baseline, in this folder, we compare the E/I difference between the electrical stimulation period and the baseline period for the control trials(6)  ./03_EI_stimulationPeriod_halluTrial_vs_controlTrial, in this folder, we compare the E/I difference between the two types of trials during the electrical stimulation period(7)  ./04_EI_baselinePeriod_halluTrial_vs_controlTrial, in this folder, we compare the E/I difference between the two types of trials during the baseline period(8)  ./Phi_Analysis, this folder contains analysis related to information integration(9)  ./Other_Analysis, this folder contains other related analysisNext, let's introduce the contents of each subfolder in detail:1.    ./dataForEI(1)  st05_elec_value_mat.mat, st05_elec_value_mat_nohall.matThese two files respectively contain the aperiodic 1/f values calculated for each recorded electrode in the visual hallucination trials and control trials, as well as the coordinates of each electrode in the standard MNI space. (The code for calculating the aperiodic 1/f values is placed in ./Other_Analysis/cal_1f.py, FOOOF toolbox(Donoghue et al., 2020) was used).2.    ./01_EI_hallucinationTrial_stimulation_vs_baseline(1)  ./ st06_filtered_data.mThis code is mainly used to find the recording contacts that are shared by hallucination trials and control trials, and these shared contracts will be used for subsequent analysis. The results of running this file are saved in:./result_01/st06_filted_vis.mat, ./result_01/st06_filted_non.mat(2)  ./ st08_vox_within_contact.mThis code is mainly used to find which voxels in the standard space are within the 8mm range of the recorded electrode. The results of running this file are saved in:./result_01/st08_vox_within_contact_radius_vis_10.mat(3)  ./st09_vox_subjNum_elecNum.m, ./st10_reorg_st09.mThis analysis mainly calculates the number of subjects available for each voxel in the standard space and reorganizes the result data for subsequent analysis. The results of the analysis are stored in:./result_01/st09_all_vox_subjNum.mat (This file is used in ./Other_Analysis/st09_... for showing the number of patients contributing electrode contacts to each neocortical location (Fig. 2))./result_01/st09_final_5_vox_subj_metric.mat./result_01/st10_final_5_vox_subj_metric.mat(4)  ./st12_01_true_tstat.mThis code is used to calculate the true t-values of each voxel, which is mainly used to compare with the null-distribution to determine significance. The results of the analysis are stored in:./result_01/st12_tstats_voxs.mat(5)  ./ st13_01_get_eachsubj_brain.m./st13_02_permut1000_eachbrain.m./ st13_03_permut1000_fullbrain.m./st14_01_tstat_permut1000.m./st15_01_group_distribution.mThese codes are mainly used to implement the following parts of the article's Methods“To determine the significance threshold, we randomly sign-flipped half of the values at each voxel for each patient’s brain map and recomputed t-statistics at the group level. By performing this procedure 1000 times, a null distribution was generated. Finally, the 2.5th and 97.5th percentiles of this null distribution were identified as negative and positive significance thresholds, respectively.”The final generated file (./result_01/ st15_01_group_threshold.mat) contains the threshold used to determine significance.(6)  ./ st15_02_get_vol.m./st15_03_to_nifti.py./st15_04_plot_surf.pyThis section of code compares the true t-values with the significance threshold, and then presents the t-values and their distribution of significant voxels (Fig.4 A, note: the colorbar here was flipped in the article figure for better describing the steep/flattened changes of aperiodic 1/f slope).(7)  ./st20_get_vol.matThis code calculates the distribution of the percentage of significant voxels among 22 brain regions of the HCP atlas. (This result was also used in ./Other_Analysis/st01_... for Fig.4 B)(8)  ./ st22_yeo7.mThe distribution of the percentage of significant voxels among yeo7 networks. (This result was also used in ./Other_Analysis/st02_... for Fig.4 C)Note: For the code in./02_EI_controlTrial_stimulation_vs_baseline,./03_EI_stimulationPeriod_halluTrial_vs_controlTrial,./04_EI_baselinePeriod_halluTrial_vs_controlTrial, the process is the same as that in ./01_EI_hallucinationTrial_stimulation_vs_baseline as described above.3.    ./Other_Analysis(1)  ./cal_1f.pyCode for calculating aperiodic 1/f slope, which was already mentioned above.(2)  ./stimcontact_info.matThe number of stimulation contacts that induced visual hallucination in each region of hcp22, and the total number of stimulation contacts in each region of hcp22.(3)  ./ st01_shuffle_b.m, ./st01_shuffle_b_supp.mThese codes were used for permutation test for comparing the proportion of significant voxels using Yeo7 atlas between the two types of trials. (Fig.4 B, Fig. S2 B) (./yeo7_bar.csv was the used, which was generated in the above E/I analysis process).(4)  ./st02_shuffle_c.m, ./st02_shuffle_c_supp.mThese codes were used for permutation test for comparing the proportion of significant voxels using HCP22 atlas between the two types of trials. (Fig.4 C, Fig. S2 C) (./hcp22_bar.csv was the used, which was generated in the above E/I analysis process).(5)  ./ st09_01_subjNum_cortex.m./ st09_02_to_nifti.py./ st09_03_plot_subjNum.pyThese codes were used to show the number of patients contributing electrode contacts to each neocortical location (Fig. 2). The data used here were generated in the previous E/I analysis as mentioned above.4.    ./Phi_Analysis(1)  ./brain_atlasThis folder contains brain structural atlas used in the information integration analysis.(2)  ./ComFilesThis folder contains some pre-generated data used to assist in information integration calculations.(3)  ./PhiToolbox-masterThis fold contains the toolbox for calculating phi (https://github.com/oizumi-lab/PhiToolbox)(4)  ./result_01/st05_lfp_vis, ./result_01/st05_lfp_nonThese folders contain LFP signals for analyzing integrating information (_vis for hallucination trials, _non for control trials).(5)  ./st07_filter_1.mThis code choses sessions where recording contacts distributed over more than one brain region and less than 15 brain regions. (in the following analysis process, only sessions where recording contacts distributed over more than 2 brain region and less than 15 brain regions were used)(6)  ./ st08_cal_phi_vis.m, ./ st08_fun.mThese two codes are used to calculate phi. (PhiToolbox was used, https://github.com/oizumi-lab/PhiToolbox)(7)  ./ st70_find_tau_vis.m, ./ st70_find_tau_non.mThese codes were used to find t that yielded the highest F* across all lag times. (For both hallucination trials and control trials, the result was t = 175.8 ms.)(8)  ./ st71_avg_phi_non.m, ./ st71_avg_phi_vis.m, ./st72_test.mThese codes were used to investigate the changes of integrated information during visual hallucinations (the result was used for Fig.5 A).(9)  ./ st76_all_phis_non.m, ./ st76_all_phis_vis.m, ./ st77_zs_reorganize.mThese codes were used to get MIP information across all subsystems where contacts distributed over more than two brain regions (and less than 15 brain regions) when t = 175.8 ms as calculated above.(10) st78_zs_cal.m, st79_graph.pyThe code for analyzing the MIP (please referring the Method “Analyzinig the Minimum Information Partitions”). Fig.5 and Fig. S1 could be generated using these codes.(11) ./ st101_zs_non_unchange.mThe code was used to show the normalized number of pairs of brain regions whose relationship to the MIP were unchanged during the stimulation period compared to the baseline for control trials. (Fig5. C) 
description: Here are the relevant codes and data used in the analysis process of this article. To facilitate your better understanding of the entire process, we have organized the analysis code according to the analysis process and retained the analysis results of major steps.This folder includes several main directories, here is a brief introduction to their functions, and then a detailed introduction to the contents of each folder:(1)  ./brain_atlas, this contains some brain structural atlas used in the analysis, and another part of the brain structural atlas are in ./Phi_Analysis/brain_atlas(2)  ./myfun, this folder contains some general functions used in programming(3)  ./dataForEI, the data used in the E/I anlaysis(4)  ./01_EI_hallucinationTrial_stimulation_vs_baseline, in this folder, we compare the E/I difference between the electrical stimulation period and the baseline period for the visual hallucination trials(5)  ./02_EI_controlTrial_stimulation_vs_baseline, in this folder, we compare the E/I difference between the electrical stimulation period and the baseline period for the control trials(6)  ./03_EI_stimulationPeriod_halluTrial_vs_controlTrial, in this folder, we compare the E/I difference between the two types of trials during the electrical stimulation period(7)  ./04_EI_baselinePeriod_halluTrial_vs_controlTrial, in this folder, we compare the E/I difference between the two types of trials during the baseline period(8)  ./Phi_Analysis, this folder contains analysis related to information integration(9)  ./Other_Analysis, this folder contains other related analysisNext, let's introduce the contents of each subfolder in detail:1.    ./dataForEI(1)  st05_elec_value_mat.mat, st05_elec_value_mat_nohall.matThese two files respectively contain the aperiodic 1/f values calculated for each recorded electrode in the visual hallucination trials and control trials, as well as the coordinates of each electrode in the standard MNI space. (The code for calculating the aperiodic 1/f values is placed in ./Other_Analysis/cal_1f.py, FOOOF toolbox(Donoghue et al., 2020) was used).2.    ./01_EI_hallucinationTrial_stimulation_vs_baseline(1)  ./ st06_filtered_data.mThis code is mainly used to find the recording contacts that are shared by hallucination trials and control trials, and these shared contracts will be used for subsequent analysis. The results of running this file are saved in:./result_01/st06_filted_vis.mat, ./result_01/st06_filted_non.mat(2)  ./ st08_vox_within_contact.mThis code is mainly used to find which voxels in the standard space are within the 8mm range of the recorded electrode. The results of running this file are saved in:./result_01/st08_vox_within_contact_radius_vis_10.mat(3)  ./st09_vox_subjNum_elecNum.m, ./st10_reorg_st09.mThis analysis mainly calculates the number of subjects available for each voxel in the standard space and reorganizes the result data for subsequent analysis. The results of the analysis are stored in:./result_01/st09_all_vox_subjNum.mat (This file is used in ./Other_Analysis/st09_... for showing the number of patients contributing electrode contacts to each neocortical location (Fig. 2))./result_01/st09_final_5_vox_subj_metric.mat./result_01/st10_final_5_vox_subj_metric.mat(4)  ./st12_01_true_tstat.mThis code is used to calculate the true t-values of each voxel, which is mainly used to compare with the null-distribution to determine significance. The results of the analysis are stored in:./result_01/st12_tstats_voxs.mat(5)  ./ st13_01_get_eachsubj_brain.m./st13_02_permut1000_eachbrain.m./ st13_03_permut1000_fullbrain.m./st14_01_tstat_permut1000.m./st15_01_group_distribution.mThese codes are mainly used to implement the following parts of the article's Methods“To determine the significance threshold, we randomly sign-flipped half of the values at each voxel for each patient’s brain map and recomputed t-statistics at the group level. By performing this procedure 1000 times, a null distribution was generated. Finally, the 2.5th and 97.5th percentiles of this null distribution were identified as negative and positive significance thresholds, respectively.”The final generated file (./result_01/ st15_01_group_threshold.mat) contains the threshold used to determine significance.(6)  ./ st15_02_get_vol.m./st15_03_to_nifti.py./st15_04_plot_surf.pyThis section of code compares the true t-values with the significance threshold, and then presents the t-values and their distribution of significant voxels (Fig.4 A, note: the colorbar here was flipped in the article figure for better describing the steep/flattened changes of aperiodic 1/f slope).(7)  ./st20_get_vol.matThis code calculates the distribution of the percentage of significant voxels among 22 brain regions of the HCP atlas. (This result was also used in ./Other_Analysis/st01_... for Fig.4 B)(8)  ./ st22_yeo7.mThe distribution of the percentage of significant voxels among yeo7 networks. (This result was also used in ./Other_Analysis/st02_... for Fig.4 C)Note: For the code in./02_EI_controlTrial_stimulation_vs_baseline,./03_EI_stimulationPeriod_halluTrial_vs_controlTrial,./04_EI_baselinePeriod_halluTrial_vs_controlTrial, the process is the same as that in ./01_EI_hallucinationTrial_stimulation_vs_baseline as described above.3.    ./Other_Analysis(1)  ./cal_1f.pyCode for calculating aperiodic 1/f slope, which was already mentioned above.(2)  ./stimcontact_info.matThe number of stimulation contacts that induced visual hallucination in each region of hcp22, and the total number of stimulation contacts in each region of hcp22.(3)  ./ st01_shuffle_b.m, ./st01_shuffle_b_supp.mThese codes were used for permutation test for comparing the proportion of significant voxels using Yeo7 atlas between the two types of trials. (Fig.4 B, Fig. S2 B) (./yeo7_bar.csv was the used, which was generated in the above E/I analysis process).(4)  ./st02_shuffle_c.m, ./st02_shuffle_c_supp.mThese codes were used for permutation test for comparing the proportion of significant voxels using HCP22 atlas between the two types of trials. (Fig.4 C, Fig. S2 C) (./hcp22_bar.csv was the used, which was generated in the above E/I analysis process).(5)  ./ st09_01_subjNum_cortex.m./ st09_02_to_nifti.py./ st09_03_plot_subjNum.pyThese codes were used to show the number of patients contributing electrode contacts to each neocortical location (Fig. 2). The data used here were generated in the previous E/I analysis as mentioned above.4.    ./Phi_Analysis(1)  ./brain_atlasThis folder contains brain structural atlas used in the information integration analysis.(2)  ./ComFilesThis folder contains some pre-generated data used to assist in information integration calculations.(3)  ./PhiToolbox-masterThis fold contains the toolbox for calculating phi (https://github.com/oizumi-lab/PhiToolbox)(4)  ./result_01/st05_lfp_vis, ./result_01/st05_lfp_nonThese folders contain LFP signals for analyzing integrating information (_vis for hallucination trials, _non for control trials).(5)  ./st07_filter_1.mThis code choses sessions where recording contacts distributed over more than one brain region and less than 15 brain regions. (in the following analysis process, only sessions where recording contacts distributed over more than 2 brain region and less than 15 brain regions were used)(6)  ./ st08_cal_phi_vis.m, ./ st08_fun.mThese two codes are used to calculate phi. (PhiToolbox was used, https://github.com/oizumi-lab/PhiToolbox)(7)  ./ st70_find_tau_vis.m, ./ st70_find_tau_non.mThese codes were used to find t that yielded the highest F* across all lag times. (For both hallucination trials and control trials, the result was t = 175.8 ms.)(8)  ./ st71_avg_phi_non.m, ./ st71_avg_phi_vis.m, ./st72_test.mThese codes were used to investigate the changes of integrated information during visual hallucinations (the result was used for Fig.5 A).(9)  ./ st76_all_phis_non.m, ./ st76_all_phis_vis.m, ./ st77_zs_reorganize.mThese codes were used to get MIP information across all subsystems where contacts distributed over more than two brain regions (and less than 15 brain regions) when t = 175.8 ms as calculated above.(10) st78_zs_cal.m, st79_graph.pyThe code for analyzing the MIP (please referring the Method “Analyzinig the Minimum Information Partitions”). Fig.5 and Fig. S1 could be generated using these codes.(11) ./ st101_zs_non_unchange.mThe code was used to show the normalized number of pairs of brain regions whose relationship to the MIP were unchanged during the stimulation period compared to the baseline for control trials. (Fig5. C)