Python version 3.6.6
conda version 4.8.5
All code was run within a conda envirnoment specified in: environment.yml
T1 scans were manually checked using FSL 5.0.11's fsleyes (see 2_RA_rating.py for details)
You will also need to run:
pip install awscli --upgrade --user
(This installs aws command line tools for your user)
The cortical results were made from fMRIPprep 1.1.4, installed in a docker container
The hippocampal results were made from fMRIprep 1.5.6, and run via a singularity image
- settings.py:
- sets various path
- yesnofun: used in 2_RA_rating.py and 2_rating_comp.py
- ISC_settings.py: Creates functions used later in ISC code.
- make_phenol: creates demographic breakdown for all subjects (Age, Sex, phenotypic PC variables - not really used)
- even_out: creates two groups with equal sizes and equal numbers of a demographic variable (e.g. sex)
- bottom part of code creates 5 equally sized age groups of subjects
- HMM_settings.py: sets various variables used for HMM code:
- pandas dataframe with un-usable parcels is here (due to low log-likelihood in both age groups).
- FDR_p funciton is here
- 1_aws.py:
- Download available HBN datasets from aws (from either Rutgers (RU) or CBCI (CitiGroup Cornell Brain Imaging Center).
- Removed subjects who had files missing, and noted what was missing in csv file.
- Edited jsons for fieldmap scans for fmriprep compatibility
- Edited fieldmap scans names for fmriprep compatibility
- 2_RA_rating.py and 2_rating_comp.py:
- 2_RA_rating.py: Allowed RA's to fill in ratings for T1 Scans
- 2_rating_comp.py: Compare ratings between RAs: Compile RA ratings into one csv, Manually arbitrate between instances in which one RA said "yes" and another "no."
- 3_fmriprep.py: Run fMRIPprep 1.1.4, installed in a docker container.
- 4_Preprocess.py and 4_Preprocess_HPC.py:
- 4_Preprocess.py: regresses out confounds found from fmriprep 1.1.4, and saves data in h5 file for cortex (one per subject).
- 4_Preprocess_HPC.py: regresses out confounds found from fmriprep 1.5.6, labels anterior and posterior hippocampus, and saves data in h5 file for Hippocampus (one per subject).
- 5_parcellation.py: This creates h5 files for each parcel with the vertices contributing to that parcel and a matrix of size (subjects x vertices x time).
- Use vertices from 5_parcellation.py to calculate ISCs and HMMs in each age group: 6_ISC.py and 6_HMM_n_k.py:
- 6_ISC.py: Determine difference in ISC and between-group ISC for Youngest and Oldest subjects. Do 100 subject-age permutations. (Repeatedly run 1000 more shuffles in parcels where p<0.05 or until p>0)
- 6_HMM_n_k.py: Determine if there is a significant difference in the number of HMM-derived events between Youngest and Oldest groups. Do 100 subject-age permutaitons. (Repeatedly run 1000 more shuffles in parcels where p<0.05 or until p>0)
- 7_HMM_ll.py:
- Find where HMM has a poor fit in either Youngest or Oldest subjects (HMM fit in 6_HMM_n_k.py).
- See if there is a difference in the number of events in the remaining parcels
- 8_HMM_stats.py: In remaining parcels:
- Run joint-fit HMM on Youngest and Oldest ages. Test on held-out subjects in all age groups
- Look for significant log-likelihood difference between Youngest and Oldest ages in jointly-fit HMMs.
- Look for significant "AUC" difference (HMM-prediction or event-timing) between Youngest and Oldest ages in jointly-fit HMMs.
- Null distribution is age-permuted subject-averaged timecourse.
- Run 100 permutations initially, then continue running code, adding 1000 permutations each time until p>0.05 or p!=0
- 9_p_check.py: Make an h5 file with p and q values for ISC and HMM tests. To be used for plotting on brain.
- Make Figures:
- 10_HMM_AUC.py: Makes AUC plots (both with data and example plots).
- 10_HMM_ll.py: Makes Log Likelihood plots in significant parcels.
- HPC.py: Gets average hippocampus trace for each subject (in both anterior and posterior hippocampus)
- event_ratings.py: Calculates event timecourse from behavioral raters and compares to hippocampus timecourse. Behavioral annotations found in "video_segmentation" folder.
- 6_ISC_test.py: Demonstrates that split-half ISC calculates ISC faster than Pairwise ISC or Leave-one-out ISC
- 1__pheno.py: Calculates various phenotypic information for sample such as how many subjects were eliminated at various pre-processing steps.
- HMM_vs_hand.py: Compares HMM event timecourses to behavioral event timecourses
- motion_check.py: Compares Framewise Displacement between age groups.
- ISC_vs_motion.py: Correlates Framewise Displacement with ISC.
- event_comp.py: Compares behavioral event boundary ratings between children and adults. These boundaries come from: "video_segmentation" (reference group for events in Figure 3), "Prolific_adult_data" (online adult data), and "Children_data" (children data).
- TPJ_check.py: Assesses the extent of the overlap between each parcel and the TPJ as defined by Dufour and colleagues (2013).
- "video_segmentation": Reference group for events in Figure 3
- "Prolific_adult_data": Online adult data
- "Children_data": Age-matched children data