Skip to content

scsnl/YZ_HCP_DNN_Gender_2023

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

“Deep learning models reveal replicable, generalizable, and behaviorally relevant sex differences in human functional brain organization.” © 2023 by The Board of Trustees of the Leland Stanford Junior University is licensed under CC BY-NC 4.0

Contact the Stanford Office of Technology Licensing (otl.stanford.edu) for commercial license inquiries

Cite this work

Ryali, S., Zhang, Y., de los Angeles, C., Superkar, K., & Menon, V. (2024). Deep learning models reveal replicable, generalizable, and behaviorally relevant sex differences in human functional brain organization. The proceedings of the National Academy of Sciences.

Key steps and corresponding scripts used for the analyses are summarized below

Time series extraction

The extracted time series were used as inputs of DNN (scripts under timeseries_extraction/)

  1. config files: rest_ts_extraction_config_*_brainnetome.m
  2. main script: read_ts_extraction_dev.m

DNN classification (scripts under dnn/)

  1. utility functions: utilityFunctions.py

  2. model architecture: modelClasses.py

  3. create cross-validation datasets on HCP and extract basic info (e.g. #F/#M, subject ids, head motions): create_cv_datasets.py and extract_basic_info.py

  4. train models on HCP datasets: hcp_cv_model_training.py

  5. test replicability on HCP datasets: evaluate_hcp_session.py

  6. test generalizability on NKI-RS dataset: evaluate_nkirs.py

  7. test generalizability on MPI Leipzig dataset: evaluate_leipzig.py

Consensus analysis (scripts under dnn/)

In consensus analysis, we split data into 5 folds for 100 times, repeated analysis for each CV dataset (training on HCP Session 1 or 3 and then extracting individual fingerprints using the trained models), and finally gathered all fingerprints from the 100 runs and identified consensus features (top features that consistently appeared across all folds)

  1. create random seeds for each of the 100 split: create_randomlist.py

  2. train models on HCP session 1 or 3 for each of CV dataset: hcp_training_models_multiple_cv_datasets.py

  3. generate feature attributions from each of the trained models using IG or DeepLift

    • for IG: generate_feature_attribution_ig_multiple_cv.py
    • for DeepLift: generate_DL_feature_attribution_multiple_cv.py
  4. get consensus features across all models for each session: get_consensus_features_multiple_cv.py (IG features of HCP cohort) and get_DL_consensus_features_multiple_cv.py (DL features of HCP cohort)

  5. generate common features across sexes: generate_common_features_across_sex.sh

  6. generate brain plots of consensus features: generate_consensus_images.m

  7. generate NKI-RS feature attributions from each of the trained models using IG or DeepLift

    • for IG: generate_nki_feature_attribution_ig_multiple_cv.py
    • for DeepLift: generate_nki_DL_feature_attribution_multiple_cv.py
  8. get NKI-RS consensus features across all HCP models of each session: get_nki_consensus_features_multiple_cv.py (IG features of NKI-RS cohort) and get_nki_DL_consensus_features_multiple_cv.py (DL features of NKI-RS cohort)

  9. generate NKI-RS common features across sexes: generate_common_features_across_sex.sh

  10. generate brain plots of NKI-RS consensus features: generate_consensus_images.m

  11. generate MPI Leipzig feature attributions from each of the trained models using IG: generate_leipzig_feature_attribution_multiple_cv.py

  12. get MPI Leipzig consensus features across all HCP models of each session: get_leipzig_consensus_features_multiple_cv.py

  13. generate MPI Leipzig common features across sexes: generate_common_features_across_sex.sh

  14. generate brain plots of Leipzig consensus features: generate_consensus_images.m

Individual fingerprints (scripts under dnn/)

  1. generate nifti files of top features for each individual: generate_indiv_niftis.py for HCP cohort and generate_nki_indiv_niftis.py for NKI-RS cohort

  2. generate brain images of top features for each individual: generate_indiv_images.m

  3. radar plots of individual fingerprints (only show top 20% features identified at the group level with the same sex)

    • generate_data_radarplots.py and generate_indiv_radarplots.py for HCP cohort
    • generate_data_radarplots_nki.py and generate_indiv_radarplots_nki.py for NKI-RS cohort
  4. distinctiveness of fingerprints: distinctiveness_fingerprint.py for HCP cohort and distinctiveness_nki_fingerprint.py for NKI cohort

  5. tsne plot of fingerprints' distinctiveness: tsne_plot_distinctiveness.py for HCP cohort and tsne_plot_distinctiveness_nki.py for NKI cohort

  6. bar plot of fingerprints' distinctiveness: generate_data_bar_plot_distinctiveness.py and distinctiveness_barplots.R

  7. stability of fingerprints: stability_fingerprint.py

Control analyses

  1. control analysis examining the relationship between head movement and brain features underlying sex classification: dnn/control_analysis_dcor2.py

  2. control analyses with different artifact reduction methods and different brain atlases

    • config files: timeseries_extraction/rest_ts_extraction_config_hcp_rfMRI_*_acompcor.m
    • main script: timeseries_extraction/read_ts_extraction_dev.m
    • same DNN classification scripts were applied to time series extracted using the scripts here

Brain-behavioral analysis (scripts under cca/)

  1. brain-behavioral analysis using individual-level stDNN features attributions (fingerprints) and 3 PCs derived from NIH toolbox congnition measures
    • mycca_brain_behav_cognition_PCversion.R is used for brain-behavioral CCA
    • mycca_brain_behav_cognition_prediction_MvsF_HCP.R is used for prediction analysis
    • mycca_plotting_brain_behav_cognition_PCversion.R is for plotting
    • myRFunc_updated.R includes all supporting functions

Conventional ML approaches (scripts under staticFC/)

  1. classification using conventrional machine learning approaches

    • classicML_staticFC_gender_multiple.py for HCP and NKI-RS cohorts
    • classicML_staticFC_gender_multiple_leipzig.py for HCP and MPI Leipzig cohorts
  2. brain-behavioral analysis using static functional connectivity and cognition measures

    • staticFC_PCs_to_csv.py is used to get the first 246 PCs of static functional connectivity and save to csv file
    • mycca_sFC_behav_cognition_PCversion.R is used for brain-behavioral CCA with sFC PCs
    • mycca_sFC_behav_cognition_prediction_MvsF_HCP.R is used for prediction analysis
    • mycca_plotting_sFC_behav_cognition_PCversion.R is for plotting
    • myRFunc_updated.R includes all supporting functions

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published