Skip to content
lrnbeard edited this page Apr 15, 2016 · 19 revisions

ENIGMA project for BP vs. HC cortical analysis

Step 0: the sample

  • All subjects come from the combined day2/fndm/nodra/effort studies
  • FreeSurfer output: /import/monstrum/day2_fndm_nodra_effrt_struct_comb/freesurferResults [note that this location may change with reward study consolidation]
  • note that of the original 287, 15 subjects were moved to the excluded folder following quality checking
  • For this project, only use those subjects which are BP or HC (n = 146)
  • subject list: /data/joy/BBL/projects/enigmaSzBp/covariates/bp/n146_bpEnigmaCortical_bblid_scanid.txt
  • refer to covariates for all diagnoses: /data/joy/BBL/projects/enigmaSzBp/covariates/bp/n146_bpEnigmaCortical_covariates_2015129.csv
  1. input files: day2_fndm_fndm2_meds_9-2-15.csv, effort_meds_9-2-15_dw.csv, FNDM_bipolarquestions.csv, n287_day2_fndm_nodra_effrt.csv, NODRA_bipolarquestions.csv, nodra_med_9-8-15.csv.

    location: /data/joy/BBL/projects/enigmaSzBp/covariates/bp

    script to make covariates: /data/joy/BBL/projects/enigmaSzBp/covariates/bp/bpEnigmaCortical_makecovs_20151130_ts.R

IMPORTANT: Steps 1-2 were completed on the entire sample, and the files were later edited to remove all irrelevant subjects

Step 1: Extract and Organize Cortical Measures (FreeSurfer)

Download the script for extracting SurfaceArea and Thickness Values: extract.sh

  • File location: /data/joy/BBL/projects/enigmaSzBp/cortical/progs
  • Save the extract.sh script in the Parent Folder with your FreeSurfer output.
    1. Parent folder: /import/monstrum/day2_fndm_nodra_effrt_struct_comb/freesurferResults
    2. run: sh extract.sh
  • output: 2 csv files listing cortical thickness and surface area measures
    1. first row header describes extracted regions
    2. CSV 1: CorticalMeasuresENIGMA_SurfAvg.csv /data/joy/BBL/projects/enigmaSzBp/cortical/bp/qaOutput/CorticalMeasuresENIGMA_SurfAvg.csv
    3. CSV 2: CorticalMeasuresENIGMA_ThickAvg.csv /data/joy/BBL/projects/enigmaSzBp/cortical/bp/qaOutput/CorticalMeasuresENIGMA_ThickAvg.csv
    4. Be sure to remove any rows from these files that are not subjects (ie. since there were other folders in the parent directory, a few lines had to be removed).
  • the csv files noted include subjects of all diagnoses

Step 2: Quality Checking Cortical Measures Outlier Detection

  • script: /data/joy/BBL/projects/enigmaSzBp/cortical/progs/enigma_outliers/outliers.R
  • run in this folder with the raw files: R --no-save --slave < outliers.R > outliers.log
  • output: /data/joy/BBL/projects/enigmaSzBp/cortical/progs/enigma_outliers/outliers.log

External Surface Method

  • create a webpage with lateral and medial snapshots of pial surface reconstructions colored with cortical labels
  • scripts: fsqc.sh Location: /data/joy/BBL/projects/enigmaSzBp/cortical/progs
  • create a scripts directory under your subjects directory, within it run fsqc.sh
  • the script will output four .tif files for each subject and a website called index.html
  • view the images using: firefox index.html and scan each for poor labelling
    • refer to the desikan killiany atlas for proper labelling
  • If cortical labels are bad:
    1. Open the data file CorticalMeasuresENIGMA_ThickAvg.csv and CorticalMeasuresENIGMA_SurfAvg.csv in Excel
    2. Mark poorly segmented cortical regions with "NA" (without the quotes) in BOTH CSV files
    3. If the whole subject is poorly segmented you can delete the subject's row from the data files or mark all of the entries in a subject's row with "NA".

QA Results

  • Good subjects: 272/287
    • n=141 BP/HC
    • 2 subjects were removed following ENIGMA QA
    • 13 subjects were removed following BBL QA
  • ROI Flagged
  • Thickness: 0.91% flagged
  • Surface Area: 1.04% flagged
  • Refer to BP_QA.pdf in github repository for more detailed information on the QA process

Step 3: Generate Summary Statistics and Histogram Plots

  • scripts: ENIGMA_CortexROI_plots.R
  • location: /data/joy/BBL/projects/enigmaSzBp/cortical/bp/histograms/ENIGMA_CortexROI_plots.R
  • run in a folder with both of your csv files: R --no-save --slave < ENIGMA_CortexROI_plots.R
  • location: /data/joy/BBL/projects/enigmaSzBp/cortical/bp/histograms
  • output: histograms and summary statistics for thickness and sa measures (series of PNG image files)

Step 4: Co-register FreeSurfer Output for Vertexwise Surface Analysis

  • scripts: preproc_BPHC.csh, templateSubjects.fsgd
    • location: /data/joy/BBL/projects/enigmaSzBp/cortical/bp/surfReg
  • Move the script preproc_BP_HC.csh to the parent folder of your FreeSurfer output, and within this parent directory, create another folder for the surface script output
  • ex: /import/monstrum/day2_fndm_nodra_effrt_struct_comb/freesurferResults/YourSURFdirectory
  • open the preproc_BP_HC.csh script in any text editor and edit the environment parameters
    • setenv FREESURFER_HOME /import/monstrum/Applications/freesurfer
    • setenv SUBJECTS_DIR /import/monstrum/day2_fndm_nodra_effrt_struct_comb/freesurferResults
    • set outfolder="/import/monstrum/day2_fndm_nodra_effrt_struct_comb/freesurferResults/YourSURFdirectory"
  • move subjects.fsgd to your output folder and create a dummy matrix (Assuming your output folder is one directory below the FreeSurfer parent folder)
  • run: ls -d ../*/ | awk -F/ '{print "Input", $2, "BD", NR, "0"}' >> subjects.fsgd
  • Open subjects.fsgd and remove all lines in the text file for subjects that were marked as poorly segmented in the QC Steps or that are not bipolar subjects
  • run the script: tcsh preproc_BP_HC.csh subjects
    • should output a series of .mgh files and .log files

Final sample: n= 141

  • Subject List: /data/joy/BBL/projects/enigmaSzBp/cortical/bp/surfReg/n146_bpEnigmaCortical_bblid_scanid.txt
  • Covariates: /data/joy/BBL/projects/enigmaSzBp/cortical/bp/surfReg/bpCovariates.csv

For an overview of surface registration, refer to: https://surfer.nmr.mgh.harvard.edu/fswiki/SurfaceRegAndTemplates

Clone this wiki locally