diff --git a/BrainNetworksInPython/datasets/NSPN_WhitakerVertes_PNAS2016/500.names.txt b/BrainNetworksInPython/datasets/NSPN_WhitakerVertes_PNAS2016/500.names.txt index b3e89da..bd0fe25 100644 --- a/BrainNetworksInPython/datasets/NSPN_WhitakerVertes_PNAS2016/500.names.txt +++ b/BrainNetworksInPython/datasets/NSPN_WhitakerVertes_PNAS2016/500.names.txt @@ -1,44 +1,3 @@ -Left-Cerebral-White-Matter -Left-Lateral-Ventricle -Left-Inf-Lat-Vent -Left-Cerebellum-White-Matter -Left-Cerebellum-Cortex -Left-Thalamus-Proper -Left-Caudate -Left-Putamen -Left-Pallidum -3rd-Ventricle -4th-Ventricle -Brain-Stem -Left-Hippocampus -Left-Amygdala -CSF -Left-Accumbens-area -Left-VentralDC -Left-vessel -Left-choroid-plexus -Right-Cerebral-White-Matter -Right-Lateral-Ventricle -Right-Inf-Lat-Vent -Right-Cerebellum-White-Matter -Right-Cerebellum-Cortex -Right-Thalamus-Proper -Right-Caudate -Right-Putamen -Right-Pallidum -Right-Hippocampus -Right-Amygdala -Right-Accumbens-area -Right-VentralDC -Right-vessel -Right-choroid-plexus -WM-hypointensities -Optic-Chiasm -CC_Posterior -CC_Mid_Posterior -CC_Central -CC_Mid_Anterior -CC_Anterior lh_bankssts_part1 lh_bankssts_part2 lh_caudalanteriorcingulate_part1 diff --git a/BrainNetworksInPython/datasets/NSPN_WhitakerVertes_PNAS2016/PARC_500aparc_thickness_behavmerge.csv b/BrainNetworksInPython/datasets/NSPN_WhitakerVertes_PNAS2016/PARC_500aparc_thickness_behavmerge.csv index 4fb9da6..5fca40a 100644 --- a/BrainNetworksInPython/datasets/NSPN_WhitakerVertes_PNAS2016/PARC_500aparc_thickness_behavmerge.csv +++ b/BrainNetworksInPython/datasets/NSPN_WhitakerVertes_PNAS2016/PARC_500aparc_thickness_behavmerge.csv @@ -1,4 +1,4 @@ -Unnamed: 0,nspn_id,occ,centre,study_primary,age_scan,sex,male,age_bin,mri_centre,wbic,ucl,discovery,validation,lh_unknown_part1_thickness,lh_bankssts_part1_thickness,lh_bankssts_part2_thickness,lh_caudalanteriorcingulate_part1_thickness,lh_caudalmiddlefrontal_part1_thickness,lh_caudalmiddlefrontal_part2_thickness,lh_caudalmiddlefrontal_part3_thickness,lh_caudalmiddlefrontal_part4_thickness,lh_cuneus_part1_thickness,lh_cuneus_part2_thickness,lh_entorhinal_part1_thickness,lh_fusiform_part1_thickness,lh_fusiform_part2_thickness,lh_fusiform_part3_thickness,lh_fusiform_part4_thickness,lh_fusiform_part5_thickness,lh_inferiorparietal_part1_thickness,lh_inferiorparietal_part2_thickness,lh_inferiorparietal_part3_thickness,lh_inferiorparietal_part4_thickness,lh_inferiorparietal_part5_thickness,lh_inferiorparietal_part6_thickness,lh_inferiorparietal_part7_thickness,lh_inferiorparietal_part8_thickness,lh_inferiortemporal_part1_thickness,lh_inferiortemporal_part2_thickness,lh_inferiortemporal_part3_thickness,lh_inferiortemporal_part4_thickness,lh_inferiortemporal_part5_thickness,lh_inferiortemporal_part6_thickness,lh_isthmuscingulate_part1_thickness,lh_isthmuscingulate_part2_thickness,lh_lateraloccipital_part1_thickness,lh_lateraloccipital_part2_thickness,lh_lateraloccipital_part3_thickness,lh_lateraloccipital_part4_thickness,lh_lateraloccipital_part5_thickness,lh_lateraloccipital_part6_thickness,lh_lateraloccipital_part7_thickness,lh_lateraloccipital_part8_thickness,lh_lateraloccipital_part9_thickness,lh_lateralorbitofrontal_part1_thickness,lh_lateralorbitofrontal_part2_thickness,lh_lateralorbitofrontal_part3_thickness,lh_lateralorbitofrontal_part4_thickness,lh_lingual_part1_thickness,lh_lingual_part2_thickness,lh_lingual_part3_thickness,lh_lingual_part4_thickness,lh_lingual_part5_thickness,lh_lingual_part6_thickness,lh_medialorbitofrontal_part1_thickness,lh_medialorbitofrontal_part2_thickness,lh_medialorbitofrontal_part3_thickness,lh_middletemporal_part1_thickness,lh_middletemporal_part2_thickness,lh_middletemporal_part3_thickness,lh_middletemporal_part4_thickness,lh_middletemporal_part5_thickness,lh_parahippocampal_part1_thickness,lh_parahippocampal_part2_thickness,lh_paracentral_part1_thickness,lh_paracentral_part2_thickness,lh_paracentral_part3_thickness,lh_parsopercularis_part1_thickness,lh_parsopercularis_part2_thickness,lh_parsopercularis_part3_thickness,lh_parsorbitalis_part1_thickness,lh_parstriangularis_part1_thickness,lh_parstriangularis_part2_thickness,lh_pericalcarine_part1_thickness,lh_pericalcarine_part2_thickness,lh_postcentral_part1_thickness,lh_postcentral_part2_thickness,lh_postcentral_part3_thickness,lh_postcentral_part4_thickness,lh_postcentral_part5_thickness,lh_postcentral_part6_thickness,lh_postcentral_part7_thickness,lh_postcentral_part8_thickness,lh_posteriorcingulate_part1_thickness,lh_posteriorcingulate_part2_thickness,lh_precentral_part1_thickness,lh_precentral_part2_thickness,lh_precentral_part3_thickness,lh_precentral_part4_thickness,lh_precentral_part5_thickness,lh_precentral_part6_thickness,lh_precentral_part7_thickness,lh_precentral_part8_thickness,lh_precentral_part9_thickness,lh_precuneus_part1_thickness,lh_precuneus_part2_thickness,lh_precuneus_part3_thickness,lh_precuneus_part4_thickness,lh_precuneus_part5_thickness,lh_precuneus_part6_thickness,lh_precuneus_part7_thickness,lh_rostralanteriorcingulate_part1_thickness,lh_rostralmiddlefrontal_part1_thickness,lh_rostralmiddlefrontal_part2_thickness,lh_rostralmiddlefrontal_part3_thickness,lh_rostralmiddlefrontal_part4_thickness,lh_rostralmiddlefrontal_part5_thickness,lh_rostralmiddlefrontal_part6_thickness,lh_rostralmiddlefrontal_part7_thickness,lh_rostralmiddlefrontal_part8_thickness,lh_rostralmiddlefrontal_part9_thickness,lh_rostralmiddlefrontal_part10_thickness,lh_superiorfrontal_part1_thickness,lh_superiorfrontal_part2_thickness,lh_superiorfrontal_part3_thickness,lh_superiorfrontal_part4_thickness,lh_superiorfrontal_part5_thickness,lh_superiorfrontal_part6_thickness,lh_superiorfrontal_part7_thickness,lh_superiorfrontal_part8_thickness,lh_superiorfrontal_part9_thickness,lh_superiorfrontal_part10_thickness,lh_superiorfrontal_part11_thickness,lh_superiorfrontal_part12_thickness,lh_superiorfrontal_part13_thickness,lh_superiorparietal_part1_thickness,lh_superiorparietal_part2_thickness,lh_superiorparietal_part3_thickness,lh_superiorparietal_part4_thickness,lh_superiorparietal_part5_thickness,lh_superiorparietal_part6_thickness,lh_superiorparietal_part7_thickness,lh_superiorparietal_part8_thickness,lh_superiorparietal_part9_thickness,lh_superiorparietal_part10_thickness,lh_superiortemporal_part1_thickness,lh_superiortemporal_part2_thickness,lh_superiortemporal_part3_thickness,lh_superiortemporal_part4_thickness,lh_superiortemporal_part5_thickness,lh_superiortemporal_part6_thickness,lh_superiortemporal_part7_thickness,lh_supramarginal_part1_thickness,lh_supramarginal_part2_thickness,lh_supramarginal_part3_thickness,lh_supramarginal_part4_thickness,lh_supramarginal_part5_thickness,lh_supramarginal_part6_thickness,lh_supramarginal_part7_thickness,lh_frontalpole_part1_thickness,lh_temporalpole_part1_thickness,lh_transversetemporal_part1_thickness,lh_insula_part1_thickness,lh_insula_part2_thickness,lh_insula_part3_thickness,lh_insula_part4_thickness,rh_unknown_part1_thickness,rh_bankssts_part1_thickness,rh_bankssts_part2_thickness,rh_caudalanteriorcingulate_part1_thickness,rh_caudalmiddlefrontal_part1_thickness,rh_caudalmiddlefrontal_part2_thickness,rh_caudalmiddlefrontal_part3_thickness,rh_caudalmiddlefrontal_part4_thickness,rh_cuneus_part1_thickness,rh_cuneus_part2_thickness,rh_cuneus_part3_thickness,rh_entorhinal_part1_thickness,rh_fusiform_part1_thickness,rh_fusiform_part2_thickness,rh_fusiform_part3_thickness,rh_fusiform_part4_thickness,rh_fusiform_part5_thickness,rh_inferiorparietal_part1_thickness,rh_inferiorparietal_part2_thickness,rh_inferiorparietal_part3_thickness,rh_inferiorparietal_part4_thickness,rh_inferiorparietal_part5_thickness,rh_inferiorparietal_part6_thickness,rh_inferiorparietal_part7_thickness,rh_inferiorparietal_part8_thickness,rh_inferiorparietal_part9_thickness,rh_inferiorparietal_part10_thickness,rh_inferiortemporal_part1_thickness,rh_inferiortemporal_part2_thickness,rh_inferiortemporal_part3_thickness,rh_inferiortemporal_part4_thickness,rh_inferiortemporal_part5_thickness,rh_isthmuscingulate_part1_thickness,rh_isthmuscingulate_part2_thickness,rh_lateraloccipital_part1_thickness,rh_lateraloccipital_part2_thickness,rh_lateraloccipital_part3_thickness,rh_lateraloccipital_part4_thickness,rh_lateraloccipital_part5_thickness,rh_lateraloccipital_part6_thickness,rh_lateraloccipital_part7_thickness,rh_lateraloccipital_part8_thickness,rh_lateraloccipital_part9_thickness,rh_lateralorbitofrontal_part1_thickness,rh_lateralorbitofrontal_part2_thickness,rh_lateralorbitofrontal_part3_thickness,rh_lateralorbitofrontal_part4_thickness,rh_lingual_part1_thickness,rh_lingual_part2_thickness,rh_lingual_part3_thickness,rh_lingual_part4_thickness,rh_lingual_part5_thickness,rh_lingual_part6_thickness,rh_medialorbitofrontal_part1_thickness,rh_medialorbitofrontal_part2_thickness,rh_medialorbitofrontal_part3_thickness,rh_middletemporal_part1_thickness,rh_middletemporal_part2_thickness,rh_middletemporal_part3_thickness,rh_middletemporal_part4_thickness,rh_middletemporal_part5_thickness,rh_middletemporal_part6_thickness,rh_parahippocampal_part1_thickness,rh_parahippocampal_part2_thickness,rh_paracentral_part1_thickness,rh_paracentral_part2_thickness,rh_paracentral_part3_thickness,rh_parsopercularis_part1_thickness,rh_parsopercularis_part2_thickness,rh_parsopercularis_part3_thickness,rh_parsorbitalis_part1_thickness,rh_parstriangularis_part1_thickness,rh_parstriangularis_part2_thickness,rh_parstriangularis_part3_thickness,rh_pericalcarine_part1_thickness,rh_pericalcarine_part2_thickness,rh_pericalcarine_part3_thickness,rh_postcentral_part1_thickness,rh_postcentral_part2_thickness,rh_postcentral_part3_thickness,rh_postcentral_part4_thickness,rh_postcentral_part5_thickness,rh_postcentral_part6_thickness,rh_postcentral_part7_thickness,rh_postcentral_part8_thickness,rh_posteriorcingulate_part1_thickness,rh_posteriorcingulate_part2_thickness,rh_precentral_part1_thickness,rh_precentral_part2_thickness,rh_precentral_part3_thickness,rh_precentral_part4_thickness,rh_precentral_part5_thickness,rh_precentral_part6_thickness,rh_precentral_part7_thickness,rh_precentral_part8_thickness,rh_precentral_part9_thickness,rh_precuneus_part1_thickness,rh_precuneus_part2_thickness,rh_precuneus_part3_thickness,rh_precuneus_part4_thickness,rh_precuneus_part5_thickness,rh_precuneus_part6_thickness,rh_precuneus_part7_thickness,rh_rostralanteriorcingulate_part1_thickness,rh_rostralmiddlefrontal_part1_thickness,rh_rostralmiddlefrontal_part2_thickness,rh_rostralmiddlefrontal_part3_thickness,rh_rostralmiddlefrontal_part4_thickness,rh_rostralmiddlefrontal_part5_thickness,rh_rostralmiddlefrontal_part6_thickness,rh_rostralmiddlefrontal_part7_thickness,rh_rostralmiddlefrontal_part8_thickness,rh_rostralmiddlefrontal_part9_thickness,rh_rostralmiddlefrontal_part10_thickness,rh_superiorfrontal_part1_thickness,rh_superiorfrontal_part2_thickness,rh_superiorfrontal_part3_thickness,rh_superiorfrontal_part4_thickness,rh_superiorfrontal_part5_thickness,rh_superiorfrontal_part6_thickness,rh_superiorfrontal_part7_thickness,rh_superiorfrontal_part8_thickness,rh_superiorfrontal_part9_thickness,rh_superiorfrontal_part10_thickness,rh_superiorfrontal_part11_thickness,rh_superiorfrontal_part12_thickness,rh_superiorfrontal_part13_thickness,rh_superiorparietal_part1_thickness,rh_superiorparietal_part2_thickness,rh_superiorparietal_part3_thickness,rh_superiorparietal_part4_thickness,rh_superiorparietal_part5_thickness,rh_superiorparietal_part6_thickness,rh_superiorparietal_part7_thickness,rh_superiorparietal_part8_thickness,rh_superiorparietal_part9_thickness,rh_superiorparietal_part10_thickness,rh_superiortemporal_part1_thickness,rh_superiortemporal_part2_thickness,rh_superiortemporal_part3_thickness,rh_superiortemporal_part4_thickness,rh_superiortemporal_part5_thickness,rh_superiortemporal_part6_thickness,rh_supramarginal_part1_thickness,rh_supramarginal_part2_thickness,rh_supramarginal_part3_thickness,rh_supramarginal_part4_thickness,rh_supramarginal_part5_thickness,rh_supramarginal_part6_thickness,rh_supramarginal_part7_thickness,rh_frontalpole_part1_thickness,rh_temporalpole_part1_thickness,rh_transversetemporal_part1_thickness,rh_insula_part1_thickness,rh_insula_part2_thickness,rh_insula_part3_thickness,rh_insula_part4_thickness +Unnamed: 0,nspn_id,occ,centre,study_primary,age_scan,sex,male,age_bin,mri_centre,wbic,ucl,discovery,validation,lh_unknown_part1,lh_bankssts_part1,lh_bankssts_part2,lh_caudalanteriorcingulate_part1,lh_caudalmiddlefrontal_part1,lh_caudalmiddlefrontal_part2,lh_caudalmiddlefrontal_part3,lh_caudalmiddlefrontal_part4,lh_cuneus_part1,lh_cuneus_part2,lh_entorhinal_part1,lh_fusiform_part1,lh_fusiform_part2,lh_fusiform_part3,lh_fusiform_part4,lh_fusiform_part5,lh_inferiorparietal_part1,lh_inferiorparietal_part2,lh_inferiorparietal_part3,lh_inferiorparietal_part4,lh_inferiorparietal_part5,lh_inferiorparietal_part6,lh_inferiorparietal_part7,lh_inferiorparietal_part8,lh_inferiortemporal_part1,lh_inferiortemporal_part2,lh_inferiortemporal_part3,lh_inferiortemporal_part4,lh_inferiortemporal_part5,lh_inferiortemporal_part6,lh_isthmuscingulate_part1,lh_isthmuscingulate_part2,lh_lateraloccipital_part1,lh_lateraloccipital_part2,lh_lateraloccipital_part3,lh_lateraloccipital_part4,lh_lateraloccipital_part5,lh_lateraloccipital_part6,lh_lateraloccipital_part7,lh_lateraloccipital_part8,lh_lateraloccipital_part9,lh_lateralorbitofrontal_part1,lh_lateralorbitofrontal_part2,lh_lateralorbitofrontal_part3,lh_lateralorbitofrontal_part4,lh_lingual_part1,lh_lingual_part2,lh_lingual_part3,lh_lingual_part4,lh_lingual_part5,lh_lingual_part6,lh_medialorbitofrontal_part1,lh_medialorbitofrontal_part2,lh_medialorbitofrontal_part3,lh_middletemporal_part1,lh_middletemporal_part2,lh_middletemporal_part3,lh_middletemporal_part4,lh_middletemporal_part5,lh_parahippocampal_part1,lh_parahippocampal_part2,lh_paracentral_part1,lh_paracentral_part2,lh_paracentral_part3,lh_parsopercularis_part1,lh_parsopercularis_part2,lh_parsopercularis_part3,lh_parsorbitalis_part1,lh_parstriangularis_part1,lh_parstriangularis_part2,lh_pericalcarine_part1,lh_pericalcarine_part2,lh_postcentral_part1,lh_postcentral_part2,lh_postcentral_part3,lh_postcentral_part4,lh_postcentral_part5,lh_postcentral_part6,lh_postcentral_part7,lh_postcentral_part8,lh_posteriorcingulate_part1,lh_posteriorcingulate_part2,lh_precentral_part1,lh_precentral_part2,lh_precentral_part3,lh_precentral_part4,lh_precentral_part5,lh_precentral_part6,lh_precentral_part7,lh_precentral_part8,lh_precentral_part9,lh_precuneus_part1,lh_precuneus_part2,lh_precuneus_part3,lh_precuneus_part4,lh_precuneus_part5,lh_precuneus_part6,lh_precuneus_part7,lh_rostralanteriorcingulate_part1,lh_rostralmiddlefrontal_part1,lh_rostralmiddlefrontal_part2,lh_rostralmiddlefrontal_part3,lh_rostralmiddlefrontal_part4,lh_rostralmiddlefrontal_part5,lh_rostralmiddlefrontal_part6,lh_rostralmiddlefrontal_part7,lh_rostralmiddlefrontal_part8,lh_rostralmiddlefrontal_part9,lh_rostralmiddlefrontal_part10,lh_superiorfrontal_part1,lh_superiorfrontal_part2,lh_superiorfrontal_part3,lh_superiorfrontal_part4,lh_superiorfrontal_part5,lh_superiorfrontal_part6,lh_superiorfrontal_part7,lh_superiorfrontal_part8,lh_superiorfrontal_part9,lh_superiorfrontal_part10,lh_superiorfrontal_part11,lh_superiorfrontal_part12,lh_superiorfrontal_part13,lh_superiorparietal_part1,lh_superiorparietal_part2,lh_superiorparietal_part3,lh_superiorparietal_part4,lh_superiorparietal_part5,lh_superiorparietal_part6,lh_superiorparietal_part7,lh_superiorparietal_part8,lh_superiorparietal_part9,lh_superiorparietal_part10,lh_superiortemporal_part1,lh_superiortemporal_part2,lh_superiortemporal_part3,lh_superiortemporal_part4,lh_superiortemporal_part5,lh_superiortemporal_part6,lh_superiortemporal_part7,lh_supramarginal_part1,lh_supramarginal_part2,lh_supramarginal_part3,lh_supramarginal_part4,lh_supramarginal_part5,lh_supramarginal_part6,lh_supramarginal_part7,lh_frontalpole_part1,lh_temporalpole_part1,lh_transversetemporal_part1,lh_insula_part1,lh_insula_part2,lh_insula_part3,lh_insula_part4,rh_unknown_part1,rh_bankssts_part1,rh_bankssts_part2,rh_caudalanteriorcingulate_part1,rh_caudalmiddlefrontal_part1,rh_caudalmiddlefrontal_part2,rh_caudalmiddlefrontal_part3,rh_caudalmiddlefrontal_part4,rh_cuneus_part1,rh_cuneus_part2,rh_cuneus_part3,rh_entorhinal_part1,rh_fusiform_part1,rh_fusiform_part2,rh_fusiform_part3,rh_fusiform_part4,rh_fusiform_part5,rh_inferiorparietal_part1,rh_inferiorparietal_part2,rh_inferiorparietal_part3,rh_inferiorparietal_part4,rh_inferiorparietal_part5,rh_inferiorparietal_part6,rh_inferiorparietal_part7,rh_inferiorparietal_part8,rh_inferiorparietal_part9,rh_inferiorparietal_part10,rh_inferiortemporal_part1,rh_inferiortemporal_part2,rh_inferiortemporal_part3,rh_inferiortemporal_part4,rh_inferiortemporal_part5,rh_isthmuscingulate_part1,rh_isthmuscingulate_part2,rh_lateraloccipital_part1,rh_lateraloccipital_part2,rh_lateraloccipital_part3,rh_lateraloccipital_part4,rh_lateraloccipital_part5,rh_lateraloccipital_part6,rh_lateraloccipital_part7,rh_lateraloccipital_part8,rh_lateraloccipital_part9,rh_lateralorbitofrontal_part1,rh_lateralorbitofrontal_part2,rh_lateralorbitofrontal_part3,rh_lateralorbitofrontal_part4,rh_lingual_part1,rh_lingual_part2,rh_lingual_part3,rh_lingual_part4,rh_lingual_part5,rh_lingual_part6,rh_medialorbitofrontal_part1,rh_medialorbitofrontal_part2,rh_medialorbitofrontal_part3,rh_middletemporal_part1,rh_middletemporal_part2,rh_middletemporal_part3,rh_middletemporal_part4,rh_middletemporal_part5,rh_middletemporal_part6,rh_parahippocampal_part1,rh_parahippocampal_part2,rh_paracentral_part1,rh_paracentral_part2,rh_paracentral_part3,rh_parsopercularis_part1,rh_parsopercularis_part2,rh_parsopercularis_part3,rh_parsorbitalis_part1,rh_parstriangularis_part1,rh_parstriangularis_part2,rh_parstriangularis_part3,rh_pericalcarine_part1,rh_pericalcarine_part2,rh_pericalcarine_part3,rh_postcentral_part1,rh_postcentral_part2,rh_postcentral_part3,rh_postcentral_part4,rh_postcentral_part5,rh_postcentral_part6,rh_postcentral_part7,rh_postcentral_part8,rh_posteriorcingulate_part1,rh_posteriorcingulate_part2,rh_precentral_part1,rh_precentral_part2,rh_precentral_part3,rh_precentral_part4,rh_precentral_part5,rh_precentral_part6,rh_precentral_part7,rh_precentral_part8,rh_precentral_part9,rh_precuneus_part1,rh_precuneus_part2,rh_precuneus_part3,rh_precuneus_part4,rh_precuneus_part5,rh_precuneus_part6,rh_precuneus_part7,rh_rostralanteriorcingulate_part1,rh_rostralmiddlefrontal_part1,rh_rostralmiddlefrontal_part2,rh_rostralmiddlefrontal_part3,rh_rostralmiddlefrontal_part4,rh_rostralmiddlefrontal_part5,rh_rostralmiddlefrontal_part6,rh_rostralmiddlefrontal_part7,rh_rostralmiddlefrontal_part8,rh_rostralmiddlefrontal_part9,rh_rostralmiddlefrontal_part10,rh_superiorfrontal_part1,rh_superiorfrontal_part2,rh_superiorfrontal_part3,rh_superiorfrontal_part4,rh_superiorfrontal_part5,rh_superiorfrontal_part6,rh_superiorfrontal_part7,rh_superiorfrontal_part8,rh_superiorfrontal_part9,rh_superiorfrontal_part10,rh_superiorfrontal_part11,rh_superiorfrontal_part12,rh_superiorfrontal_part13,rh_superiorparietal_part1,rh_superiorparietal_part2,rh_superiorparietal_part3,rh_superiorparietal_part4,rh_superiorparietal_part5,rh_superiorparietal_part6,rh_superiorparietal_part7,rh_superiorparietal_part8,rh_superiorparietal_part9,rh_superiorparietal_part10,rh_superiortemporal_part1,rh_superiortemporal_part2,rh_superiortemporal_part3,rh_superiortemporal_part4,rh_superiortemporal_part5,rh_superiortemporal_part6,rh_supramarginal_part1,rh_supramarginal_part2,rh_supramarginal_part3,rh_supramarginal_part4,rh_supramarginal_part5,rh_supramarginal_part6,rh_supramarginal_part7,rh_frontalpole_part1,rh_temporalpole_part1,rh_transversetemporal_part1,rh_insula_part1,rh_insula_part2,rh_insula_part3,rh_insula_part4 0,10356,0,Cambridge,2K_Cohort,20.761,Female,0.0,4,WBIC,1,0,0,1,0.863,2.722,2.674,2.53,2.833,2.896,2.635,2.698,2.115,2.07,3.099,2.917,2.886,2.548,2.601,2.969,2.523,2.335,2.481,2.625,2.572,3.012,3.022,2.643,2.823,2.576,2.307,2.567,2.386,2.931,2.827,2.494,2.438,2.442,2.082,2.763,1.666,2.335,2.024,1.925,2.348,2.475,3.146,2.692,2.868,2.37,1.86,2.551,1.955,2.224,2.432,2.956,2.777,2.764,3.401,3.106,3.31,3.417,3.04,2.473,2.745,2.419,2.853,2.774,2.624,2.759,2.609,2.519,2.816,2.564,1.657,2.006,1.836,2.814,1.875,2.81,1.937,1.835,2.384,1.907,2.7,2.369,2.639,3.011,2.601,2.705,2.685,2.722,2.781,2.735,2.594,2.645,2.648,2.328,2.452,2.196,2.316,2.713,2.784,2.267,2.779,2.316,2.622,2.705,2.636,2.267,2.492,2.883,2.475,2.992,2.7,3.065,2.876,3.042,2.953,2.948,3.266,2.986,2.728,2.687,2.763,3.15,2.104,2.075,2.424,2.326,2.124,2.364,2.608,2.322,2.527,2.434,2.581,3.216,2.889,3.15,2.359,2.67,2.499,2.397,2.57,2.819,3.033,2.788,2.827,2.484,2.831,3.42,2.652,2.84,3.701,3.339,3.57,0.901,2.523,2.58,2.308,2.613,2.717,2.562,2.641,2.199,1.738,2.059,3.418,2.573,2.767,2.493,2.658,2.359,2.684,2.629,2.789,2.593,2.476,2.234,2.521,2.752,2.864,2.582,3.016,2.993,2.666,2.393,3.036,2.846,2.415,1.614,2.377,1.899,2.234,2.75,2.238,2.087,1.909,2.67,2.63,2.293,2.529,2.201,2.317,1.906,2.178,1.89,2.105,2.334,2.514,2.315,2.224,3.022,3.055,3.154,2.739,2.951,2.984,2.349,2.481,2.282,2.941,2.348,2.571,2.515,2.466,2.42,2.506,2.435,2.775,2.047,1.686,1.864,1.886,2.526,1.836,2.825,2.173,2.123,1.917,1.812,2.479,2.344,2.734,2.755,2.925,2.64,2.985,2.719,2.931,2.226,2.443,2.412,2.403,2.299,2.239,2.421,2.331,2.234,2.292,2.702,1.931,2.425,2.101,2.65,2.398,2.675,2.594,2.859,2.15,2.851,2.588,3.064,2.811,2.578,3.067,2.769,2.934,2.742,2.952,3.127,2.754,3.016,2.237,2.185,2.271,2.026,2.383,2.415,2.158,2.352,2.535,2.153,3.338,2.711,3.085,2.881,2.79,2.574,2.258,2.669,2.848,2.758,2.592,2.841,2.318,2.486,3.526,2.638,3.308,2.583,3.188,3.089 1,10702,0,Cambridge,2K_Cohort,16.055,Male,1.0,2,WBIC,1,0,0,1,0.824,3.019,3.065,2.977,3.535,3.262,3.086,3.341,2.612,2.652,3.559,2.964,3.101,2.874,3.14,2.972,2.954,2.99,3.114,2.881,2.896,3.143,3.365,3.115,3.207,2.983,3.301,3.331,2.905,3.407,2.765,2.498,2.598,3.032,2.684,2.953,2.393,2.644,2.504,2.362,2.593,2.889,3.28,2.994,3.281,2.65,2.677,2.907,2.426,2.412,2.508,3.125,2.805,2.537,3.72,3.217,3.434,3.476,3.548,3.324,2.819,2.484,3.248,3.071,3.081,3.22,3.1,3.346,3.027,2.817,2.132,2.234,2.042,3.11,2.373,3.199,2.303,2.384,2.483,2.092,2.905,2.419,3.125,3.292,2.853,3.178,3.126,3.274,3.214,3.129,3.162,2.969,2.748,3.031,2.836,2.901,2.757,2.739,2.919,2.848,2.795,3.085,3.066,2.895,2.852,2.83,2.812,3.185,2.938,3.048,3.389,3.263,3.35,3.336,3.253,3.334,3.578,3.642,3.43,3.493,3.32,3.634,2.424,2.873,2.586,2.7,2.728,2.772,2.487,2.588,2.511,2.751,2.651,3.486,3.47,3.533,3.254,2.886,3.165,2.82,2.819,3.129,3.292,3.424,2.778,2.825,3.134,4.255,2.806,3.005,3.824,3.701,3.723,1.123,3.061,3.198,2.525,2.908,3.277,3.287,3.246,2.636,2.314,2.457,3.59,2.936,3.139,2.95,3.151,3.003,3.099,3.232,2.857,2.82,2.846,2.663,2.818,3.172,2.835,2.76,2.98,3.006,3.243,3.413,3.128,2.45,2.571,2.296,2.928,2.25,2.729,2.721,2.735,2.368,2.604,2.631,3.424,2.85,3.383,2.671,2.589,2.858,2.668,2.507,2.62,2.594,3.045,3.299,2.833,3.52,3.464,3.342,3.547,3.388,3.45,2.61,2.84,2.563,3.489,2.557,3.435,2.894,3.044,2.909,2.874,2.981,3.017,2.316,2.332,2.336,1.8,3.068,2.261,2.891,2.55,2.801,2.084,2.379,2.908,2.525,2.93,2.849,2.936,3.178,3.068,3.029,3.24,2.53,2.886,2.986,3.051,2.675,2.374,2.97,2.671,2.71,2.937,2.903,2.895,2.907,2.821,2.946,2.692,3.043,2.778,2.884,2.765,3.168,2.828,3.34,3.191,3.274,3.228,3.382,3.453,3.236,3.479,3.392,3.22,3.5,2.814,2.365,2.917,2.552,2.335,2.406,2.497,2.256,2.58,2.56,3.412,2.917,3.53,3.455,3.329,3.016,2.654,3.094,2.914,3.243,3.448,3.283,2.74,3.225,4.044,3.04,3.867,2.943,3.478,3.609 2,10736,0,Cambridge,2K_Cohort,14.897,Female,0.0,1,WBIC,1,0,1,0,0.796,2.907,2.792,2.86,3.25,3.139,2.828,3.527,2.224,2.2,3.593,3.145,3.246,2.976,3.172,3.056,2.764,2.918,3.05,3.063,2.815,2.927,3.301,2.976,3.2,3.09,3.226,3.296,2.763,2.974,2.808,2.57,2.096,3.006,2.228,3.067,2.028,2.435,2.547,2.246,2.556,3.064,3.145,2.881,2.943,2.651,2.644,2.732,2.488,2.292,2.713,3.096,2.823,2.905,3.497,3.156,3.432,3.184,3.528,2.318,2.524,2.449,2.937,2.722,3.018,2.93,2.708,2.726,3.084,2.623,2.251,2.288,1.824,3.38,2.264,2.716,2.156,2.191,2.601,2.633,2.916,2.375,2.806,2.915,3.052,2.723,3.255,2.882,2.764,3.054,2.798,3.036,2.322,2.88,2.844,2.886,2.626,2.913,3.132,2.518,2.641,3.005,2.969,3.035,2.592,2.859,2.989,2.947,2.987,3.32,2.858,2.857,3.17,3.529,3.045,3.408,3.412,3.318,3.259,3.275,3.008,3.302,2.567,2.8,2.404,2.74,2.54,2.55,2.735,2.553,2.387,2.657,2.566,3.388,3.096,3.43,2.897,2.888,2.841,2.843,3.026,3.54,2.996,3.12,3.02,2.829,3.41,3.805,2.664,2.854,3.683,3.241,3.203,0.933,2.731,2.997,2.715,2.745,3.25,3.272,2.95,2.513,2.014,2.27,3.142,2.806,3.233,3.346,3.234,2.826,3.164,3.089,2.997,2.925,2.813,2.793,3.005,3.065,3.013,3.217,3.439,2.804,3.257,3.091,2.788,2.495,2.615,2.321,3.232,2.349,2.372,3.065,2.671,2.407,2.294,2.99,3.104,3.104,3.229,2.886,2.488,2.261,2.65,2.261,2.504,2.572,3.207,3.043,3.085,3.508,3.949,3.594,2.913,3.397,3.162,2.593,2.692,2.381,3.109,2.517,3.128,2.905,2.915,3.02,3.273,2.865,2.81,2.309,2.101,2.153,1.857,3.159,2.135,2.879,2.716,2.448,2.262,2.481,2.923,2.474,3.054,3.021,3.036,3.345,2.758,3.064,3.12,2.572,2.853,2.93,3.072,2.729,2.594,2.886,2.635,2.739,3.441,2.834,2.689,3.1,2.834,2.822,3.133,2.724,2.828,3.121,3.149,3.029,3.162,3.112,3.292,2.975,3.391,3.366,3.35,3.319,3.289,3.562,3.124,3.509,2.508,2.271,2.627,2.478,2.666,2.422,2.526,2.542,2.706,2.441,3.517,3.059,3.126,3.244,3.153,2.878,2.902,3.05,2.995,3.233,3.526,3.269,3.076,3.133,3.9,2.914,3.894,2.898,3.72,3.58 diff --git a/BrainNetworksInPython/datasets/NSPN_WhitakerVertes_PNAS2016/__init__.py b/BrainNetworksInPython/datasets/NSPN_WhitakerVertes_PNAS2016/__init__.py index 3b712ac..086734d 100644 --- a/BrainNetworksInPython/datasets/NSPN_WhitakerVertes_PNAS2016/__init__.py +++ b/BrainNetworksInPython/datasets/NSPN_WhitakerVertes_PNAS2016/__init__.py @@ -19,15 +19,13 @@ names_file = filepath + "/500.names.txt" regionalmeasures_file = filepath + "/PARC_500aparc_thickness_behavmerge.csv" covars_file = None -names_308_style = True def _data(): return (centroids_file, regionalmeasures_file, names_file, - covars_file, - names_308_style) + covars_file) def _centroids(): @@ -46,15 +44,10 @@ def _covars(): return covars_file -def _is_names_308_style(): - return names_308_style - - def import_data(): return read_in_data( regionalmeasures_file, names_file, covars_file=covars_file, centroids_file=centroids_file, - names_308_style=names_308_style, data_as_df=True) diff --git a/BrainNetworksInPython/make_graphs.py b/BrainNetworksInPython/make_graphs.py index 8538573..6b9fe07 100644 --- a/BrainNetworksInPython/make_graphs.py +++ b/BrainNetworksInPython/make_graphs.py @@ -18,7 +18,7 @@ def anatomical_graph_attributes(): return ['parcellation', 'centroids'] -def assign_node_names(G, parcellation, names_308_style=False): +def assign_node_names(G, parcellation): """ Returns the network G with node attributes "name" assigned according to the list parcellation. @@ -36,10 +36,6 @@ def assign_node_names(G, parcellation, names_308_style=False): # Assign anatomical names to the nodes for i, node in enumerate(G.nodes()): G.node[i]['name'] = parcellation[i] - if names_308_style: - G.node[i]['name_34'] = parcellation[i].split('_')[1] - G.node[i]['name_68'] = parcellation[i].rsplit('_', 1)[0] - G.node[i]['hemi'] = parcellation[i].split('_', 1)[0] # G.graph['parcellation'] = True return G diff --git a/BrainNetworksInPython/scripts/useful_functions.py b/BrainNetworksInPython/scripts/useful_functions.py index 739898d..9c00279 100644 --- a/BrainNetworksInPython/scripts/useful_functions.py +++ b/BrainNetworksInPython/scripts/useful_functions.py @@ -10,7 +10,6 @@ def read_in_data( names_file, covars_file=None, centroids_file=None, - names_308_style=False, data_as_df=True): ''' Read in the data from the three input files: @@ -23,16 +22,10 @@ def read_in_data( brain regions. Should be aligned with names_file such that the ith line of centroids_file is the coordinates of the brain region named in the ith line of names_file. - * names_308_style : If the names are in 308 style then drop the first - 41 entries from the names file. ''' # Load names with open(names_file) as f: names = [line.strip() for line in f] - # If you have your names in names_308_style you need to strip the - # first 41 items - if names_308_style: - names = names[41:] # Load covariates if covars_file is not None: @@ -43,24 +36,14 @@ def read_in_data( if centroids_file is not None: centroids = np.loadtxt(centroids_file) - # If you have your names in names_308_style you need to strip the - # first 41 items - if names_308_style: - names = names[41:] - centroids = centroids[41:, :] # Load data if data_as_df: df = pd.read_csv(data) - # You may also have to strip the words "thickness" from the - # end of the names in the data frame - if names_308_style: - df.columns = [col.rsplit('_thickness', 1)[0] for col in df.columns] else: df = np.loadtxt(data) - return df, names, covars_list, centroids, names_308_style - + return df, names, covars_list, centroids def write_out_measures(df, output_dir, name, first_columns=[]): ''' diff --git a/BrainNetworksInPython/wrappers/corrmat_from_regionalmeasures.py b/BrainNetworksInPython/wrappers/corrmat_from_regionalmeasures.py index 1313aed..e358262 100644 --- a/BrainNetworksInPython/wrappers/corrmat_from_regionalmeasures.py +++ b/BrainNetworksInPython/wrappers/corrmat_from_regionalmeasures.py @@ -72,18 +72,6 @@ def setup_argparser(): (' Default: None')), default=None) - parser.add_argument( - '--names_308_style', - action='store_true', - help=textwrap.dedent( - ('Include this flag if your names are in the NSPN 308\n') + - ('parcellation style (which means you have 41 subcortical \ -regions)\n') + - ('that are still in the names files and that\n') + - ('the names are in __ format.\n') + - (' Default: False')), - default=False) - parser.add_argument( '--method', type=str, @@ -102,7 +90,6 @@ def corrmat_from_regionalmeasures(regional_measures_file, names_file, output_name, covars_file=None, - names_308_style=False, method='pearson'): ''' Read in regional measures, names and covariates files to compute @@ -123,8 +110,7 @@ def corrmat_from_regionalmeasures(regional_measures_file, df, names, covars_list, *a = read_in_data( regional_measures_file, names_file, - covars_file=covars_file, - names_308_style=names_308_style) + covars_file=covars_file) M = mcm.corrmat_from_regionalmeasures( df, names, covars=covars_list, method=method) @@ -144,7 +130,6 @@ def corrmat_from_regionalmeasures(regional_measures_file, arg.names_file, arg.output_name, covars_file=arg.covars_file, - names_308_style=arg.names_308_style, method=arg.method) # ============================================================================ diff --git a/BrainNetworksInPython/wrappers/network_analysis_from_corrmat.py b/BrainNetworksInPython/wrappers/network_analysis_from_corrmat.py index c5d425e..aee7bf5 100644 --- a/BrainNetworksInPython/wrappers/network_analysis_from_corrmat.py +++ b/BrainNetworksInPython/wrappers/network_analysis_from_corrmat.py @@ -86,17 +86,6 @@ def setup_argparser(): with real network.\n') + (' Default: 1000')), default=1000) - parser.add_argument( - '--names_308_style', - action='store_true', - help=textwrap.dedent( - ('Include this flag if your names are in the NSPN 308\n') - + ('parcellation style (which means you have 41 subcortical \ -regions)\n') - + ('that are still in the names and centroids files and that\n') - + ('the names are in __ format.\n') - + (' Default: False')), - default=False) arguments = parser.parse_args() @@ -108,8 +97,7 @@ def network_analysis_from_corrmat(corr_mat_file, centroids_file, output_dir, cost=10, - n_rand=1000, - names_308_style=False): + n_rand=1000): ''' This is the big function! It reads in the correlation matrix, thresholds it at the given cost @@ -122,7 +110,6 @@ def network_analysis_from_corrmat(corr_mat_file, corr_mat_file, names_file, centroids_file=centroids_file, - names_308_style=names_308_style, data_as_df=False) corrmat = os.path.basename(corr_mat_file).strip('.txt') @@ -131,8 +118,7 @@ def network_analysis_from_corrmat(corr_mat_file, B = bnip.BrainNetwork( network=M, parcellation=names, - centroids=centroids, - names_308_style=names_308_style) + centroids=centroids) # Threshold graph G = B.threshold(cost) # Calculate the modules @@ -181,8 +167,7 @@ def network_analysis_from_corrmat(corr_mat_file, arg.centroids_file, arg.output_dir, cost=arg.cost, - n_rand=arg.n_rand, - names_308_style=arg.names_308_style) + n_rand=arg.n_rand) # ============================================================================= # Wooo! All done :) diff --git a/tests/write_fixtures.py b/tests/write_fixtures.py index e3e3e4b..1a51086 100644 --- a/tests/write_fixtures.py +++ b/tests/write_fixtures.py @@ -1,42 +1,41 @@ #--------------------------- Write fixtures --------------------------- -# To regression test our wrappers we need examples. This script +# To regression test our wrappers we need examples. This script # generates files. We save these files once, and regression_test.py # re-generates these files to tests them for identicality with the -# presaved examples (fixtures). If they are found not to be identical -# it throws up an error. +# presaved examples (fixtures). If they are found not to be identical +# it throws up an error. # -# The point of this is to check that throughout the changes we make to +# The point of this is to check that throughout the changes we make to # BrainNetworksInPython the functionality of this script stays the same # -# Currently the functionality of write_fixtures is to generate corrmat -# and network_analysis data via the functions +# Currently the functionality of write_fixtures is to generate corrmat +# and network_analysis data via the functions # corrmat_from_regionalmeasures and network_analysis_from_corrmat. #---------------------------------------------------------------------- import os import sys import networkx as nx - + def recreate_correlation_matrix_fixture(folder): ##### generate a correlation matrix in the given folder using ##### - ##### the Whitaker_Vertes dataset ##### + ##### the Whitaker_Vertes dataset ##### import BrainNetworksInPython.datasets.NSPN_WhitakerVertes_PNAS2016.data as data - centroids, regionalmeasures, names, covars, names_308_style = data._get_data() + centroids, regionalmeasures, names, covars= data._get_data() from BrainNetworksInPython.wrappers.corrmat_from_regionalmeasures import corrmat_from_regionalmeasures corrmat_path = os.getcwd()+folder+'/corrmat_file.txt' corrmat_from_regionalmeasures( regionalmeasures, - names, - corrmat_path, - names_308_style=names_308_style) - + names, + corrmat_path) + def recreate_network_analysis_fixture(folder, corrmat_path): ##### generate network analysis in the given folder using the ##### ##### data in example_data and the correlation matrix given ##### - ##### by corrmat_path ##### + ##### by corrmat_path ##### import BrainNetworksInPython.datasets.NSPN_WhitakerVertes_PNAS2016.data as data - centroids, regionalmeasures, names, covars, names_308_style = data._get_data() - # It is necessary to specify a random seed because - # network_analysis_from_corrmat generates random graphs to + centroids, regionalmeasures, names, covars= data._get_data() + # It is necessary to specify a random seed because + # network_analysis_from_corrmat generates random graphs to # calculate global measures import random random.seed(2984) @@ -46,12 +45,12 @@ def recreate_network_analysis_fixture(folder, corrmat_path): centroids, os.getcwd()+folder+'/network-analysis', cost=10, - n_rand=10, # this is not a reasonable + n_rand=10 # this is not a reasonable # value for n, we generate only 10 random # graphs to save time - names_308_style=names_308_style) - -def write_fixtures(folder='/temporary_test_fixtures'): + ) + +def write_fixtures(folder='/temporary_test_fixtures'): ## Run functions corrmat_from_regionalmeasures and ## ## network_analysis_from_corrmat to save corrmat in given folder ## ##---------------------------------------------------------------## @@ -59,18 +58,18 @@ def write_fixtures(folder='/temporary_test_fixtures'): if not os.path.isdir(os.getcwd()+folder): os.makedirs(os.getcwd()+folder) # generate and save the correlation matrix - print("generating new correlation matrix") + print("generating new correlation matrix") recreate_correlation_matrix_fixture(folder) # generate and save the network analysis - print("generating new network analysis") + print("generating new network analysis") corrmat_path = 'temporary_test_fixtures/corrmat_file.txt' recreate_network_analysis_fixture(folder, corrmat_path) - + def delete_fixtures(folder): import shutil print('\ndeleting temporary files') shutil.rmtree(os.getcwd()+folder) - + def hash_folder(folder='temporary_test_fixtures'): hashes = {} for path, directories, files in os.walk(folder): @@ -78,16 +77,16 @@ def hash_folder(folder='temporary_test_fixtures'): hashes[os.path.join(path, file)] = hash_file(os.path.join(path, file)) for dir in sorted(directories): hashes.update(hash_folder(os.path.join(path, dir))) - break + break return hashes - + def hash_file(filename): import hashlib m = hashlib.sha256() with open(filename, 'rb') as f: while True: - b = f.read(2**10) + b = f.read(2**10) if not b: break m.update(b) return m.hexdigest() @@ -103,16 +102,16 @@ def generate_fixture_hashes(folder='temporary_test_fixtures'): return hash_dict def current_fixture_name(): - # returns the fixture name appropriate the current versions + # returns the fixture name appropriate the current versions # of python and networkx return "tests/.fixture_hash"+str(sys.version_info[:2])+'networkx_version'+str(nx.__version__) - + def pickle_hash(hash_dict): import pickle # when we save we record the python and networkx versions with open(current_fixture_name(), 'wb') as f: pickle.dump(hash_dict, f) - + def unpickle_hash(): import pickle # import fixture relevant to the current python, networkx versions @@ -125,4 +124,3 @@ def unpickle_hash(): if input("Are you sure you want to update Brain Networks In Python's test fixtures? (y/n)") == 'y': hash_dict = generate_fixture_hashes() pickle_hash(hash_dict) - diff --git a/tutorials/tutorial.ipynb b/tutorials/tutorial.ipynb index e4d1097..3576b33 100644 --- a/tutorials/tutorial.ipynb +++ b/tutorials/tutorial.ipynb @@ -48,7 +48,232 @@ "outputs": [], "source": [ "# Read in sample data from the NSPN WhitakerVertes PNAS 2016 paper.\n", - "df, names, covars, centroids, names_308_style = datasets.NSPN_WhitakerVertes_PNAS2016.import_data()" + "df, names, covars, centroids = datasets.NSPN_WhitakerVertes_PNAS2016.import_data()" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Unnamed: 0nspn_idocccentrestudy_primaryage_scansexmaleage_binmri_centre...rh_supramarginal_part5rh_supramarginal_part6rh_supramarginal_part7rh_frontalpole_part1rh_temporalpole_part1rh_transversetemporal_part1rh_insula_part1rh_insula_part2rh_insula_part3rh_insula_part4
00103560Cambridge2K_Cohort20.761Female0.04WBIC...2.5922.8412.3182.4863.5262.6383.3082.5833.1883.089
11107020Cambridge2K_Cohort16.055Male1.02WBIC...3.4483.2832.7403.2254.0443.0403.8672.9433.4783.609
22107360Cambridge2K_Cohort14.897Female0.01WBIC...3.5263.2693.0763.1333.9002.9143.8942.8983.7203.580
33107780Cambridge2K_Cohort20.022Female0.04WBIC...2.8302.9172.6472.7963.4013.0453.1382.7392.8333.349
44107940Cambridge2K_Cohort14.656Female0.01WBIC...2.6893.2942.8202.5392.1512.7342.7912.9353.5383.403
\n", + "

5 rows × 324 columns

\n", + "
" + ], + "text/plain": [ + " Unnamed: 0 nspn_id occ centre study_primary age_scan sex male \\\n", + "0 0 10356 0 Cambridge 2K_Cohort 20.761 Female 0.0 \n", + "1 1 10702 0 Cambridge 2K_Cohort 16.055 Male 1.0 \n", + "2 2 10736 0 Cambridge 2K_Cohort 14.897 Female 0.0 \n", + "3 3 10778 0 Cambridge 2K_Cohort 20.022 Female 0.0 \n", + "4 4 10794 0 Cambridge 2K_Cohort 14.656 Female 0.0 \n", + "\n", + " age_bin mri_centre ... rh_supramarginal_part5 \\\n", + "0 4 WBIC ... 2.592 \n", + "1 2 WBIC ... 3.448 \n", + "2 1 WBIC ... 3.526 \n", + "3 4 WBIC ... 2.830 \n", + "4 1 WBIC ... 2.689 \n", + "\n", + " rh_supramarginal_part6 rh_supramarginal_part7 rh_frontalpole_part1 \\\n", + "0 2.841 2.318 2.486 \n", + "1 3.283 2.740 3.225 \n", + "2 3.269 3.076 3.133 \n", + "3 2.917 2.647 2.796 \n", + "4 3.294 2.820 2.539 \n", + "\n", + " rh_temporalpole_part1 rh_transversetemporal_part1 rh_insula_part1 \\\n", + "0 3.526 2.638 3.308 \n", + "1 4.044 3.040 3.867 \n", + "2 3.900 2.914 3.894 \n", + "3 3.401 3.045 3.138 \n", + "4 2.151 2.734 2.791 \n", + "\n", + " rh_insula_part2 rh_insula_part3 rh_insula_part4 \n", + "0 2.583 3.188 3.089 \n", + "1 2.943 3.478 3.609 \n", + "2 2.898 3.720 3.580 \n", + "3 2.739 2.833 3.349 \n", + "4 2.935 3.538 3.403 \n", + "\n", + "[5 rows x 324 columns]" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df.head()" ] }, { @@ -61,13 +286,22 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "df_res = bnip.create_residuals_df(df, names, covars)" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, { "cell_type": "markdown", "metadata": {}, @@ -77,13 +311,14 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "metadata": { + "collapsed": true, "scrolled": false }, "outputs": [], "source": [ - "M = bnip.create_corrmat(df_res)" + "M = bnip.create_corrmat(df_res, method='pearson')" ] }, { @@ -106,8 +341,10 @@ }, { "cell_type": "code", - "execution_count": 5, - "metadata": {}, + "execution_count": 6, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "G = bnip.BrainNetwork(network=M, parcellation=names, centroids=centroids)" @@ -119,15 +356,14 @@ "source": [ "### Threshold to create a binary graph\n", "\n", - "We threshold G at cost 10 to create a binary graph with 10% as many edges as the complete graph G. Ordinarily when thresholding one takes the 10% of edges with the highest weight. In our case, because we want the resulting graph to be connected, we calculate a minimum spanning tree first. If you want to omit this step, you can pass the argument `mst=False` to `threshold`." + "We threshold G at cost 10 to create a binary graph with 10% as many edges as the complete graph G. Ordinarily when thresholding one takes the 10% of edges with the highest weight. In our case, because we want the resulting graph to be connected, we calculate a minimum spanning tree first. If you want to omit this step, you can pass the argument `mst=False` to `threshold`.\n", + "The threshold method does not edit objects inplace" ] }, { "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": true - }, + "execution_count": 7, + "metadata": {}, "outputs": [], "source": [ "H = G.threshold(10)" @@ -154,38 +390,17 @@ "* shortest_path_length" ] }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " Calculating participation coefficient - may take a little while\n" - ] - } - ], - "source": [ - "H.calculate_nodal_measures()" - ] - }, { "cell_type": "markdown", "metadata": {}, "source": [ - "### Report nodal measures as a DataFrame\n", - "\n", - "We can return all nodal attributes in a DataFrame" + "`export_nodal_measure` returns nodal attributes in a DataFrame. Let's try it now." ] }, { "cell_type": "code", "execution_count": 8, - "metadata": { - "scrolled": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -208,1540 +423,399 @@ " \n", " \n", " \n", - " average_dist\n", - " betweenness\n", " centroids\n", - " closeness\n", - " clustering\n", - " degree\n", - " interhem\n", - " interhem_proportion\n", - " module\n", - " participation_coefficient\n", - " shortest_path_length\n", - " total_dist\n", + " name\n", " x\n", " y\n", " z\n", " \n", - " \n", - " name\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", " \n", " \n", " \n", - " lh_lateralorbitofrontal_part2\n", - " 77.5299\n", - " 0.000914008\n", - " [-56.40355, -40.152663, 1.708876]\n", - " 0.370474\n", - " 0.638889\n", - " 9\n", - " 4\n", - " 0.444444\n", - " 0\n", - " 0.395062\n", - " 2.68914\n", - " 697.769\n", - " -56.4036\n", - " -40.1527\n", - " 1.70888\n", - " \n", - " \n", - " lh_lateralorbitofrontal_part3\n", - " 72.4149\n", - " 0.0122065\n", - " [-53.140506, -49.843038, 8.264557]\n", - " 0.492593\n", - " 0.340986\n", - " 49\n", - " 19\n", - " 0.387755\n", - " 0\n", - " 0.879633\n", - " 2.02247\n", - " 3548.33\n", - " -53.1405\n", - " -49.843\n", - " 8.26456\n", - " \n", - " \n", - " lh_lateralorbitofrontal_part4\n", - " 69.4417\n", - " 0.00992147\n", - " [-5.001684, 20.645903, 25.733446]\n", - " 0.430421\n", - " 0.387097\n", - " 31\n", - " 7\n", - " 0.225806\n", - " 1\n", - " 0.62435\n", - " 2.31461\n", - " 2152.69\n", - " -5.00168\n", - " 20.6459\n", - " 25.7334\n", - " \n", - " \n", - " lh_lingual_part1\n", - " 73.0082\n", - " 0.0146519\n", - " [-33.265925, 20.200202, 45.347826]\n", - " 0.399399\n", - " 0.388889\n", - " 9\n", - " 3\n", - " 0.333333\n", - " 2\n", - " 0.395062\n", - " 2.49438\n", - " 657.074\n", - " -33.2659\n", - " 20.2002\n", - " 45.3478\n", - " \n", - " \n", - " lh_lingual_part2\n", - " 54.5995\n", - " 0.00745602\n", - " [-31.958115, 2.146597, 51.26911]\n", - " 0.331258\n", - " 0.3\n", - " 5\n", - " 1\n", - " 0.2\n", - " 3\n", - " 0.36\n", - " 3.00749\n", - " 272.998\n", - " -31.9581\n", - " 2.1466\n", - " 51.2691\n", - " \n", - " \n", - " lh_lingual_part3\n", - " 51.8178\n", - " 0.00702674\n", - " [-38.795007, 12.584757, 33.278581]\n", - " 0.287568\n", - " 0\n", - " 2\n", - " 0\n", - " 0\n", - " 0\n", - " 0.75\n", - " 3.46442\n", - " 103.636\n", - " -38.795\n", - " 12.5848\n", - " 33.2786\n", - " \n", - " \n", - " lh_lingual_part4\n", - " 64.2733\n", - " 3.74977e-05\n", - " [-39.715079, 11.341351, 48.846438]\n", - " 0.250943\n", - " 0\n", - " 2\n", - " 1\n", - " 0.5\n", - " 3\n", - " 0\n", - " 3.97004\n", - " 128.547\n", - " -39.7151\n", - " 11.3414\n", - " 48.8464\n", - " \n", - " \n", - " lh_lingual_part5\n", - " 17.2811\n", - " 0\n", - " [-8.609127, -73.360119, 17.095238]\n", - " 0.285714\n", - " 0\n", - " 1\n", - " 1\n", - " 1\n", - " 4\n", - " 0\n", - " 3.48689\n", - " 17.2811\n", - " -8.60913\n", - " -73.3601\n", - " 17.0952\n", - " \n", - " \n", - " lh_lingual_part6\n", - " 93.5521\n", - " 0.00100744\n", - " [-5.3042, -87.102157, 19.323496]\n", - " 0.401813\n", - " 0.490909\n", - " 11\n", - " 4\n", - " 0.363636\n", - " 2\n", - " 0.173554\n", - " 2.4794\n", - " 1029.07\n", - " -5.3042\n", - " -87.1022\n", - " 19.3235\n", - " \n", - " \n", - " lh_medialorbitofrontal_part1\n", - " 62.0206\n", - " 0.000786891\n", - " [-24.010774, -5.86141, -32.826641]\n", - " 0.381089\n", - " 0.602564\n", - " 13\n", - " 5\n", - " 0.384615\n", - " 0\n", - " 0.408284\n", - " 2.61423\n", - " 806.268\n", - " -24.0108\n", - " -5.86141\n", - " -32.8266\n", - " \n", - " \n", - " lh_medialorbitofrontal_part2\n", - " 71.6117\n", - " 0.000795207\n", - " [-30.237677, -46.493585, -17.452397]\n", - " 0.387191\n", - " 0.562092\n", - " 18\n", - " 5\n", - " 0.277778\n", - " 1\n", - " 0.305556\n", - " 2.57303\n", - " 1289.01\n", - " -30.2377\n", - " -46.4936\n", - " -17.4524\n", - " \n", - " \n", - " lh_medialorbitofrontal_part3\n", - " 64.4163\n", - " 3.88154e-05\n", - " [-34.771765, -9.299608, -35.172549]\n", - " 0.335013\n", - " 0.3\n", - " 5\n", - " 1\n", - " 0.2\n", - " 0\n", - " 0.84\n", - " 2.97378\n", - " 322.081\n", - " -34.7718\n", - " -9.29961\n", - " -35.1725\n", - " \n", - " \n", - " lh_middletemporal_part1\n", - " 68.0589\n", - " 0.000683758\n", - " [-33.515847, -72.220765, -14.257923]\n", - " 0.415625\n", - " 0.474359\n", - " 13\n", - " 6\n", - " 0.461538\n", - " 0\n", - " 0.408284\n", - " 2.397\n", - " 884.766\n", - " -33.5158\n", - " -72.2208\n", - " -14.2579\n", - " \n", - " \n", - " lh_middletemporal_part2\n", - " 64.672\n", - " 6.80624e-05\n", - " [-37.632472, -38.758481, -22.9063]\n", - " 0.358008\n", - " 0.333333\n", - " 4\n", - " 1\n", - " 0.25\n", - " 0\n", - " 0.75\n", - " 2.78277\n", - " 258.688\n", - " -37.6325\n", - " -38.7585\n", - " -22.9063\n", - " \n", - " \n", - " lh_middletemporal_part3\n", - " 66.5584\n", - " 0.00339162\n", - " [-38.896698, -60.874682, -16.663844]\n", - " 0.413043\n", - " 0.285714\n", - " 15\n", - " 2\n", - " 0.133333\n", - " 0\n", - " 0.84\n", - " 2.41199\n", - " 998.377\n", - " -38.8967\n", - " -60.8747\n", - " -16.6638\n", - " \n", - " \n", - " lh_middletemporal_part4\n", - " 66.427\n", - " 0.00189248\n", - " [-43.393728, -58.809524, 40.471545]\n", - " 0.415625\n", - " 0.371429\n", - " 15\n", - " 5\n", - " 0.333333\n", - " 0\n", - " 0.555556\n", - " 2.397\n", - " 996.405\n", - " -43.3937\n", - " -58.8095\n", - " 40.4715\n", - " \n", - " \n", - " lh_middletemporal_part5\n", - " 69.5437\n", - " 0.00837975\n", - " [-35.980519, -83.125541, 18.926407]\n", - " 0.479279\n", - " 0.271264\n", - " 30\n", - " 10\n", - " 0.333333\n", - " 0\n", - " 0.888889\n", - " 2.07865\n", - " 2086.31\n", - " -35.9805\n", - " -83.1255\n", - " 18.9264\n", - " \n", - " \n", - " lh_parahippocampal_part1\n", - " 59.1748\n", - " 0.00072607\n", - " [-44.904486, -56.280753, 17.439942]\n", - " 0.227545\n", - " 0\n", - " 2\n", - " 1\n", - " 0.5\n", - " 0\n", - " 0\n", - " 4.37828\n", - " 118.35\n", - " -44.9045\n", - " -56.2808\n", - " 17.4399\n", - " \n", - " \n", - " lh_parahippocampal_part2\n", - " 58.1237\n", - " 0.000289405\n", - " [-31.993691, -75.483701, 33.056782]\n", - " 0.226962\n", - " 0\n", - " 2\n", - " 0\n", - " 0\n", - " 0\n", - " 0\n", - " 4.38951\n", - " 116.247\n", - " -31.9937\n", - " -75.4837\n", - " 33.0568\n", - " \n", - " \n", - " lh_paracentral_part1\n", - " 68.9099\n", - " 0.00601402\n", - " [-43.132353, -66.558824, 15.90625]\n", - " 0.479279\n", - " 0.385598\n", - " 42\n", - " 19\n", - " 0.452381\n", - " 2\n", - " 0.61678\n", - " 2.07865\n", - " 2894.21\n", - " -43.1324\n", - " -66.5588\n", - " 15.9062\n", - " \n", - " \n", - " lh_paracentral_part2\n", - " 70.5037\n", - " 0.000558145\n", - " [-37.122661, -69.533264, 43.258836]\n", - " 0.408602\n", - " 0.508333\n", - " 16\n", - " 5\n", - " 0.3125\n", - " 5\n", - " 0.75\n", - " 2.4382\n", - " 1128.06\n", - " -37.1227\n", - " -69.5333\n", - " 43.2588\n", - " \n", - " \n", - " lh_paracentral_part3\n", - " 71.4659\n", - " 0.0012621\n", - " [-43.26638, -75.049409, 23.400644]\n", - " 0.44186\n", - " 0.458498\n", - " 23\n", - " 9\n", - " 0.391304\n", - " 5\n", - " 0.810964\n", - " 2.25468\n", - " 1643.71\n", - " -43.2664\n", - " -75.0494\n", - " 23.4006\n", - " \n", - " \n", - " lh_parsopercularis_part1\n", - " 74.7311\n", - " 0.000419455\n", - " [-45.069149, -64.283245, 32.022606]\n", - " 0.413686\n", - " 0.703448\n", - " 30\n", - " 9\n", - " 0.3\n", - " 1\n", - " 0.128889\n", - " 2.40824\n", - " 2241.93\n", - " -45.0691\n", - " -64.2832\n", - " 32.0226\n", - " \n", - " \n", - " lh_parsopercularis_part2\n", - " 85.7913\n", - " 0.00156321\n", - " [-43.614049, -6.016575, -40.149171]\n", - " 0.43252\n", - " 0.442105\n", - " 20\n", - " 7\n", - " 0.35\n", - " 1\n", - " 0.64\n", - " 2.30337\n", - " 1715.83\n", - " -43.614\n", - " -6.01657\n", - " -40.1492\n", - " \n", - " \n", - " lh_parsopercularis_part3\n", - " 76.5679\n", - " 0.00198375\n", - " [-50.245499, -60.608838, -7.837971]\n", - " 0.441128\n", - " 0.571429\n", - " 36\n", - " 9\n", - " 0.25\n", - " 1\n", - " 0.305556\n", - " 2.25843\n", - " 2756.44\n", - " -50.2455\n", - " -60.6088\n", - " -7.83797\n", - " \n", - " \n", - " lh_parsorbitalis_part1\n", - " 74.8239\n", - " 0.0246323\n", - " [-48.242567, -19.479656, -32.479656]\n", - " 0.509579\n", - " 0.294276\n", - " 55\n", - " 14\n", - " 0.254545\n", - " 1\n", - " 0.721983\n", - " 1.95506\n", - " 4115.31\n", - " -48.2426\n", - " -19.4797\n", - " -32.4797\n", - " \n", - " \n", - " lh_parstriangularis_part1\n", - " 86.1448\n", - " 0.0113322\n", - " [-52.185499, -51.758004, -16.904896]\n", - " 0.493506\n", - " 0.397243\n", - " 57\n", - " 25\n", - " 0.438596\n", - " 1\n", - " 0.48261\n", - " 2.01873\n", - " 4910.25\n", - " -52.1855\n", - " -51.758\n", - " -16.9049\n", - " \n", - " \n", - " lh_parstriangularis_part2\n", - " 74.2408\n", - " 0.0102018\n", - " [-52.818271, -31.30943, -26.385069]\n", - " 0.479279\n", - " 0.366497\n", - " 49\n", - " 12\n", - " 0.244898\n", - " 1\n", - " 0.518534\n", - " 2.07865\n", - " 3637.8\n", - " -52.8183\n", - " -31.3094\n", - " -26.3851\n", - " \n", - " \n", - " lh_pericalcarine_part1\n", - " 92.1525\n", - " 0.0021726\n", - " [-52.835546, -41.770174, -22.660878]\n", - " 0.291667\n", - " 0.533333\n", - " 6\n", - " 2\n", - " 0.333333\n", - " 3\n", - " 0\n", - " 3.41573\n", - " 552.915\n", - " -52.8355\n", - " -41.7702\n", - " -22.6609\n", - " \n", - " \n", - " lh_pericalcarine_part2\n", - " 45.7405\n", - " 7.56609e-05\n", - " [-8.616947, -48.171793, 7.731863]\n", - " 0.235816\n", - " 0.666667\n", - " 3\n", - " 2\n", - " 0.666667\n", - " 3\n", - " 0\n", - " 4.22472\n", - " 137.222\n", - " -8.61695\n", - " -48.1718\n", - " 7.73186\n", - " \n", - " \n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " \n", - " \n", - " rh_superiorparietal_part1\n", - " 62.9667\n", - " 0.109746\n", - " [5.707363, -24.730648, 36.269352]\n", - " 0.596413\n", - " 0.214248\n", - " 107\n", - " 60\n", - " 0.560748\n", - " 2\n", - " 0.547209\n", - " 1.67041\n", - " 6737.43\n", - " 5.70736\n", - " -24.7306\n", - " 36.2694\n", - " \n", - " \n", - " rh_superiorparietal_part2\n", - " 81.3446\n", - " 0.00622414\n", - " [50.415483, 1.973011, 7.995028]\n", - " 0.486289\n", - " 0.437925\n", - " 49\n", - " 27\n", - " 0.55102\n", - " 2\n", - " 0.546439\n", - " 2.04869\n", - " 3985.89\n", - " 50.4155\n", - " 1.97301\n", - " 7.99503\n", - " \n", - " \n", - " rh_superiorparietal_part3\n", - " 77.5548\n", - " 0.040265\n", - " [13.824742, -24.344964, 68.442506]\n", - " 0.550725\n", - " 0.296639\n", - " 85\n", - " 47\n", - " 0.552941\n", - " 2\n", - " 0.581315\n", - " 1.80899\n", - " 6592.16\n", - " 13.8247\n", - " -24.345\n", - " 68.4425\n", - " \n", - " \n", - " rh_superiorparietal_part4\n", - " 73.3482\n", - " 0.00235456\n", - " [54.264137, 5.644953, 24.204724]\n", - " 0.448567\n", - " 0.609687\n", - " 27\n", - " 13\n", - " 0.481481\n", - " 2\n", - " 0.142661\n", - " 2.22097\n", - " 1980.4\n", - " 54.2641\n", - " 5.64495\n", - " 24.2047\n", - " \n", - " \n", - " rh_superiorparietal_part5\n", - " 74.5388\n", - " 0.00261622\n", - " [22.698219, -15.158388, 65.774133]\n", - " 0.467487\n", - " 0.508537\n", - " 41\n", - " 21\n", - " 0.512195\n", - " 2\n", - " 0.185604\n", - " 2.13109\n", - " 3056.09\n", - " 22.6982\n", - " -15.1584\n", - " 65.7741\n", - " \n", - " \n", - " rh_superiorparietal_part6\n", - " 79.313\n", - " 0.00550631\n", - " [55.756061, -2.12197, 27.641667]\n", - " 0.485401\n", - " 0.433757\n", - " 58\n", - " 30\n", - " 0.517241\n", - " 2\n", - " 0.500297\n", - " 2.05243\n", - " 4600.15\n", - " 55.7561\n", - " -2.12197\n", - " 27.6417\n", - " \n", - " \n", - " rh_superiorparietal_part7\n", - " 65.7626\n", - " 0.00234232\n", - " [33.546008, -20.560456, 58.860837]\n", - " 0.469965\n", - " 0.477952\n", - " 38\n", - " 14\n", - " 0.368421\n", - " 2\n", - " 0.41759\n", - " 2.11985\n", - " 2498.98\n", - " 33.546\n", - " -20.5605\n", - " 58.8608\n", - " \n", - " \n", - " rh_superiorparietal_part8\n", - " 80.858\n", - " 0.00246615\n", - " [48.733232, -3.49314, 43.394055]\n", - " 0.469965\n", - " 0.519192\n", - " 45\n", - " 26\n", - " 0.577778\n", - " 2\n", - " 0.209877\n", - " 2.11985\n", - " 3638.61\n", - " 48.7332\n", - " -3.49314\n", - " 43.3941\n", - " \n", - " \n", - " rh_superiorparietal_part9\n", - " 59.7709\n", - " 7.73428e-05\n", - " [39.911111, -11.508333, 46.213889]\n", - " 0.419558\n", - " 0.769231\n", - " 13\n", - " 7\n", - " 0.538462\n", - " 2\n", - " 0.147929\n", - " 2.37453\n", - " 777.022\n", - " 39.9111\n", - " -11.5083\n", - " 46.2139\n", - " \n", - " \n", - " rh_superiorparietal_part10\n", - " 74.6235\n", - " 0.0024262\n", - " [33.180982, -9.761759, 53.350716]\n", - " 0.467487\n", - " 0.457317\n", - " 41\n", - " 21\n", - " 0.512195\n", - " 2\n", - " 0.22903\n", - " 2.13109\n", - " 3059.56\n", - " 33.181\n", - " -9.76176\n", - " 53.3507\n", - " \n", - " \n", - " rh_superiortemporal_part1\n", - " 59.3691\n", - " 0.000148809\n", - " [14.098616, -58.053633, 12.916955]\n", - " 0.310748\n", - " 0.5\n", - " 4\n", - " 2\n", - " 0.5\n", - " 4\n", - " 0.4375\n", - " 3.20599\n", - " 237.476\n", - " 14.0986\n", - " -58.0536\n", - " 12.917\n", - " \n", - " \n", - " rh_superiortemporal_part2\n", - " 63.2543\n", - " 0.013529\n", - " [7.879498, -58.918828, 24.867782]\n", - " 0.490775\n", - " 0.30404\n", - " 45\n", - " 18\n", - " 0.4\n", - " 2\n", - " 0.555556\n", - " 2.02996\n", - " 2846.44\n", - " 7.8795\n", - " -58.9188\n", - " 24.8678\n", + " 0\n", + " [-27.965157, -19.013702, 17.919528]\n", + " lh_bankssts_part1\n", + " -27.9652\n", + " -19.0137\n", + " 17.9195\n", " \n", " \n", - " rh_superiortemporal_part3\n", - " 45.6731\n", - " 0.0191908\n", - " [9.761111, -47.658889, 59.438889]\n", - " 0.439669\n", - " 0.358333\n", - " 16\n", - " 7\n", - " 0.4375\n", - " 4\n", - " 0.609375\n", - " 2.26592\n", - " 730.77\n", - " 9.76111\n", - " -47.6589\n", - " 59.4389\n", + " 1\n", + " [-14.455663, -13.693461, 13.713674]\n", + " lh_bankssts_part2\n", + " -14.4557\n", + " -13.6935\n", + " 13.7137\n", " \n", " \n", - " rh_superiortemporal_part4\n", - " 74.0896\n", - " 0.0391727\n", - " [17.346741, -68.079057, 26.266297]\n", - " 0.525692\n", - " 0.236612\n", - " 61\n", - " 36\n", - " 0.590164\n", - " 4\n", - " 0.961301\n", - " 1.89513\n", - " 4519.47\n", - " 17.3467\n", - " -68.0791\n", - " 26.2663\n", + " 2\n", + " [-33.906934, -22.284672, -15.821168]\n", + " lh_caudalanteriorcingulate_part1\n", + " -33.9069\n", + " -22.2847\n", + " -15.8212\n", " \n", " \n", - " rh_superiortemporal_part5\n", - " 64.7825\n", - " 0.0127162\n", - " [6.423292, -59.699888, 49.988802]\n", - " 0.470796\n", - " 0.333333\n", - " 30\n", - " 10\n", - " 0.333333\n", - " 4\n", - " 0.91\n", - " 2.1161\n", - " 1943.48\n", - " 6.42329\n", - " -59.6999\n", - " 49.9888\n", + " 3\n", + " [-17.305373, -53.431573, -36.017154]\n", + " lh_caudalmiddlefrontal_part1\n", + " -17.3054\n", + " -53.4316\n", + " -36.0172\n", " \n", " \n", - " rh_superiortemporal_part6\n", - " 55.1969\n", - " 0.00440019\n", - " [7.5625, -66.638221, 37.237981]\n", - " 0.439669\n", - " 0.395238\n", - " 21\n", - " 10\n", - " 0.47619\n", - " 4\n", - " 0.773243\n", - " 2.26592\n", - " 1159.14\n", - " 7.5625\n", - " -66.6382\n", - " 37.238\n", + " 4\n", + " [-22.265823, -64.366296, -37.674831]\n", + " lh_caudalmiddlefrontal_part2\n", + " -22.2658\n", + " -64.3663\n", + " -37.6748\n", " \n", - " \n", - " rh_supramarginal_part1\n", - " 68.3553\n", - " 0.0112841\n", - " [9.153191, -45.782979, 40.912766]\n", - " 0.511538\n", - " 0.365915\n", - " 57\n", - " 30\n", - " 0.526316\n", - " 2\n", - " 0.376731\n", - " 1.94757\n", - " 3896.25\n", - " 9.15319\n", - " -45.783\n", - " 40.9128\n", + " \n", + "\n", + "" + ], + "text/plain": [ + " centroids name \\\n", + "0 [-27.965157, -19.013702, 17.919528] lh_bankssts_part1 \n", + "1 [-14.455663, -13.693461, 13.713674] lh_bankssts_part2 \n", + "2 [-33.906934, -22.284672, -15.821168] lh_caudalanteriorcingulate_part1 \n", + "3 [-17.305373, -53.431573, -36.017154] lh_caudalmiddlefrontal_part1 \n", + "4 [-22.265823, -64.366296, -37.674831] lh_caudalmiddlefrontal_part2 \n", + "\n", + " x y z \n", + "0 -27.9652 -19.0137 17.9195 \n", + "1 -14.4557 -13.6935 13.7137 \n", + "2 -33.9069 -22.2847 -15.8212 \n", + "3 -17.3054 -53.4316 -36.0172 \n", + "4 -22.2658 -64.3663 -37.6748 " + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "H.export_nodal_measures().head()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Use `calculate_nodal_measures` to fill in a bunch of nodal measures" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Calculating participation coefficient - may take a little while\n" + ] + } + ], + "source": [ + "H.calculate_nodal_measures()" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", + " \n", + " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", + " \n", + " \n", + " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", - " \n", - " \n", + " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + "
average_distbetweennesscentroidsclosenessclusteringdegreeinterheminterhem_proportionmodulenameparticipation_coefficientshortest_path_lengthtotal_distxyz
rh_supramarginal_part277.94710.00638183[5.983949, 34.532588, 2.542802]0.4389440.2789472080.420.57752.269661558.945.9839534.53262.5428054.58830.00824713[-27.965157, -19.013702, 17.919528]0.4959610.335847180.3829790lh_bankssts_part10.7170670.008247132565.65-27.9652-19.013717.9195
rh_supramarginal_part399.60380.00108782[28.995132, 56.1363, -10.249652]0.4311180.3986931870.38888920.5555562.310861792.8728.995156.1363-10.2497151.73580.0124798[-14.455663, -13.693461, 13.713674]0.5074380.27878855170.3090910lh_bankssts_part20.8095870.01247982845.47-14.4557-13.693513.7137
rh_supramarginal_part4105.264.78677e-05[22.805582, 58.19538, -1.627526]0.337136256.972103[-33.906934, -22.284672, -15.821168]0.336254120021lh_caudalanteriorcingulate_part10.7502.95506315.78122.805658.1954-1.62753113.944-33.9069-22.2847-15.8212
rh_supramarginal_part579.16060.000196994[31.818499, 29.862129, 37.897033]0.3877550.5930.33333320.3950622.56929712.44531.818529.862137.897
rh_supramarginal_part688.33650.00690767[38.776316, 49.490132, 5.110746]0.4862890.300142383.36250.0120765[-17.305373, -53.431573, -36.017154]0.5256850.3834858338130.3421050.45783120.664822.048693356.7938.776349.49015.11075lh_caudalmiddlefrontal_part10.4598640.01207656919.09-17.3054-53.4316-36.0172
rh_supramarginal_part786.34220.00204325[43.91779, 26.858491, 30.252022]0.4382210.40615426140.538462486.05970.0292617[-22.265823, -64.366296, -37.674831]0.5491950.29361795390.41052620.2174562.273412244.943.917826.858530.252lh_caudalmiddlefrontal_part20.6887530.02926178175.67-22.2658-64.3663-37.6748
rh_frontalpole_part195.87630.000818524[23.690265, 56.926254, 12.712881]0.4182390.5691723120.52173910.4536862.382022205.1523.690356.926312.7129
\n", + "
" + ], + "text/plain": [ + " average_dist betweenness centroids closeness \\\n", + "0 54.5883 0.00824713 [-27.965157, -19.013702, 17.919528] 0.495961 \n", + "1 51.7358 0.0124798 [-14.455663, -13.693461, 13.713674] 0.507438 \n", + "2 56.9721 0 [-33.906934, -22.284672, -15.821168] 0.336254 \n", + "3 83.3625 0.0120765 [-17.305373, -53.431573, -36.017154] 0.525685 \n", + "4 86.0597 0.0292617 [-22.265823, -64.366296, -37.674831] 0.549195 \n", + "\n", + " clustering degree interhem interhem_proportion module \\\n", + "0 0.3358 47 18 0.382979 0 \n", + "1 0.278788 55 17 0.309091 0 \n", + "2 1 2 0 0 1 \n", + "3 0.383485 83 38 0.457831 2 \n", + "4 0.293617 95 39 0.410526 2 \n", + "\n", + " name participation_coefficient \\\n", + "0 lh_bankssts_part1 0.717067 \n", + "1 lh_bankssts_part2 0.809587 \n", + "2 lh_caudalanteriorcingulate_part1 0.75 \n", + "3 lh_caudalmiddlefrontal_part1 0.459864 \n", + "4 lh_caudalmiddlefrontal_part2 0.688753 \n", + "\n", + " shortest_path_length total_dist x y z \n", + "0 0.00824713 2565.65 -27.9652 -19.0137 17.9195 \n", + "1 0.0124798 2845.47 -14.4557 -13.6935 13.7137 \n", + "2 0 113.944 -33.9069 -22.2847 -15.8212 \n", + "3 0.0120765 6919.09 -17.3054 -53.4316 -36.0172 \n", + "4 0.0292617 8175.67 -22.2658 -64.3663 -37.6748 " + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "H.export_nodal_measures().head()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We can also add measures as one might normally add nodal attributes to a networkx graph" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [], + "source": [ + "nx.set_node_attributes(H, name=\"hat\", values={x: x**2 for x in H.nodes})" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "These show up in our DataFrame too" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", + " \n", + " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", "
degreehatname
rh_temporalpole_part195.60320.000873659[43.268354, 33.058228, 22.368354]0.3388540.4530.604700.362.94007478.01643.268433.058222.3684
rh_transversetemporal_part191.60610.000480546[24.458836, 47.983535, 26.632272]0.3658870.666667720.28571440.2653062.72285641.24324.458847.983526.6323lh_bankssts_part1
rh_insula_part135.19060[38.413146, 43.921127, 19.2723]0.210610155100404.7303435.190638.413143.921119.2723lh_bankssts_part2
rh_insula_part275.96960.00366197[30.409341, 40.024725, 24.248626]0.4130430.3626371430.2142862240.5867352.411991063.5730.409340.024724.2486lh_caudalanteriorcingulate_part1
rh_insula_part364.33320.0156911[9.729638, 6.951357, 45.687783]0.3619050510.240.642.75281321.6669.729646.9513645.68783839lh_caudalmiddlefrontal_part1
rh_insula_part451.30590.0075188[10.931872, 61.39076, 5.931872]0.2665330200403.73783102.61210.931961.39085.9318749516lh_caudalmiddlefrontal_part2
\n", - "

267 rows × 15 columns

\n", "
" ], "text/plain": [ - " average_dist betweenness \\\n", - "name \n", - "lh_lateralorbitofrontal_part2 77.5299 0.000914008 \n", - "lh_lateralorbitofrontal_part3 72.4149 0.0122065 \n", - "lh_lateralorbitofrontal_part4 69.4417 0.00992147 \n", - "lh_lingual_part1 73.0082 0.0146519 \n", - "lh_lingual_part2 54.5995 0.00745602 \n", - "lh_lingual_part3 51.8178 0.00702674 \n", - "lh_lingual_part4 64.2733 3.74977e-05 \n", - "lh_lingual_part5 17.2811 0 \n", - "lh_lingual_part6 93.5521 0.00100744 \n", - "lh_medialorbitofrontal_part1 62.0206 0.000786891 \n", - "lh_medialorbitofrontal_part2 71.6117 0.000795207 \n", - "lh_medialorbitofrontal_part3 64.4163 3.88154e-05 \n", - "lh_middletemporal_part1 68.0589 0.000683758 \n", - "lh_middletemporal_part2 64.672 6.80624e-05 \n", - "lh_middletemporal_part3 66.5584 0.00339162 \n", - "lh_middletemporal_part4 66.427 0.00189248 \n", - "lh_middletemporal_part5 69.5437 0.00837975 \n", - "lh_parahippocampal_part1 59.1748 0.00072607 \n", - "lh_parahippocampal_part2 58.1237 0.000289405 \n", - "lh_paracentral_part1 68.9099 0.00601402 \n", - "lh_paracentral_part2 70.5037 0.000558145 \n", - "lh_paracentral_part3 71.4659 0.0012621 \n", - "lh_parsopercularis_part1 74.7311 0.000419455 \n", - "lh_parsopercularis_part2 85.7913 0.00156321 \n", - "lh_parsopercularis_part3 76.5679 0.00198375 \n", - "lh_parsorbitalis_part1 74.8239 0.0246323 \n", - "lh_parstriangularis_part1 86.1448 0.0113322 \n", - "lh_parstriangularis_part2 74.2408 0.0102018 \n", - "lh_pericalcarine_part1 92.1525 0.0021726 \n", - "lh_pericalcarine_part2 45.7405 7.56609e-05 \n", - "... ... ... \n", - "rh_superiorparietal_part1 62.9667 0.109746 \n", - "rh_superiorparietal_part2 81.3446 0.00622414 \n", - "rh_superiorparietal_part3 77.5548 0.040265 \n", - "rh_superiorparietal_part4 73.3482 0.00235456 \n", - "rh_superiorparietal_part5 74.5388 0.00261622 \n", - "rh_superiorparietal_part6 79.313 0.00550631 \n", - "rh_superiorparietal_part7 65.7626 0.00234232 \n", - "rh_superiorparietal_part8 80.858 0.00246615 \n", - "rh_superiorparietal_part9 59.7709 7.73428e-05 \n", - "rh_superiorparietal_part10 74.6235 0.0024262 \n", - "rh_superiortemporal_part1 59.3691 0.000148809 \n", - "rh_superiortemporal_part2 63.2543 0.013529 \n", - "rh_superiortemporal_part3 45.6731 0.0191908 \n", - "rh_superiortemporal_part4 74.0896 0.0391727 \n", - "rh_superiortemporal_part5 64.7825 0.0127162 \n", - "rh_superiortemporal_part6 55.1969 0.00440019 \n", - "rh_supramarginal_part1 68.3553 0.0112841 \n", - "rh_supramarginal_part2 77.9471 0.00638183 \n", - "rh_supramarginal_part3 99.6038 0.00108782 \n", - "rh_supramarginal_part4 105.26 4.78677e-05 \n", - "rh_supramarginal_part5 79.1606 0.000196994 \n", - "rh_supramarginal_part6 88.3365 0.00690767 \n", - "rh_supramarginal_part7 86.3422 0.00204325 \n", - "rh_frontalpole_part1 95.8763 0.000818524 \n", - "rh_temporalpole_part1 95.6032 0.000873659 \n", - "rh_transversetemporal_part1 91.6061 0.000480546 \n", - "rh_insula_part1 35.1906 0 \n", - "rh_insula_part2 75.9696 0.00366197 \n", - "rh_insula_part3 64.3332 0.0156911 \n", - "rh_insula_part4 51.3059 0.0075188 \n", - "\n", - " centroids closeness \\\n", - "name \n", - "lh_lateralorbitofrontal_part2 [-56.40355, -40.152663, 1.708876] 0.370474 \n", - "lh_lateralorbitofrontal_part3 [-53.140506, -49.843038, 8.264557] 0.492593 \n", - "lh_lateralorbitofrontal_part4 [-5.001684, 20.645903, 25.733446] 0.430421 \n", - "lh_lingual_part1 [-33.265925, 20.200202, 45.347826] 0.399399 \n", - "lh_lingual_part2 [-31.958115, 2.146597, 51.26911] 0.331258 \n", - "lh_lingual_part3 [-38.795007, 12.584757, 33.278581] 0.287568 \n", - "lh_lingual_part4 [-39.715079, 11.341351, 48.846438] 0.250943 \n", - "lh_lingual_part5 [-8.609127, -73.360119, 17.095238] 0.285714 \n", - "lh_lingual_part6 [-5.3042, -87.102157, 19.323496] 0.401813 \n", - "lh_medialorbitofrontal_part1 [-24.010774, -5.86141, -32.826641] 0.381089 \n", - "lh_medialorbitofrontal_part2 [-30.237677, -46.493585, -17.452397] 0.387191 \n", - "lh_medialorbitofrontal_part3 [-34.771765, -9.299608, -35.172549] 0.335013 \n", - "lh_middletemporal_part1 [-33.515847, -72.220765, -14.257923] 0.415625 \n", - "lh_middletemporal_part2 [-37.632472, -38.758481, -22.9063] 0.358008 \n", - "lh_middletemporal_part3 [-38.896698, -60.874682, -16.663844] 0.413043 \n", - "lh_middletemporal_part4 [-43.393728, -58.809524, 40.471545] 0.415625 \n", - "lh_middletemporal_part5 [-35.980519, -83.125541, 18.926407] 0.479279 \n", - "lh_parahippocampal_part1 [-44.904486, -56.280753, 17.439942] 0.227545 \n", - "lh_parahippocampal_part2 [-31.993691, -75.483701, 33.056782] 0.226962 \n", - "lh_paracentral_part1 [-43.132353, -66.558824, 15.90625] 0.479279 \n", - "lh_paracentral_part2 [-37.122661, -69.533264, 43.258836] 0.408602 \n", - "lh_paracentral_part3 [-43.26638, -75.049409, 23.400644] 0.44186 \n", - "lh_parsopercularis_part1 [-45.069149, -64.283245, 32.022606] 0.413686 \n", - "lh_parsopercularis_part2 [-43.614049, -6.016575, -40.149171] 0.43252 \n", - "lh_parsopercularis_part3 [-50.245499, -60.608838, -7.837971] 0.441128 \n", - "lh_parsorbitalis_part1 [-48.242567, -19.479656, -32.479656] 0.509579 \n", - "lh_parstriangularis_part1 [-52.185499, -51.758004, -16.904896] 0.493506 \n", - "lh_parstriangularis_part2 [-52.818271, -31.30943, -26.385069] 0.479279 \n", - "lh_pericalcarine_part1 [-52.835546, -41.770174, -22.660878] 0.291667 \n", - "lh_pericalcarine_part2 [-8.616947, -48.171793, 7.731863] 0.235816 \n", - "... ... ... \n", - "rh_superiorparietal_part1 [5.707363, -24.730648, 36.269352] 0.596413 \n", - "rh_superiorparietal_part2 [50.415483, 1.973011, 7.995028] 0.486289 \n", - "rh_superiorparietal_part3 [13.824742, -24.344964, 68.442506] 0.550725 \n", - "rh_superiorparietal_part4 [54.264137, 5.644953, 24.204724] 0.448567 \n", - "rh_superiorparietal_part5 [22.698219, -15.158388, 65.774133] 0.467487 \n", - "rh_superiorparietal_part6 [55.756061, -2.12197, 27.641667] 0.485401 \n", - "rh_superiorparietal_part7 [33.546008, -20.560456, 58.860837] 0.469965 \n", - "rh_superiorparietal_part8 [48.733232, -3.49314, 43.394055] 0.469965 \n", - "rh_superiorparietal_part9 [39.911111, -11.508333, 46.213889] 0.419558 \n", - "rh_superiorparietal_part10 [33.180982, -9.761759, 53.350716] 0.467487 \n", - "rh_superiortemporal_part1 [14.098616, -58.053633, 12.916955] 0.310748 \n", - "rh_superiortemporal_part2 [7.879498, -58.918828, 24.867782] 0.490775 \n", - "rh_superiortemporal_part3 [9.761111, -47.658889, 59.438889] 0.439669 \n", - "rh_superiortemporal_part4 [17.346741, -68.079057, 26.266297] 0.525692 \n", - "rh_superiortemporal_part5 [6.423292, -59.699888, 49.988802] 0.470796 \n", - "rh_superiortemporal_part6 [7.5625, -66.638221, 37.237981] 0.439669 \n", - "rh_supramarginal_part1 [9.153191, -45.782979, 40.912766] 0.511538 \n", - "rh_supramarginal_part2 [5.983949, 34.532588, 2.542802] 0.438944 \n", - "rh_supramarginal_part3 [28.995132, 56.1363, -10.249652] 0.431118 \n", - "rh_supramarginal_part4 [22.805582, 58.19538, -1.627526] 0.337136 \n", - "rh_supramarginal_part5 [31.818499, 29.862129, 37.897033] 0.387755 \n", - "rh_supramarginal_part6 [38.776316, 49.490132, 5.110746] 0.486289 \n", - "rh_supramarginal_part7 [43.91779, 26.858491, 30.252022] 0.438221 \n", - "rh_frontalpole_part1 [23.690265, 56.926254, 12.712881] 0.418239 \n", - "rh_temporalpole_part1 [43.268354, 33.058228, 22.368354] 0.338854 \n", - "rh_transversetemporal_part1 [24.458836, 47.983535, 26.632272] 0.365887 \n", - "rh_insula_part1 [38.413146, 43.921127, 19.2723] 0.21061 \n", - "rh_insula_part2 [30.409341, 40.024725, 24.248626] 0.413043 \n", - "rh_insula_part3 [9.729638, 6.951357, 45.687783] 0.361905 \n", - "rh_insula_part4 [10.931872, 61.39076, 5.931872] 0.266533 \n", - "\n", - " clustering degree interhem interhem_proportion \\\n", - "name \n", - "lh_lateralorbitofrontal_part2 0.638889 9 4 0.444444 \n", - "lh_lateralorbitofrontal_part3 0.340986 49 19 0.387755 \n", - "lh_lateralorbitofrontal_part4 0.387097 31 7 0.225806 \n", - "lh_lingual_part1 0.388889 9 3 0.333333 \n", - "lh_lingual_part2 0.3 5 1 0.2 \n", - "lh_lingual_part3 0 2 0 0 \n", - "lh_lingual_part4 0 2 1 0.5 \n", - "lh_lingual_part5 0 1 1 1 \n", - "lh_lingual_part6 0.490909 11 4 0.363636 \n", - "lh_medialorbitofrontal_part1 0.602564 13 5 0.384615 \n", - "lh_medialorbitofrontal_part2 0.562092 18 5 0.277778 \n", - "lh_medialorbitofrontal_part3 0.3 5 1 0.2 \n", - "lh_middletemporal_part1 0.474359 13 6 0.461538 \n", - "lh_middletemporal_part2 0.333333 4 1 0.25 \n", - "lh_middletemporal_part3 0.285714 15 2 0.133333 \n", - "lh_middletemporal_part4 0.371429 15 5 0.333333 \n", - "lh_middletemporal_part5 0.271264 30 10 0.333333 \n", - "lh_parahippocampal_part1 0 2 1 0.5 \n", - "lh_parahippocampal_part2 0 2 0 0 \n", - "lh_paracentral_part1 0.385598 42 19 0.452381 \n", - "lh_paracentral_part2 0.508333 16 5 0.3125 \n", - "lh_paracentral_part3 0.458498 23 9 0.391304 \n", - "lh_parsopercularis_part1 0.703448 30 9 0.3 \n", - "lh_parsopercularis_part2 0.442105 20 7 0.35 \n", - "lh_parsopercularis_part3 0.571429 36 9 0.25 \n", - "lh_parsorbitalis_part1 0.294276 55 14 0.254545 \n", - "lh_parstriangularis_part1 0.397243 57 25 0.438596 \n", - "lh_parstriangularis_part2 0.366497 49 12 0.244898 \n", - "lh_pericalcarine_part1 0.533333 6 2 0.333333 \n", - "lh_pericalcarine_part2 0.666667 3 2 0.666667 \n", - "... ... ... ... ... \n", - "rh_superiorparietal_part1 0.214248 107 60 0.560748 \n", - "rh_superiorparietal_part2 0.437925 49 27 0.55102 \n", - "rh_superiorparietal_part3 0.296639 85 47 0.552941 \n", - "rh_superiorparietal_part4 0.609687 27 13 0.481481 \n", - "rh_superiorparietal_part5 0.508537 41 21 0.512195 \n", - "rh_superiorparietal_part6 0.433757 58 30 0.517241 \n", - "rh_superiorparietal_part7 0.477952 38 14 0.368421 \n", - "rh_superiorparietal_part8 0.519192 45 26 0.577778 \n", - "rh_superiorparietal_part9 0.769231 13 7 0.538462 \n", - "rh_superiorparietal_part10 0.457317 41 21 0.512195 \n", - "rh_superiortemporal_part1 0.5 4 2 0.5 \n", - "rh_superiortemporal_part2 0.30404 45 18 0.4 \n", - "rh_superiortemporal_part3 0.358333 16 7 0.4375 \n", - "rh_superiortemporal_part4 0.236612 61 36 0.590164 \n", - "rh_superiortemporal_part5 0.333333 30 10 0.333333 \n", - "rh_superiortemporal_part6 0.395238 21 10 0.47619 \n", - "rh_supramarginal_part1 0.365915 57 30 0.526316 \n", - "rh_supramarginal_part2 0.278947 20 8 0.4 \n", - "rh_supramarginal_part3 0.398693 18 7 0.388889 \n", - "rh_supramarginal_part4 0 3 0 0 \n", - "rh_supramarginal_part5 0.5 9 3 0.333333 \n", - "rh_supramarginal_part6 0.300142 38 13 0.342105 \n", - "rh_supramarginal_part7 0.406154 26 14 0.538462 \n", - "rh_frontalpole_part1 0.56917 23 12 0.521739 \n", - "rh_temporalpole_part1 0.4 5 3 0.6 \n", - "rh_transversetemporal_part1 0.666667 7 2 0.285714 \n", - "rh_insula_part1 0 1 0 0 \n", - "rh_insula_part2 0.362637 14 3 0.214286 \n", - "rh_insula_part3 0 5 1 0.2 \n", - "rh_insula_part4 0 2 0 0 \n", - "\n", - " module participation_coefficient \\\n", - "name \n", - "lh_lateralorbitofrontal_part2 0 0.395062 \n", - "lh_lateralorbitofrontal_part3 0 0.879633 \n", - "lh_lateralorbitofrontal_part4 1 0.62435 \n", - "lh_lingual_part1 2 0.395062 \n", - "lh_lingual_part2 3 0.36 \n", - "lh_lingual_part3 0 0.75 \n", - "lh_lingual_part4 3 0 \n", - "lh_lingual_part5 4 0 \n", - "lh_lingual_part6 2 0.173554 \n", - "lh_medialorbitofrontal_part1 0 0.408284 \n", - "lh_medialorbitofrontal_part2 1 0.305556 \n", - "lh_medialorbitofrontal_part3 0 0.84 \n", - "lh_middletemporal_part1 0 0.408284 \n", - "lh_middletemporal_part2 0 0.75 \n", - "lh_middletemporal_part3 0 0.84 \n", - "lh_middletemporal_part4 0 0.555556 \n", - "lh_middletemporal_part5 0 0.888889 \n", - "lh_parahippocampal_part1 0 0 \n", - "lh_parahippocampal_part2 0 0 \n", - "lh_paracentral_part1 2 0.61678 \n", - "lh_paracentral_part2 5 0.75 \n", - "lh_paracentral_part3 5 0.810964 \n", - "lh_parsopercularis_part1 1 0.128889 \n", - "lh_parsopercularis_part2 1 0.64 \n", - "lh_parsopercularis_part3 1 0.305556 \n", - "lh_parsorbitalis_part1 1 0.721983 \n", - "lh_parstriangularis_part1 1 0.48261 \n", - "lh_parstriangularis_part2 1 0.518534 \n", - "lh_pericalcarine_part1 3 0 \n", - "lh_pericalcarine_part2 3 0 \n", - "... ... ... \n", - "rh_superiorparietal_part1 2 0.547209 \n", - "rh_superiorparietal_part2 2 0.546439 \n", - "rh_superiorparietal_part3 2 0.581315 \n", - "rh_superiorparietal_part4 2 0.142661 \n", - "rh_superiorparietal_part5 2 0.185604 \n", - "rh_superiorparietal_part6 2 0.500297 \n", - "rh_superiorparietal_part7 2 0.41759 \n", - "rh_superiorparietal_part8 2 0.209877 \n", - "rh_superiorparietal_part9 2 0.147929 \n", - "rh_superiorparietal_part10 2 0.22903 \n", - "rh_superiortemporal_part1 4 0.4375 \n", - "rh_superiortemporal_part2 2 0.555556 \n", - "rh_superiortemporal_part3 4 0.609375 \n", - "rh_superiortemporal_part4 4 0.961301 \n", - "rh_superiortemporal_part5 4 0.91 \n", - "rh_superiortemporal_part6 4 0.773243 \n", - "rh_supramarginal_part1 2 0.376731 \n", - "rh_supramarginal_part2 2 0.5775 \n", - "rh_supramarginal_part3 2 0.555556 \n", - "rh_supramarginal_part4 2 0 \n", - "rh_supramarginal_part5 2 0.395062 \n", - "rh_supramarginal_part6 2 0.66482 \n", - "rh_supramarginal_part7 2 0.217456 \n", - "rh_frontalpole_part1 1 0.453686 \n", - "rh_temporalpole_part1 0 0.36 \n", - "rh_transversetemporal_part1 4 0.265306 \n", - "rh_insula_part1 4 0 \n", - "rh_insula_part2 4 0.586735 \n", - "rh_insula_part3 4 0.64 \n", - "rh_insula_part4 4 0 \n", - "\n", - " shortest_path_length total_dist x \\\n", - "name \n", - "lh_lateralorbitofrontal_part2 2.68914 697.769 -56.4036 \n", - "lh_lateralorbitofrontal_part3 2.02247 3548.33 -53.1405 \n", - "lh_lateralorbitofrontal_part4 2.31461 2152.69 -5.00168 \n", - "lh_lingual_part1 2.49438 657.074 -33.2659 \n", - "lh_lingual_part2 3.00749 272.998 -31.9581 \n", - "lh_lingual_part3 3.46442 103.636 -38.795 \n", - "lh_lingual_part4 3.97004 128.547 -39.7151 \n", - "lh_lingual_part5 3.48689 17.2811 -8.60913 \n", - "lh_lingual_part6 2.4794 1029.07 -5.3042 \n", - "lh_medialorbitofrontal_part1 2.61423 806.268 -24.0108 \n", - "lh_medialorbitofrontal_part2 2.57303 1289.01 -30.2377 \n", - "lh_medialorbitofrontal_part3 2.97378 322.081 -34.7718 \n", - "lh_middletemporal_part1 2.397 884.766 -33.5158 \n", - "lh_middletemporal_part2 2.78277 258.688 -37.6325 \n", - "lh_middletemporal_part3 2.41199 998.377 -38.8967 \n", - "lh_middletemporal_part4 2.397 996.405 -43.3937 \n", - "lh_middletemporal_part5 2.07865 2086.31 -35.9805 \n", - "lh_parahippocampal_part1 4.37828 118.35 -44.9045 \n", - "lh_parahippocampal_part2 4.38951 116.247 -31.9937 \n", - "lh_paracentral_part1 2.07865 2894.21 -43.1324 \n", - "lh_paracentral_part2 2.4382 1128.06 -37.1227 \n", - "lh_paracentral_part3 2.25468 1643.71 -43.2664 \n", - "lh_parsopercularis_part1 2.40824 2241.93 -45.0691 \n", - "lh_parsopercularis_part2 2.30337 1715.83 -43.614 \n", - "lh_parsopercularis_part3 2.25843 2756.44 -50.2455 \n", - "lh_parsorbitalis_part1 1.95506 4115.31 -48.2426 \n", - "lh_parstriangularis_part1 2.01873 4910.25 -52.1855 \n", - "lh_parstriangularis_part2 2.07865 3637.8 -52.8183 \n", - "lh_pericalcarine_part1 3.41573 552.915 -52.8355 \n", - "lh_pericalcarine_part2 4.22472 137.222 -8.61695 \n", - "... ... ... ... \n", - "rh_superiorparietal_part1 1.67041 6737.43 5.70736 \n", - "rh_superiorparietal_part2 2.04869 3985.89 50.4155 \n", - "rh_superiorparietal_part3 1.80899 6592.16 13.8247 \n", - "rh_superiorparietal_part4 2.22097 1980.4 54.2641 \n", - "rh_superiorparietal_part5 2.13109 3056.09 22.6982 \n", - "rh_superiorparietal_part6 2.05243 4600.15 55.7561 \n", - "rh_superiorparietal_part7 2.11985 2498.98 33.546 \n", - "rh_superiorparietal_part8 2.11985 3638.61 48.7332 \n", - "rh_superiorparietal_part9 2.37453 777.022 39.9111 \n", - "rh_superiorparietal_part10 2.13109 3059.56 33.181 \n", - "rh_superiortemporal_part1 3.20599 237.476 14.0986 \n", - "rh_superiortemporal_part2 2.02996 2846.44 7.8795 \n", - "rh_superiortemporal_part3 2.26592 730.77 9.76111 \n", - "rh_superiortemporal_part4 1.89513 4519.47 17.3467 \n", - "rh_superiortemporal_part5 2.1161 1943.48 6.42329 \n", - "rh_superiortemporal_part6 2.26592 1159.14 7.5625 \n", - "rh_supramarginal_part1 1.94757 3896.25 9.15319 \n", - "rh_supramarginal_part2 2.26966 1558.94 5.98395 \n", - "rh_supramarginal_part3 2.31086 1792.87 28.9951 \n", - "rh_supramarginal_part4 2.95506 315.781 22.8056 \n", - "rh_supramarginal_part5 2.56929 712.445 31.8185 \n", - "rh_supramarginal_part6 2.04869 3356.79 38.7763 \n", - "rh_supramarginal_part7 2.27341 2244.9 43.9178 \n", - "rh_frontalpole_part1 2.38202 2205.15 23.6903 \n", - "rh_temporalpole_part1 2.94007 478.016 43.2684 \n", - "rh_transversetemporal_part1 2.72285 641.243 24.4588 \n", - "rh_insula_part1 4.73034 35.1906 38.4131 \n", - "rh_insula_part2 2.41199 1063.57 30.4093 \n", - "rh_insula_part3 2.75281 321.666 9.72964 \n", - "rh_insula_part4 3.73783 102.612 10.9319 \n", - "\n", - " y z \n", - "name \n", - "lh_lateralorbitofrontal_part2 -40.1527 1.70888 \n", - "lh_lateralorbitofrontal_part3 -49.843 8.26456 \n", - "lh_lateralorbitofrontal_part4 20.6459 25.7334 \n", - "lh_lingual_part1 20.2002 45.3478 \n", - "lh_lingual_part2 2.1466 51.2691 \n", - "lh_lingual_part3 12.5848 33.2786 \n", - "lh_lingual_part4 11.3414 48.8464 \n", - "lh_lingual_part5 -73.3601 17.0952 \n", - "lh_lingual_part6 -87.1022 19.3235 \n", - "lh_medialorbitofrontal_part1 -5.86141 -32.8266 \n", - "lh_medialorbitofrontal_part2 -46.4936 -17.4524 \n", - "lh_medialorbitofrontal_part3 -9.29961 -35.1725 \n", - "lh_middletemporal_part1 -72.2208 -14.2579 \n", - "lh_middletemporal_part2 -38.7585 -22.9063 \n", - "lh_middletemporal_part3 -60.8747 -16.6638 \n", - "lh_middletemporal_part4 -58.8095 40.4715 \n", - "lh_middletemporal_part5 -83.1255 18.9264 \n", - "lh_parahippocampal_part1 -56.2808 17.4399 \n", - "lh_parahippocampal_part2 -75.4837 33.0568 \n", - "lh_paracentral_part1 -66.5588 15.9062 \n", - "lh_paracentral_part2 -69.5333 43.2588 \n", - "lh_paracentral_part3 -75.0494 23.4006 \n", - "lh_parsopercularis_part1 -64.2832 32.0226 \n", - "lh_parsopercularis_part2 -6.01657 -40.1492 \n", - "lh_parsopercularis_part3 -60.6088 -7.83797 \n", - "lh_parsorbitalis_part1 -19.4797 -32.4797 \n", - "lh_parstriangularis_part1 -51.758 -16.9049 \n", - "lh_parstriangularis_part2 -31.3094 -26.3851 \n", - "lh_pericalcarine_part1 -41.7702 -22.6609 \n", - "lh_pericalcarine_part2 -48.1718 7.73186 \n", - "... ... ... \n", - "rh_superiorparietal_part1 -24.7306 36.2694 \n", - "rh_superiorparietal_part2 1.97301 7.99503 \n", - "rh_superiorparietal_part3 -24.345 68.4425 \n", - "rh_superiorparietal_part4 5.64495 24.2047 \n", - "rh_superiorparietal_part5 -15.1584 65.7741 \n", - "rh_superiorparietal_part6 -2.12197 27.6417 \n", - "rh_superiorparietal_part7 -20.5605 58.8608 \n", - "rh_superiorparietal_part8 -3.49314 43.3941 \n", - "rh_superiorparietal_part9 -11.5083 46.2139 \n", - "rh_superiorparietal_part10 -9.76176 53.3507 \n", - "rh_superiortemporal_part1 -58.0536 12.917 \n", - "rh_superiortemporal_part2 -58.9188 24.8678 \n", - "rh_superiortemporal_part3 -47.6589 59.4389 \n", - "rh_superiortemporal_part4 -68.0791 26.2663 \n", - "rh_superiortemporal_part5 -59.6999 49.9888 \n", - "rh_superiortemporal_part6 -66.6382 37.238 \n", - "rh_supramarginal_part1 -45.783 40.9128 \n", - "rh_supramarginal_part2 34.5326 2.5428 \n", - "rh_supramarginal_part3 56.1363 -10.2497 \n", - "rh_supramarginal_part4 58.1954 -1.62753 \n", - "rh_supramarginal_part5 29.8621 37.897 \n", - "rh_supramarginal_part6 49.4901 5.11075 \n", - "rh_supramarginal_part7 26.8585 30.252 \n", - "rh_frontalpole_part1 56.9263 12.7129 \n", - "rh_temporalpole_part1 33.0582 22.3684 \n", - "rh_transversetemporal_part1 47.9835 26.6323 \n", - "rh_insula_part1 43.9211 19.2723 \n", - "rh_insula_part2 40.0247 24.2486 \n", - "rh_insula_part3 6.95136 45.6878 \n", - "rh_insula_part4 61.3908 5.93187 \n", - "\n", - "[267 rows x 15 columns]" + " degree hat name\n", + "0 47 0 lh_bankssts_part1\n", + "1 55 1 lh_bankssts_part2\n", + "2 2 4 lh_caudalanteriorcingulate_part1\n", + "3 83 9 lh_caudalmiddlefrontal_part1\n", + "4 95 16 lh_caudalmiddlefrontal_part2" ] }, - "execution_count": 8, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "H.export_nodal_measures()" + "H.export_nodal_measures(columns=['name', 'degree', 'hat']).head()" ] }, { @@ -1753,20 +827,20 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "{'assortativity': 0.11824866195197306,\n", - " 'average_clustering': 0.4377630334995577,\n", - " 'average_shortest_path_length': 2.4554645039565206,\n", - " 'efficiency': 0.4703396063727101,\n", - " 'modularity': 0.38391579559099454}" + "{'assortativity': 0.09076922258276784,\n", + " 'average_clustering': 0.4498887255891581,\n", + " 'average_shortest_path_length': 2.376242649858285,\n", + " 'efficiency': 0.47983958611582617,\n", + " 'modularity': 0.3828553111606414}" ] }, - "execution_count": 9, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } @@ -1777,125 +851,75 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 14, "metadata": { "scrolled": false }, + "outputs": [], + "source": [ + "H.calculate_rich_club();" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Create a GraphBundle\n", + "\n", + "The `GraphBundle` object is the BrainNetworksInPython way to handle across network comparisons. What is it? Essentially it's a python dictionary with `BrainNetwork` objects as values. " + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "brain_bundle = bnip.GraphBundle([H], ['NSPN_cost=10'])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "This creates a dictionary-like object with BrainNetwork `H` keyed by `'NSPN_cost=10'`" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "scrolled": true + }, "outputs": [ { "data": { "text/plain": [ - "{0: 0.09999718397116386,\n", - " 1: 0.1044798113763631,\n", - " 2: 0.11001836232921477,\n", - " 3: 0.11489486744155675,\n", - " 4: 0.12263985091944728,\n", - " 5: 0.12916106881624123,\n", - " 6: 0.1352212389380531,\n", - " 7: 0.1392116097998451,\n", - " 8: 0.14657683112366876,\n", - " 9: 0.1562869997632015,\n", - " 10: 0.16321608040201005,\n", - " 11: 0.16813186813186815,\n", - " 12: 0.16954797779540048,\n", - " 13: 0.18207990599294946,\n", - " 14: 0.19305341551104263,\n", - " 15: 0.20165118679050567,\n", - " 16: 0.21093865484109386,\n", - " 17: 0.2184748427672956,\n", - " 18: 0.22790934555640438,\n", - " 19: 0.23662252856883728,\n", - " 20: 0.24621212121212122,\n", - " 21: 0.25217831813576497,\n", - " 22: 0.255760608904181,\n", - " 23: 0.271873165002936,\n", - " 24: 0.2852903225806452,\n", - " 25: 0.288817806210849,\n", - " 26: 0.30073880921338547,\n", - " 27: 0.3095792578792113,\n", - " 28: 0.3200815494393476,\n", - " 29: 0.33186813186813185,\n", - " 30: 0.35009467704607616,\n", - " 31: 0.35879059350503917,\n", - " 32: 0.36741519350215,\n", - " 33: 0.3756384065372829,\n", - " 34: 0.3811217510259918,\n", - " 35: 0.3884107860011474,\n", - " 36: 0.39567901234567904,\n", - " 37: 0.417427701674277,\n", - " 38: 0.4382284382284382,\n", - " 39: 0.4394230769230769,\n", - " 40: 0.4479111581173982,\n", - " 41: 0.4676346037507562,\n", - " 42: 0.48148148148148145,\n", - " 43: 0.4856743535988819,\n", - " 44: 0.488388969521045,\n", - " 45: 0.5106382978723404,\n", - " 46: 0.5252525252525253,\n", - " 47: 0.5359408033826638,\n", - " 48: 0.55,\n", - " 49: 0.5777777777777777,\n", - " 50: 0.5798319327731093,\n", - " 51: 0.6137931034482759,\n", - " 52: 0.6190476190476191,\n", - " 53: 0.6353276353276354,\n", - " 54: 0.6353276353276354,\n", - " 55: 0.6666666666666666,\n", - " 56: 0.6753246753246753,\n", - " 57: 0.7368421052631579,\n", - " 58: 0.7833333333333333,\n", - " 59: 0.7252747252747253,\n", - " 60: 0.7051282051282052,\n", - " 61: 0.7454545454545455,\n", - " 62: 0.7555555555555555,\n", - " 63: 0.8055555555555556,\n", - " 64: 0.8055555555555556,\n", - " 65: 0.8055555555555556,\n", - " 66: 0.8928571428571429,\n", - " 67: 0.8928571428571429,\n", - " 68: 0.8928571428571429,\n", - " 69: 0.8928571428571429,\n", - " 70: 0.8928571428571429,\n", - " 71: 0.9523809523809523,\n", - " 72: 0.9523809523809523,\n", - " 73: 0.9333333333333333,\n", - " 74: 1.0,\n", - " 75: 1.0,\n", - " 76: 1.0,\n", - " 77: 1.0,\n", - " 78: 1.0,\n", - " 79: 1.0,\n", - " 80: 1.0,\n", - " 81: 1.0,\n", - " 82: 1.0,\n", - " 83: 1.0,\n", - " 84: 1.0}" + "{'NSPN_cost=10': }" ] }, - "execution_count": 10, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "H.calculate_rich_club()" + "brain_bundle" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "## Create a GraphBundle\n", - "\n", - "The `GraphBundle` object is the BrainNetworksInPython way to handle across network comparisons. What is it? Essentially it's a python dictionary with `BrainNetwork` objects as values. " + "Now add a series of random_graphs created by edge swap randomisation of H (keyed by `'NSPN_cost=10'`)" ] }, { "cell_type": "code", - "execution_count": 11, - "metadata": { - "scrolled": true - }, + "execution_count": 17, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -1906,10 +930,39 @@ } ], "source": [ - "brain_bundle = bnip.GraphBundle([H], ['NSPN_WhitakerVertes_PNAS2016_cost=10'])\n", "# Note that 10 is not usually a sufficient number of random graphs to do meaningful analysis,\n", "# it is used here for time considerations\n", - "brain_bundle.create_random_graphs('NSPN_WhitakerVertes_PNAS2016_cost=10', 10)" + "brain_bundle.create_random_graphs('NSPN_cost=10', 10)" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'NSPN_cost=10': ,\n", + " 1: ,\n", + " 2: ,\n", + " 3: ,\n", + " 4: ,\n", + " 5: ,\n", + " 6: ,\n", + " 7: ,\n", + " 8: ,\n", + " 9: ,\n", + " 10: }" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "brain_bundle" ] }, { @@ -1923,7 +976,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 19, "metadata": {}, "outputs": [ { @@ -1956,91 +1009,91 @@ " \n", " \n", " \n", - " NSPN_WhitakerVertes_PNAS2016_cost=10\n", - " 0.118249\n", - " 0.437763\n", - " 2.455465\n", - " 0.470340\n", - " 0.383916\n", + " NSPN_cost=10\n", + " 0.090769\n", + " 0.449889\n", + " 2.376243\n", + " 0.479840\n", + " 0.382855\n", " \n", " \n", " 1\n", - " -0.073708\n", - " 0.225225\n", - " 2.119850\n", - " 0.513916\n", + " -0.071249\n", + " 0.235727\n", + " 2.093193\n", + " 0.518252\n", " 0.000000\n", " \n", " \n", " 2\n", - " -0.088696\n", - " 0.230606\n", - " 2.116330\n", - " 0.514315\n", + " -0.098295\n", + " 0.226066\n", + " 2.080397\n", + " 0.520099\n", " 0.000000\n", " \n", " \n", " 3\n", - " -0.109531\n", - " 0.225835\n", - " 2.113739\n", - " 0.514871\n", + " -0.077308\n", + " 0.213056\n", + " 2.088879\n", + " 0.518763\n", " 0.000000\n", " \n", " \n", " 4\n", - " -0.062834\n", - " 0.226202\n", - " 2.111430\n", - " 0.515094\n", + " -0.088068\n", + " 0.238785\n", + " 2.086594\n", + " 0.519347\n", " 0.000000\n", " \n", " \n", " 5\n", - " -0.069585\n", - " 0.220937\n", - " 2.126271\n", - " 0.513408\n", + " -0.070630\n", + " 0.227094\n", + " 2.092855\n", + " 0.518107\n", " 0.000000\n", " \n", " \n", " 6\n", - " -0.065148\n", - " 0.218086\n", - " 2.125032\n", - " 0.513100\n", + " -0.081738\n", + " 0.231484\n", + " 2.091057\n", + " 0.518607\n", " 0.000000\n", " \n", " \n", " 7\n", - " -0.084736\n", - " 0.233843\n", - " 2.108755\n", - " 0.515502\n", + " -0.074692\n", + " 0.230248\n", + " 2.094801\n", + " 0.517963\n", " 0.000000\n", " \n", " \n", " 8\n", - " -0.062070\n", - " 0.222203\n", - " 2.118132\n", - " 0.514172\n", + " -0.083732\n", + " 0.227024\n", + " 2.090317\n", + " 0.518569\n", " 0.000000\n", " \n", " \n", " 9\n", - " -0.057764\n", - " 0.234477\n", - " 2.118611\n", - " 0.513993\n", + " -0.092003\n", + " 0.234767\n", + " 2.083273\n", + " 0.519629\n", " 0.000000\n", " \n", " \n", " 10\n", - " -0.049595\n", - " 0.220120\n", - " 2.118358\n", - " 0.514012\n", + " -0.081507\n", + " 0.226348\n", + " 2.090634\n", + " 0.518729\n", " 0.000000\n", " \n", " \n", @@ -2048,47 +1101,34 @@ "" ], "text/plain": [ - " assortativity average_clustering \\\n", - "NSPN_WhitakerVertes_PNAS2016_cost=10 0.118249 0.437763 \n", - "1 -0.073708 0.225225 \n", - "2 -0.088696 0.230606 \n", - "3 -0.109531 0.225835 \n", - "4 -0.062834 0.226202 \n", - "5 -0.069585 0.220937 \n", - "6 -0.065148 0.218086 \n", - "7 -0.084736 0.233843 \n", - "8 -0.062070 0.222203 \n", - "9 -0.057764 0.234477 \n", - "10 -0.049595 0.220120 \n", - "\n", - " average_shortest_path_length \\\n", - "NSPN_WhitakerVertes_PNAS2016_cost=10 2.455465 \n", - "1 2.119850 \n", - "2 2.116330 \n", - "3 2.113739 \n", - "4 2.111430 \n", - "5 2.126271 \n", - "6 2.125032 \n", - "7 2.108755 \n", - "8 2.118132 \n", - "9 2.118611 \n", - "10 2.118358 \n", + " assortativity average_clustering average_shortest_path_length \\\n", + "NSPN_cost=10 0.090769 0.449889 2.376243 \n", + "1 -0.071249 0.235727 2.093193 \n", + "2 -0.098295 0.226066 2.080397 \n", + "3 -0.077308 0.213056 2.088879 \n", + "4 -0.088068 0.238785 2.086594 \n", + "5 -0.070630 0.227094 2.092855 \n", + "6 -0.081738 0.231484 2.091057 \n", + "7 -0.074692 0.230248 2.094801 \n", + "8 -0.083732 0.227024 2.090317 \n", + "9 -0.092003 0.234767 2.083273 \n", + "10 -0.081507 0.226348 2.090634 \n", "\n", - " efficiency modularity \n", - "NSPN_WhitakerVertes_PNAS2016_cost=10 0.470340 0.383916 \n", - "1 0.513916 0.000000 \n", - "2 0.514315 0.000000 \n", - "3 0.514871 0.000000 \n", - "4 0.515094 0.000000 \n", - "5 0.513408 0.000000 \n", - "6 0.513100 0.000000 \n", - "7 0.515502 0.000000 \n", - "8 0.514172 0.000000 \n", - "9 0.513993 0.000000 \n", - "10 0.514012 0.000000 " + " efficiency modularity \n", + "NSPN_cost=10 0.479840 0.382855 \n", + "1 0.518252 0.000000 \n", + "2 0.520099 0.000000 \n", + "3 0.518763 0.000000 \n", + "4 0.519347 0.000000 \n", + "5 0.518107 0.000000 \n", + "6 0.518607 0.000000 \n", + "7 0.517963 0.000000 \n", + "8 0.518569 0.000000 \n", + "9 0.519629 0.000000 \n", + "10 0.518729 0.000000 " ] }, - "execution_count": 12, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } @@ -2099,7 +1139,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 20, "metadata": {}, "outputs": [ { @@ -2134,31 +1174,31 @@ " 8\n", " 9\n", " ...\n", - " 75\n", - " 76\n", - " 77\n", - " 78\n", - " 79\n", - " 80\n", - " 81\n", - " 82\n", - " 83\n", - " 84\n", + " 96\n", + " 97\n", + " 98\n", + " 99\n", + " 100\n", + " 101\n", + " 102\n", + " 103\n", + " 104\n", + " 105\n", " \n", " \n", " \n", " \n", - " NSPN_WhitakerVertes_PNAS2016_cost=10\n", - " 0.099997\n", - " 0.10448\n", - " 0.110018\n", - " 0.114895\n", - " 0.122640\n", - " 0.129161\n", - " 0.135221\n", - " 0.139212\n", - " 0.146577\n", - " 0.156287\n", + " NSPN_cost=10\n", + " 0.100004\n", + " 0.103228\n", + " 0.107244\n", + " 0.112039\n", + " 0.117842\n", + " 0.122398\n", + " 0.127975\n", + " 0.131899\n", + " 0.136820\n", + " 0.141069\n", " ...\n", " 1.0\n", " 1.0\n", @@ -2173,16 +1213,16 @@ " \n", " \n", " 1\n", - " 0.099997\n", - " 0.10448\n", - " 0.109894\n", - " 0.114699\n", - " 0.122253\n", - " 0.128452\n", - " 0.133963\n", - " 0.137703\n", - " 0.144447\n", - " 0.153635\n", + " 0.100004\n", + " 0.103228\n", + " 0.107175\n", + " 0.111920\n", + " 0.117564\n", + " 0.121950\n", + " 0.127226\n", + " 0.131092\n", + " 0.135825\n", + " 0.139908\n", " ...\n", " 1.0\n", " 1.0\n", @@ -2197,16 +1237,16 @@ " \n", " \n", " 2\n", - " 0.099997\n", - " 0.10448\n", - " 0.109894\n", - " 0.114699\n", - " 0.122253\n", - " 0.128489\n", - " 0.134041\n", - " 0.137785\n", - " 0.144534\n", - " 0.153824\n", + " 0.100004\n", + " 0.103228\n", + " 0.107175\n", + " 0.111920\n", + " 0.117564\n", + " 0.121950\n", + " 0.127226\n", + " 0.131092\n", + " 0.135885\n", + " 0.139940\n", " ...\n", " 1.0\n", " 1.0\n", @@ -2221,40 +1261,40 @@ " \n", " \n", " 3\n", - " 0.099997\n", - " 0.10448\n", - " 0.109894\n", - " 0.114699\n", - " 0.122253\n", - " 0.128452\n", - " 0.133963\n", - " 0.137703\n", - " 0.144403\n", - " 0.153587\n", + " 0.100004\n", + " 0.103228\n", + " 0.107175\n", + " 0.111920\n", + " 0.117564\n", + " 0.121950\n", + " 0.127226\n", + " 0.131150\n", + " 0.135885\n", + " 0.139940\n", " ...\n", - " 1.0\n", - " 1.0\n", - " 1.0\n", - " 1.0\n", - " 1.0\n", - " 1.0\n", - " 1.0\n", - " 1.0\n", - " 1.0\n", - " 1.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", " \n", " \n", " 4\n", - " 0.099997\n", - " 0.10448\n", - " 0.109894\n", - " 0.114699\n", - " 0.122253\n", - " 0.128452\n", - " 0.133963\n", - " 0.137703\n", - " 0.144577\n", - " 0.153966\n", + " 0.100004\n", + " 0.103228\n", + " 0.107175\n", + " 0.111920\n", + " 0.117589\n", + " 0.121976\n", + " 0.127254\n", + " 0.131121\n", + " 0.135915\n", + " 0.139940\n", " ...\n", " 1.0\n", " 1.0\n", @@ -2269,40 +1309,40 @@ " \n", " \n", " 5\n", - " 0.099997\n", - " 0.10448\n", - " 0.109925\n", - " 0.114732\n", - " 0.122323\n", - " 0.128527\n", - " 0.134041\n", - " 0.137866\n", - " 0.144621\n", - " 0.153777\n", + " 0.100004\n", + " 0.103228\n", + " 0.107175\n", + " 0.111920\n", + " 0.117564\n", + " 0.121950\n", + " 0.127226\n", + " 0.131092\n", + " 0.135855\n", + " 0.139908\n", " ...\n", - " 1.0\n", - " 1.0\n", - " 1.0\n", - " 1.0\n", - " 1.0\n", - " 1.0\n", - " 1.0\n", - " 1.0\n", - " 1.0\n", - " 1.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", " \n", " \n", " 6\n", - " 0.099997\n", - " 0.10448\n", - " 0.109894\n", - " 0.114699\n", - " 0.122288\n", - " 0.128527\n", - " 0.134081\n", - " 0.137866\n", - " 0.144664\n", - " 0.154014\n", + " 0.100004\n", + " 0.103228\n", + " 0.107175\n", + " 0.111920\n", + " 0.117564\n", + " 0.121950\n", + " 0.127254\n", + " 0.131121\n", + " 0.135855\n", + " 0.139971\n", " ...\n", " 1.0\n", " 1.0\n", @@ -2317,16 +1357,16 @@ " \n", " \n", " 7\n", - " 0.099997\n", - " 0.10448\n", - " 0.109894\n", - " 0.114699\n", - " 0.122253\n", - " 0.128489\n", - " 0.134041\n", - " 0.137785\n", - " 0.144534\n", - " 0.153730\n", + " 0.100004\n", + " 0.103228\n", + " 0.107175\n", + " 0.111920\n", + " 0.117564\n", + " 0.121976\n", + " 0.127282\n", + " 0.131208\n", + " 0.135976\n", + " 0.140065\n", " ...\n", " 1.0\n", " 1.0\n", @@ -2341,16 +1381,16 @@ " \n", " \n", " 8\n", - " 0.099997\n", - " 0.10448\n", - " 0.109894\n", - " 0.114699\n", - " 0.122253\n", - " 0.128489\n", - " 0.134002\n", - " 0.137744\n", - " 0.144447\n", - " 0.153682\n", + " 0.100004\n", + " 0.103228\n", + " 0.107175\n", + " 0.111920\n", + " 0.117564\n", + " 0.121950\n", + " 0.127282\n", + " 0.131150\n", + " 0.135915\n", + " 0.140034\n", " ...\n", " 1.0\n", " 1.0\n", @@ -2365,16 +1405,16 @@ " \n", " \n", " 9\n", - " 0.099997\n", - " 0.10448\n", - " 0.109894\n", - " 0.114699\n", - " 0.122253\n", - " 0.128452\n", - " 0.133963\n", - " 0.137703\n", - " 0.144490\n", - " 0.153777\n", + " 0.100004\n", + " 0.103228\n", + " 0.107175\n", + " 0.111920\n", + " 0.117564\n", + " 0.121950\n", + " 0.127226\n", + " 0.131092\n", + " 0.135825\n", + " 0.139877\n", " ...\n", " 1.0\n", " 1.0\n", @@ -2389,90 +1429,77 @@ " \n", " \n", " 10\n", - " 0.099997\n", - " 0.10448\n", - " 0.109894\n", - " 0.114699\n", - " 0.122253\n", - " 0.128452\n", - " 0.134041\n", - " 0.137785\n", - " 0.144577\n", - " 0.153730\n", + " 0.100004\n", + " 0.103228\n", + " 0.107175\n", + " 0.111920\n", + " 0.117564\n", + " 0.121950\n", + " 0.127254\n", + " 0.131121\n", + " 0.135885\n", + " 0.139908\n", " ...\n", - " 1.0\n", - " 1.0\n", - " 1.0\n", - " 1.0\n", - " 1.0\n", - " 1.0\n", - " 1.0\n", - " 1.0\n", - " 1.0\n", - " 1.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", + " 0.0\n", " \n", " \n", "\n", - "

11 rows × 85 columns

\n", + "

11 rows × 106 columns

\n", "" ], "text/plain": [ - " 0 1 2 3 \\\n", - "NSPN_WhitakerVertes_PNAS2016_cost=10 0.099997 0.10448 0.110018 0.114895 \n", - "1 0.099997 0.10448 0.109894 0.114699 \n", - "2 0.099997 0.10448 0.109894 0.114699 \n", - "3 0.099997 0.10448 0.109894 0.114699 \n", - "4 0.099997 0.10448 0.109894 0.114699 \n", - "5 0.099997 0.10448 0.109925 0.114732 \n", - "6 0.099997 0.10448 0.109894 0.114699 \n", - "7 0.099997 0.10448 0.109894 0.114699 \n", - "8 0.099997 0.10448 0.109894 0.114699 \n", - "9 0.099997 0.10448 0.109894 0.114699 \n", - "10 0.099997 0.10448 0.109894 0.114699 \n", + " 0 1 2 3 4 5 \\\n", + "NSPN_cost=10 0.100004 0.103228 0.107244 0.112039 0.117842 0.122398 \n", + "1 0.100004 0.103228 0.107175 0.111920 0.117564 0.121950 \n", + "2 0.100004 0.103228 0.107175 0.111920 0.117564 0.121950 \n", + "3 0.100004 0.103228 0.107175 0.111920 0.117564 0.121950 \n", + "4 0.100004 0.103228 0.107175 0.111920 0.117589 0.121976 \n", + "5 0.100004 0.103228 0.107175 0.111920 0.117564 0.121950 \n", + "6 0.100004 0.103228 0.107175 0.111920 0.117564 0.121950 \n", + "7 0.100004 0.103228 0.107175 0.111920 0.117564 0.121976 \n", + "8 0.100004 0.103228 0.107175 0.111920 0.117564 0.121950 \n", + "9 0.100004 0.103228 0.107175 0.111920 0.117564 0.121950 \n", + "10 0.100004 0.103228 0.107175 0.111920 0.117564 0.121950 \n", "\n", - " 4 5 6 7 \\\n", - "NSPN_WhitakerVertes_PNAS2016_cost=10 0.122640 0.129161 0.135221 0.139212 \n", - "1 0.122253 0.128452 0.133963 0.137703 \n", - "2 0.122253 0.128489 0.134041 0.137785 \n", - "3 0.122253 0.128452 0.133963 0.137703 \n", - "4 0.122253 0.128452 0.133963 0.137703 \n", - "5 0.122323 0.128527 0.134041 0.137866 \n", - "6 0.122288 0.128527 0.134081 0.137866 \n", - "7 0.122253 0.128489 0.134041 0.137785 \n", - "8 0.122253 0.128489 0.134002 0.137744 \n", - "9 0.122253 0.128452 0.133963 0.137703 \n", - "10 0.122253 0.128452 0.134041 0.137785 \n", + " 6 7 8 9 ... 96 97 98 99 \\\n", + "NSPN_cost=10 0.127975 0.131899 0.136820 0.141069 ... 1.0 1.0 1.0 1.0 \n", + "1 0.127226 0.131092 0.135825 0.139908 ... 1.0 1.0 1.0 1.0 \n", + "2 0.127226 0.131092 0.135885 0.139940 ... 1.0 1.0 1.0 1.0 \n", + "3 0.127226 0.131150 0.135885 0.139940 ... 0.0 0.0 0.0 0.0 \n", + "4 0.127254 0.131121 0.135915 0.139940 ... 1.0 1.0 1.0 1.0 \n", + "5 0.127226 0.131092 0.135855 0.139908 ... 0.0 0.0 0.0 0.0 \n", + "6 0.127254 0.131121 0.135855 0.139971 ... 1.0 1.0 1.0 1.0 \n", + "7 0.127282 0.131208 0.135976 0.140065 ... 1.0 1.0 1.0 1.0 \n", + "8 0.127282 0.131150 0.135915 0.140034 ... 1.0 1.0 1.0 1.0 \n", + "9 0.127226 0.131092 0.135825 0.139877 ... 1.0 1.0 1.0 1.0 \n", + "10 0.127254 0.131121 0.135885 0.139908 ... 0.0 0.0 0.0 0.0 \n", "\n", - " 8 9 ... 75 76 77 \\\n", - "NSPN_WhitakerVertes_PNAS2016_cost=10 0.146577 0.156287 ... 1.0 1.0 1.0 \n", - "1 0.144447 0.153635 ... 1.0 1.0 1.0 \n", - "2 0.144534 0.153824 ... 1.0 1.0 1.0 \n", - "3 0.144403 0.153587 ... 1.0 1.0 1.0 \n", - "4 0.144577 0.153966 ... 1.0 1.0 1.0 \n", - "5 0.144621 0.153777 ... 1.0 1.0 1.0 \n", - "6 0.144664 0.154014 ... 1.0 1.0 1.0 \n", - "7 0.144534 0.153730 ... 1.0 1.0 1.0 \n", - "8 0.144447 0.153682 ... 1.0 1.0 1.0 \n", - "9 0.144490 0.153777 ... 1.0 1.0 1.0 \n", - "10 0.144577 0.153730 ... 1.0 1.0 1.0 \n", + " 100 101 102 103 104 105 \n", + "NSPN_cost=10 1.0 1.0 1.0 1.0 1.0 1.0 \n", + "1 1.0 1.0 1.0 1.0 1.0 1.0 \n", + "2 1.0 1.0 1.0 1.0 1.0 1.0 \n", + "3 0.0 0.0 0.0 0.0 0.0 0.0 \n", + "4 1.0 1.0 1.0 1.0 1.0 1.0 \n", + "5 0.0 0.0 0.0 0.0 0.0 0.0 \n", + "6 1.0 1.0 1.0 1.0 1.0 1.0 \n", + "7 1.0 1.0 1.0 1.0 1.0 1.0 \n", + "8 1.0 1.0 1.0 1.0 1.0 1.0 \n", + "9 1.0 1.0 1.0 1.0 1.0 1.0 \n", + "10 0.0 0.0 0.0 0.0 0.0 0.0 \n", "\n", - " 78 79 80 81 82 83 84 \n", - "NSPN_WhitakerVertes_PNAS2016_cost=10 1.0 1.0 1.0 1.0 1.0 1.0 1.0 \n", - "1 1.0 1.0 1.0 1.0 1.0 1.0 1.0 \n", - "2 1.0 1.0 1.0 1.0 1.0 1.0 1.0 \n", - "3 1.0 1.0 1.0 1.0 1.0 1.0 1.0 \n", - "4 1.0 1.0 1.0 1.0 1.0 1.0 1.0 \n", - "5 1.0 1.0 1.0 1.0 1.0 1.0 1.0 \n", - "6 1.0 1.0 1.0 1.0 1.0 1.0 1.0 \n", - "7 1.0 1.0 1.0 1.0 1.0 1.0 1.0 \n", - "8 1.0 1.0 1.0 1.0 1.0 1.0 1.0 \n", - "9 1.0 1.0 1.0 1.0 1.0 1.0 1.0 \n", - "10 1.0 1.0 1.0 1.0 1.0 1.0 1.0 \n", - "\n", - "[11 rows x 85 columns]" + "[11 rows x 106 columns]" ] }, - "execution_count": 13, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" }