Giter VIP home page Giter VIP logo

hbn's Introduction

Code for analyses used in:

"Development changes story evoked responses in the neocortex and hippocampus"

Samantha S. Cohen & Christopher Baldassano

System specifications:

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 files:

  1. settings.py:
    • sets various path
    • yesnofun: used in 2_RA_rating.py and 2_rating_comp.py
  2. 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
  3. 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

Order of code is as follows:

  1. 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. 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. 3_fmriprep.py: Run fMRIPprep 1.1.4, installed in a docker container.
  4. 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. 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).
  6. 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. 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. 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. 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.
  10. 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.

Code Relevant for Hippocampus:

  1. HPC.py: Gets average hippocampus trace for each subject (in both anterior and posterior hippocampus)
  2. event_ratings.py: Calculates event timecourse from behavioral raters and compares to hippocampus timecourse. Behavioral annotations found in "video_segmentation" folder.

Other code:

Behavioral event segmentation data folders:

hbn's People

Contributors

samsydco avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.