#!/bin/tcsh # ---------------------------------------------------------------------- # partition subjects with respect to ave (uncensored) motion # given: motion file with (after header line): # SUBJ #TRs #censor ave_mot ave_censor ave_TSNR # # create: # 1. sorted motion file # 2. group.big.txt # 3. group.small.txt # 4. a motion covariates file, with just subject and motion, mot_covary.txt # ---------------------------------------------------------------------- # set up and basic tests set top_dir = `pwd` set misc_dir = $top_dir/misc_dir set motion_file = $misc_dir/motion_info.txt # check that we have results and the motion info file scripts/check.subj.results if ( $status ) exit if ( ! -f $motion_file ) then echo "** partition_motion: missing motion info file, $motion_file" exit endif # ---------------------------------------------------------------------- # additions to script... echo "-- make motion groups: making group and covariate files..." # make a sorted motion file (sorted by ave_mot) set sorted_file = $misc_dir/sorted_ave_mot.txt tail -n 190 $motion_file | awk '{print $4, $1}' | sort -n > $sorted_file # the first 95 subjects go to small, the last 95 go to big head -n 95 $sorted_file | awk '{print $2}' > $misc_dir/group.small.txt tail -n 95 $sorted_file | awk '{print $2}' > $misc_dir/group.big.txt # make a motion covariates file mot_covary.txt awk '{print $1, $4}' $motion_file > $misc_dir/mot_covary.txt echo " created sorted_ave_mot.txt group.{big,small}.txt mot_covary.txt"