From noreply at svn.ci.uchicago.edu Sun Aug 2 23:58:10 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Sun, 2 Aug 2009 23:58:10 -0500 (CDT) Subject: [Swift-commit] r3024 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2 Message-ID: <20090803045810.1884C9CCAB@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-02 23:58:09 -0500 (Sun, 02 Aug 2009) New Revision: 3024 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/ Log: for clean time series From noreply at svn.ci.uchicago.edu Mon Aug 3 00:04:13 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Mon, 3 Aug 2009 00:04:13 -0500 (CDT) Subject: [Swift-commit] r3025 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos Message-ID: <20090803050414.071B29CCAB@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-03 00:04:13 -0500 (Mon, 03 Aug 2009) New Revision: 3025 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/AFNIprocss.swift Log: my standard preprocessing workflow. includes tshift option in volreg Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/AFNIprocss.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/AFNIprocss.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/AFNIprocss.swift 2009-08-03 05:04:13 UTC (rev 3025) @@ -0,0 +1,50 @@ +#---- doing volreg, despike, mean, percent sig change for PK2 +#-- now using 'tshift' for slice timing correction +type file{} + +type AFNI_obj{ + file HEAD; + file BRIK; +}; + + +app (AFNI_obj volregResult, file resultVolregMotion) AFNI_volreg (string baseName, AFNI_obj inputTS, AFNI_obj referenceTS, string volregBaseString){ + AFNI_3dvolreg "-twopass" "-twodup" "-dfile" @strcat("mot_",baseName) "-base" @strcat(volregBaseString,"+orig[225]") "-tshift" 4 "-prefix" @strcat("volreg.",baseName) @inputTS.BRIK; +} + +app (AFNI_obj despikeResult) AFNI_despike (string baseName, AFNI_obj volregdInputTS){ + AFNI_3dDespike "-prefix" @strcat("despiked.",baseName) @volregdInputTS.BRIK; +} + +app (AFNI_obj meanResult) AFNI_mean (AFNI_obj despikeResult, string baseName){ + AFNI_3dTstat "-mean" "-prefix" @strcat("mean.",baseName) @despikeResult.BRIK; +} + +app (AFNI_obj nrmlzPerChngResult) AFNI_normalizePerChng (AFNI_obj despikeResult, AFNI_obj meanResult, string baseName){ + AFNI_3dcalc "-a" @despikeResult.BRIK "-b" @meanResult.BRIK "-expr" @strcat( "((a-b)/b)*100" ) "-fscale" "-prefix" @strcat("nrmlzdPerChng.",baseName); +} + +(AFNI_obj despikeResult, AFNI_obj meanResult, AFNI_obj nrmlzPerChngResult) AFNI_PerChngTS (string baseName, AFNI_obj volregdInput){ + (despikeResult) = AFNI_despike(baseName, volregdInput); + (meanResult) = AFNI_mean(despikeResult, baseName); + (nrmlzPerChngResult) = AFNI_normalizePerChng(despikeResult, meanResult, baseName); +} + + +string declarelist[] = ["PK2"]; +foreach subject in declarelist{ + int runs[] = [1:8]; + foreach run in runs{ + string baseName = @strcat(subject,".run",run); + AFNI_obj inputTS; + AFNI_obj volregResult; + file resultVolregMotion; + AFNI_obj volregRefTS; + string volregBaseString = @strcat("ts.4"); + AFNI_obj despikeResult; + AFNI_obj meanResult; + AFNI_obj nrmlzPerChngResult; + (volregResult, resultVolregMotion) = AFNI_volreg(baseName, inputTS, volregRefTS, volregBaseString); + (despikeResult, meanResult, nrmlzPerChngResult) = AFNI_PerChngTS(baseName, volregResult); + } +} From noreply at svn.ci.uchicago.edu Mon Aug 3 00:06:03 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Mon, 3 Aug 2009 00:06:03 -0500 (CDT) Subject: [Swift-commit] r3026 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos Message-ID: <20090803050603.E439C9CCAB@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-03 00:06:03 -0500 (Mon, 03 Aug 2009) New Revision: 3026 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/AFNImaskave.swift Log: for getting white matter and ventricle masks (via FS parcellation) Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/AFNImaskave.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/AFNImaskave.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/AFNImaskave.swift 2009-08-03 05:06:03 UTC (rev 3026) @@ -0,0 +1,22 @@ +# getting a white matter and ventricle mask for each PK2 run +type file{} + +type AFNI_obj{ + file HEAD; + file BRIK; +}; + +app (file maskaveResult) AFNI_maskave (AFNI_obj mask, AFNI_obj inputTS){ + AFNI_3dmaskave "-mask" @mask.BRIK @inputTS.BRIK stdout=@maskaveResult; +} + +string names[] = ["white","vent"]; +int runs[] = [1:8]; +foreach nn in names{ + foreach rr in runs{ + AFNI_obj mask; + AFNI_obj inputTS; + file maskaveResult; + maskaveResult = AFNI_maskave(mask, inputTS); + } +} From noreply at svn.ci.uchicago.edu Mon Aug 3 00:07:38 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Mon, 3 Aug 2009 00:07:38 -0500 (CDT) Subject: [Swift-commit] r3027 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos Message-ID: <20090803050738.CDC5A9CCAB@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-03 00:07:38 -0500 (Mon, 03 Aug 2009) New Revision: 3027 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/AFNIcleanTSruns.swift Log: use of 3dDeconvolve to get a cleaned time series, having included regressors for motion and white matter signal. This distributes runs rather than doing the whole time series concatenated. Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/AFNIcleanTSruns.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/AFNIcleanTSruns.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/AFNIcleanTSruns.swift 2009-08-03 05:07:38 UTC (rev 3027) @@ -0,0 +1,58 @@ +#-- deconvolve cleaning up TS +#---- doing this run by run +type file{} + +type AFNI_obj{ + file HEAD; + file BRIK; +} + +type stims{ + string labels[]; + string fnames[]; +} + +app (AFNI_obj deconvBucketResult, AFNI_obj errtsResult) AFNI_pincheDeconvolution (AFNI_obj normalized, stims stimuli, file censor, file motionfile, file WMmask, file Ventmask, string outPrefix, string outerrtsPrefix){ + AFNI_3dDeconvolve "-jobs" 2 "-input" @filename(normalized.BRIK) "-polort" 3 "-tshift" "-num_stimts" 8 + "-stim_file" 1 stimuli.fnames[0] + "-stim_file" 2 stimuli.fnames[1] + "-stim_file" 3 stimuli.fnames[2] + "-stim_file" 4 stimuli.fnames[3] + "-stim_file" 5 stimuli.fnames[4] + "-stim_file" 6 stimuli.fnames[5] + "-stim_file" 7 stimuli.fnames[6] + "-stim_file" 8 stimuli.fnames[7] + "-censor" @filename(censor) + "-full_first" "-rout" + "-bucket" outPrefix + "-errts" outerrtsPrefix; +} + + +string declarelist[] = ["PK2"]; +int runs[] = [1:8]; +foreach subject in declarelist{ + foreach rr in runs{ + ## map inputs + file motionfile; + file WMmask; + file Ventmask; + file censor; + AFNI_obj normalized; + + ## map outputs + string outPrefix = @strcat("garbage_bucketTS_",subject,"run",rr); + string outerrtsPrefix = @strcat("cleanTS_",subject,"run",rr); + AFNI_obj bucket; + AFNI_obj errts; + + #---- stimuli info + stims stimuli; + stimuli.labels = ["roll","pitch","yaw","dx","dy","dz","whitemask","ventmask"]; + stimuli.fnames = [@strcat(@filename(motionfile),"[1]"), at strcat(@filename(motionfile),"[2]"), at strcat(@filename(motionfile),"[3]"), + @strcat(@filename(motionfile),"[4]"), at strcat(@filename(motionfile),"[5]"), at strcat(@filename(motionfile),"[6]"), + @filename(WMmask), at filename(Ventmask)]; + + (bucket, errts) = AFNI_pincheDeconvolution(normalized, stimuli, censor, motionfile, WMmask, Ventmask, outPrefix, outerrtsPrefix); + } +} From noreply at svn.ci.uchicago.edu Mon Aug 3 00:08:58 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Mon, 3 Aug 2009 00:08:58 -0500 (CDT) Subject: [Swift-commit] r3028 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos Message-ID: <20090803050858.5F87B9CCAB@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-03 00:08:58 -0500 (Mon, 03 Aug 2009) New Revision: 3028 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/Vol2SurfSmooth.swift Log: This does 3dVol2Surf and SurfSmooth via Swift workflow. Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/Vol2SurfSmooth.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/Vol2SurfSmooth.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/Vol2SurfSmooth.swift 2009-08-03 05:08:58 UTC (rev 3028) @@ -0,0 +1,49 @@ +#--- this is for the PK2 surface projections and smoothing on the surface +## cleanTScat_PK2allruns is a TS that has had slice time correction, covariates for motion, wm, and ventricles. +## did each run separate and concatenated at end. +type file{} +type AFNI_obj{ + file HEAD; + file BRIK; +} + + +app (file vol2surfOutfile) AFNI_Vol2Surf (file spec_file, file smoothwm, file pial, string map, AFNI_obj surfvol, AFNI_obj grid_parent){ + AFNI_3dVol2Surf "-spec" @spec_file "-surf_A" @smoothwm "-surf_B" @pial + "-map_func" map "-f_steps" 15 "-f_index" "voxels" "-oob_index" "-1" "-oob_value" 0 "-no_headers" "-outcols_NSD_format" + "-sv" @surfvol.BRIK "-grid_parent" @grid_parent.BRIK "-out_1D" @filename(vol2surfOutfile); +} + +app (file surfsmoothOutfile) SurfSmooth (file spec_file, file smoothwm, file vol2surfOutfile){ + SurfSmooth "-spec" @spec_file "-surf_A" @smoothwm "-met" "HEAT_07" "-input" @vol2surfOutfile + "-fwhm" 4 "-Niter" "-1" "-add_index" "-output" @filename(surfsmoothOutfile); +} + +(file vol2surfOutfile, file surfsmoothOutfile) ProjectSmoothProc (file spec_file, file smoothwm, file pial, string map, AFNI_obj surfvol, AFNI_obj grid_parent){ + (vol2surfOutfile)= AFNI_Vol2Surf(spec_file, smoothwm, pial, map, surfvol, grid_parent); + (surfsmoothOutfile) = SurfSmooth(spec_file, smoothwm, vol2surfOutfile); +} + + +string declarelist[] = ["PK2"]; +string mapFunctions[] = ["ave"]; +string hemis[] = ["lh","rh"]; +string conditions[] = ["cleanTScat_PK2allruns"]; + +foreach subject in declarelist{ + foreach map in mapFunctions{ + foreach h in hemis{ + foreach cc in conditions{ + string baseDir = @strcat("/gpfs/pads/fmri/cnari/swift/projects/andric/peakfit_pilots/",subject,"/"); + file spec_file; + file smoothwm; + file pial; + AFNI_obj surfvol; + AFNI_obj grid_parent; + file vol2surfOutfile; + file surfsmoothOutfile; + (vol2surfOutfile, surfsmoothOutfile) = ProjectSmoothProc(spec_file, smoothwm, pial, map, surfvol, grid_parent); + } + } + } +} From noreply at svn.ci.uchicago.edu Mon Aug 3 00:12:00 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Mon, 3 Aug 2009 00:12:00 -0500 (CDT) Subject: [Swift-commit] r3030 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos Message-ID: <20090803051200.2E3409CCAB@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-03 00:12:00 -0500 (Mon, 03 Aug 2009) New Revision: 3030 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/censor_motion.sh Log: this was used to run the censor.py Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/censor_motion.sh =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/censor_motion.sh (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/censor_motion.sh 2009-08-03 05:12:00 UTC (rev 3030) @@ -0,0 +1,9 @@ +#!/bin/tcsh + +foreach x (1 2 3 4 5 6 7 8) + +#mv mot_PK2.run$x mot_PK2_run$x + +./censor.py -f mot_PK2_run$x + +end From noreply at svn.ci.uchicago.edu Mon Aug 3 00:13:46 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Mon, 3 Aug 2009 00:13:46 -0500 (CDT) Subject: [Swift-commit] r3031 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos Message-ID: <20090803051346.2B0289CCAB@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-03 00:13:45 -0500 (Mon, 03 Aug 2009) New Revision: 3031 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/catTS_files.sh Log: Used for concatenating the cleaned individual run time series files - post AFNIcleanTSruns.swift - into one Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/catTS_files.sh =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/catTS_files.sh (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/catTS_files.sh 2009-08-03 05:13:45 UTC (rev 3031) @@ -0,0 +1,6 @@ +#!/bin/tcsh + +## this is for the cleaned time series that have been volreg'd with slice timing correction +set subj = "PK2" + +3dTcat -prefix cleanTScat_PK2allruns cleanTS_PK2run1+orig cleanTS_PK2run2+orig cleanTS_PK2run3+orig cleanTS_PK2run4+orig cleanTS_PK2run5+orig cleanTS_PK2run6+orig cleanTS_PK2run7+orig cleanTS_PK2run8+orig From noreply at svn.ci.uchicago.edu Mon Aug 3 00:14:31 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Mon, 3 Aug 2009 00:14:31 -0500 (CDT) Subject: [Swift-commit] r3032 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos Message-ID: <20090803051431.53CDA9CCAB@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-03 00:14:31 -0500 (Mon, 03 Aug 2009) New Revision: 3032 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/swift_execute.sh Log: Used to execute swift Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/swift_execute.sh =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/swift_execute.sh (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/swift_execute.sh 2009-08-03 05:14:31 UTC (rev 3032) @@ -0,0 +1,3 @@ +#!/bin/tcsh + +swift Vol2SurfSmooth.swift -sites.file /gpfs/pads/fmri/cnari_svn/config/sites_bsd.xml -tc.file /gpfs/pads/fmri/cnari_svn/config/tc.data -user="andric" Property changes on: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/swift_execute.sh ___________________________________________________________________ Name: svn:executable + * From noreply at svn.ci.uchicago.edu Mon Aug 3 00:15:54 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Mon, 3 Aug 2009 00:15:54 -0500 (CDT) Subject: [Swift-commit] r3033 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos Message-ID: <20090803051554.33DA59CCAB@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-03 00:15:54 -0500 (Mon, 03 Aug 2009) New Revision: 3033 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/smoothTSprep3.sh Log: for prepping surface time series to go into the db Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/smoothTSprep3.sh =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/smoothTSprep3.sh (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/smoothTSprep3.sh 2009-08-03 05:15:54 UTC (rev 3033) @@ -0,0 +1,6 @@ +#!/bin/tcsh + +foreach h (lh rh) +echo "doing $h"; date +paste -d ' ' PK2${h}smth PK2vertNum.${h} PK2_${h}.roiNum cleanTSsmooth_${h}_PK2justTS.1D > cleanTSsmooth_${h}_PK2fordb.txt +end From noreply at svn.ci.uchicago.edu Mon Aug 3 00:16:14 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Mon, 3 Aug 2009 00:16:14 -0500 (CDT) Subject: [Swift-commit] r3034 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos Message-ID: <20090803051614.216F49CCAB@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-03 00:16:14 -0500 (Mon, 03 Aug 2009) New Revision: 3034 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/smoothTSprep2.sh Log: for prepping surface time series to go into the db Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/smoothTSprep2.sh =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/smoothTSprep2.sh (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/smoothTSprep2.sh 2009-08-03 05:16:14 UTC (rev 3034) @@ -0,0 +1,6 @@ +#!/bin/tcsh + +foreach h (lh rh) +echo "doing $h"; date +awk '{$1="";$2="";print}' cleanTSsmooth_${h}_PK2.1D.dset | awk '{sub(/^[ \t]+/, ""); print}' > cleanTSsmooth_${h}_PK2justTS.1D +end From noreply at svn.ci.uchicago.edu Mon Aug 3 00:16:25 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Mon, 3 Aug 2009 00:16:25 -0500 (CDT) Subject: [Swift-commit] r3035 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos Message-ID: <20090803051625.3F36D9CCAB@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-03 00:16:25 -0500 (Mon, 03 Aug 2009) New Revision: 3035 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/smoothTSprep1.sh Log: for prepping surface time series to go into the db Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/smoothTSprep1.sh =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/smoothTSprep1.sh (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/smoothTSprep1.sh 2009-08-03 05:16:25 UTC (rev 3035) @@ -0,0 +1,4 @@ +#!/bin/tcsh + +tail -n 131423 cleanTScat_PK2allruns_rhSmooth_mapave.1D.dset > cleanTSsmooth_rh_PK2.1D.dset +tail -n 130934 cleanTScat_PK2allruns_lhSmooth_mapave.1D.dset > cleanTSsmooth_lh_PK2.1D.dset From noreply at svn.ci.uchicago.edu Mon Aug 3 00:17:41 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Mon, 3 Aug 2009 00:17:41 -0500 (CDT) Subject: [Swift-commit] r3036 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos Message-ID: <20090803051741.E00239CCAB@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-03 00:17:41 -0500 (Mon, 03 Aug 2009) New Revision: 3036 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/insertDataTS.py Log: For inserting time series values into the db - tables already existed Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/insertDataTS.py =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/insertDataTS.py (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/insertDataTS.py 2009-08-03 05:17:41 UTC (rev 3036) @@ -0,0 +1,37 @@ +#!/usr/bin/python + +import commands +import os +import sys +import MySQLdb +import time + + +hemis = ['lh','rh'] + +try: + connection = MySQLdb.connect(read_default_file="~/.my.cnf",db="HEL") +except MySQLdb.Error, e: + print "Error %d: %s" % (e.args[0], e.args[1]) + sys.exit (1) + +cursor = connection.cursor() + +def insertdata_to_db(h): + print "que hora es?\n"+time.ctime() + try: + #file = "'/disks/ci-gpfs/fmri/cnari/swift/projects/andric/peakfit_pilots/PK2/PK2surfaces/surfaceData/PK2_"+h+"_TSfordb.txt'" + #file = "'/disks/ci-gpfs/fmri/cnari/swift/projects/andric/peakfit_pilots/PK2/PK2surfaces/surfaceData/cleanTSsmooth_"+h+"_PK2fordb.txt'" + file = "'/gpfs/pads/fmri/cnari/swift/projects/andric/peakfit_pilots/PK2/preprocessingDos/cleanTSsmooth_"+h+"_PK2fordb.txt'" + print "File loading: "+file + insert_statement = "load data local infile "+file+" into table peakTS_data"+h+" fields terminated by ' ';" + print "Insert statement: "+insert_statement + cursor.execute(insert_statement) + print "Number of rows inserted: %d" % cursor.rowcount + except MySQLdb.Error, e: + print "Error loading peakFunc_data"+h+" %d -->> %s" % (e.args[0], e.args[1]) + sys.exit (1) + + +for h in hemis: + insertdata_to_db(h) From noreply at svn.ci.uchicago.edu Mon Aug 3 00:28:56 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Mon, 3 Aug 2009 00:28:56 -0500 (CDT) Subject: [Swift-commit] r3037 - SwiftApps/SIDGrid/swift/swift_scripts/afni Message-ID: <20090803052856.BFB479CC9C@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-03 00:28:56 -0500 (Mon, 03 Aug 2009) New Revision: 3037 Modified: SwiftApps/SIDGrid/swift/swift_scripts/afni/AFNIprocss.swift Log: Preprocessing procedures; now includes the 'tshift' (slice timing correction) in the volreg Modified: SwiftApps/SIDGrid/swift/swift_scripts/afni/AFNIprocss.swift =================================================================== --- SwiftApps/SIDGrid/swift/swift_scripts/afni/AFNIprocss.swift 2009-08-03 05:17:41 UTC (rev 3036) +++ SwiftApps/SIDGrid/swift/swift_scripts/afni/AFNIprocss.swift 2009-08-03 05:28:56 UTC (rev 3037) @@ -1,4 +1,5 @@ #---- doing volreg, despike, mean, percent sig change for PK2 +#-- now using 'tshift' for slice timing correction type file{} type AFNI_obj{ @@ -8,7 +9,7 @@ app (AFNI_obj volregResult, file resultVolregMotion) AFNI_volreg (string baseName, AFNI_obj inputTS, AFNI_obj referenceTS, string volregBaseString){ - AFNI_3dvolreg "-twopass" "-twodup" "-dfile" @strcat("mot_",baseName) "-base" @strcat(volregBaseString,"+orig[225]") "-prefix" @strcat("volreg.",baseName) @inputTS.BRIK; + AFNI_3dvolreg "-twopass" "-twodup" "-dfile" @strcat("mot_",baseName) "-base" @strcat(volregBaseString,"+orig[225]") "-tshift" 4 "-prefix" @strcat("volreg.",baseName) @inputTS.BRIK; } app (AFNI_obj despikeResult) AFNI_despike (string baseName, AFNI_obj volregdInputTS){ From noreply at svn.ci.uchicago.edu Mon Aug 3 00:30:36 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Mon, 3 Aug 2009 00:30:36 -0500 (CDT) Subject: [Swift-commit] r3038 - SwiftApps/SIDGrid/swift/swift_scripts/afni Message-ID: <20090803053036.F0EB39CC9C@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-03 00:30:36 -0500 (Mon, 03 Aug 2009) New Revision: 3038 Added: SwiftApps/SIDGrid/swift/swift_scripts/afni/Vol2SurfSmooth.swift Log: for doing 3dVol2Surf and SurfSmooth in one swift workflow Added: SwiftApps/SIDGrid/swift/swift_scripts/afni/Vol2SurfSmooth.swift =================================================================== --- SwiftApps/SIDGrid/swift/swift_scripts/afni/Vol2SurfSmooth.swift (rev 0) +++ SwiftApps/SIDGrid/swift/swift_scripts/afni/Vol2SurfSmooth.swift 2009-08-03 05:30:36 UTC (rev 3038) @@ -0,0 +1,49 @@ +#--- this is for the PK2 surface projections and smoothing on the surface +## cleanTScat_PK2allruns is a TS that has had slice time correction, covariates for motion, wm, and ventricles. +## did each run separate and concatenated at end. +type file{} +type AFNI_obj{ + file HEAD; + file BRIK; +} + + +app (file vol2surfOutfile) AFNI_Vol2Surf (file spec_file, file smoothwm, file pial, string map, AFNI_obj surfvol, AFNI_obj grid_parent){ + AFNI_3dVol2Surf "-spec" @spec_file "-surf_A" @smoothwm "-surf_B" @pial + "-map_func" map "-f_steps" 15 "-f_index" "voxels" "-oob_index" "-1" "-oob_value" 0 "-no_headers" "-outcols_NSD_format" + "-sv" @surfvol.BRIK "-grid_parent" @grid_parent.BRIK "-out_1D" @filename(vol2surfOutfile); +} + +app (file surfsmoothOutfile) SurfSmooth (file spec_file, file smoothwm, file vol2surfOutfile){ + SurfSmooth "-spec" @spec_file "-surf_A" @smoothwm "-met" "HEAT_07" "-input" @vol2surfOutfile + "-fwhm" 4 "-Niter" "-1" "-add_index" "-output" @filename(surfsmoothOutfile); +} + +(file vol2surfOutfile, file surfsmoothOutfile) ProjectSmoothProc (file spec_file, file smoothwm, file pial, string map, AFNI_obj surfvol, AFNI_obj grid_parent){ + (vol2surfOutfile)= AFNI_Vol2Surf(spec_file, smoothwm, pial, map, surfvol, grid_parent); + (surfsmoothOutfile) = SurfSmooth(spec_file, smoothwm, vol2surfOutfile); +} + + +string declarelist[] = ["PK2"]; +string mapFunctions[] = ["ave"]; +string hemis[] = ["lh","rh"]; +string conditions[] = ["cleanTScat_PK2allruns"]; + +foreach subject in declarelist{ + foreach map in mapFunctions{ + foreach h in hemis{ + foreach cc in conditions{ + string baseDir = @strcat("/gpfs/pads/fmri/cnari/swift/projects/andric/peakfit_pilots/",subject,"/"); + file spec_file; + file smoothwm; + file pial; + AFNI_obj surfvol; + AFNI_obj grid_parent; + file vol2surfOutfile; + file surfsmoothOutfile; + (vol2surfOutfile, surfsmoothOutfile) = ProjectSmoothProc(spec_file, smoothwm, pial, map, surfvol, grid_parent); + } + } + } +} From noreply at svn.ci.uchicago.edu Wed Aug 5 15:57:14 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Wed, 5 Aug 2009 15:57:14 -0500 (CDT) Subject: [Swift-commit] r3039 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2 Message-ID: <20090805205714.9B1E49CCAC@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-05 15:57:14 -0500 (Wed, 05 Aug 2009) New Revision: 3039 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/ Log: turnpoint analysis summer 2009 From noreply at svn.ci.uchicago.edu Wed Aug 5 15:59:17 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Wed, 5 Aug 2009 15:59:17 -0500 (CDT) Subject: [Swift-commit] r3040 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis Message-ID: <20090805205917.B565B9CCAC@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-05 15:59:17 -0500 (Wed, 05 Aug 2009) New Revision: 3040 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/turning.swift Log: swift script to do turnpoints analysis Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/turning.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/turning.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/turning.swift 2009-08-05 20:59:17 UTC (rev 3040) @@ -0,0 +1,48 @@ +#--- turnpoints across the brain via Mediator - for PK2 +## type declarations: +type file{} +type Rscript; +## a type for simple mapping the two output files: + +## Mediator app declaration: +app (file tarOut) run_query (string med_args, file config, Rscript code, file Annot){ + Mediator med_args @filename(code) @filename(Annot); +} + +## this process sets parameters and calls Mediator: +loop_query(int vert, string user, string db, string host, string query_outline, Rscript code, file config, string subject, string h, int beginTS, int endTS, file Annot){ + string outPrefix = @strcat("pa_vs_noise_vert",vert,h); + string tarPrefix = @strcat("turning_out",h,"/vert",vert,"_",h); + file tarOut; + string med_args = @strcat("--user ","andric"," --conf ", @filename(config)," --db ", db," --host ", host, + " --vox ", vert," --subject ", subject," --subquery tsTSVAR"," --begin_ts ",beginTS," --end_ts ",endTS, + " --query ", query_outline," --r_swift_args ",outPrefix," ",vert," ",h," ", at filename(tarOut), " --outprefix ", "FAH_Q", " --r_script ", at filename(code)); + (tarOut) = run_query(med_args, config, code, Annot); +} + +## needed parameters to use Mediator: +string user = @arg("user"); +string db = "HEL"; +string host = "tp-neurodb.ci.uchicago.edu"; +file config; + +## mapping the R code: +Rscript code; +file Annot; + +## variables to move across in the foreach loops: +string declarelist[] = ["PK2smth"]; +string hemilist[] = ["lh"]; +int vertices[] = [0:130933:1]; +#int vertices[] = [0:1:1]; + +foreach subject in declarelist{ + foreach h in hemilist{ + int beginTS = 0; + int endTS = 1807; + string query_outline = @strcat("SELECT SUBQUERY FROM peakTS_data",h," WHERE subject = '",subject,"' AND vertex=VOX"); + foreach vert in vertices{ + loop_query(vert, user, db, host, query_outline, code, config, subject, h, beginTS, endTS, Annot); + } + } +} From noreply at svn.ci.uchicago.edu Wed Aug 5 16:00:54 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Wed, 5 Aug 2009 16:00:54 -0500 (CDT) Subject: [Swift-commit] r3041 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis Message-ID: <20090805210054.16C879CCAC@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-05 16:00:53 -0500 (Wed, 05 Aug 2009) New Revision: 3041 Modified: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/turning.swift Log: modified for the 'move_vs_still' comparison Modified: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/turning.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/turning.swift 2009-08-05 20:59:17 UTC (rev 3040) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/turning.swift 2009-08-05 21:00:53 UTC (rev 3041) @@ -11,8 +11,8 @@ ## this process sets parameters and calls Mediator: loop_query(int vert, string user, string db, string host, string query_outline, Rscript code, file config, string subject, string h, int beginTS, int endTS, file Annot){ - string outPrefix = @strcat("pa_vs_noise_vert",vert,h); - string tarPrefix = @strcat("turning_out",h,"/vert",vert,"_",h); + string outPrefix = @strcat("move_vs_still_vert",vert,h); + string tarPrefix = @strcat("turning2_out",h,"/vert",vert,"_",h); file tarOut; string med_args = @strcat("--user ","andric"," --conf ", @filename(config)," --db ", db," --host ", host, " --vox ", vert," --subject ", subject," --subquery tsTSVAR"," --begin_ts ",beginTS," --end_ts ",endTS, From noreply at svn.ci.uchicago.edu Wed Aug 5 16:01:59 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Wed, 5 Aug 2009 16:01:59 -0500 (CDT) Subject: [Swift-commit] r3042 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis Message-ID: <20090805210159.BC5F69CCAC@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-05 16:01:59 -0500 (Wed, 05 Aug 2009) New Revision: 3042 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/turningRH.swift Log: the RH was done separate to manage dir sizes Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/turningRH.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/turningRH.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/turningRH.swift 2009-08-05 21:01:59 UTC (rev 3042) @@ -0,0 +1,47 @@ +#--- turnpoints across the brain via Mediator - for PK2 +## type declarations: +type file{} +type Rscript; +## a type for simple mapping the two output files: + +## Mediator app declaration: +app (file tarOut) run_query (string med_args, file config, Rscript code, file Annot){ + Mediator med_args @filename(code) @filename(Annot); +} + +## this process sets parameters and calls Mediator: +loop_query(int vert, string user, string db, string host, string query_outline, Rscript code, file config, string subject, string h, int beginTS, int endTS, file Annot){ + string outPrefix = @strcat("pa_vs_noise_vert",vert,h); + string tarPrefix = @strcat("turning_out",h,"/vert",vert,"_",h); + file tarOut; + string med_args = @strcat("--user ","andric"," --conf ", @filename(config)," --db ", db," --host ", host, + " --vox ", vert," --subject ", subject," --subquery tsTSVAR"," --begin_ts ",beginTS," --end_ts ",endTS, + " --query ", query_outline," --r_swift_args ",outPrefix," ",vert," ",h," ", at filename(tarOut), " --outprefix ", "FAH_Q", " --r_script ", at filename(code)); + (tarOut) = run_query(med_args, config, code, Annot); +} + +## needed parameters to use Mediator: +string user = @arg("user"); +string db = "HEL"; +string host = "tp-neurodb.ci.uchicago.edu"; +file config; + +## mapping the R code: +Rscript code; +file Annot; + +## variables to move across in the foreach loops: +string declarelist[] = ["PK2smth"]; +string hemilist[] = ["rh"]; +int vertices[] = [0:131422:1]; + +foreach subject in declarelist{ + foreach h in hemilist{ + int beginTS = 0; + int endTS = 1807; + string query_outline = @strcat("SELECT SUBQUERY FROM peakTS_data",h," WHERE subject = '",subject,"' AND vertex=VOX"); + foreach vert in vertices{ + loop_query(vert, user, db, host, query_outline, code, config, subject, h, beginTS, endTS, Annot); + } + } +} From noreply at svn.ci.uchicago.edu Wed Aug 5 16:03:09 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Wed, 5 Aug 2009 16:03:09 -0500 (CDT) Subject: [Swift-commit] r3043 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis Message-ID: <20090805210309.2CF4A9CCAC@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-05 16:03:09 -0500 (Wed, 05 Aug 2009) New Revision: 3043 Modified: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/turningRH.swift Log: modified to do the 'move_vs_still' comparison Modified: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/turningRH.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/turningRH.swift 2009-08-05 21:01:59 UTC (rev 3042) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/turningRH.swift 2009-08-05 21:03:09 UTC (rev 3043) @@ -11,8 +11,8 @@ ## this process sets parameters and calls Mediator: loop_query(int vert, string user, string db, string host, string query_outline, Rscript code, file config, string subject, string h, int beginTS, int endTS, file Annot){ - string outPrefix = @strcat("pa_vs_noise_vert",vert,h); - string tarPrefix = @strcat("turning_out",h,"/vert",vert,"_",h); + string outPrefix = @strcat("move_vs_still_vert",vert,h); + string tarPrefix = @strcat("turning2_out",h,"/vert",vert,"_",h); file tarOut; string med_args = @strcat("--user ","andric"," --conf ", @filename(config)," --db ", db," --host ", host, " --vox ", vert," --subject ", subject," --subquery tsTSVAR"," --begin_ts ",beginTS," --end_ts ",endTS, From noreply at svn.ci.uchicago.edu Wed Aug 5 16:03:58 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Wed, 5 Aug 2009 16:03:58 -0500 (CDT) Subject: [Swift-commit] r3044 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis Message-ID: <20090805210358.299189CCAC@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-05 16:03:58 -0500 (Wed, 05 Aug 2009) New Revision: 3044 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/swift_turning.sh Log: shell script to execute swift Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/swift_turning.sh =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/swift_turning.sh (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/swift_turning.sh 2009-08-05 21:03:58 UTC (rev 3044) @@ -0,0 +1,3 @@ +#!/bin/tcsh + +swift -resume turning2RH-20090803-1108-ounfu2n8.0.rlog turning2RH.swift -sites.file /gpfs/pads/fmri/cnari_svn/config/coaster_ranger.xml -user="andric" Property changes on: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/swift_turning.sh ___________________________________________________________________ Name: svn:executable + * From noreply at svn.ci.uchicago.edu Wed Aug 5 16:05:28 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Wed, 5 Aug 2009 16:05:28 -0500 (CDT) Subject: [Swift-commit] r3045 - in SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis: . Rturning Message-ID: <20090805210528.A2C329CCAC@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-05 16:05:28 -0500 (Wed, 05 Aug 2009) New Revision: 3045 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/Rturning/ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/Rturning/for3dDecon.PK2_4condSHORTcat_all.1D SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/Rturning/turnchi.R Log: this dir holds the R script and design matrix Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/Rturning/for3dDecon.PK2_4condSHORTcat_all.1D =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/Rturning/for3dDecon.PK2_4condSHORTcat_all.1D (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/Rturning/for3dDecon.PK2_4condSHORTcat_all.1D 2009-08-05 21:05:28 UTC (rev 3045) @@ -0,0 +1,1808 @@ +0 0 0 1 +1 0 0 0 +0 0 1 0 +0 0 0 0 +1 0 0 0 +0 0 1 0 +0 0 0 1 +1 0 0 0 +0 1 0 0 +0 1 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +1 0 0 0 +1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 1 +0 1 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 1 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 1 0 +0 0 1 0 +1 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1 +0 0 0 0 +0 1 0 0 +0 0 0 1 +0 0 0 1 +0 0 0 0 +0 1 0 0 +0 1 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 1 +0 1 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +1 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +1 0 0 0 +0 0 0 1 +0 0 0 0 +1 0 0 0 +1 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 1 0 0 +1 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 1 +0 0 1 0 +0 0 0 0 +1 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 1 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 1 0 +0 1 0 0 +0 0 0 0 +0 1 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +1 0 0 0 +1 0 0 0 +0 1 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 1 +0 0 0 1 +0 0 0 0 +0 0 1 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +1 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 1 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 1 0 0 +0 0 0 1 +0 1 0 0 +0 0 0 1 +0 0 0 0 +0 0 1 0 +0 0 0 1 +0 0 1 0 +0 1 0 0 +0 0 0 0 +1 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 1 +0 0 1 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 1 0 0 +0 1 0 0 +0 0 1 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 1 0 +1 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 0 +1 0 0 0 +0 0 0 1 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +1 0 0 0 +0 0 0 1 +1 0 0 0 +0 0 1 0 +0 0 0 1 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 1 0 +0 0 1 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +1 0 0 0 +1 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 1 +0 0 0 1 +1 0 0 0 +0 1 0 0 +0 0 1 0 +0 1 0 0 +0 0 0 1 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 1 +0 1 0 0 +0 1 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +1 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 1 0 0 +0 0 0 1 +0 0 0 0 +0 0 1 0 +1 0 0 0 +1 0 0 0 +0 0 0 0 +1 0 0 0 +1 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 1 +0 1 0 0 +0 1 0 0 +1 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 1 0 +0 0 0 0 +0 0 0 1 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 1 +1 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 1 0 +1 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 1 +0 0 0 1 +0 0 1 0 +0 0 0 0 +1 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 1 0 0 +0 0 0 1 +1 0 0 0 +0 0 0 0 +0 0 1 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 1 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 1 0 +0 0 0 1 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 1 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 1 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 1 +0 1 0 0 +0 1 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 1 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 1 0 +0 1 0 0 +0 0 1 0 +0 0 0 1 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 1 0 +0 0 0 1 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 1 0 0 +0 1 0 0 +1 0 0 0 +0 1 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 1 +1 0 0 0 +0 0 1 0 +1 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 1 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 1 0 0 +0 0 1 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 1 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 1 0 +1 0 0 0 +1 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 1 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 1 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 1 0 +1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 1 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +1 0 0 0 +0 0 0 1 +0 0 1 0 +0 1 0 0 +0 0 1 0 +0 0 0 1 +0 1 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1 +0 1 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +1 0 0 0 +1 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 1 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +1 0 0 0 +0 1 0 0 +0 0 1 0 +0 1 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 1 0 0 +1 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +1 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 1 +0 1 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 1 0 0 +0 1 0 0 +0 0 0 0 +1 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 1 +0 0 0 0 +1 0 0 0 +0 0 0 1 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 1 0 +0 0 0 0 +1 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 1 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 1 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 1 +0 0 0 0 +0 0 0 1 +1 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 1 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 1 0 0 +0 0 0 1 +0 0 1 0 +0 0 0 0 +1 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 1 0 +1 0 0 0 +1 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 1 +0 1 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 1 +0 0 0 1 +0 0 0 1 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 1 0 +0 0 1 0 +0 0 0 0 +1 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 1 0 0 +0 0 0 1 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 1 0 0 +0 0 0 0 +1 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +1 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 1 0 0 +0 1 0 0 +0 1 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 1 0 +1 0 0 0 +0 1 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 1 +1 0 0 0 +0 0 0 1 +0 1 0 0 +0 1 0 0 +0 0 0 1 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 1 0 0 +0 1 0 0 +0 0 1 0 +0 0 1 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 1 0 +1 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 1 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +1 0 0 0 +1 0 0 0 +1 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 1 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +1 0 0 0 +1 0 0 0 +1 0 0 0 +0 1 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 1 +0 0 1 0 +0 0 0 1 +1 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +1 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 1 +1 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 1 +0 0 0 0 +0 1 0 0 +0 0 0 1 +0 1 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 1 +0 0 1 0 +0 0 1 0 +0 1 0 0 +0 0 0 1 +0 0 0 1 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 1 0 +0 0 0 0 +0 0 1 0 +1 0 0 0 +0 1 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 1 +0 0 0 0 +0 0 1 0 +0 0 0 1 +0 0 1 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 1 0 0 +0 1 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +1 0 0 0 +0 0 1 0 +0 0 0 1 +0 0 0 0 +0 0 0 1 +0 0 1 0 +0 1 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 1 +1 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 1 0 +1 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 1 0 0 +0 0 0 1 +0 0 0 1 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 1 +0 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 1 +0 1 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 1 0 0 +0 0 1 0 +0 0 1 0 +0 0 1 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 1 0 +0 1 0 0 +1 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +1 0 0 0 +0 0 1 0 +0 0 0 0 +1 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 1 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 1 0 0 +0 0 0 0 +0 1 0 0 +0 0 1 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +1 0 0 0 +0 0 0 1 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 1 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 1 +1 0 0 0 +1 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +1 0 0 0 +1 0 0 0 +1 0 0 0 +0 0 0 1 +0 1 0 0 +0 0 1 0 +0 0 1 0 +1 0 0 0 +0 1 0 0 +0 0 0 1 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 1 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 1 +1 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 1 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 1 +0 1 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 1 +0 0 1 0 +0 1 0 0 +0 0 0 0 +1 0 0 0 +0 1 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +1 0 0 0 +0 0 0 1 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 1 +0 0 1 0 +0 1 0 0 +0 1 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 1 0 +0 0 0 0 +0 0 0 1 +1 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 1 +0 0 0 1 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 1 +0 1 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +1 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 1 0 +0 0 0 1 +0 0 0 0 +1 0 0 0 +0 0 0 1 +0 0 0 1 +0 0 0 0 +1 0 0 0 +0 0 1 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 1 0 0 +0 0 0 0 +1 0 0 0 +0 1 0 0 +0 0 1 0 +0 1 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 1 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 1 +1 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 1 0 +0 0 0 0 +0 0 1 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 1 0 0 +0 1 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +1 0 0 0 +0 1 0 0 +1 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 1 0 +1 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 1 +0 1 0 0 +0 0 1 0 +0 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +1 0 0 0 +1 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 0 +1 0 0 0 +0 1 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 1 0 +1 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 1 0 +0 1 0 0 +0 0 0 0 +1 0 0 0 +1 0 0 0 +1 0 0 0 +1 0 0 0 +0 0 0 0 +0 1 0 0 +0 1 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 1 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 1 0 +0 0 0 0 +0 0 0 1 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +1 0 0 0 +0 0 0 0 +0 0 1 0 +1 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 1 +0 0 1 0 +0 0 0 1 +0 1 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +1 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 1 +1 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 1 0 +1 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +1 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 0 1 +0 0 0 1 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 1 +0 1 0 0 +0 0 0 1 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 1 +1 0 0 0 +0 0 1 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 1 +1 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 0 0 0 +1 0 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 0 +0 1 0 0 +0 1 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 +0 0 1 0 +0 0 0 1 +0 1 0 0 +0 0 0 0 +0 0 0 0 +0 1 0 0 +1 0 0 0 +0 1 0 0 +1 0 0 0 +0 0 0 0 +0 0 0 1 +0 0 0 0 +0 0 0 1 +0 0 0 1 +0 0 0 0 +0 1 0 0 +0 0 1 0 +0 0 0 0 +0 1 0 0 +0 0 1 0 +1 0 0 0 +0 0 1 0 +0 0 0 0 +0 1 0 0 +0 0 0 0 +0 0 0 1 +0 0 1 0 +0 0 1 0 +0 0 0 0 +0 0 0 0 +0 0 0 0 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/Rturning/turnchi.R =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/Rturning/turnchi.R (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/Rturning/turnchi.R 2009-08-05 21:05:28 UTC (rev 3045) @@ -0,0 +1,174 @@ +### TURNPOINTS +library(akima) +library(pastecs) + +allargs <- Sys.getenv("R_SWIFT_ARGS") +print(allargs) + +outprefix <- noquote(strsplit(allargs," ")[[1]][2]) +print(outprefix) +output_file_prefix <- paste(outprefix) +vertnum <- noquote(strsplit(allargs," ")[[1]][3]) +vertnum <- as.numeric(vertnum) +print(vertnum) +hemi <- noquote(strsplit(allargs," ")[[1]][4]) +h <- paste(hemi) +print(h) +tar_name <- noquote(strsplit(allargs," ")[[1]][5]) +tar_name <- paste(tar_name) +print(tar_name) + +inputfilename <- Sys.getenv("R_INPUT") + +inputTS <- as.matrix(read.table(inputfilename)) +inputTS <- data.frame(inputTS[1,])[,1] +print(length(inputTS)) + + +#### Now do peak and valley analysis based on turnpoints + +ts_turnpoints <- turnpoints(inputTS) +ts_peaks <- (1:length(inputTS))[extract(ts_turnpoints, no.tp = FALSE, peak = TRUE, pit = FALSE)] +ts_valleys <- (1:length(inputTS))[extract(ts_turnpoints, no.tp = FALSE, peak = FALSE, pit = TRUE)] +lower = 1 + +ts_peaks_and_valleys <- NULL +# this if loop is for when we start with a valley +if (ts_peaks[1] > ts_valleys[1]) { + # this section fills from time 1 to the pitt with "v" + upper <- ts_valleys[lower] + for (i in seq(lower,upper)) { + ts_peaks_and_valleys <- c(ts_peaks_and_valleys, "v") + } + # this section alternates between the base of a peak to the peak back down to the pitt, etc + for (lower in c(1:min(length(ts_peaks),length(ts_valleys)))) { + valley_index <- ts_valleys[lower] + peak_index <- ts_peaks[lower] + for (i in seq(valley_index,peak_index-1)) { + ts_peaks_and_valleys <- c(ts_peaks_and_valleys, "p") + } + if (lower < max(length(ts_peaks),length(ts_valleys))) { + valley_index <- ts_valleys[lower+1] + for (i in seq(peak_index,valley_index-1)) { + ts_peaks_and_valleys <- c(ts_peaks_and_valleys, "v") + } + } + } + # if you started with valley end with peak + valley_index <- max(ts_valleys,ts_peaks)+1 + peak_index <- length(inputTS) + for (i in seq(valley_index,peak_index)) { + ts_peaks_and_valleys <- c(ts_peaks_and_valleys, "p") + } + #PCs_peaks_and_valleys[,column] <- ts_peaks_and_valleys + #column <- column +1 +} else if (ts_peaks[1] < ts_valleys[1]) { # this if loop is for when we start with a peak + # this section fills from time 1 to the peak with "p" + upper <- ts_peaks[lower] + for (i in seq(lower,upper)) { + ts_peaks_and_valleys <- c(ts_peaks_and_valleys, "p") + } + # this section alternates between the base of a peak to the peak back down to the pitt, etc + for (lower in c(1:(min(length(ts_peaks),length(ts_valleys))))) { + valley_index <- ts_peaks[lower] + peak_index <- ts_valleys[lower] + for (i in seq(valley_index,peak_index-1)) { + ts_peaks_and_valleys <- c(ts_peaks_and_valleys, "v") + } + if (lower < max(length(ts_peaks),length(ts_valleys))) { + valley_index <- ts_peaks[lower+1] + for (i in seq(peak_index,valley_index-1)) { + ts_peaks_and_valleys <- c(ts_peaks_and_valleys, "p") + } + } + } + # if you started with peak end with valley + valley_index <- max(ts_valleys,ts_peaks)+1 + peak_index <- length(inputTS) + for (i in seq(valley_index,peak_index)) { + ts_peaks_and_valleys <- c(ts_peaks_and_valleys, "v") + } + #PCs_peaks_and_valleys[,column] <- ts_peaks_and_valleys + #column <- column +1 +} + +### would've written out here, but trying tpchisqtest instead + +write.table(ts_peaks_and_valleys,"ts_peak_valley.tmp",row.name = F,col.name = F,append=FALSE) +ts_peaks_and_valleys <- read.table("ts_peak_valley.tmp") + +coded <- read.table("Rturning/for3dDecon.PK2_4condSHORTcat_all.1D") +annotation_recode <- "" +annotation_recode[coded[,1]==1] <- "still" +annotation_recode[coded[,2]==1] <- "move" +annotation_recode[coded[,3]==1] <- "still" +annotation_recode[coded[,4]==1] <- "move" +annotation_recode[which(is.na(annotation_recode))] <- "blank" + +# set the resulting recoded attributes of interest as variables +# the primary attribute should go first +dimension_1 <- "move" +dimension_2 <- "still" + + +#### source call was here !!!!!!! + +## don't need to read in this var, never wrote it out..........ts_peaks_and_valleys <- read.table(inputfilename) +## annotation shift: +## by TR (ts & coding not resampled here) +#matrix_to_add_to_ts_peaks_and_valleys <- matrix(ncol=1,nrow=10,data=0) +#ts_peaks_and_valleys <- rbind(ts_peaks_and_valleys,matrix_to_add_to_ts_peaks_and_valleys) + +# set lags +#lags <- as.factor(c(0,.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5,10)) +lags <- as.factor(c(0,1,2,3,4,5,6)) + +for (lag in as.numeric(levels(lags))) { + + # Now we need to pad the "annotation_recode" file in an appropriate manner + if (lag == 0) { + annotation_recode_short <- as.matrix(annotation_recode) + #add_to_end_of_annotation_recode_short <- matrix(ncol=1,nrow=0,data=0) + #annotation_recode_long <- as.character(rbind(annotation_recode_short,add_to_end_of_annotation_recode_short)) + annotation_recode_long <- annotation_recode_short + } + + if (lag > 0 && lag < 6) { + annotation_recode_short <- as.matrix(annotation_recode) + beginning_number_of_rows <- lag*1 + end_number_of_rows <- 6-lag*1 + add_to_beginning_of_annotation_recode_short <- matrix(ncol=1,nrow=beginning_number_of_rows,data=0) + add_to_end_of_annotation_recode_short <- matrix(ncol=1,nrow=end_number_of_rows,data=0) + annotation_recode_long <- as.character(rbind(add_to_beginning_of_annotation_recode_short,annotation_recode_short,add_to_end_of_annotation_recode_short)) + } + + if (lag == 6) { + annotation_recode_short <- as.matrix(annotation_recode) + add_to_beginning_of_annotation_recode_short <- matrix(ncol=1,nrow=6,data=0) + annotation_recode_long <- as.character(rbind(add_to_beginning_of_annotation_recode_short,annotation_recode_short)) + } + + contingency_table <- matrix(ncol=2,nrow=2) + one_way_contingency_table_results <- matrix(nrow = 1, ncol= 5) + #colnames(one_way_contingency_table_results) <- c("attribute_at_peak", "attribute_at_valley", "x_square", "p_value") + two_way_contingency_table_results <- matrix(nrow = 1, ncol= 7) + #colnames(two_way_contingency_table_results) <- c("attribute_at_peak", "no_attribute_at_peak", "attribute_at_valley", "no_attribute_at_valley", "x_square", "p_value") + + ts_PVdata <- ts_peaks_and_valleys[,1] + contingency_table <- matrix(ncol=2,nrow=2,dimnames = list(c(dimension_1, dimension_2),c("Peak", "Pit"))) + # This converts the amount of time to TR. Do we like this? + contingency_table[1,1] <- length(which(ts_PVdata[annotation_recode_long==dimension_1]=="p")) + contingency_table[1,2] <- length(which(ts_PVdata[annotation_recode_long==dimension_1]=="v")) + contingency_table[2,1] <- length(which(ts_PVdata[annotation_recode_long==dimension_2]=="p")) + contingency_table[2,2] <- length(which(ts_PVdata[annotation_recode_long==dimension_2]=="v")) + one_way_chisq_contingency_table <- chisq.test(as.table(contingency_table[1,])) + two_way_chisq_contingency_table <- chisq.test(as.table(contingency_table)) + + one_way_contingency_table_results[1,] <- c(vertnum,as.vector(c(as.vector(contingency_table[1,]),one_way_chisq_contingency_table$statistic, one_way_chisq_contingency_table$p.value))) + two_way_contingency_table_results[1,] <- c(vertnum,as.vector(contingency_table),two_way_chisq_contingency_table$statistic, two_way_chisq_contingency_table$p.value) + + write.table(round(one_way_contingency_table_results,4),paste(output_file_prefix,".lag",lag,".oneway.chisqresult",sep=""),row.name = FALSE,col.name = FALSE,append=FALSE) + + write.table(round(two_way_contingency_table_results,4),paste(output_file_prefix,".lag",lag,".twoway.chisqresult",sep=""),row.name = FALSE,col.name = FALSE,append=FALSE) +} +system(paste("tar cfz ",tar_name," *.chisqresult",sep="")); From noreply at svn.ci.uchicago.edu Wed Aug 5 16:09:04 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Wed, 5 Aug 2009 16:09:04 -0500 (CDT) Subject: [Swift-commit] r3046 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis Message-ID: <20090805210904.E53149CCAC@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-05 16:09:04 -0500 (Wed, 05 Aug 2009) New Revision: 3046 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts/ Log: scripts dir holds various scripts From noreply at svn.ci.uchicago.edu Wed Aug 5 16:11:51 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Wed, 5 Aug 2009 16:11:51 -0500 (CDT) Subject: [Swift-commit] r3047 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts Message-ID: <20090805211151.8CCF19CCAC@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-05 16:11:51 -0500 (Wed, 05 Aug 2009) New Revision: 3047 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts/newfilecat.py Log: code to build brain images for each lag taking from the enormous output dir Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts/newfilecat.py =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts/newfilecat.py (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts/newfilecat.py 2009-08-05 21:11:51 UTC (rev 3047) @@ -0,0 +1,59 @@ +#!/usr/bin/python + +import os +import fnmatch +import shutil +import time + + +def finder(L,value): + listsubset = [] + for ff in thefiles: + if fnmatch.fnmatch(ff,value): + listsubset += [ff] + + return listsubset + + +h = "lh" +baseDir = os.getenv("cnari")+"/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis" +outputDir = baseDir+"/turning_out"+h +viewDir = baseDir+"/views" + +os.chdir(outputDir) +print os.getcwd() + +thefiles = os.listdir(os.getcwd()) +print "Number of files in this dir: "+`len(thefiles)` + +for i in range(2,7): + onewayBrain = h+"_lag"+`i`+".oneway.1D" + print onewayBrain+" starting: "+time.ctime() + onewayfiles = finder(thefiles,"pa_vs_noise*.lag"+`i`+".oneway.chisqresult") + print "Found all files in this subset, now building brain "+time.ctime() + brainUNO = '' + for pa in onewayfiles: + brainUNO += open(pa,"r").read() + + onewayResult = open(onewayBrain,"w") + print "Now WRITING "+onewayBrain+" -- "+time.ctime() + onewayResult.write(brainUNO) + onewayResult.close() + print "Now COPYING "+onewayBrain + shutil.copy2(onewayBrain,viewDir) + + + twowayBrain = h+"_lag"+`i`+".twoway.1D" + print twowayBrain+" starting: "+time.ctime() + twowayfiles = finder(thefiles,"pa_vs_noise*.lag"+`i`+".twoway.chisqresult") + print "Found all files in this subset, now building brain "+time.ctime() + brainDOS = '' + for pa in twowayfiles: + brainDOS += open(pa,"r").read() + + twowayResult = open(twowayBrain,"w") + print "Now WRITING "+twowayBrain+" -- "+time.ctime() + twowayResult.write(brainDOS) + twowayResult.close() + print "Now COPYING "+twowayBrain + shutil.copy2(twowayBrain,viewDir) From noreply at svn.ci.uchicago.edu Wed Aug 5 16:12:54 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Wed, 5 Aug 2009 16:12:54 -0500 (CDT) Subject: [Swift-commit] r3048 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts Message-ID: <20090805211254.3DD739CCAC@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-05 16:12:54 -0500 (Wed, 05 Aug 2009) New Revision: 3048 Modified: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts/newfilecat.py Log: cleaned up the code a bit. this one is doing the 'move_vs_still' comparison Modified: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts/newfilecat.py =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts/newfilecat.py 2009-08-05 21:11:51 UTC (rev 3047) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts/newfilecat.py 2009-08-05 21:12:54 UTC (rev 3048) @@ -8,16 +8,16 @@ def finder(L,value): listsubset = [] - for ff in thefiles: + for ff in L: if fnmatch.fnmatch(ff,value): listsubset += [ff] return listsubset -h = "lh" +h = "rh" baseDir = os.getenv("cnari")+"/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis" -outputDir = baseDir+"/turning_out"+h +outputDir = baseDir+"/turning2_out"+h viewDir = baseDir+"/views" os.chdir(outputDir) @@ -26,10 +26,10 @@ thefiles = os.listdir(os.getcwd()) print "Number of files in this dir: "+`len(thefiles)` -for i in range(2,7): - onewayBrain = h+"_lag"+`i`+".oneway.1D" +for i in range(0,2): + onewayBrain = "move_vs_still_"+h+"_lag"+`i`+".oneway.1D" print onewayBrain+" starting: "+time.ctime() - onewayfiles = finder(thefiles,"pa_vs_noise*.lag"+`i`+".oneway.chisqresult") + onewayfiles = finder(thefiles,"move_vs_still*.lag"+`i`+".oneway.chisqresult") print "Found all files in this subset, now building brain "+time.ctime() brainUNO = '' for pa in onewayfiles: @@ -43,9 +43,9 @@ shutil.copy2(onewayBrain,viewDir) - twowayBrain = h+"_lag"+`i`+".twoway.1D" + twowayBrain = "move_vs_still_"+h+"_lag"+`i`+".twoway.1D" print twowayBrain+" starting: "+time.ctime() - twowayfiles = finder(thefiles,"pa_vs_noise*.lag"+`i`+".twoway.chisqresult") + twowayfiles = finder(thefiles,"move_vs_still*.lag"+`i`+".twoway.chisqresult") print "Found all files in this subset, now building brain "+time.ctime() brainDOS = '' for pa in twowayfiles: From noreply at svn.ci.uchicago.edu Wed Aug 5 16:14:16 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Wed, 5 Aug 2009 16:14:16 -0500 (CDT) Subject: [Swift-commit] r3049 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts Message-ID: <20090805211416.62B4E9CCAC@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-05 16:14:16 -0500 (Wed, 05 Aug 2009) New Revision: 3049 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts/untar.py Log: this untars files from enormous output dir Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts/untar.py =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts/untar.py (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts/untar.py 2009-08-05 21:14:16 UTC (rev 3049) @@ -0,0 +1,20 @@ +#!/usr/bin/python + +import os +import commands +import time + + +baseDir = os.getenv("cnari")+"/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis" +os.chdir(baseDir+"/turning2_outrh") +print os.getcwd() + +thefiles = os.listdir(os.getcwd()) +print len(thefiles) + +print time.ctime() +for tt in thefiles: + os.system("tar -xzf "+tt) + + +print time.ctime() From noreply at svn.ci.uchicago.edu Wed Aug 5 16:15:03 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Wed, 5 Aug 2009 16:15:03 -0500 (CDT) Subject: [Swift-commit] r3050 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts Message-ID: <20090805211503.5267B9CCAC@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-05 16:15:03 -0500 (Wed, 05 Aug 2009) New Revision: 3050 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts/untarSupp.py Log: this looks specifically for '*.tgz' files rather than building a list of all files in the dir Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts/untarSupp.py =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts/untarSupp.py (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis/scripts/untarSupp.py 2009-08-05 21:15:03 UTC (rev 3050) @@ -0,0 +1,33 @@ +#!/usr/bin/python + +import os +import fnmatch +import commands +import time + + +def finder(L,value): + listsubset = [] + for ff in L: + if fnmatch.fnmatch(ff,value): + listsubset += [ff] + + return listsubset + + + +baseDir = os.getenv("cnari")+"/swift/projects/andric/peakfit_pilots/PK2/turnpointAnalysis" +os.chdir(baseDir+"/turning2_outlh") +print os.getcwd() + +thefiles = os.listdir(os.getcwd()) +print "number of files in this dir: "+`len(thefiles)`+" :: "+time.ctime() +tgzfiles = finder(thefiles,"*.tgz") +print "number of tgz files in this dir: "+`len(tgzfiles)`+" :: "+time.ctime() + +print "Starting untar "+time.ctime() +for tt in tgzfiles: + os.system("tar -xzf "+tt) + + +print "Finished at "+time.ctime() From noreply at svn.ci.uchicago.edu Thu Aug 6 10:21:49 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Thu, 6 Aug 2009 10:21:49 -0500 (CDT) Subject: [Swift-commit] r3051 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem Message-ID: <20090806152149.809D59CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-06 10:21:49 -0500 (Thu, 06 Aug 2009) New Revision: 3051 Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/ Log: dir for individual subjects ccf data From noreply at svn.ci.uchicago.edu Thu Aug 6 10:23:15 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Thu, 6 Aug 2009 10:23:15 -0500 (CDT) Subject: [Swift-commit] r3052 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss Message-ID: <20090806152315.89A329CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-06 10:23:15 -0500 (Thu, 06 Aug 2009) New Revision: 3052 Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/ Log: dir for interpolated ccf From noreply at svn.ci.uchicago.edu Thu Aug 6 10:26:49 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Thu, 6 Aug 2009 10:26:49 -0500 (CDT) Subject: [Swift-commit] r3053 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs Message-ID: <20090806152649.CBF149CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-06 10:26:49 -0500 (Thu, 06 Aug 2009) New Revision: 3053 Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/indiv_ccfinterp.swift Log: does ccf on individual subjs using interpolation Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/indiv_ccfinterp.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/indiv_ccfinterp.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/indiv_ccfinterp.swift 2009-08-06 15:26:49 UTC (rev 3053) @@ -0,0 +1,53 @@ +#-- doing this analysis this time interpolating the HRFs for better lag precision +type file{} + +app (file qout, file rout) run_query (string allcatargs, file config, file dot_r){ + Mediator allcatargs stdout=@filename(qout) @filename(dot_r); +} + + +loop_query(int bvox, string user, string db, string host, string query_outline, file r_script, file config, string id, string h, int ss){ + int evox = bvox+3999; + string r_swift_args = h; + string theoutprefix = @strcat("ss",ss,"interp_results/",id,bvox,"_",evox); + string med_args = @strcat("--user ","andric", + " --conf ", "user.config", + " --db ", db, + " --host ", host, + " --query ", query_outline, + " --r_script ", @filename(r_script), + " --begin_vox ", bvox, + " --end_vox ", evox, + " --subject ", id, + " --batchstep ", "1000", + " --outprefix ", theoutprefix, + " --r_swift_args ", r_swift_args, + " --subject ", id); + file q_result ; + file r_result ; + (q_result, r_result) = run_query(med_args, r_script, config); +} + + +string user = @arg("user"); +string db = "EMBLEM1"; +string host = "tp-neurodb.ci.uchicago.edu"; + +file r_script; +file config; + +int subjs[] = [3,5,6,7,8,10,11,12,13,14,15,17,18,19,20,21,22,23,24,25,26,27,28,30]; +#int subjs[] = [3]; +int mybatches[] = [1:196000:4000]; +string hemis[] = ["lh","rh"]; +string nombre = "interp"; + +foreach ss in subjs{ + foreach h in hemis { + string query_outline = @strcat("SELECT subject, voxel, speech0B, speech1B, speech2B, speech3B, speech4B, speech5B, speech6B, speech7B, speech8B, gesture0B, gesture1B, gesture2B, gesture3B, gesture4B, gesture5B, gesture6B, gesture7B, gesture8B, gestspeech0B, gestspeech1B, gestspeech2B, gestspeech3B, gestspeech4B, gestspeech5B, gestspeech6B, gestspeech7B, gestspeech8B, grasp0B, grasp1B, grasp2B, grasp3B, grasp4B, grasp5B, grasp6B, grasp7B, grasp8B FROM emblemfem",h," WHERE subject = ",ss," AND voxel between BEGIN_BATCH and END_BATCH"); + string id = @strcat(nombre,"_",h); + foreach batch in mybatches { + loop_query(batch, user, db, host, query_outline, r_script, config, id, h, ss); + } + } +} From noreply at svn.ci.uchicago.edu Thu Aug 6 10:27:56 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Thu, 6 Aug 2009 10:27:56 -0500 (CDT) Subject: [Swift-commit] r3054 - in SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs: . scripts Message-ID: <20090806152756.E20149CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-06 10:27:56 -0500 (Thu, 06 Aug 2009) New Revision: 3054 Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/catsort.py SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/copier.py SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/copystuff.py SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/find_missing.py SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/findmissingverts.R SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/findmissingverts.py SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/indiv_ccfinterp.R SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/indiv_ccfinterpSupp.R SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/medication.py SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/medicationTRES.py SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/printcount.py SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/untarthem.py Log: scripts dir for interp ccf on individual subjects Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/catsort.py =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/catsort.py (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/catsort.py 2009-08-06 15:27:56 UTC (rev 3054) @@ -0,0 +1,20 @@ +#!/usr/bin/python + +import os +import commands +index = range(1,196001) + +hemis = ['lh','rh'] +#hemis = ['rh'] +subjs = [10] +#subjs = [13,14,15,17,18,19,20,21,22,23,24,25,26,27,28,30] +#subjs = [3,5,6,7,8,10,11,12,13,14,15,17,18,19,20,21,22,23,24,25,26,27,28,30] +baseDir = os.getenv("cnari")+"/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/" + +for ss in subjs: + os.chdir(baseDir+"ss"+`ss`+"interp_results/") + print os.getcwd() + for h in hemis: + sortfile = "sorted_"+h+"_ccf.txt" + commands.getoutput("cat "+h+"_*_ccf.txt | sort -g -k 1 > "+sortfile) + Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/copier.py =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/copier.py (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/copier.py 2009-08-06 15:27:56 UTC (rev 3054) @@ -0,0 +1,13 @@ +#!/usr/bin/python + +import shutil +import os + + +subjs = [3,5,6,7,8,10,11,12,13,14,15,17,18,19,20,21,22,23,24,25,26,27,28,30] +baseDir = os.getenv("cnari")+"/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/" + + +for ss in subjs: + shutil.copy2(baseDir+"scripts/indiv_ccfinterpSupp.R", baseDir+"ss"+`ss`+"interp_results") + Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/copystuff.py =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/copystuff.py (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/copystuff.py 2009-08-06 15:27:56 UTC (rev 3054) @@ -0,0 +1,13 @@ +#!/usr/bin/python + +import os +import commands + +hemis = ['lh','rh'] +subjs = [3,5,6,7,8,10,11,12,13,14,15,17,18,19,20,21,22,23,24,25,26,27,28,30] +baseDir = os.getenv("cnari")+"/swift/projects/andric/ccf_emblem/individual_ss/" + +for ss in subjs: + oldStuff = baseDir+"IDEALseed/ss"+`ss`+"_results/ss_vec"+`ss`+".txt" + newStuff = baseDir+"interpolatedHRFs/ss"+`ss`+"interp_results/" + commands.getoutput("cp "+oldStuff+" "+newStuff) Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/find_missing.py =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/find_missing.py (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/find_missing.py 2009-08-06 15:27:56 UTC (rev 3054) @@ -0,0 +1,28 @@ +#!/usr/bin/python + +import os +import commands + + +starts = range(1,196000,1000) +subjs = [5,6,7,8,10,11,12,13,14,15,17,18,19,20,21,22,23,24,25,26,27,28,30] +#subjs = [3] +baseDir = os.getenv("cnari")+"/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/" +hemis = ['lh','rh'] + + +for ss in subjs: + os.chdir(baseDir+"ss"+`ss`+"interp_results/") + print os.getcwd() + for h in hemis: + outfile = baseDir+"ss"+`ss`+"interp_results/missing_"+h+"_ss"+`ss`+"starts.txt" + missed = "" + for num in starts: + voxdata = h+"_"+`num`+"_"+`(num+999)`+"_ccf.txt" + if os.path.exists(voxdata): pass + else: + missed += `num`+"\n" + + file = open(outfile,'w') + file.write(missed) + file.close() Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/findmissingverts.R =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/findmissingverts.R (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/findmissingverts.R 2009-08-06 15:27:56 UTC (rev 3054) @@ -0,0 +1,6 @@ +prefix <- Sys.getenv("R_FILE") +sorted <- read.table(prefix) +verts <- c(1:196000) +index <- sorted[,1] +missing <- which(!verts %in% index) +write.table(missing,paste(prefix,"missingverts",sep=""),row.names=F,col.names=F,quote=F) Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/findmissingverts.py =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/findmissingverts.py (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/findmissingverts.py 2009-08-06 15:27:56 UTC (rev 3054) @@ -0,0 +1,20 @@ +#!/usr/bin/python + +import os +import commands +index = range(1,196001) + +hemis = ['lh','rh'] +subjs = [3] +#subjs = [3,5,6,7,8,10,11,12,13,14,15,17,18,19,20,21,22,23,24,25,26,27,28,30] +baseDir = os.getenv("cnari")+"/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/" + +for ss in subjs: + os.chdir(baseDir+"ss"+`ss`+"interp_results/") + print os.getcwd() + for h in hemis: + sortfile = baseDir+"ss"+`ss`+"interp_results/sorted_"+h+"_ccf" + commands.getoutput("cat "+h+"_*_ccf.txt | sort -g -k 1 > "+sortfile) + os.environ["R_FILE"] = sortfile + os.system("/usr/bin/R CMD BATCH --vanilla "+baseDir+"scripts/findmissingverts.R") + Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/indiv_ccfinterp.R =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/indiv_ccfinterp.R (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/indiv_ccfinterp.R 2009-08-06 15:27:56 UTC (rev 3054) @@ -0,0 +1,136 @@ +#--- June 1, 2009 +## using interpolation to get better precision on the lag +#---- This vrsion cuts off Beta vals abs(val) > 8 and uses lag.max=12 +library(akima) +allinputs <- Sys.getenv("R_SWIFT_ARGS") +print(allinputs) +outname <- noquote(strsplit(allinputs," ")[[1]][1]) +hemi <- noquote(strsplit(allinputs," ")[[1]][2]) + +inputfile <- Sys.getenv("R_INPUT") +dd <- read.table(inputfile) +Query_out <- data.frame(dd) + + +NumSubjects <- 1; +NumTimepoints <- 9; +NumCols <- 36 +SubjectVec <- as.factor(rep(1:NumSubjects,NumCols)) +CondVect <- as.factor(rep(1:4, rep(NumTimepoints*NumSubjects, 4))) +TimePointVec <- as.factor(rep(rep(1:9, rep(NumSubjects, 9)),4)) +OverallRows <- length(levels(as.factor(Query_out[,2]))) +ccf <- matrix(nrow=OverallRows, ncol=10) + +mat_row = 0 + +attach(Query_out) +vox_levels <- as.factor(Query_out[,2]) + +for (vox in levels(vox_levels)){ + mat_row = mat_row + 1 + # brougt in many voxels, now go one by one + vox_matrix <- Query_out[which(Query_out[,2] == vox),] + # take colums 3-38of the results and make vector + zz <- (stack(vox_matrix[,3:38])) + VoxValues_vec <- zz[,1] + Voxel_df <- data.frame(S=SubjectVec, Cond=CondVect, Time=TimePointVec, Beta=VoxValues_vec) + attach(Voxel_df) + # grab those entries with extreme values to try to ammend with clean data + cutoff_obs <- Voxel_df[(Voxel_df$Beta <= -8) | (Voxel_df$Beta >= 8),] + + if (length(unique(cutoff_obs$Beta)) > 0){ + # get breakdown of the extreme values by subject and condition. if we wanted just by subject could have used + # cutoff_obs_breakdown <- aggregate(cutoff_obs$Beta, by=list(cutoff_obs$S), length) + cutoff_obs_breakdown <- aggregate(cutoff_obs$Beta, by=list(cutoff_obs$S, cutoff_obs$Time), length) + # now get just those conditions that had 1 or more extreme vals. + # ss that contributed more than 1 vals to any condition gets kicked out from this voxel's analysis + t1 <- subset(cutoff_obs_breakdown, cutoff_obs_breakdown$x >=1) + kicked_out_ss <- as.factor(as.vector(unique(t1[,1]))) + num_kicked_out_ss <- (length(kicked_out_ss)) + cleaned_ss_df <- Voxel_df[!(Voxel_df$S %in% kicked_out_ss),] + remaining_ss <- length(as.factor(as.vector(unique(cleaned_ss_df$S)))) + final_df <- cleaned_ss_df + rm(cleaned_ss_df) + } + else{ + num_kicked_out_ss = 0 + final_df <- Voxel_df + } + + detach(Voxel_df) + rm(Voxel_df) + attach(final_df) + # control_vec is to track which voxels have shit data + # keeping the previous voxel's data if current voxel is crap + if (length(Beta) == 0){ + agListMean <- agListMean + control_vec <- c(1) + } + else{ + agListMean <- aggregate(Beta, by=list(Time, Cond), mean) + control_vec <- c(0) + } + + + waver.vector <- c(0,8.96394,89.8344,75.8427,23.2527,4.09246,0.507025,0.0493012,0) + vox_speech_vec <- subset(agListMean, Group.2==1)[,3] + vox_gesture_vec <- subset(agListMean, Group.2==2)[,3] + vox_gestspeech_vec <- subset(agListMean, Group.2==3)[,3] + vox_grasp_vec <- subset(agListMean, Group.2==4)[,3] + + + ##-- INTERPOLATION -------- ## + origX <- c(1:NumTimepoints) + ## 4 Hz resampling to get into 1/4 of a TR (1/2 second) + resample_length <- length(seq(1,NumTimepoints,1/4)) + ## interpolate waver.vector and then each condition + asp_wvr <- aspline(origX,waver.vector,n=resample_length,method="improved")$y + asp_speech <- aspline(origX,vox_speech_vec,n=resample_length,method="improved")$y + asp_gesture <- aspline(origX,vox_gesture_vec,n=resample_length,method="improved")$y + asp_gestspeech <- aspline(origX,vox_gestspeech_vec,n=resample_length,method="improved")$y + asp_grasp <- aspline(origX,vox_grasp_vec,n=resample_length,method="improved")$y + + + #---- SPEECH + speech_ccf <- ccf(asp_speech, asp_wvr, lag.max = 12, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(speech_ccf$acf))) != 0){ + speech_ccf$acf[1:25] = 0 + } + speech_frame <- as.matrix(data.frame(speech_ccf$acf,speech_ccf$lag)) + speech_cor <- speech_frame[which.max(speech_frame[,1]),] + + + #---- GESTURE + gesture_ccf <- ccf(asp_gesture, asp_wvr, lag.max = 12, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(gesture_ccf$acf))) != 0){ + gesture_ccf$acf[1:25] = 0 + } + gesture_frame <- as.matrix(data.frame(gesture_ccf$acf,gesture_ccf$lag)) + gesture_cor <- gesture_frame[which.max(gesture_frame[,1]),] + + + #---- GESTURE & SPEECH + gestspeech_ccf <- ccf(asp_gestspeech, asp_wvr, lag.max = 12, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(gestspeech_ccf$acf))) != 0){ + gestspeech_ccf$acf[1:25] = 0 + } + gestspeech_frame <- as.matrix(data.frame(gestspeech_ccf$acf,gestspeech_ccf$lag)) + gestspeech_cor <- gestspeech_frame[which.max(gestspeech_frame[,1]),] + + + #---- GRASP + grasp_ccf <- ccf(asp_grasp, asp_wvr, lag.max = 12, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(grasp_ccf$acf))) != 0){ + grasp_ccf$acf[1:25] = 0 + } + grasp_frame <- as.matrix(data.frame(grasp_ccf$acf,grasp_ccf$lag)) + grasp_cor <- grasp_frame[which.max(grasp_frame[,1]),] + + + vox_id <- as.integer(vox) + ccf[mat_row, ] <- c(vox_id, speech_cor[[1]], speech_cor[[2]], gesture_cor[[1]], gesture_cor[[2]], gestspeech_cor[[1]], gestspeech_cor[[2]], grasp_cor[[1]], grasp_cor[[2]], control_vec) + detach(final_df) + rm(final_df) +} + +write.table(round(ccf,5), file=paste(hemi,"_",outname,"_ccf.txt",sep=""), row.names=FALSE, col.names=FALSE) Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/indiv_ccfinterpSupp.R =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/indiv_ccfinterpSupp.R (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/indiv_ccfinterpSupp.R 2009-08-06 15:27:56 UTC (rev 3054) @@ -0,0 +1,133 @@ +#this is for adaptively filling in the missing vertices on the ccf analysis. +## because the original .R script cleans bad vertices by using the previous vert's values, some batches were entirely missed if the first vertex in the batch was bad +library(akima) +outname <- "" +dd <- read.table(paste(Sys.getenv("R_FILE"),".txt",sep="")) +arg_length <- length(noquote(strsplit(Sys.getenv("R_FILE"),"/"))[[1]]) +outname <- noquote(strsplit(Sys.getenv("R_FILE"),"/"))[[1]][arg_length] +Query_out <- data.frame(dd) + + +NumSubjects <- 1; +NumTimepoints <- 9; +NumCols <- 36 +SubjectVec <- as.factor(rep(1:NumSubjects,NumCols)) +CondVect <- as.factor(rep(1:4, rep(NumTimepoints*NumSubjects, 4))) +TimePointVec <- as.factor(rep(rep(1:9, rep(NumSubjects, 9)),4)) +OverallRows <- length(levels(as.factor(Query_out[,2]))) +ccf <- matrix(nrow=OverallRows, ncol=10) +#control_vec <- matrix(nrow=OverallRows,ncol=1) + +mat_row = 0 + +attach(Query_out) +vox_levels <- as.factor(Query_out[,2]) + +for (vox in levels(vox_levels)){ + mat_row = mat_row + 1 + # brougt in many voxels, now go one by one + vox_matrix <- Query_out[which(Query_out[,2] == vox),] + # take colums 3-38of the results and make vector + zz <- (stack(vox_matrix[,3:38])) + VoxValues_vec <- zz[,1] + Voxel_df <- data.frame(S=SubjectVec, Cond=CondVect, Time=TimePointVec, Beta=VoxValues_vec) + attach(Voxel_df) + # grab those entries with extreme values to try to ammend with clean data + cutoff_obs <- Voxel_df[(Voxel_df$Beta <= -8) | (Voxel_df$Beta >= 8),] + + if (length(unique(cutoff_obs$Beta)) > 0){ + # get breakdown of the extreme values by subject and condition. if we wanted just by subject could have used + # cutoff_obs_breakdown <- aggregate(cutoff_obs$Beta, by=list(cutoff_obs$S), length) + cutoff_obs_breakdown <- aggregate(cutoff_obs$Beta, by=list(cutoff_obs$S, cutoff_obs$Time), length) + # now get just those conditions that had 1 or more extreme vals. + # ss that contributed more than 1 vals to any condition gets kicked out from this voxel's analysis + t1 <- subset(cutoff_obs_breakdown, cutoff_obs_breakdown$x >=1) + kicked_out_ss <- as.factor(as.vector(unique(t1[,1]))) + num_kicked_out_ss <- (length(kicked_out_ss)) + cleaned_ss_df <- Voxel_df[!(Voxel_df$S %in% kicked_out_ss),] + remaining_ss <- length(as.factor(as.vector(unique(cleaned_ss_df$S)))) + final_df <- cleaned_ss_df + rm(cleaned_ss_df) + } + else{ + num_kicked_out_ss = 0 + final_df <- Voxel_df + } + + detach(Voxel_df) + rm(Voxel_df) + attach(final_df) + # control_vec is to track which voxels have shit data + # keeping the previous voxel's data if current voxel is crap + if (length(Beta) == 0){ + agListMean <- agListMean + control_vec <- c(1) + } + else{ + agListMean <- aggregate(Beta, by=list(Time, Cond), mean) + control_vec <- c(0) + } + + + waver.vector <- c(0,8.96394,89.8344,75.8427,23.2527,4.09246,0.507025,0.0493012,0) + vox_speech_vec <- subset(agListMean, Group.2==1)[,3] + vox_gesture_vec <- subset(agListMean, Group.2==2)[,3] + vox_gestspeech_vec <- subset(agListMean, Group.2==3)[,3] + vox_grasp_vec <- subset(agListMean, Group.2==4)[,3] + + + ##-- INTERPOLATION -------- ## + origX <- c(1:NumTimepoints) + ## 4 Hz resampling to get into 1/4 of a TR (1/2 second) + resample_length <- length(seq(1,NumTimepoints,1/4)) + ## interpolate waver.vector and then each condition + asp_wvr <- aspline(origX,waver.vector,n=resample_length,method="improved")$y + asp_speech <- aspline(origX,vox_speech_vec,n=resample_length,method="improved")$y + asp_gesture <- aspline(origX,vox_gesture_vec,n=resample_length,method="improved")$y + asp_gestspeech <- aspline(origX,vox_gestspeech_vec,n=resample_length,method="improved")$y + asp_grasp <- aspline(origX,vox_grasp_vec,n=resample_length,method="improved")$y + + + #---- SPEECH + speech_ccf <- ccf(asp_speech, asp_wvr, lag.max = 12, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(speech_ccf$acf))) != 0){ + speech_ccf$acf[1:25] = 0 + } + speech_frame <- as.matrix(data.frame(speech_ccf$acf,speech_ccf$lag)) + speech_cor <- speech_frame[which.max(speech_frame[,1]),] + + + #---- GESTURE + gesture_ccf <- ccf(asp_gesture, asp_wvr, lag.max = 12, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(gesture_ccf$acf))) != 0){ + gesture_ccf$acf[1:25] = 0 + } + gesture_frame <- as.matrix(data.frame(gesture_ccf$acf,gesture_ccf$lag)) + gesture_cor <- gesture_frame[which.max(gesture_frame[,1]),] + + + #---- GESTURE & SPEECH + gestspeech_ccf <- ccf(asp_gestspeech, asp_wvr, lag.max = 12, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(gestspeech_ccf$acf))) != 0){ + gestspeech_ccf$acf[1:25] = 0 + } + gestspeech_frame <- as.matrix(data.frame(gestspeech_ccf$acf,gestspeech_ccf$lag)) + gestspeech_cor <- gestspeech_frame[which.max(gestspeech_frame[,1]),] + + + #---- GRASP + grasp_ccf <- ccf(asp_grasp, asp_wvr, lag.max = 12, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(grasp_ccf$acf))) != 0){ + grasp_ccf$acf[1:25] = 0 + } + grasp_frame <- as.matrix(data.frame(grasp_ccf$acf,grasp_ccf$lag)) + grasp_cor <- grasp_frame[which.max(grasp_frame[,1]),] + + + vox_id <- as.integer(vox) + ccf[mat_row, ] <- c(vox_id, speech_cor[[1]], speech_cor[[2]], gesture_cor[[1]], gesture_cor[[2]], gestspeech_cor[[1]], gestspeech_cor[[2]], grasp_cor[[1]], grasp_cor[[2]], control_vec) + detach(final_df) + rm(final_df) +} + +write.table(round(ccf,5), file=paste(outname,"_ccf.txt",sep=""), row.names=FALSE, col.names=FALSE) Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/medication.py =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/medication.py (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/medication.py 2009-08-06 15:27:56 UTC (rev 3054) @@ -0,0 +1,72 @@ +#!/usr/bin/python + +#---- this procedure is to go through each dir and find the missing text files then run R to fill in the gaps... +# must first run 'find_missing_files.py' +### this version is specific for the 'new' HNL machines (calero, guardado, manzur, pinto) because it sources a library for those distributions +import commands +import os +import sys +import MySQLdb + + +#subjs = [5,6,7,8,10,11,12,13,14,15,17,18,19,20,21,22,23,24,25,26,27,28,30] +#subjs = [6] +#subjs = [11,12] +subjs = [10] +#subjs = [13,14,15,17,18,19,20,21] +#subjs = [22,23,24,25,26,27,28,30] +hemis = ['rh'] +#hemis = ['lh','rh'] +baseDir = os.getenv("cnari")+"/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/" + +def the_supplement(ss,h): + ss_dir = baseDir+"ss"+`ss`+"interp_results/" + #missingfilename = ss_dir+"missing_"+`ss`+h+"_starts.txt" + missingfilename = ss_dir+"missing_"+h+"_ss"+`ss`+"starts.txt" + print "missing file is: "+missingfilename + missingfile = open(missingfilename,"r") + missingnums = missingfile.read().split() + print "missing numbers are: "+str(missingnums) + + for num in missingnums: + begin_vox = int(num) + end_vox = int(num)+999 + outprefix = ss_dir+"/"+h+"_"+num+"_"+`end_vox` + print "outprefix: "+outprefix+"\n" + checkfile = outprefix+"_ccf.txt" + outfile = outprefix+".txt" + print "begin vox: "+`begin_vox`+" and end vox: "+`end_vox`+"\n" + while os.path.exists(checkfile)==False: + try: + connection = MySQLdb.connect(db="EMBLEM1",read_default_file="~/.my.cnf") + except MySQLdb.Error, e: + print "Error %d: %s" % (e.args[0], e.args[1]) + sys.exist (1) + + + query = "SELECT subject, voxel, speech0B, speech1B, speech2B, speech3B, speech4B, speech5B, speech6B, speech7B, speech8B, gesture0B, gesture1B, gesture2B, gesture3B, gesture4B, gesture5B, gesture6B, gesture7B, gesture8B, gestspeech0B, gestspeech1B, gestspeech2B, gestspeech3B, gestspeech4B, gestspeech5B, gestspeech6B, gestspeech7B, gestspeech8B, grasp0B, grasp1B, grasp2B, grasp3B, grasp4B, grasp5B, grasp6B, grasp7B, grasp8B FROM emblemfem"+h+" WHERE subject = "+`ss`+" and voxel between "+`begin_vox`+" and "+`end_vox`+";" + + cursor = connection.cursor() + cursor.execute(query) + result = list(cursor.fetchall()) + bully = '' + for rr in list(result): + bully += str(rr[0])+" "+str(rr[1])+" "+str(rr[2])+" "+str(rr[3])+" "+str(rr[4])+" "+str(rr[5])+" "+str(rr[6])+" "+str(rr[7])+" "+str(rr[8])+" "+str(rr[9])+" "+str(rr[10])+" "+str(rr[11])+" "+str(rr[12])+" "+str(rr[13])+" "+str(rr[14])+" "+str(rr[15])+" "+str(rr[16])+" "+str(rr[17])+" "+str(rr[18])+" "+str(rr[19])+" "+str(rr[20])+" "+str(rr[21])+" "+str(rr[22])+" "+str(rr[23])+" "+str(rr[24])+" "+str(rr[25])+" "+str(rr[26])+" "+str(rr[27])+" "+str(rr[28])+" "+str(rr[29])+" "+str(rr[30])+" "+str(rr[31])+" "+str(rr[32])+" "+str(rr[33])+" "+str(rr[34])+" "+str(rr[35])+" "+str(rr[36])+" "+str(rr[37])+"\n" + + + file = open(outfile,"w") + file.write(bully) + file.close() + + os.environ["R_FILE"] = outprefix + os.chdir(ss_dir) + print "now working in: \n"+os.getcwd() + os.system("R CMD BATCH --vanilla ./indiv_ccfinterpSupp.R") + begin_vox = begin_vox + 1 + print "next begin_vox is: "+`begin_vox`+"\n" + + + +for ss in subjs: + for h in hemis: + the_supplement(ss,h) Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/medicationTRES.py =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/medicationTRES.py (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/medicationTRES.py 2009-08-06 15:27:56 UTC (rev 3054) @@ -0,0 +1,71 @@ +#!/usr/bin/python + +#---- this procedure is to go through each dir and find the missing text files then run R to fill in the gaps... +# must first run 'find_missing_files.py' +### this version is specific for the 'new' HNL machines (calero, guardado, manzur, pinto) because it sources a library for those distributions +import commands +import os +import sys +import MySQLdb + + +subjs = [5] +#subjs = [5,6,7,8,10,11,12,13,14,15,17,18,19,20,21,22,23,24,25,26,27,28,30] +#subjs = [6] +#subjs = [11,12] +#subjs = [13,14,15,17,18,19,20,21] +#subjs = [22,23,24,25,26,27,28,30] +hemis = ['lh','rh'] +baseDir = os.getenv("cnari")+"/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/" + +def the_supplement(ss,h): + ss_dir = baseDir+"ss"+`ss`+"interp_results/" + #missingfilename = ss_dir+"missing_"+`ss`+h+"_starts.txt" + missingfilename = ss_dir+"missing_"+h+"_ss"+`ss`+"starts.txt" + print "missing file is: "+missingfilename + missingfile = open(missingfilename,"r") + missingnums = missingfile.read().split() + print "missing numbers are: "+str(missingnums) + + for num in missingnums: + begin_vox = int(num) + end_vox = int(num)+999 + outprefix = ss_dir+"/"+h+"_"+num+"_"+`end_vox` + print "outprefix: "+outprefix+"\n" + checkfile = outprefix+"_ccf.txt" + outfile = outprefix+".txt" + print "begin vox: "+`begin_vox`+" and end vox: "+`end_vox`+"\n" + while os.path.exists(checkfile)==False: + try: + connection = MySQLdb.connect(db="EMBLEM1",read_default_file="~/.my.cnf") + except MySQLdb.Error, e: + print "Error %d: %s" % (e.args[0], e.args[1]) + sys.exist (1) + + + query = "SELECT subject, voxel, speech0B, speech1B, speech2B, speech3B, speech4B, speech5B, speech6B, speech7B, speech8B, gesture0B, gesture1B, gesture2B, gesture3B, gesture4B, gesture5B, gesture6B, gesture7B, gesture8B, gestspeech0B, gestspeech1B, gestspeech2B, gestspeech3B, gestspeech4B, gestspeech5B, gestspeech6B, gestspeech7B, gestspeech8B, grasp0B, grasp1B, grasp2B, grasp3B, grasp4B, grasp5B, grasp6B, grasp7B, grasp8B FROM emblemfem"+h+" WHERE subject = "+`ss`+" and voxel between "+`begin_vox`+" and "+`end_vox`+";" + + cursor = connection.cursor() + cursor.execute(query) + result = list(cursor.fetchall()) + bully = '' + for rr in list(result): + bully += str(rr[0])+" "+str(rr[1])+" "+str(rr[2])+" "+str(rr[3])+" "+str(rr[4])+" "+str(rr[5])+" "+str(rr[6])+" "+str(rr[7])+" "+str(rr[8])+" "+str(rr[9])+" "+str(rr[10])+" "+str(rr[11])+" "+str(rr[12])+" "+str(rr[13])+" "+str(rr[14])+" "+str(rr[15])+" "+str(rr[16])+" "+str(rr[17])+" "+str(rr[18])+" "+str(rr[19])+" "+str(rr[20])+" "+str(rr[21])+" "+str(rr[22])+" "+str(rr[23])+" "+str(rr[24])+" "+str(rr[25])+" "+str(rr[26])+" "+str(rr[27])+" "+str(rr[28])+" "+str(rr[29])+" "+str(rr[30])+" "+str(rr[31])+" "+str(rr[32])+" "+str(rr[33])+" "+str(rr[34])+" "+str(rr[35])+" "+str(rr[36])+" "+str(rr[37])+"\n" + + + file = open(outfile,"w") + file.write(bully) + file.close() + + os.environ["R_FILE"] = outprefix + os.chdir(ss_dir) + print "now working in: \n"+os.getcwd() + os.system("R CMD BATCH --vanilla ./indiv_ccfinterpSupp.R") + begin_vox = begin_vox + 1 + print "next begin_vox is: "+`begin_vox`+"\n" + + + +for ss in subjs: + for h in hemis: + the_supplement(ss,h) Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/printcount.py =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/printcount.py (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/printcount.py 2009-08-06 15:27:56 UTC (rev 3054) @@ -0,0 +1,15 @@ +#!/usr/bin/python + +import os +import commands + +hemis = ['lh','rh'] +subjs = [3,5,6,7,8,10,11,12,13,14,15,17,18,19,20,21,22,23,24,25,26,27,28,30] +baseDir = os.getenv("cnari")+"/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/" + +for ss in subjs: + os.chdir(baseDir+"ss"+`ss`+"interp_results/") + print os.getcwd() + for h in hemis: + sortfile = "sorted_"+h+"_ccf.txt" + print h+" count: "+commands.getoutput("wc "+sortfile) Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/untarthem.py =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/untarthem.py (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/untarthem.py 2009-08-06 15:27:56 UTC (rev 3054) @@ -0,0 +1,19 @@ +#!/usr/bin/python + +import commands +import time +import os +import sys + + +hemis = ['lh','rh'] +subjs = [3,5,6,7,8,10,11,12,13,14,15,17,18,19,20,21,22,23,24,25,26,27,28,30] +baseDir = os.getenv("cnari")+"/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/" + +for ss in subjs: + for h in hemis: + os.chdir(baseDir+"ss"+`ss`+"interp_results/") + print os.getcwd() + print time.ctime()+"\ndoing "+h + print commands.getoutput("ls interp_"+h+"*.tar | wc") + print commands.getoutput("find -name 'interp_"+h+"*.tar' -exec tar xf '{}' ';'") From noreply at svn.ci.uchicago.edu Thu Aug 6 10:29:00 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Thu, 6 Aug 2009 10:29:00 -0500 (CDT) Subject: [Swift-commit] r3055 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs Message-ID: <20090806152900.8B4739CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-06 10:29:00 -0500 (Thu, 06 Aug 2009) New Revision: 3055 Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/swift_execute.sh Log: shell script for executing swift Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/swift_execute.sh =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/swift_execute.sh (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/swift_execute.sh 2009-08-06 15:29:00 UTC (rev 3055) @@ -0,0 +1,3 @@ +#!/bin/tcsh + +swift indiv_ccfinterp.swift -sites.file /disks/ci-gpfs/fmri/cnari/swift/config/sites_ncsa.xml -tc.file /disks/ci-gpfs/fmri/cnari/swift/config/tc.data -user="andric" Property changes on: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/swift_execute.sh ___________________________________________________________________ Name: svn:executable + * From noreply at svn.ci.uchicago.edu Thu Aug 6 10:29:36 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Thu, 6 Aug 2009 10:29:36 -0500 (CDT) Subject: [Swift-commit] r3056 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs Message-ID: <20090806152936.2F0E89CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-06 10:29:36 -0500 (Thu, 06 Aug 2009) New Revision: 3056 Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/maker.py Log: used to quickly make individual ss dirs Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/maker.py =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/maker.py (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/maker.py 2009-08-06 15:29:36 UTC (rev 3056) @@ -0,0 +1,8 @@ +#!/usr/bin/python + +import commands + +subjs = [3,5,6,7,8,10,11,12,13,14,15,17,18,19,20,21,22,23,24,25,26,27,28,30] + +for ss in subjs: + print commands.getoutput("mkdir ss"+`ss`+"interp_results") From noreply at svn.ci.uchicago.edu Thu Aug 6 10:31:46 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Thu, 6 Aug 2009 10:31:46 -0500 (CDT) Subject: [Swift-commit] r3057 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem Message-ID: <20090806153146.519729CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-06 10:31:46 -0500 (Thu, 06 Aug 2009) New Revision: 3057 Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ Log: group ccf analysis dir From noreply at svn.ci.uchicago.edu Thu Aug 6 10:33:17 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Thu, 6 Aug 2009 10:33:17 -0500 (CDT) Subject: [Swift-commit] r3058 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL Message-ID: <20090806153317.227769CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-06 10:33:16 -0500 (Thu, 06 Aug 2009) New Revision: 3058 Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccf.final1000_rh.swift SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccf_final1000_lh.swift SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccf_final1000_rh.swift SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccf_lh.swift SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccf_rh.swift SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccfinterp.swift SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccfinterpFINAL1000.swift SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccfinterp_lh.swift SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccfinterp_lhFINAL1000.swift Log: swift script for group ccf analysis Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccf.final1000_rh.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccf.final1000_rh.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccf.final1000_rh.swift 2009-08-06 15:33:16 UTC (rev 3058) @@ -0,0 +1,45 @@ +type file{} + +(file qout, file rout) run_query (string allcatargs, file config, file dot_r){ + app{ + Mediator allcatargs stdout=@filename(qout) @filename(dot_r); + } +} + +string user = @arg("user"); +string db = "EMBLEM1"; +string host = "tp-neurodb.ci.uchicago.edu"; + +string query_outline = "SELECT subject, voxel, speech0B, speech1B, speech2B, speech3B, speech4B, speech5B, speech6B, speech7B, speech8B, gesture0B, gesture1B, gesture2B, gesture3B, gesture4B, gesture5B, gesture6B, gesture7B, gesture8B, gestspeech0B, gestspeech1B, gestspeech2B, gestspeech3B, gestspeech4B, gestspeech5B, gestspeech6B, gestspeech7B, gestspeech8B, grasp0B, grasp1B, grasp2B, grasp3B, grasp4B, grasp5B, grasp6B, grasp7B, grasp8B FROM emblemfemrh WHERE voxel between BEGIN_BATCH and END_BATCH"; + +file r_script; +file config; + +string id = "backinCHI_rh"; + +loop_query(int bvox, string user, string db, string host, string query_outline, file r_script, file config, string id){ + int evox = bvox+999; + string r_swift_args = @strcat("ccf"); + string med_args = @strcat("--user ","andric", + " --conf ", "user.config", + " --db ", db, + " --host ", host, + " --query ", query_outline, + " --r_script ", @filename(r_script), + " --begin_vox ", bvox, + " --end_vox ", evox, + " --subject ", id, + " --batchstep ", "1000", + " --r_swift_args ", r_swift_args, + " --subject ", id); + file q_result ; + file r_result ; + (q_result, r_result) = run_query(med_args, r_script, config); +} + +#int mybatches = [0:191000:5000]; +int mybatches = [195000]; + +foreach batch in mybatches { + loop_query(batch, user, db, host, query_outline, r_script, config, id); +} Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccf_final1000_lh.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccf_final1000_lh.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccf_final1000_lh.swift 2009-08-06 15:33:16 UTC (rev 3058) @@ -0,0 +1,45 @@ +type file{} + +(file qout, file rout) run_query (string allcatargs, file config, file dot_r){ + app{ + Mediator allcatargs stdout=@filename(qout) @filename(dot_r); + } +} + +string user = @arg("user"); +string db = "EMBLEM1"; +string host = "tp-neurodb.ci.uchicago.edu"; + +string query_outline = "SELECT subject, voxel, speech0B, speech1B, speech2B, speech3B, speech4B, speech5B, speech6B, speech7B, speech8B, gesture0B, gesture1B, gesture2B, gesture3B, gesture4B, gesture5B, gesture6B, gesture7B, gesture8B, gestspeech0B, gestspeech1B, gestspeech2B, gestspeech3B, gestspeech4B, gestspeech5B, gestspeech6B, gestspeech7B, gestspeech8B, grasp0B, grasp1B, grasp2B, grasp3B, grasp4B, grasp5B, grasp6B, grasp7B, grasp8B FROM emblemfemlh WHERE voxel between BEGIN_BATCH and END_BATCH"; + +file r_script; +file config; + +string id = "canonHRF_lh"; + +loop_query(int bvox, string user, string db, string host, string query_outline, file r_script, file config, string id){ + int evox = bvox+999; + string r_swift_args = @strcat("ccf"); + string med_args = @strcat("--user ","andric", + " --conf ", "user.config", + " --db ", db, + " --host ", host, + " --query ", query_outline, + " --r_script ", @filename(r_script), + " --begin_vox ", bvox, + " --end_vox ", evox, + " --subject ", id, + " --batchstep ", "1000", + " --r_swift_args ", r_swift_args, + " --subject ", id); + file q_result ; + file r_result ; + (q_result, r_result) = run_query(med_args, r_script, config); +} + +#int mybatches = [0:191000:5000]; +int mybatches = [195000]; + +foreach batch in mybatches { + loop_query(batch, user, db, host, query_outline, r_script, config, id); +} Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccf_final1000_rh.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccf_final1000_rh.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccf_final1000_rh.swift 2009-08-06 15:33:16 UTC (rev 3058) @@ -0,0 +1,45 @@ +type file{} + +(file qout, file rout) run_query (string allcatargs, file config, file dot_r){ + app{ + Mediator allcatargs stdout=@filename(qout) @filename(dot_r); + } +} + +string user = @arg("user"); +string db = "EMBLEM1"; +string host = "tp-neurodb.ci.uchicago.edu"; + +string query_outline = "SELECT subject, voxel, speech0B, speech1B, speech2B, speech3B, speech4B, speech5B, speech6B, speech7B, speech8B, gesture0B, gesture1B, gesture2B, gesture3B, gesture4B, gesture5B, gesture6B, gesture7B, gesture8B, gestspeech0B, gestspeech1B, gestspeech2B, gestspeech3B, gestspeech4B, gestspeech5B, gestspeech6B, gestspeech7B, gestspeech8B, grasp0B, grasp1B, grasp2B, grasp3B, grasp4B, grasp5B, grasp6B, grasp7B, grasp8B FROM emblemfemrh WHERE voxel between BEGIN_BATCH and END_BATCH"; + +file r_script; +file config; + +string id = "canonHRF_rh"; + +loop_query(int bvox, string user, string db, string host, string query_outline, file r_script, file config, string id){ + int evox = bvox+999; + string r_swift_args = @strcat("ccf"); + string med_args = @strcat("--user ","andric", + " --conf ", "user.config", + " --db ", db, + " --host ", host, + " --query ", query_outline, + " --r_script ", @filename(r_script), + " --begin_vox ", bvox, + " --end_vox ", evox, + " --subject ", id, + " --batchstep ", "1000", + " --r_swift_args ", r_swift_args, + " --subject ", id); + file q_result ; + file r_result ; + (q_result, r_result) = run_query(med_args, r_script, config); +} + +#int mybatches = [0:191000:5000]; +int mybatches = [195000]; + +foreach batch in mybatches { + loop_query(batch, user, db, host, query_outline, r_script, config, id); +} Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccf_lh.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccf_lh.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccf_lh.swift 2009-08-06 15:33:16 UTC (rev 3058) @@ -0,0 +1,44 @@ +type file{} + +(file qout, file rout) run_query (string allcatargs, file config, file dot_r){ + app{ + Mediator allcatargs stdout=@filename(qout) @filename(dot_r); + } +} + +string user = @arg("user"); +string db = "EMBLEM1"; +string host = "tp-neurodb.ci.uchicago.edu"; + +string query_outline = "SELECT subject, voxel, speech0B, speech1B, speech2B, speech3B, speech4B, speech5B, speech6B, speech7B, speech8B, gesture0B, gesture1B, gesture2B, gesture3B, gesture4B, gesture5B, gesture6B, gesture7B, gesture8B, gestspeech0B, gestspeech1B, gestspeech2B, gestspeech3B, gestspeech4B, gestspeech5B, gestspeech6B, gestspeech7B, gestspeech8B, grasp0B, grasp1B, grasp2B, grasp3B, grasp4B, grasp5B, grasp6B, grasp7B, grasp8B FROM emblemfemlh WHERE voxel between BEGIN_BATCH and END_BATCH"; + +file r_script; +file config; + +string id = "canonHRF_lh"; + +loop_query(int bvox, string user, string db, string host, string query_outline, file r_script, file config, string id){ + int evox = bvox+4999; + string r_swift_args = @strcat("ccf"); + string med_args = @strcat("--user ","andric", + " --conf ", "user.config", + " --db ", db, + " --host ", host, + " --query ", query_outline, + " --r_script ", @filename(r_script), + " --begin_vox ", bvox, + " --end_vox ", evox, + " --subject ", id, + " --batchstep ", "1000", + " --r_swift_args ", r_swift_args, + " --subject ", id); + file q_result ; + file r_result ; + (q_result, r_result) = run_query(med_args, r_script, config); +} + +int mybatches = [0:191000:5000]; + +foreach batch in mybatches { + loop_query(batch, user, db, host, query_outline, r_script, config, id); +} Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccf_rh.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccf_rh.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccf_rh.swift 2009-08-06 15:33:16 UTC (rev 3058) @@ -0,0 +1,44 @@ +type file{} + +(file qout, file rout) run_query (string allcatargs, file config, file dot_r){ + app{ + Mediator allcatargs stdout=@filename(qout) @filename(dot_r); + } +} + +string user = @arg("user"); +string db = "EMBLEM1"; +string host = "tp-neurodb.ci.uchicago.edu"; + +string query_outline = "SELECT subject, voxel, speech0B, speech1B, speech2B, speech3B, speech4B, speech5B, speech6B, speech7B, speech8B, gesture0B, gesture1B, gesture2B, gesture3B, gesture4B, gesture5B, gesture6B, gesture7B, gesture8B, gestspeech0B, gestspeech1B, gestspeech2B, gestspeech3B, gestspeech4B, gestspeech5B, gestspeech6B, gestspeech7B, gestspeech8B, grasp0B, grasp1B, grasp2B, grasp3B, grasp4B, grasp5B, grasp6B, grasp7B, grasp8B FROM emblemfemrh WHERE voxel between BEGIN_BATCH and END_BATCH"; + +file r_script; +file config; + +string id = "canonHRF_rh"; + +loop_query(int bvox, string user, string db, string host, string query_outline, file r_script, file config, string id){ + int evox = bvox+4999; + string r_swift_args = @strcat("ccf"); + string med_args = @strcat("--user ","andric", + " --conf ", "user.config", + " --db ", db, + " --host ", host, + " --query ", query_outline, + " --r_script ", @filename(r_script), + " --begin_vox ", bvox, + " --end_vox ", evox, + " --subject ", id, + " --batchstep ", "1000", + " --r_swift_args ", r_swift_args, + " --subject ", id); + file q_result ; + file r_result ; + (q_result, r_result) = run_query(med_args, r_script, config); +} + +int mybatches = [0:191000:5000]; + +foreach batch in mybatches { + loop_query(batch, user, db, host, query_outline, r_script, config, id); +} Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccfinterp.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccfinterp.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccfinterp.swift 2009-08-06 15:33:16 UTC (rev 3058) @@ -0,0 +1,49 @@ +#-- doing this analysis this time interpolating the HRFs for better lag precision +type file{} + +app (file qout, file rout) run_query (string allcatargs, file config, file dot_r){ + Mediator allcatargs stdout=@filename(qout) @filename(dot_r); +} + + +loop_query(int bvox, string user, string db, string host, string query_outline, file r_script, file config, string id, string h){ + int evox = bvox+4999; + string r_swift_args = h; + string theoutprefix = @strcat("interp_results/",id,bvox,"_",evox); + string med_args = @strcat("--user ","andric", + " --conf ", "user.config", + " --db ", db, + " --host ", host, + " --query ", query_outline, + " --r_script ", @filename(r_script), + " --begin_vox ", bvox, + " --end_vox ", evox, + " --subject ", id, + " --batchstep ", "1000", + " --outprefix ", theoutprefix, + " --r_swift_args ", r_swift_args, + " --subject ", id); + file q_result ; + file r_result ; + (q_result, r_result) = run_query(med_args, r_script, config); +} + + +string user = @arg("user"); +string db = "EMBLEM1"; +string host = "tp-neurodb.ci.uchicago.edu"; + +file r_script; +file config; + +int mybatches[] = [0:191000:5000]; +string hemis[] = ["lh","rh"]; +string nombre = "interp"; + +foreach h in hemis { + string query_outline = @strcat("SELECT subject, voxel, speech0B, speech1B, speech2B, speech3B, speech4B, speech5B, speech6B, speech7B, speech8B, gesture0B, gesture1B, gesture2B, gesture3B, gesture4B, gesture5B, gesture6B, gesture7B, gesture8B, gestspeech0B, gestspeech1B, gestspeech2B, gestspeech3B, gestspeech4B, gestspeech5B, gestspeech6B, gestspeech7B, gestspeech8B, grasp0B, grasp1B, grasp2B, grasp3B, grasp4B, grasp5B, grasp6B, grasp7B, grasp8B FROM emblemfem",h," WHERE voxel between BEGIN_BATCH and END_BATCH"); + string id = @strcat(nombre,"_",h); + foreach batch in mybatches { + loop_query(batch, user, db, host, query_outline, r_script, config, id, h); + } +} Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccfinterpFINAL1000.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccfinterpFINAL1000.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccfinterpFINAL1000.swift 2009-08-06 15:33:16 UTC (rev 3058) @@ -0,0 +1,50 @@ +#-- doing this analysis this time interpolating the HRFs for better lag precision +type file{} + +app (file qout, file rout) run_query (string allcatargs, file config, file dot_r){ + Mediator allcatargs stdout=@filename(qout) @filename(dot_r); +} + + +loop_query(int bvox, string user, string db, string host, string query_outline, file r_script, file config, string id, string h){ + int evox = bvox+999; + string r_swift_args = h; + string theoutprefix = @strcat("interp_results/",id,bvox,"_",evox); + string med_args = @strcat("--user ","andric", + " --conf ", "user.config", + " --db ", db, + " --host ", host, + " --query ", query_outline, + " --r_script ", @filename(r_script), + " --begin_vox ", bvox, + " --end_vox ", evox, + " --subject ", id, + " --batchstep ", "1000", + " --outprefix ", theoutprefix, + " --r_swift_args ", r_swift_args, + " --subject ", id); + file q_result ; + file r_result ; + (q_result, r_result) = run_query(med_args, r_script, config); +} + + +string user = @arg("user"); +string db = "EMBLEM1"; +string host = "tp-neurodb.ci.uchicago.edu"; + +file r_script; +file config; + +#int mybatches[] = [0:191000:5000]; +int mybatches[] = [195000]; +string hemis[] = ["lh","rh"]; +string nombre = "interp"; + +foreach h in hemis { + string query_outline = @strcat("SELECT subject, voxel, speech0B, speech1B, speech2B, speech3B, speech4B, speech5B, speech6B, speech7B, speech8B, gesture0B, gesture1B, gesture2B, gesture3B, gesture4B, gesture5B, gesture6B, gesture7B, gesture8B, gestspeech0B, gestspeech1B, gestspeech2B, gestspeech3B, gestspeech4B, gestspeech5B, gestspeech6B, gestspeech7B, gestspeech8B, grasp0B, grasp1B, grasp2B, grasp3B, grasp4B, grasp5B, grasp6B, grasp7B, grasp8B FROM emblemfem",h," WHERE voxel between BEGIN_BATCH and END_BATCH"); + string id = @strcat(nombre,"_",h); + foreach batch in mybatches { + loop_query(batch, user, db, host, query_outline, r_script, config, id, h); + } +} Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccfinterp_lh.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccfinterp_lh.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccfinterp_lh.swift 2009-08-06 15:33:16 UTC (rev 3058) @@ -0,0 +1,44 @@ +#-- doing this analysis this time interpolating the HRFs for better lag precision +type file{} + +app (file qout, file rout) run_query (string allcatargs, file config, file dot_r){ + Mediator allcatargs stdout=@filename(qout) @filename(dot_r); +} + + +string user = @arg("user"); +string db = "EMBLEM1"; +string host = "tp-neurodb.ci.uchicago.edu"; + +string query_outline = "SELECT subject, voxel, speech0B, speech1B, speech2B, speech3B, speech4B, speech5B, speech6B, speech7B, speech8B, gesture0B, gesture1B, gesture2B, gesture3B, gesture4B, gesture5B, gesture6B, gesture7B, gesture8B, gestspeech0B, gestspeech1B, gestspeech2B, gestspeech3B, gestspeech4B, gestspeech5B, gestspeech6B, gestspeech7B, gestspeech8B, grasp0B, grasp1B, grasp2B, grasp3B, grasp4B, grasp5B, grasp6B, grasp7B, grasp8B FROM emblemfemlh WHERE voxel between BEGIN_BATCH and END_BATCH"; + +file r_script; +file config; + +string id = "interp_lh"; + +loop_query(int bvox, string user, string db, string host, string query_outline, file r_script, file config, string id){ + int evox = bvox+4999; + string r_swift_args = @strcat("ccf"); + string med_args = @strcat("--user ","andric", + " --conf ", "user.config", + " --db ", db, + " --host ", host, + " --query ", query_outline, + " --r_script ", @filename(r_script), + " --begin_vox ", bvox, + " --end_vox ", evox, + " --subject ", id, + " --batchstep ", "1000", + " --r_swift_args ", r_swift_args, + " --subject ", id); + file q_result ; + file r_result ; + (q_result, r_result) = run_query(med_args, r_script, config); +} + +int mybatches = [0:191000:5000]; + +foreach batch in mybatches { + loop_query(batch, user, db, host, query_outline, r_script, config, id); +} Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccfinterp_lhFINAL1000.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccfinterp_lhFINAL1000.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/ccfinterp_lhFINAL1000.swift 2009-08-06 15:33:16 UTC (rev 3058) @@ -0,0 +1,49 @@ +#-- doing this analysis this time interpolating the HRFs for better lag precision +type file{} + +app (file qout, file rout) run_query (string allcatargs, file config, file dot_r){ + Mediator allcatargs stdout=@filename(qout) @filename(dot_r); +} + + +string user = @arg("user"); +string db = "EMBLEM1"; +string host = "tp-neurodb.ci.uchicago.edu"; + +string query_outline = "SELECT subject, voxel, speech0B, speech1B, speech2B, speech3B, speech4B, speech5B, speech6B, speech7B, speech8B, gesture0B, gesture1B, gesture2B, gesture3B, gesture4B, gesture5B, gesture6B, gesture7B, gesture8B, gestspeech0B, gestspeech1B, gestspeech2B, gestspeech3B, gestspeech4B, gestspeech5B, gestspeech6B, gestspeech7B, gestspeech8B, grasp0B, grasp1B, grasp2B, grasp3B, grasp4B, grasp5B, grasp6B, grasp7B, grasp8B FROM emblemfemlh WHERE voxel between BEGIN_BATCH and END_BATCH"; + +file r_script; +file config; + +loop_query(int bvox, string user, string db, string host, string query_outline, file r_script, file config, string id){ + int evox = bvox+999; + string r_swift_args = @strcat("ccf"); + string med_args = @strcat("--user ","andric", + " --conf ", "user.config", + " --db ", db, + " --host ", host, + " --query ", query_outline, + " --r_script ", @filename(r_script), + " --begin_vox ", bvox, + " --end_vox ", evox, + " --subject ", id, + " --batchstep ", "1000", + " --r_swift_args ", r_swift_args, + " --subject ", id); + file q_result ; + file r_result ; + (q_result, r_result) = run_query(med_args, r_script, config); +} + + +#int mybatches = [0:191000:5000]; +int mybatches[] = [195000]; +string hemis[] = ["lh","rh"]; +string nombre = "interp"; + +foreach h in hemis { + string id = @strcat(nombre,"_",h); + foreach batch in mybatches { + loop_query(batch, user, db, host, query_outline, r_script, config, id); + } +} From noreply at svn.ci.uchicago.edu Thu Aug 6 10:34:50 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Thu, 6 Aug 2009 10:34:50 -0500 (CDT) Subject: [Swift-commit] r3059 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL Message-ID: <20090806153450.209E89CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-06 10:34:49 -0500 (Thu, 06 Aug 2009) New Revision: 3059 Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/swift_execute.sh Log: shell script for executing ccf group analysis via swift Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/swift_execute.sh =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/swift_execute.sh (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/swift_execute.sh 2009-08-06 15:34:49 UTC (rev 3059) @@ -0,0 +1,3 @@ +#!/bin/tcsh + +swift ccfinterp.swift -sites.file /disks/ci-gpfs/fmri/cnari/swift/config/sites_ncsa.xml -tc.file /disks/ci-gpfs/fmri/cnari/swift/config/tc.data -user="andric" Property changes on: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/swift_execute.sh ___________________________________________________________________ Name: svn:executable + * From noreply at svn.ci.uchicago.edu Thu Aug 6 10:35:30 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Thu, 6 Aug 2009 10:35:30 -0500 (CDT) Subject: [Swift-commit] r3060 - in SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL: . scripts Message-ID: <20090806153530.C3A849CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-06 10:35:30 -0500 (Thu, 06 Aug 2009) New Revision: 3060 Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/scripts/ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/scripts/grid_ccf_lh.R SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/scripts/grid_ccf_rh.R SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/scripts/grid_ccfinterp.R SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/scripts/grid_ccfinterpOLD.R SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/scripts/grid_ccfinterp_lh.R Log: R scripts for ccf group analysis Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/scripts/grid_ccf_lh.R =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/scripts/grid_ccf_lh.R (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/scripts/grid_ccf_lh.R 2009-08-06 15:35:30 UTC (rev 3060) @@ -0,0 +1,145 @@ +#---- Thursday; April 24, 2008 +#---- This vrsion cuts off Beta vals abs(val) > 8 and uses lag.max=4 +allinputs <- Sys.getenv("R_SWIFT_ARGS") +outname <- noquote(strsplit(allinputs," ")[[1]][1]) + +inputfile <- Sys.getenv("R_INPUT") +dd <- read.table(inputfile) +Query_out <- data.frame(dd) + +NumSubjects <- 24; +NumTimepoints <- 9; +NumCols <- 36 +# generate the vectors that apply to each group of vectors +SubjectVec <- as.factor(rep(1:NumSubjects,NumCols)) +CondVect <- as.factor(rep(1:4, rep(NumTimepoints*NumSubjects, 4))) +TimePointVec <- as.factor(rep(rep(1:9, rep(NumSubjects, 9)),4)) +# the subject categorization: 1=ta-percept 0=ka or ka-ta-percept, 9=to remove from this analysis +# mja: WHAT DO I DO WITH THIS ?????? +# for now, EVERYBODY'S IN! : 0 = stayin alive +SubjectCategorization <- c(0,0,0,0,0,0,0,0,0,0,0,0) +SubjectCategorization_Vec <- as.factor(rep(SubjectCategorization, 36)) +OverallRows <- length(levels(as.factor(Query_out[,2]))) +ccf <- matrix(nrow=OverallRows, ncol=10) +speech <- matrix(nrow=OverallRows, ncol=10) +gesture <- matrix(nrow=OverallRows, ncol=10) +gestspeech <- matrix(nrow=OverallRows, ncol=10) +grasp <- matrix(nrow=OverallRows, ncol=10) + +mat_row = 0 + +attach(Query_out) +#vox_levels <- as.factor(voxel) +vox_levels <- as.factor(Query_out[,2]) +for (vox in levels(vox_levels)){ + mat_row = mat_row + 1 + # brougt in many voxels, now go one by one + vox_matrix <- Query_out[which(Query_out[,2] == vox),] + # take colums 3-38of the results and make vector + zz <- (stack(vox_matrix[,3:38])) + VoxValues_vec <- zz[,1] + Voxel_df <- data.frame(S=SubjectVec, Cond=CondVect, Time=TimePointVec, Beta=VoxValues_vec, SubjCat=SubjectCategorization_Vec) + attach(Voxel_df) + # grab those entries with extreme betavalues + cutoff_obs <- Voxel_df[(Voxel_df$Beta <= -8) | (Voxel_df$Beta >= 8),] + # if there are extreme values, clean them, otherwise, the final dataframe is the original one + # IN THIS ANALYSIS, WE COMPLETELY REMOVE SS THAT CONTRIBUTE EXTREME VALS + + if (length(unique(cutoff_obs$Beta)) > 0){ + # get breakdown of the extreme values by subject and condition. if we wanted just by subject could have used + # cutoff_obs_breakdown <- aggregate(cutoff_obs$Beta, by=list(cutoff_obs$S), length) + cutoff_obs_breakdown <- aggregate(cutoff_obs$Beta, by=list(cutoff_obs$S, cutoff_obs$Time), length) + # now get just those conditions that had 1 or more extreme vals. + # ss that contributed more than 1 vals to any condition gets kicked out from this voxel's analysis + # this filter is very conservative. basically kicks out any ss that contributed extreme vals + # clean_ss_df is basically Voxel_df with the problematic ss removed + t1 <- subset(cutoff_obs_breakdown, cutoff_obs_breakdown$x >=1) + kicked_out_ss <- as.factor(as.vector(unique(t1[,1]))) + num_kicked_out_ss <- (length(kicked_out_ss)) + cleaned_ss_df <- Voxel_df[!(Voxel_df$S %in% kicked_out_ss),] + # skip scaling and outlier removal for now + # remove remaining extreme values from df with filtered ss + # cleaned_ss_noextreme_df <- cleaned_ss_df[(cleaned_ss_df$Beta >= -10) & (cleaned_ss_df$Beta <= 10),] + # final_df <- cleaned_ss_noextreme_df[(cleaned_ss_noextreme_df$ScaledBeta >= -4) & (cleaned_ss_noextreme_df$ScaledBeta <= 4),] + remaining_ss <- length(as.factor(as.vector(unique(cleaned_ss_df$S)))) + # print(remaining_ss) + final_df <- cleaned_ss_df + rm(cleaned_ss_df) + } + else{ + num_kicked_out_ss = 0 + final_df <- Voxel_df + } + + # once we have final_df either after removal of extreme value or not we are ready for computations + detach(Voxel_df) + rm(Voxel_df) + attach(final_df) + # agList collapses across time so each SXSyllable is one value rather than 9. + #agListMean <- aggregate(Beta, by=list(S, Cond), mean) + agListMean <- aggregate(Beta, by=list(Time, Cond), mean) + #agListMax <- aggregate(Beta, by=list(S, Cond), max) + #agListMean <- aggregate(agListMax[,3], by=list(agListMax[,2]), mean) + #mydf <- data.frame(agListMean) + #mydf <- data.frame(agListMean[,3], agListMax[,3]) + #write.table(mydf, file=paste("firsttry",vox,".txt",sep=""), row.names=FALSE, quote=FALSE) + # get beta vals for each condition collapsed across time. subset gets a matrix, and [,3] selects the third column. try without [,3] + waver.vector <- c(0,8.96394,89.8344,75.8427,23.2527,4.09246,0.507025,0.0493012,0) + vox_speech_vec <- subset(agListMean, Group.2==1)[,3] + vox_gesture_vec <- subset(agListMean, Group.2==2)[,3] + vox_gestspeech_vec <- subset(agListMean, Group.2==3)[,3] + vox_grasp_vec <- subset(agListMean, Group.2==4)[,3] + + #---- SPEECH + speech_ccf <- ccf(vox_speech_vec, waver.vector, lag.max = 4, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(speech_ccf$acf))) != 0){ + speech_ccf$acf[1:9] = 0 + } + speech_frame <- as.matrix(data.frame(speech_ccf$acf,speech_ccf$lag)) + speech_cor <- speech_frame[which.max(speech_frame[,1]),] + + + #---- GESTURE + gesture_ccf <- ccf(vox_gesture_vec, waver.vector, lag.max = 4, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(gesture_ccf$acf))) != 0){ + gesture_ccf$acf[1:9] = 0 + } + gesture_frame <- as.matrix(data.frame(gesture_ccf$acf,gesture_ccf$lag)) + gesture_cor <- gesture_frame[which.max(gesture_frame[,1]),] + + + #---- GESTURE & SPEECH + gestspeech_ccf <- ccf(vox_gestspeech_vec, waver.vector, lag.max = 4, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(gestspeech_ccf$acf))) != 0){ + gestspeech_ccf$acf[1:9] = 0 + } + gestspeech_frame <- as.matrix(data.frame(gestspeech_ccf$acf,gestspeech_ccf$lag)) + gestspeech_cor <- gestspeech_frame[which.max(gestspeech_frame[,1]),] + + + #---- GRASP + grasp_ccf <- ccf(vox_grasp_vec, waver.vector, lag.max = 4, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(grasp_ccf$acf))) != 0){ + grasp_ccf$acf[1:9] = 0 + } + grasp_frame <- as.matrix(data.frame(grasp_ccf$acf,grasp_ccf$lag)) + grasp_cor <- grasp_frame[which.max(grasp_frame[,1]),] + + + + vox_id <- as.integer(vox) + ccf[mat_row, ] <- c(vox_id, speech_cor[[1]], speech_cor[[2]], gesture_cor[[1]], gesture_cor[[2]], gestspeech_cor[[1]], gestspeech_cor[[2]], grasp_cor[[1]], grasp_cor[[2]], num_kicked_out_ss) + speech[mat_row, ] <- c(vox_id,vox_speech_vec) + gesture[mat_row, ] <- c(vox_id,vox_gesture_vec) + gestspeech[mat_row, ] <- c(vox_id,vox_gestspeech_vec) + grasp[mat_row, ] <- c(vox_id,vox_grasp_vec) + + detach(final_df) + rm(final_df, agListMean) +} + +write.table(round(ccf,5), file=paste(outname,"_lh_ccf.txt",sep=""), row.names=FALSE, col.names=FALSE) +write.table(round(speech,5), file=paste(outname,"_lh_speech.txt",sep=""), row.names=FALSE, col.names=FALSE) +write.table(round(gesture,5), file=paste(outname,"_lh_emblem.txt",sep=""), row.names=FALSE, col.names=FALSE) +write.table(round(gestspeech,5), file=paste(outname,"_lh_embspeech.txt",sep=""), row.names=FALSE, col.names=FALSE) +write.table(round(grasp,5), file=paste(outname,"_lh_grasp.txt",sep=""), row.names=FALSE, col.names=FALSE) Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/scripts/grid_ccf_rh.R =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/scripts/grid_ccf_rh.R (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/scripts/grid_ccf_rh.R 2009-08-06 15:35:30 UTC (rev 3060) @@ -0,0 +1,145 @@ +#---- Thursday; April 24, 2008 +#---- This vrsion cuts off Beta vals abs(val) > 8 and uses lag.max=4 +allinputs <- Sys.getenv("R_SWIFT_ARGS") +outname <- noquote(strsplit(allinputs," ")[[1]][1]) + +inputfile <- Sys.getenv("R_INPUT") +dd <- read.table(inputfile) +Query_out <- data.frame(dd) + +NumSubjects <- 24; +NumTimepoints <- 9; +NumCols <- 36 +# generate the vectors that apply to each group of vectors +SubjectVec <- as.factor(rep(1:NumSubjects,NumCols)) +CondVect <- as.factor(rep(1:4, rep(NumTimepoints*NumSubjects, 4))) +TimePointVec <- as.factor(rep(rep(1:9, rep(NumSubjects, 9)),4)) +# the subject categorization: 1=ta-percept 0=ka or ka-ta-percept, 9=to remove from this analysis +# mja: WHAT DO I DO WITH THIS ?????? +# for now, EVERYBODY'S IN! : 0 = stayin alive +SubjectCategorization <- c(0,0,0,0,0,0,0,0,0,0,0,0) +SubjectCategorization_Vec <- as.factor(rep(SubjectCategorization, 36)) +OverallRows <- length(levels(as.factor(Query_out[,2]))) +ccf <- matrix(nrow=OverallRows, ncol=10) +speech <- matrix(nrow=OverallRows, ncol=10) +gesture <- matrix(nrow=OverallRows, ncol=10) +gestspeech <- matrix(nrow=OverallRows, ncol=10) +grasp <- matrix(nrow=OverallRows, ncol=10) + +mat_row = 0 + +attach(Query_out) +#vox_levels <- as.factor(voxel) +vox_levels <- as.factor(Query_out[,2]) +for (vox in levels(vox_levels)){ + mat_row = mat_row + 1 + # brougt in many voxels, now go one by one + vox_matrix <- Query_out[which(Query_out[,2] == vox),] + # take colums 3-38of the results and make vector + zz <- (stack(vox_matrix[,3:38])) + VoxValues_vec <- zz[,1] + Voxel_df <- data.frame(S=SubjectVec, Cond=CondVect, Time=TimePointVec, Beta=VoxValues_vec, SubjCat=SubjectCategorization_Vec) + attach(Voxel_df) + # grab those entries with extreme betavalues + cutoff_obs <- Voxel_df[(Voxel_df$Beta <= -8) | (Voxel_df$Beta >= 8),] + # if there are extreme values, clean them, otherwise, the final dataframe is the original one + # IN THIS ANALYSIS, WE COMPLETELY REMOVE SS THAT CONTRIBUTE EXTREME VALS + + if (length(unique(cutoff_obs$Beta)) > 0){ + # get breakdown of the extreme values by subject and condition. if we wanted just by subject could have used + # cutoff_obs_breakdown <- aggregate(cutoff_obs$Beta, by=list(cutoff_obs$S), length) + cutoff_obs_breakdown <- aggregate(cutoff_obs$Beta, by=list(cutoff_obs$S, cutoff_obs$Time), length) + # now get just those conditions that had 1 or more extreme vals. + # ss that contributed more than 1 vals to any condition gets kicked out from this voxel's analysis + # this filter is very conservative. basically kicks out any ss that contributed extreme vals + # clean_ss_df is basically Voxel_df with the problematic ss removed + t1 <- subset(cutoff_obs_breakdown, cutoff_obs_breakdown$x >=1) + kicked_out_ss <- as.factor(as.vector(unique(t1[,1]))) + num_kicked_out_ss <- (length(kicked_out_ss)) + cleaned_ss_df <- Voxel_df[!(Voxel_df$S %in% kicked_out_ss),] + # skip scaling and outlier removal for now + # remove remaining extreme values from df with filtered ss + # cleaned_ss_noextreme_df <- cleaned_ss_df[(cleaned_ss_df$Beta >= -10) & (cleaned_ss_df$Beta <= 10),] + # final_df <- cleaned_ss_noextreme_df[(cleaned_ss_noextreme_df$ScaledBeta >= -4) & (cleaned_ss_noextreme_df$ScaledBeta <= 4),] + remaining_ss <- length(as.factor(as.vector(unique(cleaned_ss_df$S)))) + # print(remaining_ss) + final_df <- cleaned_ss_df + rm(cleaned_ss_df) + } + else{ + num_kicked_out_ss = 0 + final_df <- Voxel_df + } + + # once we have final_df either after removal of extreme value or not we are ready for computations + detach(Voxel_df) + rm(Voxel_df) + attach(final_df) + # agList collapses across time so each SXSyllable is one value rather than 9. + #agListMean <- aggregate(Beta, by=list(S, Cond), mean) + agListMean <- aggregate(Beta, by=list(Time, Cond), mean) + #agListMax <- aggregate(Beta, by=list(S, Cond), max) + #agListMean <- aggregate(agListMax[,3], by=list(agListMax[,2]), mean) + #mydf <- data.frame(agListMean) + #mydf <- data.frame(agListMean[,3], agListMax[,3]) + #write.table(mydf, file=paste("firsttry",vox,".txt",sep=""), row.names=FALSE, quote=FALSE) + # get beta vals for each condition collapsed across time. subset gets a matrix, and [,3] selects the third column. try without [,3] + waver.vector <- c(0,8.96394,89.8344,75.8427,23.2527,4.09246,0.507025,0.0493012,0) + vox_speech_vec <- subset(agListMean, Group.2==1)[,3] + vox_gesture_vec <- subset(agListMean, Group.2==2)[,3] + vox_gestspeech_vec <- subset(agListMean, Group.2==3)[,3] + vox_grasp_vec <- subset(agListMean, Group.2==4)[,3] + + #---- SPEECH + speech_ccf <- ccf(vox_speech_vec, waver.vector, lag.max = 4, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(speech_ccf$acf))) != 0){ + speech_ccf$acf[1:9] = 0 + } + speech_frame <- as.matrix(data.frame(speech_ccf$acf,speech_ccf$lag)) + speech_cor <- speech_frame[which.max(speech_frame[,1]),] + + + #---- GESTURE + gesture_ccf <- ccf(vox_gesture_vec, waver.vector, lag.max = 4, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(gesture_ccf$acf))) != 0){ + gesture_ccf$acf[1:9] = 0 + } + gesture_frame <- as.matrix(data.frame(gesture_ccf$acf,gesture_ccf$lag)) + gesture_cor <- gesture_frame[which.max(gesture_frame[,1]),] + + + #---- GESTURE & SPEECH + gestspeech_ccf <- ccf(vox_gestspeech_vec, waver.vector, lag.max = 4, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(gestspeech_ccf$acf))) != 0){ + gestspeech_ccf$acf[1:9] = 0 + } + gestspeech_frame <- as.matrix(data.frame(gestspeech_ccf$acf,gestspeech_ccf$lag)) + gestspeech_cor <- gestspeech_frame[which.max(gestspeech_frame[,1]),] + + + #---- GRASP + grasp_ccf <- ccf(vox_grasp_vec, waver.vector, lag.max = 4, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(grasp_ccf$acf))) != 0){ + grasp_ccf$acf[1:9] = 0 + } + grasp_frame <- as.matrix(data.frame(grasp_ccf$acf,grasp_ccf$lag)) + grasp_cor <- grasp_frame[which.max(grasp_frame[,1]),] + + + + vox_id <- as.integer(vox) + ccf[mat_row, ] <- c(vox_id, speech_cor[[1]], speech_cor[[2]], gesture_cor[[1]], gesture_cor[[2]], gestspeech_cor[[1]], gestspeech_cor[[2]], grasp_cor[[1]], grasp_cor[[2]], num_kicked_out_ss) + speech[mat_row, ] <- c(vox_id,vox_speech_vec) + gesture[mat_row, ] <- c(vox_id,vox_gesture_vec) + gestspeech[mat_row, ] <- c(vox_id,vox_gestspeech_vec) + grasp[mat_row, ] <- c(vox_id,vox_grasp_vec) + + detach(final_df) + rm(final_df, agListMean) +} + +write.table(round(ccf,5), file=paste(outname,"_rh_ccf.txt",sep=""), row.names=FALSE, col.names=FALSE) +write.table(round(speech,5), file=paste(outname,"_rh_speech.txt",sep=""), row.names=FALSE, col.names=FALSE) +write.table(round(gesture,5), file=paste(outname,"_rh_emblem.txt",sep=""), row.names=FALSE, col.names=FALSE) +write.table(round(gestspeech,5), file=paste(outname,"_rh_embspeech.txt",sep=""), row.names=FALSE, col.names=FALSE) +write.table(round(grasp,5), file=paste(outname,"_rh_grasp.txt",sep=""), row.names=FALSE, col.names=FALSE) Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/scripts/grid_ccfinterp.R =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/scripts/grid_ccfinterp.R (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/scripts/grid_ccfinterp.R 2009-08-06 15:35:30 UTC (rev 3060) @@ -0,0 +1,151 @@ +#---- May 31, 2009 +## using interpolation to get better precision on the lag +#---- This vrsion cuts off Beta vals abs(val) > 8 and uses lag.max=4 +library(akima) +allinputs <- Sys.getenv("R_SWIFT_ARGS") +print(allinputs) +outname <- noquote(strsplit(allinputs," ")[[1]][1]) +hemi <- noquote(strsplit(allinputs," ")[[1]][2]) + +inputfile <- Sys.getenv("R_INPUT") +dd <- read.table(inputfile) +Query_out <- data.frame(dd) + +NumSubjects <- 24; +NumTimepoints <- 9; +NumCols <- 36 +# generate the vectors that apply to each group of vectors +SubjectVec <- as.factor(rep(1:NumSubjects,NumCols)) +CondVect <- as.factor(rep(1:4, rep(NumTimepoints*NumSubjects, 4))) +TimePointVec <- as.factor(rep(rep(1:9, rep(NumSubjects, 9)),4)) +# the subject categorization: 1=ta-percept 0=ka or ka-ta-percept, 9=to remove from this analysis +SubjectCategorization <- c(0,0,0,0,0,0,0,0,0,0,0,0) +SubjectCategorization_Vec <- as.factor(rep(SubjectCategorization, 36)) +OverallRows <- length(levels(as.factor(Query_out[,2]))) +ccf <- matrix(nrow=OverallRows, ncol=10) +speech <- matrix(nrow=OverallRows, ncol=10) +gesture <- matrix(nrow=OverallRows, ncol=10) +gestspeech <- matrix(nrow=OverallRows, ncol=10) +grasp <- matrix(nrow=OverallRows, ncol=10) + +mat_row = 0 + +attach(Query_out) +#vox_levels <- as.factor(voxel) +vox_levels <- as.factor(Query_out[,2]) +for (vox in levels(vox_levels)){ + mat_row = mat_row + 1 + # brougt in many voxels, now go one by one + vox_matrix <- Query_out[which(Query_out[,2] == vox),] + # take colums 3-38of the results and make vector + zz <- (stack(vox_matrix[,3:38])) + VoxValues_vec <- zz[,1] + Voxel_df <- data.frame(S=SubjectVec, Cond=CondVect, Time=TimePointVec, Beta=VoxValues_vec, SubjCat=SubjectCategorization_Vec) + attach(Voxel_df) + # grab those entries with extreme betavalues + cutoff_obs <- Voxel_df[(Voxel_df$Beta <= -8) | (Voxel_df$Beta >= 8),] + # if there are extreme values, clean them, otherwise, the final dataframe is the original one + # IN THIS ANALYSIS, WE COMPLETELY REMOVE SS THAT CONTRIBUTE EXTREME VALS + + if (length(unique(cutoff_obs$Beta)) > 0){ + # get breakdown of the extreme values by subject and condition. if we wanted just by subject could have used + cutoff_obs_breakdown <- aggregate(cutoff_obs$Beta, by=list(cutoff_obs$S, cutoff_obs$Time), length) + # now get just those conditions that had 1 or more extreme vals. + # ss that contributed more than 1 vals to any condition gets kicked out from this voxel's analysis + # this filter is very conservative. basically kicks out any ss that contributed extreme vals + # clean_ss_df is basically Voxel_df with the problematic ss removed + t1 <- subset(cutoff_obs_breakdown, cutoff_obs_breakdown$x >=1) + kicked_out_ss <- as.factor(as.vector(unique(t1[,1]))) + num_kicked_out_ss <- (length(kicked_out_ss)) + cleaned_ss_df <- Voxel_df[!(Voxel_df$S %in% kicked_out_ss),] + # remove remaining extreme values from df with filtered ss + # cleaned_ss_noextreme_df <- cleaned_ss_df[(cleaned_ss_df$Beta >= -10) & (cleaned_ss_df$Beta <= 10),] + # final_df <- cleaned_ss_noextreme_df[(cleaned_ss_noextreme_df$ScaledBeta >= -4) & (cleaned_ss_noextreme_df$ScaledBeta <= 4),] + remaining_ss <- length(as.factor(as.vector(unique(cleaned_ss_df$S)))) + # print(remaining_ss) + final_df <- cleaned_ss_df + rm(cleaned_ss_df) + } + else{ + num_kicked_out_ss = 0 + final_df <- Voxel_df + } + + # once we have final_df either after removal of extreme value or not we are ready for computations + detach(Voxel_df) + rm(Voxel_df) + attach(final_df) + #agListMean <- aggregate(Beta, by=list(S, Cond), mean) + agListMean <- aggregate(Beta, by=list(Time, Cond), mean) + #agListMax <- aggregate(Beta, by=list(S, Cond), max) + #agListMean <- aggregate(agListMax[,3], by=list(agListMax[,2]), mean) + #mydf <- data.frame(agListMean) + #mydf <- data.frame(agListMean[,3], agListMax[,3]) + # get beta vals for each condition collapsed across time. subset gets a matrix, and [,3] selects the third column. try without [,3] + waver.vector <- c(0,8.96394,89.8344,75.8427,23.2527,4.09246,0.507025,0.0493012,0) + vox_speech_vec <- subset(agListMean, Group.2==1)[,3] + vox_gesture_vec <- subset(agListMean, Group.2==2)[,3] + vox_gestspeech_vec <- subset(agListMean, Group.2==3)[,3] + vox_grasp_vec <- subset(agListMean, Group.2==4)[,3] + + + ##-- INTERPOLATION -------- ## + origX <- c(1:NumTimepoints) + ## 4 Hz resampling to get into 1/4 of a TR (1/2 second) + resample_length <- length(seq(1,NumTimepoints,1/4)) + ## interpolate waver.vector and then each condition + asp_wvr <- aspline(origX,waver.vector,n=resample_length,method="improved")$y + asp_speech <- aspline(origX,vox_speech_vec,n=resample_length,method="improved")$y + asp_gesture <- aspline(origX,vox_gesture_vec,n=resample_length,method="improved")$y + asp_gestspeech <- aspline(origX,vox_gestspeech_vec,n=resample_length,method="improved")$y + asp_grasp <- aspline(origX,vox_grasp_vec,n=resample_length,method="improved")$y + + + #---- SPEECH + speech_ccf <- ccf(asp_speech, asp_wvr, lag.max = 12, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(speech_ccf$acf))) != 0){ + speech_ccf$acf[1:25] = 0 + } + speech_frame <- as.matrix(data.frame(speech_ccf$acf,speech_ccf$lag)) + speech_cor <- speech_frame[which.max(speech_frame[,1]),] + + + #---- GESTURE + gesture_ccf <- ccf(asp_gesture, asp_wvr, lag.max = 12, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(gesture_ccf$acf))) != 0){ + gesture_ccf$acf[1:25] = 0 + } + gesture_frame <- as.matrix(data.frame(gesture_ccf$acf,gesture_ccf$lag)) + gesture_cor <- gesture_frame[which.max(gesture_frame[,1]),] + + + #---- GESTURE & SPEECH + gestspeech_ccf <- ccf(asp_gestspeech, asp_wvr, lag.max = 12, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(gestspeech_ccf$acf))) != 0){ + gestspeech_ccf$acf[1:25] = 0 + } + gestspeech_frame <- as.matrix(data.frame(gestspeech_ccf$acf,gestspeech_ccf$lag)) + gestspeech_cor <- gestspeech_frame[which.max(gestspeech_frame[,1]),] + + + #---- GRASP + grasp_ccf <- ccf(asp_grasp, asp_wvr, lag.max = 12, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(grasp_ccf$acf))) != 0){ + grasp_ccf$acf[1:25] = 0 + } + grasp_frame <- as.matrix(data.frame(grasp_ccf$acf,grasp_ccf$lag)) + grasp_cor <- grasp_frame[which.max(grasp_frame[,1]),] + + + vox_id <- as.integer(vox) + ccf[mat_row, ] <- c(vox_id, speech_cor[[1]], speech_cor[[2]], gesture_cor[[1]], gesture_cor[[2]], gestspeech_cor[[1]], gestspeech_cor[[2]], grasp_cor[[1]], grasp_cor[[2]], num_kicked_out_ss) + #speech[mat_row, ] <- c(vox_id,vox_speech_vec) + #gesture[mat_row, ] <- c(vox_id,vox_gesture_vec) + #gestspeech[mat_row, ] <- c(vox_id,vox_gestspeech_vec) + #grasp[mat_row, ] <- c(vox_id,vox_grasp_vec) + + detach(final_df) + rm(final_df, agListMean) +} + +write.table(round(ccf,5), file=paste(hemi,"_",outname,"_ccf.txt",sep=""), row.names=FALSE, col.names=FALSE) Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/scripts/grid_ccfinterpOLD.R =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/scripts/grid_ccfinterpOLD.R (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/scripts/grid_ccfinterpOLD.R 2009-08-06 15:35:30 UTC (rev 3060) @@ -0,0 +1,155 @@ +#---- May 31, 2009 +## using interpolation to get better precision on the lag +#---- This vrsion cuts off Beta vals abs(val) > 8 and uses lag.max=4 +library(akima) +allinputs <- Sys.getenv("R_SWIFT_ARGS") +print(allinputs) +outname <- noquote(strsplit(allinputs," ")[[1]][1]) + +inputfile <- Sys.getenv("R_INPUT") +dd <- read.table(inputfile) +Query_out <- data.frame(dd) + +NumSubjects <- 24; +NumTimepoints <- 9; +NumCols <- 36 +# generate the vectors that apply to each group of vectors +SubjectVec <- as.factor(rep(1:NumSubjects,NumCols)) +CondVect <- as.factor(rep(1:4, rep(NumTimepoints*NumSubjects, 4))) +TimePointVec <- as.factor(rep(rep(1:9, rep(NumSubjects, 9)),4)) +# the subject categorization: 1=ta-percept 0=ka or ka-ta-percept, 9=to remove from this analysis +SubjectCategorization <- c(0,0,0,0,0,0,0,0,0,0,0,0) +SubjectCategorization_Vec <- as.factor(rep(SubjectCategorization, 36)) +OverallRows <- length(levels(as.factor(Query_out[,2]))) +ccf <- matrix(nrow=OverallRows, ncol=10) +speech <- matrix(nrow=OverallRows, ncol=10) +gesture <- matrix(nrow=OverallRows, ncol=10) +gestspeech <- matrix(nrow=OverallRows, ncol=10) +grasp <- matrix(nrow=OverallRows, ncol=10) + +mat_row = 0 + +attach(Query_out) +#vox_levels <- as.factor(voxel) +vox_levels <- as.factor(Query_out[,2]) +for (vox in levels(vox_levels)){ + mat_row = mat_row + 1 + # brougt in many voxels, now go one by one + vox_matrix <- Query_out[which(Query_out[,2] == vox),] + # take colums 3-38of the results and make vector + zz <- (stack(vox_matrix[,3:38])) + VoxValues_vec <- zz[,1] + Voxel_df <- data.frame(S=SubjectVec, Cond=CondVect, Time=TimePointVec, Beta=VoxValues_vec, SubjCat=SubjectCategorization_Vec) + attach(Voxel_df) + # grab those entries with extreme betavalues + cutoff_obs <- Voxel_df[(Voxel_df$Beta <= -8) | (Voxel_df$Beta >= 8),] + # if there are extreme values, clean them, otherwise, the final dataframe is the original one + # IN THIS ANALYSIS, WE COMPLETELY REMOVE SS THAT CONTRIBUTE EXTREME VALS + + if (length(unique(cutoff_obs$Beta)) > 0){ + # get breakdown of the extreme values by subject and condition. if we wanted just by subject could have used + cutoff_obs_breakdown <- aggregate(cutoff_obs$Beta, by=list(cutoff_obs$S, cutoff_obs$Time), length) + # now get just those conditions that had 1 or more extreme vals. + # ss that contributed more than 1 vals to any condition gets kicked out from this voxel's analysis + # this filter is very conservative. basically kicks out any ss that contributed extreme vals + # clean_ss_df is basically Voxel_df with the problematic ss removed + t1 <- subset(cutoff_obs_breakdown, cutoff_obs_breakdown$x >=1) + kicked_out_ss <- as.factor(as.vector(unique(t1[,1]))) + num_kicked_out_ss <- (length(kicked_out_ss)) + cleaned_ss_df <- Voxel_df[!(Voxel_df$S %in% kicked_out_ss),] + # remove remaining extreme values from df with filtered ss + # cleaned_ss_noextreme_df <- cleaned_ss_df[(cleaned_ss_df$Beta >= -10) & (cleaned_ss_df$Beta <= 10),] + # final_df <- cleaned_ss_noextreme_df[(cleaned_ss_noextreme_df$ScaledBeta >= -4) & (cleaned_ss_noextreme_df$ScaledBeta <= 4),] + remaining_ss <- length(as.factor(as.vector(unique(cleaned_ss_df$S)))) + # print(remaining_ss) + final_df <- cleaned_ss_df + rm(cleaned_ss_df) + } + else{ + num_kicked_out_ss = 0 + final_df <- Voxel_df + } + + # once we have final_df either after removal of extreme value or not we are ready for computations + detach(Voxel_df) + rm(Voxel_df) + attach(final_df) + #agListMean <- aggregate(Beta, by=list(S, Cond), mean) + agListMean <- aggregate(Beta, by=list(Time, Cond), mean) + #agListMax <- aggregate(Beta, by=list(S, Cond), max) + #agListMean <- aggregate(agListMax[,3], by=list(agListMax[,2]), mean) + #mydf <- data.frame(agListMean) + #mydf <- data.frame(agListMean[,3], agListMax[,3]) + # get beta vals for each condition collapsed across time. subset gets a matrix, and [,3] selects the third column. try without [,3] + waver.vector <- c(0,8.96394,89.8344,75.8427,23.2527,4.09246,0.507025,0.0493012,0) + vox_speech_vec <- subset(agListMean, Group.2==1)[,3] + vox_gesture_vec <- subset(agListMean, Group.2==2)[,3] + vox_gestspeech_vec <- subset(agListMean, Group.2==3)[,3] + vox_grasp_vec <- subset(agListMean, Group.2==4)[,3] + + + ##-- INTERPOLATION -------- ## + origX <- c(1:NumTimepoints) + ## 4 Hz resampling to get into 1/4 of a TR (1/2 second) + resample_length <- length(seq(1,NumTimepoints,1/4)) + ## interpolate waver.vector and then each condition + asp_wvr <- aspline(origX,waver.vector,n=resample_length,method="improved")$y + asp_speech <- aspline(origX,vox_speech_vec,n=resample_length,method="improved")$y + asp_gesture <- aspline(origX,vox_gesture_vec,n=resample_length,method="improved")$y + asp_gestspeech <- aspline(origX,vox_gestspeech_vec,n=resample_length,method="improved")$y + asp_grasp <- aspline(origX,vox_grasp_vec,n=resample_length,method="improved")$y + + + #---- SPEECH + speech_ccf <- ccf(asp_speech, asp_wvr, lag.max = 12, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(speech_ccf$acf))) != 0){ + speech_ccf$acf[1:25] = 0 + } + speech_frame <- as.matrix(data.frame(speech_ccf$acf,speech_ccf$lag)) + speech_cor <- speech_frame[which.max(speech_frame[,1]),] + + + #---- GESTURE + gesture_ccf <- ccf(asp_gesture, asp_wvr, lag.max = 12, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(gesture_ccf$acf))) != 0){ + gesture_ccf$acf[1:25] = 0 + } + gesture_frame <- as.matrix(data.frame(gesture_ccf$acf,gesture_ccf$lag)) + gesture_cor <- gesture_frame[which.max(gesture_frame[,1]),] + + + #---- GESTURE & SPEECH + gestspeech_ccf <- ccf(asp_gestspeech, asp_wvr, lag.max = 12, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(gestspeech_ccf$acf))) != 0){ + gestspeech_ccf$acf[1:25] = 0 + } + gestspeech_frame <- as.matrix(data.frame(gestspeech_ccf$acf,gestspeech_ccf$lag)) + gestspeech_cor <- gestspeech_frame[which.max(gestspeech_frame[,1]),] + + + #---- GRASP + grasp_ccf <- ccf(asp_grasp, asp_wvr, lag.max = 12, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(grasp_ccf$acf))) != 0){ + grasp_ccf$acf[1:25] = 0 + } + grasp_frame <- as.matrix(data.frame(grasp_ccf$acf,grasp_ccf$lag)) + grasp_cor <- grasp_frame[which.max(grasp_frame[,1]),] + + + + vox_id <- as.integer(vox) + ccf[mat_row, ] <- c(vox_id, speech_cor[[1]], speech_cor[[2]], gesture_cor[[1]], gesture_cor[[2]], gestspeech_cor[[1]], gestspeech_cor[[2]], grasp_cor[[1]], grasp_cor[[2]], num_kicked_out_ss) + #speech[mat_row, ] <- c(vox_id,vox_speech_vec) + #gesture[mat_row, ] <- c(vox_id,vox_gesture_vec) + #gestspeech[mat_row, ] <- c(vox_id,vox_gestspeech_vec) + #grasp[mat_row, ] <- c(vox_id,vox_grasp_vec) + + detach(final_df) + rm(final_df, agListMean) +} + +write.table(round(ccf,5), file=paste(outname,"_ccf.txt",sep=""), row.names=FALSE, col.names=FALSE) +#write.table(round(speech,5), file=paste(outname,"_lh_speech.txt",sep=""), row.names=FALSE, col.names=FALSE) +#write.table(round(gesture,5), file=paste(outname,"_lh_emblem.txt",sep=""), row.names=FALSE, col.names=FALSE) +#write.table(round(gestspeech,5), file=paste(outname,"_lh_embspeech.txt",sep=""), row.names=FALSE, col.names=FALSE) +#write.table(round(grasp,5), file=paste(outname,"_lh_grasp.txt",sep=""), row.names=FALSE, col.names=FALSE) Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/scripts/grid_ccfinterp_lh.R =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/scripts/grid_ccfinterp_lh.R (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/ccf_emblemIDEAL/scripts/grid_ccfinterp_lh.R 2009-08-06 15:35:30 UTC (rev 3060) @@ -0,0 +1,154 @@ +#---- May 31, 2009 +## using interpolation to get better precision on the lag +#---- This vrsion cuts off Beta vals abs(val) > 8 and uses lag.max=4 +library(akima) +allinputs <- Sys.getenv("R_SWIFT_ARGS") +outname <- noquote(strsplit(allinputs," ")[[1]][1]) + +inputfile <- Sys.getenv("R_INPUT") +dd <- read.table(inputfile) +Query_out <- data.frame(dd) + +NumSubjects <- 24; +NumTimepoints <- 9; +NumCols <- 36 +# generate the vectors that apply to each group of vectors +SubjectVec <- as.factor(rep(1:NumSubjects,NumCols)) +CondVect <- as.factor(rep(1:4, rep(NumTimepoints*NumSubjects, 4))) +TimePointVec <- as.factor(rep(rep(1:9, rep(NumSubjects, 9)),4)) +# the subject categorization: 1=ta-percept 0=ka or ka-ta-percept, 9=to remove from this analysis +SubjectCategorization <- c(0,0,0,0,0,0,0,0,0,0,0,0) +SubjectCategorization_Vec <- as.factor(rep(SubjectCategorization, 36)) +OverallRows <- length(levels(as.factor(Query_out[,2]))) +ccf <- matrix(nrow=OverallRows, ncol=10) +speech <- matrix(nrow=OverallRows, ncol=10) +gesture <- matrix(nrow=OverallRows, ncol=10) +gestspeech <- matrix(nrow=OverallRows, ncol=10) +grasp <- matrix(nrow=OverallRows, ncol=10) + +mat_row = 0 + +attach(Query_out) +#vox_levels <- as.factor(voxel) +vox_levels <- as.factor(Query_out[,2]) +for (vox in levels(vox_levels)){ + mat_row = mat_row + 1 + # brougt in many voxels, now go one by one + vox_matrix <- Query_out[which(Query_out[,2] == vox),] + # take colums 3-38of the results and make vector + zz <- (stack(vox_matrix[,3:38])) + VoxValues_vec <- zz[,1] + Voxel_df <- data.frame(S=SubjectVec, Cond=CondVect, Time=TimePointVec, Beta=VoxValues_vec, SubjCat=SubjectCategorization_Vec) + attach(Voxel_df) + # grab those entries with extreme betavalues + cutoff_obs <- Voxel_df[(Voxel_df$Beta <= -8) | (Voxel_df$Beta >= 8),] + # if there are extreme values, clean them, otherwise, the final dataframe is the original one + # IN THIS ANALYSIS, WE COMPLETELY REMOVE SS THAT CONTRIBUTE EXTREME VALS + + if (length(unique(cutoff_obs$Beta)) > 0){ + # get breakdown of the extreme values by subject and condition. if we wanted just by subject could have used + cutoff_obs_breakdown <- aggregate(cutoff_obs$Beta, by=list(cutoff_obs$S, cutoff_obs$Time), length) + # now get just those conditions that had 1 or more extreme vals. + # ss that contributed more than 1 vals to any condition gets kicked out from this voxel's analysis + # this filter is very conservative. basically kicks out any ss that contributed extreme vals + # clean_ss_df is basically Voxel_df with the problematic ss removed + t1 <- subset(cutoff_obs_breakdown, cutoff_obs_breakdown$x >=1) + kicked_out_ss <- as.factor(as.vector(unique(t1[,1]))) + num_kicked_out_ss <- (length(kicked_out_ss)) + cleaned_ss_df <- Voxel_df[!(Voxel_df$S %in% kicked_out_ss),] + # remove remaining extreme values from df with filtered ss + # cleaned_ss_noextreme_df <- cleaned_ss_df[(cleaned_ss_df$Beta >= -10) & (cleaned_ss_df$Beta <= 10),] + # final_df <- cleaned_ss_noextreme_df[(cleaned_ss_noextreme_df$ScaledBeta >= -4) & (cleaned_ss_noextreme_df$ScaledBeta <= 4),] + remaining_ss <- length(as.factor(as.vector(unique(cleaned_ss_df$S)))) + # print(remaining_ss) + final_df <- cleaned_ss_df + rm(cleaned_ss_df) + } + else{ + num_kicked_out_ss = 0 + final_df <- Voxel_df + } + + # once we have final_df either after removal of extreme value or not we are ready for computations + detach(Voxel_df) + rm(Voxel_df) + attach(final_df) + #agListMean <- aggregate(Beta, by=list(S, Cond), mean) + agListMean <- aggregate(Beta, by=list(Time, Cond), mean) + #agListMax <- aggregate(Beta, by=list(S, Cond), max) + #agListMean <- aggregate(agListMax[,3], by=list(agListMax[,2]), mean) + #mydf <- data.frame(agListMean) + #mydf <- data.frame(agListMean[,3], agListMax[,3]) + # get beta vals for each condition collapsed across time. subset gets a matrix, and [,3] selects the third column. try without [,3] + waver.vector <- c(0,8.96394,89.8344,75.8427,23.2527,4.09246,0.507025,0.0493012,0) + vox_speech_vec <- subset(agListMean, Group.2==1)[,3] + vox_gesture_vec <- subset(agListMean, Group.2==2)[,3] + vox_gestspeech_vec <- subset(agListMean, Group.2==3)[,3] + vox_grasp_vec <- subset(agListMean, Group.2==4)[,3] + + + ##-- INTERPOLATION -------- ## + origX <- c(1:NumTimepoints) + ## 4 Hz resampling to get into 1/4 of a TR (1/2 second) + resample_length <- length(seq(1,NumTimepoints,1/4)) + ## interpolate waver.vector and then each condition + asp_wvr <- aspline(origX,waver.vector,n=resample_length,method="improved")$y + asp_speech <- aspline(origX,vox_speech_vec,n=resample_length,method="improved")$y + asp_gesture <- aspline(origX,vox_gesture_vec,n=resample_length,method="improved")$y + asp_gestspeech <- aspline(origX,vox_gestspeech_vec,n=resample_length,method="improved")$y + asp_grasp <- aspline(origX,vox_grasp_vec,n=resample_length,method="improved")$y + + + #---- SPEECH + speech_ccf <- ccf(asp_speech, asp_wvr, lag.max = 12, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(speech_ccf$acf))) != 0){ + speech_ccf$acf[1:25] = 0 + } + speech_frame <- as.matrix(data.frame(speech_ccf$acf,speech_ccf$lag)) + speech_cor <- speech_frame[which.max(speech_frame[,1]),] + + + #---- GESTURE + gesture_ccf <- ccf(asp_gesture, asp_wvr, lag.max = 12, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(gesture_ccf$acf))) != 0){ + gesture_ccf$acf[1:25] = 0 + } + gesture_frame <- as.matrix(data.frame(gesture_ccf$acf,gesture_ccf$lag)) + gesture_cor <- gesture_frame[which.max(gesture_frame[,1]),] + + + #---- GESTURE & SPEECH + gestspeech_ccf <- ccf(asp_gestspeech, asp_wvr, lag.max = 12, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(gestspeech_ccf$acf))) != 0){ + gestspeech_ccf$acf[1:25] = 0 + } + gestspeech_frame <- as.matrix(data.frame(gestspeech_ccf$acf,gestspeech_ccf$lag)) + gestspeech_cor <- gestspeech_frame[which.max(gestspeech_frame[,1]),] + + + #---- GRASP + grasp_ccf <- ccf(asp_grasp, asp_wvr, lag.max = 12, type = c("correlation"), na.action=na.pass, plot=FALSE) + if (sum(as.numeric(is.na(grasp_ccf$acf))) != 0){ + grasp_ccf$acf[1:25] = 0 + } + grasp_frame <- as.matrix(data.frame(grasp_ccf$acf,grasp_ccf$lag)) + grasp_cor <- grasp_frame[which.max(grasp_frame[,1]),] + + + + vox_id <- as.integer(vox) + ccf[mat_row, ] <- c(vox_id, speech_cor[[1]], speech_cor[[2]], gesture_cor[[1]], gesture_cor[[2]], gestspeech_cor[[1]], gestspeech_cor[[2]], grasp_cor[[1]], grasp_cor[[2]], num_kicked_out_ss) + #speech[mat_row, ] <- c(vox_id,vox_speech_vec) + #gesture[mat_row, ] <- c(vox_id,vox_gesture_vec) + #gestspeech[mat_row, ] <- c(vox_id,vox_gestspeech_vec) + #grasp[mat_row, ] <- c(vox_id,vox_grasp_vec) + + detach(final_df) + rm(final_df, agListMean) +} + +write.table(round(ccf,5), file=paste(outname,"_lh_ccf.txt",sep=""), row.names=FALSE, col.names=FALSE) +#write.table(round(speech,5), file=paste(outname,"_lh_speech.txt",sep=""), row.names=FALSE, col.names=FALSE) +#write.table(round(gesture,5), file=paste(outname,"_lh_emblem.txt",sep=""), row.names=FALSE, col.names=FALSE) +#write.table(round(gestspeech,5), file=paste(outname,"_lh_embspeech.txt",sep=""), row.names=FALSE, col.names=FALSE) +#write.table(round(grasp,5), file=paste(outname,"_lh_grasp.txt",sep=""), row.names=FALSE, col.names=FALSE) From noreply at svn.ci.uchicago.edu Thu Aug 6 10:50:24 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Thu, 6 Aug 2009 10:50:24 -0500 (CDT) Subject: [Swift-commit] r3061 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2 Message-ID: <20090806155025.0571E9CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-06 10:50:24 -0500 (Thu, 06 Aug 2009) New Revision: 3061 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/ Log: peak analysis on vertex by vertex basis over the whole brain From noreply at svn.ci.uchicago.edu Thu Aug 6 10:52:31 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Thu, 6 Aug 2009 10:52:31 -0500 (CDT) Subject: [Swift-commit] r3062 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain Message-ID: <20090806155231.D222B9CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-06 10:52:31 -0500 (Thu, 06 Aug 2009) New Revision: 3062 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2mediator.swift Log: peak analysis using mediator Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2mediator.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2mediator.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2mediator.swift 2009-08-06 15:52:31 UTC (rev 3062) @@ -0,0 +1,59 @@ +#--- peak analysis across the brain via Mediator +## type declarations: +type file{} +type Rscript; +## a type for simple mapping the 3 R scripts used: +type PeakfitR{ + Rscript ShellpeakMediatorPK2; + Rscript preprocessEnewsmooth; + Rscript peakfitv2v1; +} +## a type for simple mapping the two output files: +type PeakResult{ + file pdf; + file a; + file b; +} + +## Mediator app declaration: +app (file q_result, PeakResult outObj) run_query (string med_args, file config, PeakfitR code){ + Mediator med_args stdout=@filename(q_result) @filename(code.ShellpeakMediatorPK2); +} + +## this process sets parameters and calls Mediator: +loop_query(int vert, string user, string db, string host, string query_outline, PeakfitR code, file config, string subject, string h){ + int evox = vert; + string theoutprefix = "FAH_Q"; + PeakResult outObj; + file q_result; + string med_args = @strcat("--user ","andric"," --conf ", @filename(config)," --db ", db," --host ", host, + " --begin_vox ", vert," --end_vox ", evox," --batchstep ", "1"," --subject ", subject, + " --query ", query_outline," --r_swift_args ", @filename(outObj)," --r_script ", @filename(code.ShellpeakMediatorPK2)," --outprefix ", theoutprefix); + trace(med_args); + (q_result, outObj) = run_query(med_args, config, code); +} + +## needed parameters to use Mediator: +string user = @arg("user"); +string db = "HEL"; +string host = "tp-neurodb.ci.uchicago.edu"; +file config; + +## mapping the R code: +PeakfitR code; + +## variables to move across in the foreach loops: +string declarelist[] = ["PK2smth"]; +string hemilist[] = ["lh"]; +int vertices[] = [1:2:1]; + +## nest the loop_query process in foreach loops to move across variable sets +foreach subject in declarelist{ + foreach h in hemilist{ + string query_outline = @strcat("SELECT * FROM peakTS_data",h," WHERE subject = '",subject,"' AND vertex between BEGIN_BATCH and END_BATCH"); + trace(query_outline); + foreach vert in vertices{ + loop_query(vert, user, db, host, query_outline, code, config, subject, h); + } + } +} Property changes on: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2mediator.swift ___________________________________________________________________ Name: svn:executable + * From noreply at svn.ci.uchicago.edu Thu Aug 6 10:53:34 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Thu, 6 Aug 2009 10:53:34 -0500 (CDT) Subject: [Swift-commit] r3063 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain Message-ID: <20090806155334.9E5849CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-06 10:53:34 -0500 (Thu, 06 Aug 2009) New Revision: 3063 Modified: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2mediator.swift Log: specifies r_script in Mediator call - having different issues recognizing this argument on different grid sites Modified: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2mediator.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2mediator.swift 2009-08-06 15:52:31 UTC (rev 3062) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2mediator.swift 2009-08-06 15:53:34 UTC (rev 3063) @@ -17,7 +17,7 @@ ## Mediator app declaration: app (file q_result, PeakResult outObj) run_query (string med_args, file config, PeakfitR code){ - Mediator med_args stdout=@filename(q_result) @filename(code.ShellpeakMediatorPK2); + Mediator med_args stdout=@filename(q_result) "--r_script" @filename(code.ShellpeakMediatorPK2); } ## this process sets parameters and calls Mediator: @@ -28,7 +28,7 @@ file q_result; string med_args = @strcat("--user ","andric"," --conf ", @filename(config)," --db ", db," --host ", host, " --begin_vox ", vert," --end_vox ", evox," --batchstep ", "1"," --subject ", subject, - " --query ", query_outline," --r_swift_args ", @filename(outObj)," --r_script ", @filename(code.ShellpeakMediatorPK2)," --outprefix ", theoutprefix); + " --query ", query_outline," --r_swift_args ", @filename(outObj)," --outprefix ", theoutprefix); trace(med_args); (q_result, outObj) = run_query(med_args, config, code); } @@ -44,7 +44,7 @@ ## variables to move across in the foreach loops: string declarelist[] = ["PK2smth"]; -string hemilist[] = ["lh"]; +string hemilist[] = ["rh"]; int vertices[] = [1:2:1]; ## nest the loop_query process in foreach loops to move across variable sets From noreply at svn.ci.uchicago.edu Thu Aug 6 10:54:50 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Thu, 6 Aug 2009 10:54:50 -0500 (CDT) Subject: [Swift-commit] r3064 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain Message-ID: <20090806155450.22C339CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-06 10:54:50 -0500 (Thu, 06 Aug 2009) New Revision: 3064 Modified: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2mediator.swift Log: dropped using batch arguments Modified: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2mediator.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2mediator.swift 2009-08-06 15:53:34 UTC (rev 3063) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2mediator.swift 2009-08-06 15:54:50 UTC (rev 3064) @@ -27,7 +27,7 @@ PeakResult outObj; file q_result; string med_args = @strcat("--user ","andric"," --conf ", @filename(config)," --db ", db," --host ", host, - " --begin_vox ", vert," --end_vox ", evox," --batchstep ", "1"," --subject ", subject, + " --subject ", subject, " --query ", query_outline," --r_swift_args ", @filename(outObj)," --outprefix ", theoutprefix); trace(med_args); (q_result, outObj) = run_query(med_args, config, code); @@ -44,8 +44,8 @@ ## variables to move across in the foreach loops: string declarelist[] = ["PK2smth"]; -string hemilist[] = ["rh"]; -int vertices[] = [1:2:1]; +string hemilist[] = ["lh"]; +int vertices[] = [3:4:1]; ## nest the loop_query process in foreach loops to move across variable sets foreach subject in declarelist{ From noreply at svn.ci.uchicago.edu Thu Aug 6 10:56:09 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Thu, 6 Aug 2009 10:56:09 -0500 (CDT) Subject: [Swift-commit] r3065 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain Message-ID: <20090806155609.EF49E9CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-06 10:56:09 -0500 (Thu, 06 Aug 2009) New Revision: 3065 Modified: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2mediator.swift Log: put 'r_script' argument back in med_args. different sites (and diff versions of swift) having trouble recognizing this arg Modified: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2mediator.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2mediator.swift 2009-08-06 15:54:50 UTC (rev 3064) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2mediator.swift 2009-08-06 15:56:09 UTC (rev 3065) @@ -17,7 +17,7 @@ ## Mediator app declaration: app (file q_result, PeakResult outObj) run_query (string med_args, file config, PeakfitR code){ - Mediator med_args stdout=@filename(q_result) "--r_script" @filename(code.ShellpeakMediatorPK2); + Mediator med_args stdout=@filename(q_result) @filename(code.ShellpeakMediatorPK2); } ## this process sets parameters and calls Mediator: @@ -28,7 +28,7 @@ file q_result; string med_args = @strcat("--user ","andric"," --conf ", @filename(config)," --db ", db," --host ", host, " --subject ", subject, - " --query ", query_outline," --r_swift_args ", @filename(outObj)," --outprefix ", theoutprefix); + " --query ", query_outline," --r_swift_args ", @filename(outObj)," --outprefix ", theoutprefix, " --r_script Rscripts/ShellpeakMediatorPK2.R"); trace(med_args); (q_result, outObj) = run_query(med_args, config, code); } From noreply at svn.ci.uchicago.edu Thu Aug 6 10:59:18 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Thu, 6 Aug 2009 10:59:18 -0500 (CDT) Subject: [Swift-commit] r3066 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain Message-ID: <20090806155918.BE0FD9CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-06 10:59:18 -0500 (Thu, 06 Aug 2009) New Revision: 3066 Modified: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2mediator.swift Log: now Mediator using a 'VOX' arg. also switched 'r_script' back into Mediator call Modified: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2mediator.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2mediator.swift 2009-08-06 15:56:09 UTC (rev 3065) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2mediator.swift 2009-08-06 15:59:18 UTC (rev 3066) @@ -17,18 +17,17 @@ ## Mediator app declaration: app (file q_result, PeakResult outObj) run_query (string med_args, file config, PeakfitR code){ - Mediator med_args stdout=@filename(q_result) @filename(code.ShellpeakMediatorPK2); + Mediator med_args stdout=@filename(q_result) "--r_script" @filename(code.ShellpeakMediatorPK2); } ## this process sets parameters and calls Mediator: loop_query(int vert, string user, string db, string host, string query_outline, PeakfitR code, file config, string subject, string h){ - int evox = vert; string theoutprefix = "FAH_Q"; - PeakResult outObj; - file q_result; + PeakResult outObj; + file q_result ; string med_args = @strcat("--user ","andric"," --conf ", @filename(config)," --db ", db," --host ", host, - " --subject ", subject, - " --query ", query_outline," --r_swift_args ", @filename(outObj)," --outprefix ", theoutprefix, " --r_script Rscripts/ShellpeakMediatorPK2.R"); + " --vox ", vert," --subject ", subject, + " --query ", query_outline," --r_swift_args ", @filename(outObj)," --outprefix ", theoutprefix); trace(med_args); (q_result, outObj) = run_query(med_args, config, code); } @@ -45,12 +44,12 @@ ## variables to move across in the foreach loops: string declarelist[] = ["PK2smth"]; string hemilist[] = ["lh"]; -int vertices[] = [3:4:1]; +int vertices[] = [1:2:1]; ## nest the loop_query process in foreach loops to move across variable sets foreach subject in declarelist{ foreach h in hemilist{ - string query_outline = @strcat("SELECT * FROM peakTS_data",h," WHERE subject = '",subject,"' AND vertex between BEGIN_BATCH and END_BATCH"); + string query_outline = @strcat("SELECT * FROM peakTS_data",h," WHERE subject = '",subject,"' AND vertex=VOX"); trace(query_outline); foreach vert in vertices{ loop_query(vert, user, db, host, query_outline, code, config, subject, h); From noreply at svn.ci.uchicago.edu Thu Aug 6 11:00:33 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Thu, 6 Aug 2009 11:00:33 -0500 (CDT) Subject: [Swift-commit] r3067 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain Message-ID: <20090806160033.309519CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-06 11:00:33 -0500 (Thu, 06 Aug 2009) New Revision: 3067 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2med_runs.swift Log: testing run by run peak analysis. whole time series was infinite run time and not finishing. Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2med_runs.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2med_runs.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/PK2med_runs.swift 2009-08-06 16:00:33 UTC (rev 3067) @@ -0,0 +1,66 @@ +#--- peak analysis across the brain via Mediator +## type declarations: +type file{} +type Rscript; +## a type for simple mapping the 3 R scripts used: +type PeakfitR{ + Rscript ShellpeakMediatorPK2; + Rscript preprocessEnewsmooth; + Rscript peakfitv2v1; +} +## a type for simple mapping the two output files: +type PeakResult{ + file pdf; + file a; + file b; +} + +## Mediator app declaration: +app (file q_result, PeakResult outObj) run_query (string med_args, file config, PeakfitR code){ + Mediator med_args stdout=@filename(q_result) "--r_script" @filename(code.ShellpeakMediatorPK2); +} + +## this process sets parameters and calls Mediator: +loop_query(int vert, string user, string db, string host, string query_outline, PeakfitR code, file config, string subject, string h, int rr, int beginTS, int endTS){ + string theoutprefix = "FAH_Q"; + PeakResult outObj; + file q_result ; + string med_args = @strcat("--user ","andric"," --conf ", @filename(config)," --db ", db," --host ", host, + " --vox ", vert," --subject ", subject," --subquery tsTSVAR"," --begin_ts ",beginTS," --end_ts ",endTS, + " --query ", query_outline," --r_swift_args ", @filename(outObj)," --outprefix ", theoutprefix); + trace(med_args); + (q_result, outObj) = run_query(med_args, config, code); +} + +## needed parameters to use Mediator: +string user = @arg("user"); +string db = "HEL"; +string host = "tp-neurodb.ci.uchicago.edu"; +file config; + +## mapping the R code: +PeakfitR code; + +## variables to move across in the foreach loops: +string declarelist[] = ["PK2smth"]; +string hemilist[] = ["lh"]; +int vertices[] = [1:2:1]; + +int runs[] = [1:2]; +int starts[] = [0, 226, 452, 678, 904, 1130, 1356, 1582]; +#int starts[] = [1, 227, 453, 679, 905, 1131, 1357, 1583]; +int TSend = 225; + +foreach subject in declarelist{ + foreach h in hemilist{ + foreach rr in runs{ + int beginTS = starts[rr]; + int endTS = starts[rr]+TSend; + string query_outline = @strcat("SELECT SUBQUERY FROM peakTS_data",h," WHERE subject = '",subject,"' AND vertex=VOX"); + trace(query_outline); + foreach vert in vertices{ + loop_query(vert, user, db, host, query_outline, code, config, subject, h, rr, beginTS, endTS); + } + } + } +} From noreply at svn.ci.uchicago.edu Thu Aug 6 11:02:07 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Thu, 6 Aug 2009 11:02:07 -0500 (CDT) Subject: [Swift-commit] r3068 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain Message-ID: <20090806160207.7080C9CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-06 11:02:07 -0500 (Thu, 06 Aug 2009) New Revision: 3068 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/ts_mediator.swift Log: now using a 'SUBQUERY' arg in Mediator that can more easily specify columns rather than using the wildcard Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/ts_mediator.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/ts_mediator.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/ts_mediator.swift 2009-08-06 16:02:07 UTC (rev 3068) @@ -0,0 +1,58 @@ +#--- peak analysis across the brain via Mediator +## type declarations: +type file{} +type Rscript; +## a type for simple mapping the 3 R scripts used: +type PeakfitR{ + Rscript subqrymediator; + Rscript preprocessEnewsmooth; + Rscript peakfitv2v1; +} +## a type for simple mapping the two output files: +type PeakResult{ + file pdf; + file a; + file b; +} + +## Mediator app declaration: +app (file q_result, PeakResult outObj) run_query (string med_args, file config, PeakfitR code){ + Mediator med_args stdout=@filename(q_result) @filename(code.subqrymediator); +} + +## this process sets parameters and calls Mediator: +loop_query(int vert, string user, string db, string host, string query_outline, PeakfitR code, file config, string subject, string h, int beginTS, int endTS){ + string theoutprefix = "FAH_Q"; + PeakResult outObj; + file q_result ; + string med_args = @strcat("--user ","andric"," --conf ", @filename(config)," --db ", db," --host ", host, + " --vox ", vert," --subject ", subject," --subquery tsTSVAR"," --begin_ts ",beginTS," --end_ts ",endTS, + " --query ", query_outline," --r_swift_args ", @filename(outObj)," --outprefix ", theoutprefix, " --r_script ", at filename(code.subqrymediator)); + trace(med_args); + (q_result, outObj) = run_query(med_args, config, code); +} + +## needed parameters to use Mediator: +string user = @arg("user"); +string db = "HEL"; +string host = "tp-neurodb.ci.uchicago.edu"; +file config; + +## mapping the R code: +PeakfitR code; + +## variables to move across in the foreach loops: +string declarelist[] = ["PK2smth"]; +string hemilist[] = ["lh"]; +int vertices[] = [3]; + +foreach subject in declarelist{ + foreach h in hemilist{ + int beginTS = 0; + int endTS = 1807; + string query_outline = @strcat("SELECT SUBQUERY FROM peakTS_data",h," WHERE subject = '",subject,"' AND vertex=VOX"); + foreach vert in vertices{ + loop_query(vert, user, db, host, query_outline, code, config, subject, h, beginTS, endTS); + } + } +} From noreply at svn.ci.uchicago.edu Thu Aug 6 11:03:01 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Thu, 6 Aug 2009 11:03:01 -0500 (CDT) Subject: [Swift-commit] r3069 - SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain Message-ID: <20090806160301.E10369CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-06 11:03:01 -0500 (Thu, 06 Aug 2009) New Revision: 3069 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/swift_execute.sh Log: shell script for executing swift Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/swift_execute.sh =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/swift_execute.sh (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/swift_execute.sh 2009-08-06 16:03:01 UTC (rev 3069) @@ -0,0 +1,3 @@ +#!/bin/tcsh + +swift -resume ts_mediator-20090722-2339-dd912pja.0.rlog ts_mediator.swift -sites.file /gpfs/pads/fmri/cnari_svn/config/local_sites.xml -tc.file /gpfs/pads/fmri/cnari_svn/config/tc.data -user="andric" Property changes on: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/swift_execute.sh ___________________________________________________________________ Name: svn:executable + * From noreply at svn.ci.uchicago.edu Thu Aug 6 11:03:58 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Thu, 6 Aug 2009 11:03:58 -0500 (CDT) Subject: [Swift-commit] r3070 - in SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain: . Rscripts Message-ID: <20090806160358.903E09CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-06 11:03:58 -0500 (Thu, 06 Aug 2009) New Revision: 3070 Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/Rscripts/ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/Rscripts/peakfitv2v1.R SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/Rscripts/preprocessEnewsmooth.R SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/Rscripts/subqrymediator.R Log: R code for doing peak analysis Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/Rscripts/peakfitv2v1.R =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/Rscripts/peakfitv2v1.R (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/Rscripts/peakfitv2v1.R 2009-08-06 16:03:58 UTC (rev 3070) @@ -0,0 +1,385 @@ +# ---------------------------------------------------------------------- +# Savitzky-Golay Algorithm +# ---------------------------------------------------------------------- +# T2 <- sav.gol(T, fl, forder, dorder); +# +# Polynomial filtering method of Savitzky and Golay +# See Numerical Recipes, 1992, Chapter 14.8, for details. +# +# T = vector of signals to be filtered +# (the derivative is calculated for each ROW) +# fl = filter length (for instance fl = 51..151) +# forder = filter order (2 = quadratic filter, 4= quartic) +# dorder = derivative order (0 = smoothing, 1 = first derivative, etc.) +# +sav.gol <- function(T, fl, forder, dorder) +{ + m <- length(T) + dorder <- dorder + 1 + + # -- calculate filter coefficients -- + fc <- (fl-1)/2 # index: window left and right + X <- outer(-fc:fc, 0:forder, FUN="^") # polynomial terms and +coefficients + Y <- pinv(X); # pseudoinverse + + # -- filter via convolution and take care of the end points -- + T2 <- convolve(T, rev(Y[dorder,]), type="o") # convolve(...) + T2 <- T2[(fc+1):(length(T2)-fc)] +} +#----------------------------------------------------------------------- +# *** PseudoInvers of a Matrix *** +# using singular value decomposition +# +pinv <- function (A) +{ + s <- svd(A) + s$v %*% diag(1/s$d) %*% t(s$u) +} +#----------------------------------------------------------------------- +# +# +#------------gamma function used in peakfit------------------------------------------- +# +# | x-a1 | | (x-a1)/a2 + a3 -1 |^(a3-1) +# y = a0*exp|- -------|*| ------------------ | +# | a2 | | a3-1 | +# a0 = amplitude +# a1 = center +# a2 = width (>0) +# a3 = shape (> 1.01, < 167.92) +# + +f_peakfit <- function(a0,a1,a2,a3,n,x) { + expr <- rep(c(0),length(x)); + for (i in 1:n) + { + tmp <- rep(c(0),length(x)) + tmp <- a0[i]*exp(-(x - a1[i])/a2[i])*((x - a1[i])/(a2[i]*(a3[i] - 1)) + 1 )^(a3[i] - 1); +# when { b[i]/shape*(x -center[i]) + 1 } < 0, the power is meaningless. tmp[j] is "NaN" and will be replaced by zero + for (j in 1:length(x)) {if (tmp[j] == "NaN") {tmp[j] = 0} } + expr <- expr + tmp + } + eval(expr) +} + + +# define the function (a kind of simplified version from above) to be used to fit the data +# +# y = a*exp(-b*(x - center))*(b/shape*(x - center) + 1)^(shape) +# +# a = amplitude +# b = decay parameter (correspond to 1/a2) +# center = a1; +# shape = a3 - 1; later shape will be fixed as 8.6, which is a common number used in most of fMRI study +# +# +# ------------------------------------------------------------------------------------------- +# the following is a summation of gmma functions to fit raw data +# assumption: linear system +# x is the time points +# n is the number of peaks detected by second derivatives +# a, b and center are the parameters defined above and need to be estimated +# a, b and center are vectors with length corresponding to the number of peaks +# + + +# shape is fixed at 8.6 in all the following analysis +shape = 8.6 +f <- function(a,b,center,n,x) { + shape = 8.6; + expr <- rep(c(0),length(x)); + for (i in 1:n) + { + tmp <- rep(c(0),length(x)) + tmp <- a[i]*exp(-b[i]*(x - center[i]))*(b[i]/shape*(x -center[i]) + 1 )^shape +# when { b[i]/shape*(x -center[i]) + 1 } < 0, the power is meaningless. tmp[j] is "NaN" and will be replaced by zero + for (j in 1:length(x)) {if (tmp[j] == "NaN") {tmp[j] = 0} } + expr <- expr + tmp + } + eval(expr) +} + +# linear square fit, minmize funtion 0.5*|y - y_hat|^2. +# Use as an input function for constraint estimation +fcn_L2 <- function(par,n,x,y_and_noise,fcall) { + a <- par[1:n] + b <- par[(n+1):(2*n)] + center <- par[(2*n+1):(3*n)] + new_par <- c(list(a = a),list(b = b),list(center = center)) + res <- (y_and_noise - do.call("fcall",c( as.list(new_par), list(n = n), list(x = x) ) )); + 0.5*t(res) %*% res + } + + +# define the function (a kind of simplified version from above) to be used to fit the data +# +# y = a*exp(-b*(x - center))*(b/shape*(x - center) + 1)^(shape) +# +# a = amplitude +# b = decay parameter (correspond to 1/a2) +# center = a1; +# shape = a3 - 1; later shape will be fixed as 8.6, which is a common number used in most of fMRI study +# +# df_a = exp(-b*(x - center))*(b/shape*(x - center) + 1)^(shape) +# df_b = a*(-(x-center))*exp(-b*(x - center))*(b/shape*(x - center) + 1)^(shape) + a*exp(-b*(x - center))*shape*(b/shape*(x - center) + 1)^(shape-1)*(x - center)/shape +# df_center = a*b*exp(-b*(x - center))*(b/shape*(x - center) + 1)^(shape) + a*exp(-b*(x - center))*shape*(b/shape*(x - center) + 1)^(shape-1)*(-b/shape) + +D_fcn_L2 <- function(par,n,x,y_and_noise,fcall) { + df_a <- matrix(rep(c(0),n*length(x)),ncol = n, nrow = length(x)) + df_b <- matrix(rep(c(0),n*length(x)),ncol = n, nrow = length(x)) + df_center <- matrix(rep(c(0),n*length(x)),ncol = n, nrow = length(x)) + a <- par[1:n] + b <- par[(n+1):(2*n)] + center <- par[(2*n+1):(3*n)] + new_par <- c(list(a = a),list(b = b),list(center = center)) + for (i in 1:n) { + df_a[,i] <- exp(-b[i]*(x - center[i]))*(b[i]/shape *(x -center[i]) + 1 )^shape + df_b[,i] <- a[i]*(-(x - center[i]))*exp(-b[i]*(x - center[i]))*(b[i]/shape *(x -center[i]) + 1 )^shape + a[i]*exp(-b[i]*(x - center[i]))*shape*(b[i]/shape*(x -center[i]) + 1 )^(shape - 1)*(x - center[i])/shape + df_center[,i] <- a[i]*b[i]*exp(-b[i]*(x - center[i]))*(b[i]/shape *(x -center[i]) + 1 )^shape + a[i]*exp(-b[i]*(x - center[i]))*shape*(b[i]/shape*(x -center[i]) + 1 )^(shape -1 )*(-b[i]/shape) + } + tmp <- cbind(df_a,df_b,df_center) + for (i in 1:(dim(tmp)[1]) ) { + for (j in 1:(dim(tmp)[2]) ) { + if (tmp[i,j] == "NaN") {tmp[i,j] = 0} + } + } + j_f <- tmp + y_eval <- do.call("fcall",c(list(a = a), list(b = b), list(center = center), list(n = n), list(x = x))) + t(j_f) %*% (y_eval - y_and_noise) + } + +#---- deriv 3------------------------------------------------------------- +D_individual_f <- deriv3( + ~a*exp(-b*(x - center))*(b/shape*(x -center) + 1 )^shape, + c("a","b","center"), + function(a,b,center,x,shape) {}) + +test_D_fcn_L2 <- function(par,n,x,y_and_noise,fcall) { + shape = 8.6 + df_a <- matrix(rep(c(0),n*length(x)),ncol = n, nrow = length(x)) + df_b <- matrix(rep(c(0),n*length(x)),ncol = n, nrow = length(x)) + df_center <- matrix(rep(c(0),n*length(x)),ncol = n, nrow = length(x)) + a <- par[1:n] + b <- par[(n+1):(2*n)] + center <- par[(2*n+1):(3*n)] + new_par <- c(list(a = a),list(b = b),list(center = center)) + for (i in 1:n) { + tmp <- D_individual_f(a[i],b[i],center[i],x,shape) + g <- attr(tmp,"gradient") + df_a[,i] <- g[,1]; + df_b[,i] <- g[,2]; + df_center[,i] <- g[,3]; + } + tmp <- cbind(df_a,df_b,df_center) + for (i in 1:(dim(tmp)[1]) ) { + for (j in 1:(dim(tmp)[2]) ) { + if (tmp[i,j] == "NaN") {tmp[i,j] = 0} + } + } + j_f <- tmp + y_eval <- do.call("fcall",c(list(a = a), list(b = b), list(center = center), list(n = n), list(x = x))) + t(j_f) %*% (y_eval - y_and_noise) + } +#---------------------------------------------------------------------- + +# 2nd derivative +test_D2_fcn_L2 <- function(par,n,x,y_and_noise,fcall) { + shape = 8.6 + df_a <- matrix(rep(c(0),n*length(x)),ncol = n, nrow = length(x)) + df_b <- matrix(rep(c(0),n*length(x)),ncol = n, nrow = length(x)) + df_center <- matrix(rep(c(0),n*length(x)),ncol = n, nrow = length(x)) + a <- par[1:n] + b <- par[(n+1):(2*n)] + center <- par[(2*n+1):(3*n)] + new_par <- c(list(a = a),list(b = b),list(center = center)) + f <- do.call("fcall",c(list(a = a), list(b = b), list(center = center), list(n = n), list(x = x))) - y_and_noise + + for (i in 1:n) { + tmp <- D_individual_f(a[i],b[i],center[i],x,shape) + g <- attr(tmp,"gradient") + df_a[,i] <- g[,1]; + df_b[,i] <- g[,2]; + df_center[,i] <- g[,3]; + } + tmp <- cbind(df_a,df_b,df_center) + for (i in 1:(dim(tmp)[1]) ) { + for (j in 1:(dim(tmp)[2]) ) { + if (tmp[i,j] == "NaN") {tmp[i,j] = 0} + } + } + j_f <- tmp + term1 <- t(j_f) %*% j_f +# 1st term in the equation calculated, shall be a 3n x 3n matrix + + f_D2f = matrix(rep(c(0),9*n^2),ncol = 3*n,nrow = 3*n); + for (i in 1:n) { + tmp <- D_individual_f(a[i],b[i],center[i],x,shape) + h <- colSums(attr(tmp,"hessian")*f,1) + f_D2f[i,i] = h[1,1]; + f_D2f[n+i,i] = f_D2f[i,n+i] = h[1,2]; + f_D2f[2*n+i,i] = f_D2f[i,2*n+i] = h[1,3]; + f_D2f[n+i,n+i] = h[2,2]; + f_D2f[2*n+i,n+i] = f_D2f[n+i,2*n+i] = h[2,3]; + f_D2f[2*n+i,2*n+i] = h[3,3]; + } + for (i in 1:(dim(f_D2f)[1]) ) { + for (j in 1:(dim(f_D2f)[2]) ) { + if (f_D2f[i,j] == "NaN") {f_D2f[i,j] = 0} + } + } + + term1 + f_D2f + } + +#---------------------------------------------------------------------------------------- +# plot fitted curve with observed one +plot.est <- function(par,fcall,n,x,col) { + a <- par[1:n] + b <- par[(n+1):(2*n)] + center <- par[(2*n+1):(3*n)] + new_par <- c(list(a = a),list(b = b),list(center = center)) + y_est <- do.call("fcall",c( as.list(new_par), list(n = n), list(x = x) )) + lines(x,y_est,col = col,lwd = 2) + } + +# plot individual fitted curve +plot.est.individual <- function(par,fcall,n,x,col) { + a <- par[1:n] + b <- par[(n+1):(2*n)] + center <- par[(2*n+1):(3*n)] + for (i in 1:n) + { + new_par <- c(list(a = a[i]),list(b = b[i]),list(center = center[i])) + y_est <- do.call("fcall",c( as.list(new_par), list(n = 1), list(x = x) )) + lines(x,y_est,col = col,lwd = 1) + } +} + + +# fit summary + +# fit statistical summary for constraint estimation +est.stats.summary <- function(par,sse,x,y) { + n_x = length(x); # the number of observations + m = length(par); # the number of parameters + sse # sum of squares due to error + ave_y = mean(y); # the mean of observation + ssm = 0.5* t(y - ave_y) %*% (y - ave_y); # the sum of square about mean + r2 = 1 - sse/ssm; # R square, coefficient of determination + dof = n_x - m; # degree of freedom + r2_adjusted = 1 - sse*(n_x-1)/(ssm*(dof-1)); # adjusted R square + mse = sse/dof; # the mean square error + se = sqrt(mse); # the standard error of fit, the root mse + msr = (ssm - sse)/(m - 1); # mean square regression + f = msr/mse; # F-statistics + c(r2,dof,r2_adjusted,f,se) +# c("r2" = r2,"DF" = dof,"Adj r2" = r2_adjusted,"F" = f,"standard error of fit" = se) + } + +# fit summary includes two fitting parameters (amplitude and centerfwhm and analytical area under the curve +# -----fwhm------------ +# fwhm ~ 2.35*b^(1/2)*c +# b & c are from gamma variate function x^b*exp(-t/c) +# this approximation is found in ref "Event-related fMRI Contast When using Constant Interstimulus Interval: Theory and Experiment", pubished in Magnetic Resonance in Medicine 43:540-548 (2000) +# this approximation result is a little bit different from that from peakfit +# in our code,shape parameter is fixed at 8.6 & width related parameter is b +# fwhm ~ 2.35*sqrt(8.6)/b +# -----area under the curve------- +# after some derivations, area under the curve is a/b*exp(8.6)*8.6^(-8.6)*gamma(8.6+1); +# the derivation was confirmed with peakfit result +est.summary_1 <- function(fcall,par,sse,n,x,y) { + a <- par[1:n] # estimated a + b <- par[(n+1):(2*n)] # estimated b + center <- par[(2*n+1):(3*n)] # estimated center +# --calculate standard error of fit + n_x = length(x); # the number of observations + m = length(par); # the number of parameters + dof = n_x - m; # degree of freedom + sse # sum of squares due to error + mse = sse/dof; # the mean square error + se = sqrt(mse); # the standard error of fit, the root mse +#---standard error of parameters, se * 1/sqrt(diag(hessian matrix of 0.5*|y-y_hat|^2)) + std_par <- se * 1/sqrt(diag(test_D2_fcn_L2(par,n,x,y,f))) # std error of estimated parameters + std_a <- std_par[1:n]; + std_b <- std_par[(n+1):(2*n)]; + std_center <- std_par[(2*n+1):(3*n)]; +#---calculate fwhm, analytical area and percent area------ + shape <- 8.6 + fwhm <- matrix(c(0),ncol = 1,nrow = n); + area <- matrix(c(0),ncol = 1,nrow = n); + percent_area <- matrix(c(0),ncol = 1,nrow = n); for (i in 1:n) { + fwhm[i] <- 2.35*sqrt(shape)/b[i]; + area[i] <- a[i]/b[i]*exp(shape)*shape^(-shape)*gamma(shape+1); + } + percent_area <- area/sum(area)*100; +#---need to double check--------------------- + std_fwhm <- std_b * 2.35*sqrt(8.6) * 1/sqrt(b^4); +#---calculate partial F stats for each peak + y_est_col <- matrix(c(0),ncol = n, nrow = n_x); + for (i in 1:n) + { + new_par <- c(list(a = a[i]),list(b = b[i]),list(center = center[i])); + y_est_col[,i] <- do.call("fcall",c( as.list(new_par), list(n = 1), list(x = x) )); # each col corresponds to each peak fitted ts + } + + p_partial <- matrix(c(0),ncol = 1, nrow = n); + for (i in 1:n) + { + res_wo_i <- rowSums(y_est_col[,-i]) - y; # residual without ith peak + ssr <- 0.5*res_wo_i %*% res_wo_i; # sum square of error of residual + dof_diff <- 3; # degree of freedom difference between full model and reduced model (i.e. without ith peak) + F_partial <- ((ssr - sse)/dof_diff)/(sse/dof); # partial F stats for ith peak + p_partial[i] <- 1 - pf(F_partial,dof_diff,dof); + } + +#---summary of individual results + summary <- data.frame(a,std_a,center,std_center,fwhm,std_fwhm,area,percent_area,p_partial); + name_of_row <- paste("Peak",1:n,sep=""); + name_of_col <- c("Amplitude","e_Amplitude","Center","e_Center","FWHM","e_FWHM","Area","% Area","p_partial"); + dimnames(summary) <- list(name_of_row,name_of_col); + summary + } + +est.summary <- function(par,sse,n,x,y) { + a <- par[1:n] # estimated a + b <- par[(n+1):(2*n)] # estimated b + center <- par[(2*n+1):(3*n)] # estimated center +# --calculate standard error of fit + n_x = length(x); # the number of observations + m = length(par); # the number of parameters + dof = n_x - m; # degree of freedom + sse # sum of squares due to error + mse = sse/dof; # the mean square error + se = sqrt(mse); # the standard error of fit, the root mse +#---standard error of parameters, se * 1/sqrt(diag(hessian matrix of 0.5*|y-y_hat|^2)) + std_par <- se * 1/sqrt(diag(test_D2_fcn_L2(par,n,x,y,f))) # std error of estimated parameters + std_a <- std_par[1:n]; + std_b <- std_par[(n+1):(2*n)]; + std_center <- std_par[(2*n+1):(3*n)]; +#---calculate fwhm, analytical area and percent area------ + shape <- 8.6 + fwhm <- matrix(c(0),ncol = 1,nrow = n); + area <- matrix(c(0),ncol = 1,nrow = n); + percent_area <- matrix(c(0),ncol = 1,nrow = n); for (i in 1:n) { + fwhm[i] <- 2.35*sqrt(shape)/b[i]; + area[i] <- a[i]/b[i]*exp(shape)*shape^(-shape)*gamma(shape+1); + } + percent_area <- area/sum(area, na.rm=T)*100; +#---need to double check--------------------- + std_fwhm <- std_b * 2.35*sqrt(8.6) * 1/sqrt(b^4); +#---onset --------------- + onset <- center - shape/b; +#---summary of individual results + summary <- data.frame(a,std_a,center,std_center,fwhm,std_fwhm,area,percent_area,onset); + name_of_row <- paste("Peak",1:n,sep=""); + name_of_col <- c("Amplitude","e_Amplitude","Center","e_Center","FWHM","e_FWHM","Area","% Area","onset"); + dimnames(summary) <- list(name_of_row,name_of_col); + summary + } + + + + + + Property changes on: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/Rscripts/peakfitv2v1.R ___________________________________________________________________ Name: svn:executable + * Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/Rscripts/preprocessEnewsmooth.R =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/Rscripts/preprocessEnewsmooth.R (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/Rscripts/preprocessEnewsmooth.R 2009-08-06 16:03:58 UTC (rev 3070) @@ -0,0 +1,76 @@ +preprocess_1 <- function(input) { + + # read file (read.table) and save as vector (as.matrix) + original_y <- input*1000; + + # original # of points before interpolation + original_x <- c(1:length(original_y)); + + #---------calculate 2nd derivative to find peaks------------------------------------ + # + # windowlength argument n + # p is order of polynimal + # D is the order of derivative + + windowlength <- 3 # 3 data points covered + # tested 4 data points, detail info might be lost + order_polynomial <- 2; # includes constant, linear and quadratic terms + order_derivative <- 2; # need the information of second derivatives + + derivative_original_y <- sav.gol(original_y, fl = windowlength, forder = order_polynomial, dorder = order_derivative); + + + # guess # of possible peaks by counting negative y derivatives and corresponding amplitude of y > noise level + noise_level <- 0; # so far noise level is set to 0 + + # guess peak location: use all negative second derivatives or use local min of second derivative + # peak_location = original_x[derivative_original_y < 0 & original_y > noise_level]; + + tmp <- rep(c(0),length(original_x)); + for ( i in 2:(length(original_x)-1) ) { + if ( (derivative_original_y[i] < derivative_original_y[i-1]) & (derivative_original_y[i] < derivative_original_y[i+1]) ) + { tmp[i] = i;} + } + peak_location = original_x[tmp > 0]; + + possible_peaks = length(peak_location) + + #------------------------------------------------------------------------------------- + + + #-----------------interpolation data--------------------------------------------------- + # + # always needs # of parameters < length of observation + # in the case that 2nd derivative detect many peaks, interpolation shall be used + stim_res = 2 # sympliy double the time points + + interpolation <- ksmooth(original_x,original_y,"normal",bandwidth = 1,x.points = seq(1,length(original_x),by = 1/stim_res)); + + #derivative_interpolation <- sav.gol(interpolation$y, fl = windowlength, forder = order_polynomial, dorder = order_derivative); + # calculatae new peak location + new_peak_location = stim_res*(peak_location - 1) + 1; + + # calculatae new peak amplitude + + peak_amplitude = rep(c(0),possible_peaks); + for (i in 1:possible_peaks ) { peak_amplitude[i] = interpolation$y[new_peak_location[i]] } + + #--------------------initializaation---------------------------------------- + # + # parameter a corresponds to peak amplitude + a_guess <- peak_amplitude; + + # parameter b corresponds to 1/peak width + b_guess <- rep(c(length(original_y)/possible_peaks), possible_peaks); + + #real_center_guess <- interpolation$x[new_peak_location]; + #center_guess <- b_guess*real_center_guess; + center_guess <- interpolation$x[new_peak_location]; + + guess <- c(a_guess,b_guess,center_guess); + n <- possible_peaks; + + out <- list(guess = guess,n = n,interpolated_x = interpolation$x,interpolated_y = interpolation$y); + out +} + \ No newline at end of file Property changes on: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/Rscripts/preprocessEnewsmooth.R ___________________________________________________________________ Name: svn:executable + * Added: SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/Rscripts/subqrymediator.R =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/Rscripts/subqrymediator.R (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/peakfit_pilots/PK2/wholebrain/Rscripts/subqrymediator.R 2009-08-06 16:03:58 UTC (rev 3070) @@ -0,0 +1,64 @@ +library(stats) +source("Rscripts/preprocessEnewsmooth.R") +source("Rscripts/peakfitv2v1.R") + +inputfilename <- Sys.getenv("R_INPUT") +print(inputfilename) +allargs <- Sys.getenv("R_SWIFT_ARGS") +print(allargs) +outobjectname <- noquote(strsplit(allargs," ")[[1]][2]) +print(outobjectname) +outputPDFfilename <- paste(outobjectname,"pdf",sep="") +outputAfilename <- paste(outobjectname,"a",sep="") +outputBfilename <- paste(outobjectname,"b",sep="") + +dd <- as.matrix(read.table(inputfilename)) +dd <- data.frame(dd[1,]) +print(length(dd[,1])) + +## taking the mean of the TS to be the baseline +quickbase <- mean(dd[,1]) +adjusted.input = dd[,1]-quickbase +print(paste("starting res_preprocess ::: ",date(),sep="")) +res_preprocess <- preprocess_1(input = adjusted.input); + +print(paste("moving on to test_nlminb ::: ",date(),sep="")) + +test2_res_D2_nlminb <- nlminb( + start = res_preprocess$guess, + objective = fcn_L2, + gradient = test_D_fcn_L2, +#hessian = test_D2_fcn_L2, + control = list(eval.max = 50000, iter.max = 5000), +# the lower line with fewer iterations is just for testing purposes. the upper line is the real one +# control = list(eval.max = 100, iter.max = 50), + lower = rep(c(0),length(res_preprocess$guess)), + fcall = f, + n = res_preprocess$n, + x = res_preprocess$interpolated_x, + y_and_noise = res_preprocess$interpolated_y) + +pdf(file=outputPDFfilename) +op <- par(mfrow=c(1,1)) +plot(res_preprocess$interpolated_x,res_preprocess$interpolated_y,xlab = "",ylab = "BOLD (1E-3)",type = "b"); +plot.est(par = test2_res_D2_nlminb$par, fcall = f, n = res_preprocess$n, res_preprocess$interpolated_x,col = "blue"); +plot.est.individual(par = test2_res_D2_nlminb$par, fcall = f, n = res_preprocess$n, res_preprocess$interpolated_x,col = "blue"); +dev.off() +par(op) + +result1<- est.stats.summary( + par = test2_res_D2_nlminb$par, + sse = test2_res_D2_nlminb$objective, + x = res_preprocess$interpolated_x, + y = res_preprocess$interpolated_y) + +result2 <- est.summary( + par = test2_res_D2_nlminb$par, + sse = test2_res_D2_nlminb$objective, + n = res_preprocess$n, + x = res_preprocess$interpolated_x, + y = res_preprocess$interpolated_y) + + +write.table(result1,outputAfilename,row.name = F,col.name = F) +write.table(result2,outputBfilename,row.name = F,col.name = F) From noreply at svn.ci.uchicago.edu Thu Aug 6 18:44:32 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Thu, 6 Aug 2009 18:44:32 -0500 (CDT) Subject: [Swift-commit] r3071 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts Message-ID: <20090806234432.B7FDF9CC9D@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-06 18:44:32 -0500 (Thu, 06 Aug 2009) New Revision: 3071 Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/paste_dbprep.py Log: used to put together ss files for the db Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/paste_dbprep.py =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/paste_dbprep.py (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/paste_dbprep.py 2009-08-06 23:44:32 UTC (rev 3071) @@ -0,0 +1,37 @@ +#!/usr/bin/python + +import os +import shutil +import commands + + +subjs = [5,6,7,8,10,11,12,13,14,15,17,18,19,20,21,22,23,24,25,26,27,28,30] +#subjs = [3] +hemis = ['lh','rh'] + +ccfInterpDir = os.getenv("cnari")+"/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/" +oldCCFDir = os.getenv("cnari")+"/swift/projects/andric/ccf_emblem/individual_ss/IDEALseed/" + +seed_vec = "name_vec.txt" +seed_name = oldCCFDir+seed_vec + +print "copying "+seed_name+" to\n"+ccfInterpDir +shutil.copy2(seed_name,ccfInterpDir) + +def paster(): + ss_dir = ccfInterpDir+"ss"+`ss`+"interp_results/" + os.chdir(ss_dir) + print os.getcwd() + oldSSPath = oldCCFDir+"ss"+`ss`+"_results/" + SSVec = "ss_vec"+`ss`+".txt" + shutil.copy2(oldSSPath+SSVec,".") + ROIVec = "roi_vec_"+h+"_ss"+`ss`+".txt" + shutil.copy2(oldSSPath+ROIVec,".") + fordb_name = "fordb_ss"+`ss`+"_"+h+".txt" + print commands.getoutput("paste -d ' ' "+seed_name+" "+SSVec+" "+ROIVec+" sorted_"+h+"_ccf.txt > "+fordb_name) + print "word count for "+fordb_name+" is: "+commands.getoutput("wc "+fordb_name) + + +for ss in subjs: + for h in hemis: + paster() From noreply at svn.ci.uchicago.edu Thu Aug 6 18:44:50 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Thu, 6 Aug 2009 18:44:50 -0500 (CDT) Subject: [Swift-commit] r3072 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts Message-ID: <20090806234450.CC5E69CC9D@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-06 18:44:50 -0500 (Thu, 06 Aug 2009) New Revision: 3072 Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/insert_to_db.py Log: used to insert ss files into the db Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/insert_to_db.py =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/insert_to_db.py (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/scripts/insert_to_db.py 2009-08-06 23:44:50 UTC (rev 3072) @@ -0,0 +1,43 @@ +#!/usr/bin/python + +import os +import sys +import commands +import MySQLdb +import time + +subjs = [3,5,6,7,8,10,11,12,13,14,15,17,18,19,20,21,22,23,24,25,26,27,28,30] +#subjs = [3] +hemis = ['lh','rh'] + +ccfInterpDir = os.getenv("cnari")+"/swift/projects/andric/ccf_emblem/individual_ss/interpolatedHRFs/" + +#---- defining the insert statement function that is going to be run +def insertdata_to_db(h,ss): + print "que hora es?\n"+time.ctime() + try: + file = "'"+ccfInterpDir+"ss"+`ss`+"interp_results/fordb_ss"+`ss`+"_"+h+".txt'" + print "File loading: "+file + insert_statement = "load data local infile "+file+" into table interpCCF_"+h+" fields terminated by ' ';" + print "Insert statement: "+insert_statement + cursor.execute(insert_statement) + print "Number of rows inserted %d" % cursor.rowcount + except MySQLdb.Error, e: + print "Error during "+h+" "+`ss`+" inserting %d -->> %s" % (e.args[0], e.args[1]) + sys.exit (1) + + +#---- establishing connection to the db +try: + connection = MySQLdb.connect(read_default_file="~/.my.cnf",db="EMBLEM1") +except MySQLdb.Error, e: + print "Error %d: %s" % (e.args[0], e.args[1]) + sys.exit (1) + + +cursor = connection.cursor() + +#---- running the insert statement function through the loops +for h in hemis: + for ss in subjs: + insertdata_to_db(h,ss) From noreply at svn.ci.uchicago.edu Thu Aug 6 22:34:06 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Thu, 6 Aug 2009 22:34:06 -0500 (CDT) Subject: [Swift-commit] r3073 - in SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy: . scripts Message-ID: <20090807033406.B3AEB9CC9D@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-06 22:34:06 -0500 (Thu, 06 Aug 2009) New Revision: 3073 Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/FriedmanTest.R SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/cat_sort_allss2.py SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/find_missing_files.py SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/surfclust.py Log: scripts for Friedman Test analysis Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/FriedmanTest.R =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/FriedmanTest.R (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/FriedmanTest.R 2009-08-07 03:34:06 UTC (rev 3073) @@ -0,0 +1,25 @@ +#---- this is to do friedman non-parametric test on lags +allinputs <- Sys.getenv("R_SWIFT_ARGS") +print(Sys.getenv("R_SWIFT_ARGS")); +outname <- noquote(strsplit(allinputs," ")[[1]][1]) +outname2 <- noquote(strsplit(allinputs," ")[[1]][2]) + +inputfile <- Sys.getenv("R_INPUT") +print(inputfile) +Query_out <- as.matrix(read.table(inputfile)) + +#names(Query_out) <- c("subject", "vertex", "speech_lag", "emblem_lag", "embspeech_lag"); + +m <- matrix(nrow=500,ncol=3) +mat_row <- 0; +#attach(Query_out) +vertex_levels <- as.factor(Query_out[,2]) +for (vert in levels(vertex_levels)){ + mat_row = mat_row + 1 + vert_data <- matrix(c(Query_out[which(Query_out[,2]==vert),3:5]),nr=24) + friedman_test <- friedman.test(vert_data) + vert_id <- as.integer(vert) + m[mat_row, ] <- c(vert_id, friedman_test$statistic[[1]], friedman_test$p.value[[1]]) + rm(vert_data) +} +write.table(round(m,5), file=paste(outname2,outname,".txt",sep=""), row.names=FALSE, col.names=FALSE, quote=F) Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/cat_sort_allss2.py =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/cat_sort_allss2.py (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/cat_sort_allss2.py 2009-08-07 03:34:06 UTC (rev 3073) @@ -0,0 +1,25 @@ +#!/usr/bin/python + +import os +import commands +import time + + +hemis = ['lh','rh'] +seeds = ['IDEAL'] + + +def concat_sort(ss,h): + print "starting concat_sort process\ntime is: "+time.ctime() + os.chdir(os.getenv("cnari")+"/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/results/") + print os.getcwd() + commands.getoutput("cat *"+h+"*0.txt > "+h+"_"+ss+"_gather.txt") + print "word count of gather file ("+h+"_"+ss+"_gather.txt): "+commands.getoutput("wc "+h+"_"+ss+"_gather.txt") + commands.getoutput("sort -g -k 1 "+h+"_"+ss+"_gather.txt > "+h+"_"+ss+"_sorted.txt") + print "word count of sorted file ("+h+"_"+ss+"_sorted.txt): "+commands.getoutput("wc "+h+"_"+ss+"_sorted.txt") + commands.getoutput("rm -rf "+h+"_"+ss+"_gather.txt") + + +for ss in seeds: + for h in hemis: + concat_sort(ss,h) Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/find_missing_files.py =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/find_missing_files.py (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/find_missing_files.py 2009-08-07 03:34:06 UTC (rev 3073) @@ -0,0 +1,27 @@ +#!/usr/bin/python + +import commands +import time +import os +import sys + +#---- VERY IMPORTANT: CURRENTLY, THIS SCRIPT IS HARDCODED FOR ONE HEMI AT A TIME +starts = range(1,196000,500) +hemis = ['lh'] +#subjs = [5,6,7,8,10,11,12,13,14,15,17,18,19,20,21,22,23,24,25,26,27,28,30] + + +for h in hemis: + os.chdir(os.getenv("cnari")+"/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/results/") + print os.getcwd() + outfile = os.getenv("cnari")+"/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/results/missing_"+h+"starts.txt" + missed = "" + for num in starts: + voxdata = "IDEAL"+h+"_NonParam"+`num`+"_"+`(num+499)`+".txt" + if os.path.exists(voxdata): pass + else: + missed += `num`+"\n" + + file = open(outfile,"w") + file.write(missed) + file.close() Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/surfclust.py =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/surfclust.py (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/surfclust.py 2009-08-07 03:34:06 UTC (rev 3073) @@ -0,0 +1,27 @@ +#!/usr/bin/python + +import os +import commands +import sys +import time + + +seed = ['IDEAL'] +hemis = ['lh','rh'] + +os.chdir(os.getenv("cnari")+"/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/results/") +print os.getcwd() + +def surf_clust(ss,h): + print "surfclust for seed: "+ss+"\nhemisphere: "+h+"\ntime started: "+time.ctime() + print commands.getoutput("SurfClust \ + -spec HORRY."+h+".mesh140_std.spec -surf_A HORRY."+h+".mesh140_std.pial.asc \ + -input "+h+"_"+ss+"_new_sorted.txt 1 -rmm 2.8 -thresh_col 1 -thresh 6.0 -amm2 2 -sort_n_nodes \ + -out_clusterdset -out_roidset -prepend_node_index -out_fulllist \ + -prefix "+h+"_"+ss+"_clustered_p05") + + + +for ss in seed: + for h in hemis: + surf_clust(ss,h) From noreply at svn.ci.uchicago.edu Thu Aug 6 23:56:13 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Thu, 6 Aug 2009 23:56:13 -0500 (CDT) Subject: [Swift-commit] r3074 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts Message-ID: <20090807045613.1AC859CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-06 23:56:12 -0500 (Thu, 06 Aug 2009) New Revision: 3074 Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/FriedmanTest.R Log: this version uses an aggregate function rather than a 'for' loop Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/FriedmanTest.R =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/FriedmanTest.R 2009-08-07 03:34:06 UTC (rev 3073) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/FriedmanTest.R 2009-08-07 04:56:12 UTC (rev 3074) @@ -1,25 +1,36 @@ -#---- this is to do friedman non-parametric test on lags +#---- R script for carrying out friedman test +FriedmanStat <- function(x){ + mm <- matrix(nrow=24,ncol=3) + mm[,1] = x[1:24] + mm[,2] = x[25:48] + mm[,3] = x[49:72] + return(friedman.test(mm)[[1]][[1]]) +} + +FriedmanP <- function(x){ + mm <- matrix(nrow=24,ncol=3) + mm[,1] = x[1:24] + mm[,2] = x[25:48] + mm[,3] = x[49:72] + return(friedman.test(mm)[[3]][[1]]) +} + +#---- Swift housekeeping: allinputs <- Sys.getenv("R_SWIFT_ARGS") print(Sys.getenv("R_SWIFT_ARGS")); -outname <- noquote(strsplit(allinputs," ")[[1]][1]) -outname2 <- noquote(strsplit(allinputs," ")[[1]][2]) - +batchID <- noquote(strsplit(allinputs," ")[[1]][1]) +outname <- noquote(strsplit(allinputs," ")[[1]][2]) +print(outname) inputfile <- Sys.getenv("R_INPUT") print(inputfile) Query_out <- as.matrix(read.table(inputfile)) -#names(Query_out) <- c("subject", "vertex", "speech_lag", "emblem_lag", "embspeech_lag"); - -m <- matrix(nrow=500,ncol=3) -mat_row <- 0; -#attach(Query_out) -vertex_levels <- as.factor(Query_out[,2]) -for (vert in levels(vertex_levels)){ - mat_row = mat_row + 1 - vert_data <- matrix(c(Query_out[which(Query_out[,2]==vert),3:5]),nr=24) - friedman_test <- friedman.test(vert_data) - vert_id <- as.integer(vert) - m[mat_row, ] <- c(vert_id, friedman_test$statistic[[1]], friedman_test$p.value[[1]]) - rm(vert_data) -} -write.table(round(m,5), file=paste(outname2,outname,".txt",sep=""), row.names=FALSE, col.names=FALSE, quote=F) +#---- analysis: +data_stack <- stack(data.frame(Query_out[,3:5]))[1] +vertices <- Query_out[,2] +nn <- data.frame(cbind(vertices,data_stack)) +m <- matrix(nrow=length(as.integer(levels(as.factor(vertices)))),ncol=3) +m[,1] <- as.integer(levels(as.factor(vertices))) +m[,2] <- aggregate(nn$values, list(nn$vertices),FriedmanStat)[,2] +m[,3] <- 1 - (aggregate(nn$values, list(nn$vertices),FriedmanP)[,2]) +write.table(round(m,5), file=paste(outname,".txt",sep=""), row.names=FALSE, col.names=FALSE, quote=F) From noreply at svn.ci.uchicago.edu Fri Aug 7 00:08:39 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Fri, 7 Aug 2009 00:08:39 -0500 (CDT) Subject: [Swift-commit] r3075 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts Message-ID: <20090807050839.12A159CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-07 00:08:38 -0500 (Fri, 07 Aug 2009) New Revision: 3075 Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/FriedmanTest.R Log: cleaned up the aggregate functions Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/FriedmanTest.R =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/FriedmanTest.R 2009-08-07 04:56:12 UTC (rev 3074) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/scripts/FriedmanTest.R 2009-08-07 05:08:38 UTC (rev 3075) @@ -4,7 +4,7 @@ mm[,1] = x[1:24] mm[,2] = x[25:48] mm[,3] = x[49:72] - return(friedman.test(mm)[[1]][[1]]) + return(friedman.test(mm)$statistic[[1]]) } FriedmanP <- function(x){ @@ -12,7 +12,7 @@ mm[,1] = x[1:24] mm[,2] = x[25:48] mm[,3] = x[49:72] - return(friedman.test(mm)[[3]][[1]]) + return(friedman.test(mm)$p.value) } #---- Swift housekeeping: From noreply at svn.ci.uchicago.edu Fri Aug 7 14:56:55 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Fri, 7 Aug 2009 14:56:55 -0500 (CDT) Subject: [Swift-commit] r3076 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy Message-ID: <20090807195655.9C2829CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-07 14:56:55 -0500 (Fri, 07 Aug 2009) New Revision: 3076 Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/lh_NonParametric_lag_analy.swift Log: cleaned up my swift code for running this analysis Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/lh_NonParametric_lag_analy.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/lh_NonParametric_lag_analy.swift 2009-08-07 05:08:38 UTC (rev 3075) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/lh_NonParametric_lag_analy.swift 2009-08-07 19:56:55 UTC (rev 3076) @@ -1,47 +1,43 @@ +#---- Friedman Test summer 2009. re-doing with interpolated data +## type declarations type file{} +type Rscript; -(file qout, file rout) run_query (string allcatargs, file config, file r_script){ - app{ - Mediator allcatargs stdout=@filename(qout) @filename(r_script); - } +## Mediator app declaration +app (file qout, file rout) run_query (string allcatargs, file config, Rscript code){ + Mediator allcatargs stdout=@filename(qout) @filename(code); } + +loop_query(int bvox, string user, string db, string host, string query_outline, Rscript code, file config, string id, string h){ + int evox = bvox+499; + string outName = @strcat("output",h,"/",h,id,bvox,"_",evox); + string med_args = @strcat("--user ","andric"," --conf ", @filename(config)," --db ", db," --host ", host, + " --query ", query_outline," --begin_vox ", bvox," --end_vox ", evox," --batchstep ", "500", + " --r_script ", @filename(code)," --r_swift_args ",outName," --outprefix ", "TOLDJA", + " --subject ", id); + file q_result ; + file r_result ; + (q_result, r_result) = run_query(med_args, config, code); +} + +## parameters Mediator needs string user = @arg("user"); string db = "EMBLEM1"; string host = "tp-neurodb.ci.uchicago.edu"; -string baseid = "lh_NonParam"; - -file r_script; file config; +## mapping the R code +Rscript code; -loop_query(int bvox, string user, string db, string host, string query_outline, file r_script, file config, string id){ - int evox = bvox+499; - string r_swift_args = @strcat(id); - string theoutprefix = @strcat(id,bvox,"_",evox); - string med_args = @strcat("--user ","andric", - " --conf ", "user.config", - " --db ", db, - " --host ", host, - " --query ", query_outline, - " --r_script ", @filename(r_script), - " --begin_vox ", bvox, - " --end_vox ", evox, - " --outprefix ", theoutprefix, - " --batchstep ", "500", - " --r_swift_args ", r_swift_args, - " --subject ", id); - file q_result ; - file r_result ; - (q_result, r_result) = run_query(med_args, r_script, config); -} +## variables to move across +string hemilist[] = ["lh"]; +int mybatches[] = [1:196000:500]; +string id = "interp"; -string regions = ["IDEAL"]; -foreach region in regions { - int mybatches = [1:196000:500]; +foreach h in hemilist{ foreach batch in mybatches { - string id = @strcat(region, baseid); - string query_outline = @strcat("select subject, vertex, speech_lag, emblem_lag, embspeech_lag from ccf_phase2_lh where seed_region = '",region,"' and vertex between BEGIN_BATCH and END_BATCH"); - loop_query(batch, user, db, host, query_outline, r_script, config, id); + string query_outline = @strcat("SELECT subject, vertex, speech_lag, emblem_lag, embspeech_lag FROM interpCCF_",h," WHERE vertex BETWEEN BEGIN_BATCH and END_BATCH"); + loop_query(batch, user, db, host, query_outline, code, config, id, h); } } From noreply at svn.ci.uchicago.edu Fri Aug 7 14:59:45 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Fri, 7 Aug 2009 14:59:45 -0500 (CDT) Subject: [Swift-commit] r3077 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy Message-ID: <20090807195946.078269CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-07 14:59:45 -0500 (Fri, 07 Aug 2009) New Revision: 3077 Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/rh_NonParametric_lag_analy.swift Log: cleaned up swift coding Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/rh_NonParametric_lag_analy.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/rh_NonParametric_lag_analy.swift 2009-08-07 19:56:55 UTC (rev 3076) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/rh_NonParametric_lag_analy.swift 2009-08-07 19:59:45 UTC (rev 3077) @@ -1,47 +1,43 @@ +#---- Friedman Test summer 2009. re-doing with interpolated data +## type declarations type file{} +type Rscript; -(file qout, file rout) run_query (string allcatargs, file config, file r_script){ - app{ - Mediator allcatargs stdout=@filename(qout) @filename(r_script); - } +## Mediator app declaration +app (file qout, file rout) run_query (string allcatargs, file config, Rscript code){ + Mediator allcatargs stdout=@filename(qout) @filename(code); } + +loop_query(int bvox, string user, string db, string host, string query_outline, Rscript code, file config, string id, string h){ + int evox = bvox+499; + string outName = @strcat("output",h,"/",h,id,bvox,"_",evox); + string med_args = @strcat("--user ","andric"," --conf ", @filename(config)," --db ", db," --host ", host, + " --query ", query_outline," --begin_vox ", bvox," --end_vox ", evox," --batchstep ", "500", + " --r_script ", @filename(code)," --r_swift_args ",outName," --outprefix ", "TOLDJA", + " --subject ", id); + file q_result ; + file r_result ; + (q_result, r_result) = run_query(med_args, config, code); +} + +## parameters Mediator needs string user = @arg("user"); string db = "EMBLEM1"; string host = "tp-neurodb.ci.uchicago.edu"; -string baseid = "rh_NonParam"; - -file r_script; file config; +## mapping the R code +Rscript code; -loop_query(int bvox, string user, string db, string host, string query_outline, file r_script, file config, string id){ - int evox = bvox+499; - string r_swift_args = @strcat(id); - string theoutprefix = @strcat(id,bvox,"_",evox); - string med_args = @strcat("--user ","andric", - " --conf ", "user.config", - " --db ", db, - " --host ", host, - " --query ", query_outline, - " --r_script ", @filename(r_script), - " --begin_vox ", bvox, - " --end_vox ", evox, - " --outprefix ", theoutprefix, - " --batchstep ", "500", - " --r_swift_args ", r_swift_args, - " --subject ", id); - file q_result ; - file r_result ; - (q_result, r_result) = run_query(med_args, r_script, config); -} +## variables to move across +string hemilist[] = ["rh"]; +int mybatches[] = [1:196000:500]; +string id = "interp"; -string regions = ["IDEAL"]; -foreach region in regions { - int mybatches = [1:196000:500]; +foreach h in hemilist{ foreach batch in mybatches { - string id = @strcat(region, baseid); - string query_outline = @strcat("select subject, vertex, speech_lag, emblem_lag, embspeech_lag from ccf_phase2_rh where seed_region = '",region,"' and vertex between BEGIN_BATCH and END_BATCH"); - loop_query(batch, user, db, host, query_outline, r_script, config, id); + string query_outline = @strcat("SELECT subject, vertex, speech_lag, emblem_lag, embspeech_lag FROM interpCCF_",h," WHERE vertex BETWEEN BEGIN_BATCH and END_BATCH"); + loop_query(batch, user, db, host, query_outline, code, config, id, h); } } From noreply at svn.ci.uchicago.edu Fri Aug 7 15:00:17 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Fri, 7 Aug 2009 15:00:17 -0500 (CDT) Subject: [Swift-commit] r3078 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy Message-ID: <20090807200017.4186E9CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-07 15:00:17 -0500 (Fri, 07 Aug 2009) New Revision: 3078 Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/swift_execute.sh Log: shell script for executing swift Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/swift_execute.sh =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/swift_execute.sh (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/swift_execute.sh 2009-08-07 20:00:17 UTC (rev 3078) @@ -0,0 +1,3 @@ +#!/bin/tcsh + +swift lh_NonParametric_lag_analy.swift -sites.file /ci/projects/cnari/config/coaster_ranger.xml -user="andric" Property changes on: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/swift_execute.sh ___________________________________________________________________ Name: svn:executable + * From noreply at svn.ci.uchicago.edu Sat Aug 8 10:33:56 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Sat, 8 Aug 2009 10:33:56 -0500 (CDT) Subject: [Swift-commit] r3079 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy Message-ID: <20090808153356.1D00E9CCA8@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-08 10:33:55 -0500 (Sat, 08 Aug 2009) New Revision: 3079 Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/ Log: newer version of permutations From noreply at svn.ci.uchicago.edu Sat Aug 8 10:35:20 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Sat, 8 Aug 2009 10:35:20 -0500 (CDT) Subject: [Swift-commit] r3080 - in SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations: . scripts Message-ID: <20090808153520.CEDEA9CCA8@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-08 10:35:20 -0500 (Sat, 08 Aug 2009) New Revision: 3080 Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/generate_conds_config.R SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/generate_subjs_config.R SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/modifiedFriedmanPermutation.R Log: scripts dir for NewPermutations Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/generate_conds_config.R =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/generate_conds_config.R (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/generate_conds_config.R 2009-08-08 15:35:20 UTC (rev 3080) @@ -0,0 +1,5 @@ +config <- array(0,c(4000,3,24)) +for (i in 1:ncol(config[1,,])){ + config[,,i] <- sample(1:3) +} +save(config,file="config_file.Rdata") Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/generate_subjs_config.R =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/generate_subjs_config.R (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/generate_subjs_config.R 2009-08-08 15:35:20 UTC (rev 3080) @@ -0,0 +1,9 @@ +cc <- as.vector(c(rep(0,12),rep(1,12))) +con <- matrix(nrow=4000,ncol=24) +mat_row <- 0; + +for (i in 1:nrow(con)){ + mat_row <- mat_row + 1 + con[mat_row,] <- c(sample(cc)) +} +write.table(con,file="subjs_config_file.txt",row.names=FALSE,col.names=FALSE,quote=FALSE) Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/modifiedFriedmanPermutation.R =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/modifiedFriedmanPermutation.R (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/scripts/modifiedFriedmanPermutation.R 2009-08-08 15:35:20 UTC (rev 3080) @@ -0,0 +1,38 @@ +#---- doing friedman permutations +#---- coded Tuesday; July 22, 2008 + +#---- this is the function used in the aggregate: +FriedmanPerm <- function(x){ + mb <- matrix(nrow=24,ncol=3) + mb[,1] = x[1:24] + mb[,2] = x[25:48] + mb[,3] = x[49:72] + for (t in subj_resamp){ + mb[t,] <- mb[t,(config[configLine,,t])] + } + return(friedman.test(mb)[[1]][[1]]) +} + +#---- Swift housekeeping: +allinputs <- Sys.getenv("R_SWIFT_ARGS") +print(Sys.getenv("R_SWIFT_ARGS")); +outname <- noquote(strsplit(allinputs," ")[[1]][1]) +configLine <- as.integer(noquote(strsplit(allinputs," ")[[1]][2])) +print(configLine) + +inputfile <- Sys.getenv("R_INPUT") +print(inputfile) +Query_out <- as.matrix(read.table(inputfile)) +load("config_file.Rdata") +config_subjs <- as.matrix(read.table("subjs_config_file.txt")) +subj_resamp <- which(as.vector(config_subjs[configLine,])==1) + + +#---- this is where the fun begins: +data_stack <- stack(data.frame(Query_out[,3:5]))[1] +vertices <- Query_out[,2] +nn <- data.frame(cbind(vertices,data_stack)) +m <- matrix(nrow=length(as.integer(levels(as.factor(vertices)))),ncol=2) +m[,1] <- as.integer(levels(as.factor(vertices))) +m[,2] <- aggregate(nn$values, list(nn$vertices),FriedmanPerm)[,2] +write.table(round(m,5), file=paste(configLine,"PermFriedman",outname,".txt",sep=""), row.names=FALSE, col.names=FALSE, quote=F) From noreply at svn.ci.uchicago.edu Sat Aug 8 10:36:17 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Sat, 8 Aug 2009 10:36:17 -0500 (CDT) Subject: [Swift-commit] r3081 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations Message-ID: <20090808153617.930479CCA8@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-08 10:36:17 -0500 (Sat, 08 Aug 2009) New Revision: 3081 Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/PermFriedman.swift SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/PermFriedman1001.swift SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/PermFriedman2001.swift SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/oldPermFriedman.swift SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/permclust.swift SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/permclustThresh6.swift SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/permclustnotnew.swift Log: SwiftScripts for permutations and clustering Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/PermFriedman.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/PermFriedman.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/PermFriedman.swift 2009-08-08 15:36:17 UTC (rev 3081) @@ -0,0 +1,53 @@ +#---- coded Tuesday; July 22, 2008 +type file{} + +(file qout, file rout) run_query (string allcatargs, file config, file r_script, file r_config_conds, file r_config_subjs){ + app{ + Mediator allcatargs stdout=@filename(qout) @filename(r_script) @filename(r_config_conds) @filename(r_config_subjs); + } +} + +string user = @arg("user"); +string db = "EMBLEM1"; +string host = "tp-neurodb.ci.uchicago.edu"; +#string host = "login4.ranger.tacc.utexas.edu"; + +file r_script; +file r_config_conds; +file r_config_subjs; +file config; + + +loop_query(int bvox, string user, string db, string host, string query_outline, file r_script, file config, file r_config_conds, file r_config_subjs, string id, int medstep, int swiftstep){ + int evox = bvox+(swiftstep-1); + string baseid = "PermFriedman"; + string r_swift_args = @strcat(id); + string theoutprefix = @strcat(id,baseid,bvox,"_",evox); + string med_args = @strcat("--user ",user, + " --conf ", "user.config", + " --db ", db, + " --host ", host, + " --query ", query_outline, + " --r_script ", @filename(r_script), + " --begin_vox ", bvox, + " --end_vox ", evox, + " --outprefix ", theoutprefix, + " --batchstep ", medstep, + " --r_swift_args ", r_swift_args, + " --subject ", id); + file q_result ; + file r_result ; + (q_result, r_result) = run_query(med_args, r_script, config, r_config_conds, r_config_subjs); +} + +int swiftstep = 28000; +int mediatorstep = 7000; +int permbrains = [1:1000:1]; +foreach perm in permbrains { + int mybatches = [1:196000:swiftstep]; + foreach batch in mybatches { + string id = @strcat(perm); + string query_outline = @strcat("select subject, vertex, speech_lag, emblem_lag, embspeech_lag from ccf_phase2_lh where vertex between BEGIN_BATCH and END_BATCH"); + loop_query(batch, user, db, host, query_outline, r_script, config, r_config_conds, r_config_subjs, id, mediatorstep, swiftstep); + } +} Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/PermFriedman1001.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/PermFriedman1001.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/PermFriedman1001.swift 2009-08-08 15:36:17 UTC (rev 3081) @@ -0,0 +1,53 @@ +#---- coded Tuesday; July 22, 2008 +type file{} + +(file qout, file rout) run_query (string allcatargs, file config, file r_script, file r_config_conds, file r_config_subjs){ + app{ + Mediator allcatargs stdout=@filename(qout) @filename(r_script) @filename(r_config_conds) @filename(r_config_subjs); + } +} + +string user = @arg("user"); +string db = "EMBLEM1"; +string host = "tp-neurodb.ci.uchicago.edu"; +#string host = "login4.ranger.tacc.utexas.edu"; + +file r_script; +file r_config_conds; +file r_config_subjs; +file config; + + +loop_query(int bvox, string user, string db, string host, string query_outline, file r_script, file config, file r_config_conds, file r_config_subjs, string id, int medstep, int swiftstep){ + int evox = bvox+(swiftstep-1); + string baseid = "PermFriedman"; + string r_swift_args = @strcat(id); + string theoutprefix = @strcat(id,baseid,bvox,"_",evox); + string med_args = @strcat("--user ",user, + " --conf ", "user.config", + " --db ", db, + " --host ", host, + " --query ", query_outline, + " --r_script ", @filename(r_script), + " --begin_vox ", bvox, + " --end_vox ", evox, + " --outprefix ", theoutprefix, + " --batchstep ", medstep, + " --r_swift_args ", r_swift_args, + " --subject ", id); + file q_result ; + file r_result ; + (q_result, r_result) = run_query(med_args, r_script, config, r_config_conds, r_config_subjs); +} + +int swiftstep = 28000; +int mediatorstep = 7000; +int permbrains = [1001:2000:1]; +foreach perm in permbrains { + int mybatches = [1:196000:swiftstep]; + foreach batch in mybatches { + string id = @strcat(perm); + string query_outline = @strcat("select subject, vertex, speech_lag, emblem_lag, embspeech_lag from ccf_phase2_lh where vertex between BEGIN_BATCH and END_BATCH"); + loop_query(batch, user, db, host, query_outline, r_script, config, r_config_conds, r_config_subjs, id, mediatorstep, swiftstep); + } +} Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/PermFriedman2001.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/PermFriedman2001.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/PermFriedman2001.swift 2009-08-08 15:36:17 UTC (rev 3081) @@ -0,0 +1,53 @@ +#---- coded Tuesday; July 22, 2008 +type file{} + +(file qout, file rout) run_query (string allcatargs, file config, file r_script, file r_config_conds, file r_config_subjs){ + app{ + Mediator allcatargs stdout=@filename(qout) @filename(r_script) @filename(r_config_conds) @filename(r_config_subjs); + } +} + +string user = @arg("user"); +string db = "EMBLEM1"; +string host = "tp-neurodb.ci.uchicago.edu"; +#string host = "login4.ranger.tacc.utexas.edu"; + +file r_script; +file r_config_conds; +file r_config_subjs; +file config; + + +loop_query(int bvox, string user, string db, string host, string query_outline, file r_script, file config, file r_config_conds, file r_config_subjs, string id, int medstep, int swiftstep){ + int evox = bvox+(swiftstep-1); + string baseid = "PermFriedman"; + string r_swift_args = @strcat(id); + string theoutprefix = @strcat(id,baseid,bvox,"_",evox); + string med_args = @strcat("--user ",user, + " --conf ", "user.config", + " --db ", db, + " --host ", host, + " --query ", query_outline, + " --r_script ", @filename(r_script), + " --begin_vox ", bvox, + " --end_vox ", evox, + " --outprefix ", theoutprefix, + " --batchstep ", medstep, + " --r_swift_args ", r_swift_args, + " --subject ", id); + file q_result ; + file r_result ; + (q_result, r_result) = run_query(med_args, r_script, config, r_config_conds, r_config_subjs); +} + +int swiftstep = 28000; +int mediatorstep = 7000; +int permbrains = [2001:3000:1]; +foreach perm in permbrains { + int mybatches = [1:196000:swiftstep]; + foreach batch in mybatches { + string id = @strcat(perm); + string query_outline = @strcat("select subject, vertex, speech_lag, emblem_lag, embspeech_lag from ccf_phase2_lh where vertex between BEGIN_BATCH and END_BATCH"); + loop_query(batch, user, db, host, query_outline, r_script, config, r_config_conds, r_config_subjs, id, mediatorstep, swiftstep); + } +} Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/oldPermFriedman.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/oldPermFriedman.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/oldPermFriedman.swift 2009-08-08 15:36:17 UTC (rev 3081) @@ -0,0 +1,54 @@ +#---- coded Tuesday; July 22, 2008 +type file{} + +(file qout, file rout) run_query (string allcatargs, file config, file r_script, file r_config_conds, file r_config_subjs){ + app{ + Mediator allcatargs stdout=@filename(qout) @filename(r_script) @filename(r_config_conds) @filename(r_config_subjs); + } +} + +string user = @arg("user"); +string db = "EMBLEM1"; +string host = "tp-neurodb.ci.uchicago.edu"; +#string host = "login4.ranger.tacc.utexas.edu"; + +file r_script; +file r_config_conds; +file r_config_subjs; +file config; + + +loop_query(int bvox, string user, string db, string host, string query_outline, file r_script, file config, file r_config_conds, file r_config_subjs, string id, int medstep, int swiftstep){ + int evox = bvox+(swiftstep-1); + int batch_evox = bvox+(medstep-1); + string baseid = "PermFriedman"; + string r_swift_args = @strcat(id); + string theoutprefixR_result = @strcat(id,baseid,bvox,"_",batch_evox); + string theoutprefixQuery_result = @strcat(id,baseid,bvox,"_",evox); + string med_args = @strcat("--user ",user, + " --conf ", "user.config", + " --db ", db, + " --host ", host, + " --query ", query_outline, + " --r_script ", @filename(r_script), + " --begin_vox ", bvox, + " --end_vox ", evox, + " --batchstep ", medstep, + " --r_swift_args ", r_swift_args, + " --subject ", id); + file q_result ; + file r_result ; + (q_result, r_result) = run_query(med_args, r_script, config, r_config_conds, r_config_subjs); +} + +int swiftstep = 28000; +int mediatorstep =7000; +int permbrains = [1:1:1]; +foreach perm in permbrains { + int mybatches = [1:196000:swiftstep]; + foreach batch in mybatches { + string id = @strcat(perm); + string query_outline = @strcat("select subject, vertex, speech_lag, emblem_lag, embspeech_lag from ccf_phase2_lh where vertex between BEGIN_BATCH and END_BATCH"); + loop_query(batch, user, db, host, query_outline, r_script, config, r_config_conds, r_config_subjs, id, mediatorstep, swiftstep); + } +} Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/permclust.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/permclust.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/permclust.swift 2009-08-08 15:36:17 UTC (rev 3081) @@ -0,0 +1,33 @@ +# Tuesday; July 22, 2008 +# checked over and set again on Friday; August 22, 2008 +# this version loops also the rmm value +type file{} + +type surfclust_table{} + + +(surfclust_table surfclustOutput) SurfClust (file specFile, file surfFile, file input, int threshVal, float rmmVal, string prefix){ + app { + SurfClust "-spec" @filename(specFile) "-surf_A" @filename(surfFile) "-input" @filename(input) "1" "-rmm" rmmVal "-thresh_col" "1" "-thresh" threshVal "-amm2" "2" "-sort_n_nodes" "-prepend_node_index" "-prefix" prefix; + } +} + + +int vertexThresh[] = [6,9]; +int permbrains[] = [3:3000:1]; +#int permbrains[] = [1:2:1]; +float rmm_vals[] = [2.2,2.5]; + +foreach brain in permbrains{ + foreach thresh in vertexThresh{ + foreach rmm in rmm_vals{ + file HORRYspec ; + file HORRYsurf ; + string inputName=@strcat("PermBrain",brain,"_output.txt"); + file inputFile ; + string outPrefix=@strcat(brain,"_Thresh",thresh); + surfclust_table surfclustOutput ; + (surfclustOutput) = SurfClust(HORRYspec,HORRYsurf,inputFile,thresh,rmm,outPrefix); + } + } +} Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/permclustThresh6.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/permclustThresh6.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/permclustThresh6.swift 2009-08-08 15:36:17 UTC (rev 3081) @@ -0,0 +1,33 @@ +# Tuesday; July 22, 2008 +# checked over and set again on Friday; August 22, 2008 +# this version loops also the rmm value +type file{} + +type surfclust_table{} + + +(surfclust_table surfclustOutput) SurfClust (file specFile, file surfFile, file input, int threshVal, float rmmVal, string prefix){ + app { + SurfClust "-spec" @filename(specFile) "-surf_A" @filename(surfFile) "-input" @filename(input) "1" "-rmm" rmmVal "-thresh_col" "1" "-thresh" threshVal "-amm2" "2" "-sort_n_nodes" "-prepend_node_index" "-prefix" prefix; + } +} + + +int vertexThresh[] = [6]; +int permbrains[] = [3:3000:1]; +#int permbrains[] = [1:2:1]; +float rmm_vals[] = [2.2,2.5]; + +foreach brain in permbrains{ + foreach thresh in vertexThresh{ + foreach rmm in rmm_vals{ + file HORRYspec ; + file HORRYsurf ; + string inputName=@strcat("PermBrain",brain,"_output.txt"); + file inputFile ; + string outPrefix=@strcat(brain,"_Thresh",thresh); + surfclust_table surfclustOutput ; + (surfclustOutput) = SurfClust(HORRYspec,HORRYsurf,inputFile,thresh,rmm,outPrefix); + } + } +} Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/permclustnotnew.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/permclustnotnew.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/permclustnotnew.swift 2009-08-08 15:36:17 UTC (rev 3081) @@ -0,0 +1,33 @@ +# coded Tuesday; July 22, 2008 +# checked over and set again on Friday; August 22, 2008 +# this version loops also the rmm value +type file{} + +type surfclust_table{} + + +(surfclust_table surfclustOutput) SurfClust (file specFile, file surfFile, file input, int threshVal, float rmmVal, string prefix){ + app { + SurfClust "-spec" @filename(specFile) "-surf_A" @filename(surfFile) "-input" @filename(input) "1 -rmm" rmmVal "-thresh_col 1 -thresh" threshVal "-amm2 2 -sort_n_nodes -prepend_node_index -prefix" prefix; + } +} + + +int vertexThresh[] = [9]; +#int permbrains = [2001:3000:1]; +int permbrains = [1:2:1]; +float rmm_vals = [2.2,2.5]; + +foreach brain in permbrains{ + foreach thresh in vertexThresh{ + foreach rmm in rmm_vals{ + file HORRYspec ; + file HORRYsurf ; + string inputName=@strcat("brain_",brain,"PermFriedman.txt"); + file inputFile ; + string outPrefix=@strcat(brain,"_Thresh",thresh); + surfclust_table surfclustOutput ; + (surfclustOutput) = SurfClust(HORRYspec,HORRYsurf,inputFile,thresh,rmm,outPrefix); + } + } +} From noreply at svn.ci.uchicago.edu Sat Aug 8 11:05:37 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Sat, 8 Aug 2009 11:05:37 -0500 (CDT) Subject: [Swift-commit] r3082 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations Message-ID: <20090808160537.5D4589CCA8@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-08 11:05:37 -0500 (Sat, 08 Aug 2009) New Revision: 3082 Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/concat_sort.py SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/permClst_dist.py SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/permClst_distOLD.py SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/untar.py Log: python script for handling the permutations Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/concat_sort.py =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/concat_sort.py (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/concat_sort.py 2009-08-08 16:05:37 UTC (rev 3082) @@ -0,0 +1,26 @@ +#!/usr/bin/python + +import os +import commands +import time + + +brains = range(1001,3001,1) +#brains = range(1,3,1) + +def concat_sort(nn): + commands.getoutput("cat "+`nn`+"PermFriedman*_*.txt > PermBrain"+`nn`+"_gather.txt") + print "gather file (PermBrain"+`nn`+"_gather.txt): "+commands.getoutput("wc PermBrain"+`nn`+"_gather.txt") + commands.getoutput("sort -g -k 1 PermBrain"+`nn`+"_gather.txt > PermBrain"+`nn`+"_output.txt") + print "count of sorted file (PermBrain"+`nn`+"_output.txt): "+commands.getoutput("wc PermBrain"+`nn`+"_output.txt") + commands.getoutput("rm -rf "+`nn`+"PermFriedman*_*.txt") + commands.getoutput("rm -rf PermBrain"+`nn`+"_gather.txt") + + + +os.chdir(os.getenv("cnari")+"/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/") +print os.getcwd() +print "starting concat_sort process\ntime is: "+time.ctime() + +for nn in brains: + concat_sort(nn) Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/permClst_dist.py =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/permClst_dist.py (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/permClst_dist.py 2009-08-08 16:05:37 UTC (rev 3082) @@ -0,0 +1,45 @@ +#!/usr/bin/python + +#---- revised coding: Saturday; August 23, 2008 +# reads a set of output files from surfclust +# and copies the line containing the largest +# cluster (most nodes) and writes all of +# those lines to a new file. +# if the output file contains no data, a +# 0 is entered + +### no user parameters need be entered + +import commands +import os +import sys +from stat import * + + +rmm_vals = ["2.2","2.5"] + + +def sort_dist(rmm): + file_list = commands.getoutput("ls *_Thresh9_ClstTable_r"+rmm+"_a2.0.1D") + + fl = file_list.split('\n') + + filename = "ClstDistribution_rhRMM"+rmm+"_Thresh9.txt" + perm_clust_out = open("ClstDistribution_rhRMM"+rmm+"_Thresh9.txt", "w") + + for f in fl: + sz = os.stat(f)[ST_SIZE] + if sz == 0: + perm_clust_out.write('0\n') + else: + clst_file = open(f, "r") + ln_16 = clst_file.readlines()[16] + perm_clust_out.write(ln_16) + clst_file.close() + + perm_clust_out.close() + commands.getoutput("sort -r -g -k 2 "+filename+" > srtdClstDistribution_rhRMM"+rmm+"_Thresh9.txt.txt") + + +for rmm in rmm_vals: + sort_dist(rmm) Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/permClst_distOLD.py =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/permClst_distOLD.py (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/permClst_distOLD.py 2009-08-08 16:05:37 UTC (rev 3082) @@ -0,0 +1,36 @@ +#!/usr/bin/python + +# reads a set of output files from surfclust +# and copies the line containing the largest +# cluster (most nodes) and writes all of +# those lines to a new file. +# if the output file contains no data, a +# 0 is entered + +### no user parameters need be entered + +import commands +import os +import sys +from stat import * + +file_list = commands.getoutput("ls *_Thresh9_ClstTable_r2.8_a2.0.1D") + +fl = file_list.split('\n') + + +filename = "permClst_distributionThresh9.txt" +perm_clust_out = open("permClst_distributionThresh9.txt", "w") + +for f in fl: + sz = os.stat(f)[ST_SIZE] + if sz == 0: + perm_clust_out.write('0\n') + else: + clst_file = open(f, "r") + ln_16 = clst_file.readlines()[16] + perm_clust_out.write(ln_16) + clst_file.close() + +perm_clust_out.close() +commands.getoutput("sort -r -g -k 2 "+filename+" > srtdPerm_DistributionThresh9.txt") Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/untar.py =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/untar.py (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/untar.py 2009-08-08 16:05:37 UTC (rev 3082) @@ -0,0 +1,12 @@ +#!/usr/bin/python + +import commands +import time +import os +import sys + + +os.chdir(os.getenv("cnari")+"/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/") +print os.getcwd() +print commands.getoutput("ls *PermFriedman*.tar | wc") +print commands.getoutput("find -name '*PermFriedman*.tar' -exec tar xvf '{}' ';'") From noreply at svn.ci.uchicago.edu Sat Aug 8 11:06:09 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Sat, 8 Aug 2009 11:06:09 -0500 (CDT) Subject: [Swift-commit] r3083 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations Message-ID: <20090808160609.D27849CCA8@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-08 11:06:09 -0500 (Sat, 08 Aug 2009) New Revision: 3083 Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/swift_execute.sh Log: shell script for executing swift Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/swift_execute.sh =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/swift_execute.sh (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/swift_execute.sh 2009-08-08 16:06:09 UTC (rev 3083) @@ -0,0 +1,3 @@ +#!/bin/tcsh + +swift -resume permclust-20080825-0158-xnryilcc.0.rlog permclust.swift -sites.file /disks/gpfs/fmri/cnari/swift/config/sites_ucanl64.xml -tc.file /disks/gpfs/fmri/cnari/swift/config/tc.data -user="andric" Property changes on: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/NewPermutations/swift_execute.sh ___________________________________________________________________ Name: svn:executable + * From noreply at svn.ci.uchicago.edu Sat Aug 8 17:04:15 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Sat, 8 Aug 2009 17:04:15 -0500 (CDT) Subject: [Swift-commit] r3084 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy Message-ID: <20090808220415.185FE9CC94@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-08 17:04:14 -0500 (Sat, 08 Aug 2009) New Revision: 3084 Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/FriedmanPerm.swift Log: new way of running Friedman test permutations Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/FriedmanPerm.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/FriedmanPerm.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/FriedmanPerm.swift 2009-08-08 22:04:14 UTC (rev 3084) @@ -0,0 +1,56 @@ +#---- coded 08.August.2009 +type file{} +type Rscript; +type AnalyConfig{ + file Rdata; + file txt; +} + +app (file rout) run_query (string allcatargs, file config, Rscript code, AnalyConfig permutationSetup){ + Mediator allcatargs @filename(code); +} + + +loop_query(int bvox, string user, string db, string host, string query_outline, Rscript code, file config, string id, string h, int perm, AnalyConfig permutationSetup, int batchstep){ + int evox = bvox+(batchstep-1); + string outName = @strcat("permout",h,"/perm",perm,"_",h,bvox,"_",evox); + string med_args = @strcat("--user ","andric", + " --conf ", @filename(config), + " --db ", db, + " --host ", host, + " --query ", query_outline, + " --r_script ", @filename(code), + " --begin_vox ", bvox, + " --end_vox ", evox, + " --outprefix ", "TOLDJA", + " --batchstep ", batchstep, + " --r_swift_args ", outName," ",perm, + " --subject ", id); + file r_result ; + r_result = run_query(med_args, config, code, permutationSetup); +} + +string user = @arg("user"); +string db = "EMBLEM1"; +string host = "tp-neurodb.ci.uchicago.edu"; +file config; + +Rscript code; +AnalyConfig permutationSetup; + +string hemilist[] = ["lh"]; +int batchstep = 7000; +#int permbrains[] = [1:3000:1]; +int permbrains[] = [1:2:1]; +#int mybatches[] = [1:196000:batchstep]; +int mybatches[] = [1:14000:batchstep]; +string id = "perminterp"; + +foreach h in hemilist{ + foreach perm in permbrains{ + foreach batch in mybatches{ + string query_outline = @strcat("SELECT subject, vertex, speech_lag, emblem_lag, embspeech_lag FROM interpCCF_",h," WHERE vertex BETWEEN BEGIN_BATCH and END_BATCH"); + loop_query(batch, user, db, host, query_outline, code, config, id, h, perm, permutationSetup, batchstep); + } + } +} From noreply at svn.ci.uchicago.edu Sat Aug 8 23:47:19 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Sat, 8 Aug 2009 23:47:19 -0500 (CDT) Subject: [Swift-commit] r3086 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/PermScripts Message-ID: <20090809044719.944339CCA8@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-08 23:47:19 -0500 (Sat, 08 Aug 2009) New Revision: 3086 Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/PermScripts/FriedmanPerm.R Log: the .Rdata now loads both 'config' and 'ss_config' because was having trouble getting the ss config file fully transfered to grid site Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/PermScripts/FriedmanPerm.R =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/PermScripts/FriedmanPerm.R 2009-08-08 22:05:58 UTC (rev 3085) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/PermScripts/FriedmanPerm.R 2009-08-09 04:47:19 UTC (rev 3086) @@ -1,5 +1,5 @@ #---- doing friedman permutations -#---- coded Tuesday; July 22, 2008 +#---- coded 08.August.2009 #---- this is the function used in the aggregate: FriedmanPerm <- function(x){ @@ -24,11 +24,9 @@ inputfile <- Sys.getenv("R_INPUT") print(inputfile) Query_out <- as.matrix(read.table(inputfile)) -load("PermScripts/PermConfig.Rdata") -config_subjs <- as.matrix(read.table("PermScripts/PermConfig.txt")) -subj_resamp <- which(as.vector(config_subjs[configLine,])==1) +load("PermScripts/FriedmanPerm.Rdata.Rdata") ## this loads 'ss_config' (for ss) and 'config' (condition orders for diff perms across subjs) +subj_resamp <- which(as.vector(ss_config[configLine,])==1) - #---- this is where the fun begins: data_stack <- stack(data.frame(Query_out[,3:5]))[1] vertices <- Query_out[,2] From noreply at svn.ci.uchicago.edu Sat Aug 8 23:49:47 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Sat, 8 Aug 2009 23:49:47 -0500 (CDT) Subject: [Swift-commit] r3087 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/PermScripts Message-ID: <20090809044947.9F3449CCA8@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-08 23:49:47 -0500 (Sat, 08 Aug 2009) New Revision: 3087 Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/PermScripts/FriedmanPerm.R Log: had a type in the previous Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/PermScripts/FriedmanPerm.R =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/PermScripts/FriedmanPerm.R 2009-08-09 04:47:19 UTC (rev 3086) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/PermScripts/FriedmanPerm.R 2009-08-09 04:49:47 UTC (rev 3087) @@ -24,7 +24,7 @@ inputfile <- Sys.getenv("R_INPUT") print(inputfile) Query_out <- as.matrix(read.table(inputfile)) -load("PermScripts/FriedmanPerm.Rdata.Rdata") ## this loads 'ss_config' (for ss) and 'config' (condition orders for diff perms across subjs) +load("PermScripts/FriedmanPerm.Rdata") ## this loads 'ss_config' (for ss) and 'config' (condition orders for diff perms across subjs) subj_resamp <- which(as.vector(ss_config[configLine,])==1) #---- this is where the fun begins: From noreply at svn.ci.uchicago.edu Sat Aug 8 23:56:31 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Sat, 8 Aug 2009 23:56:31 -0500 (CDT) Subject: [Swift-commit] r3088 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/PermScripts Message-ID: <20090809045631.B31909CCA8@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-08 23:56:31 -0500 (Sat, 08 Aug 2009) New Revision: 3088 Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/PermScripts/generate_PermEnv.R Log: used to generate FriedmanPerm.Rdata Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/PermScripts/generate_PermEnv.R =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/PermScripts/generate_PermEnv.R (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/PermScripts/generate_PermEnv.R 2009-08-09 04:56:31 UTC (rev 3088) @@ -0,0 +1,14 @@ +config <- array(0,c(4000,3,24)) +for (i in 1:ncol(config[1,,])){ + config[,,i] <- sample(1:3) +} + +cc <- as.vector(c(rep(0,12),rep(1,12))) +ss_config <- matrix(nrow=3000,ncol=24) +mat_row <- 0; + +for (i in 1:nrow(ss_config)){ + mat_row <- mat_row + 1 + ss_config[mat_row,] <- c(sample(cc)) +} +save(config,ss_config,file="FriedmanPerm.Rdata") From noreply at svn.ci.uchicago.edu Sun Aug 9 00:03:28 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Sun, 9 Aug 2009 00:03:28 -0500 (CDT) Subject: [Swift-commit] r3089 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy Message-ID: <20090809050328.B96359CCA8@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-09 00:03:28 -0500 (Sun, 09 Aug 2009) New Revision: 3089 Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/swift_execute.sh Log: running Permutations Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/swift_execute.sh =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/swift_execute.sh 2009-08-09 04:56:31 UTC (rev 3088) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/swift_execute.sh 2009-08-09 05:03:28 UTC (rev 3089) @@ -1,3 +1,3 @@ #!/bin/tcsh -swift lh_NonParametric_lag_analy.swift -sites.file /ci/projects/cnari/config/coaster_ranger.xml -user="andric" +swift FriedmanPerm.swift -sites.file /ci/projects/cnari/config/coaster_ranger.xml -user="andric" From noreply at svn.ci.uchicago.edu Sun Aug 9 00:14:36 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Sun, 9 Aug 2009 00:14:36 -0500 (CDT) Subject: [Swift-commit] r3090 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy Message-ID: <20090809051437.06AFC9CCA8@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-09 00:14:36 -0500 (Sun, 09 Aug 2009) New Revision: 3090 Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/FriedmanPerm.swift Log: updated to map only Rscript and Rdata with a new type Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/FriedmanPerm.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/FriedmanPerm.swift 2009-08-09 05:03:28 UTC (rev 3089) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/FriedmanPerm.swift 2009-08-09 05:14:36 UTC (rev 3090) @@ -1,17 +1,17 @@ #---- coded 08.August.2009 type file{} type Rscript; -type AnalyConfig{ +type PermAnaly{ + Rscript R; file Rdata; - file txt; } -app (file rout) run_query (string allcatargs, file config, Rscript code, AnalyConfig permutationSetup){ - Mediator allcatargs @filename(code); +app (file rout) run_query (string allcatargs, file config, PermAnaly code){ + Mediator allcatargs @code.R; } -loop_query(int bvox, string user, string db, string host, string query_outline, Rscript code, file config, string id, string h, int perm, AnalyConfig permutationSetup, int batchstep){ +loop_query(int bvox, string user, string db, string host, string query_outline, PermAnaly code, file config, string id, string h, int perm, int batchstep){ int evox = bvox+(batchstep-1); string outName = @strcat("permout",h,"/perm",perm,"_",h,bvox,"_",evox); string med_args = @strcat("--user ","andric", @@ -19,7 +19,7 @@ " --db ", db, " --host ", host, " --query ", query_outline, - " --r_script ", @filename(code), + " --r_script ", @filename(code.R), " --begin_vox ", bvox, " --end_vox ", evox, " --outprefix ", "TOLDJA", @@ -27,7 +27,7 @@ " --r_swift_args ", outName," ",perm, " --subject ", id); file r_result ; - r_result = run_query(med_args, config, code, permutationSetup); + r_result = run_query(med_args, config, code); } string user = @arg("user"); @@ -35,8 +35,7 @@ string host = "tp-neurodb.ci.uchicago.edu"; file config; -Rscript code; -AnalyConfig permutationSetup; +PermAnaly code; string hemilist[] = ["lh"]; int batchstep = 7000; @@ -50,7 +49,7 @@ foreach perm in permbrains{ foreach batch in mybatches{ string query_outline = @strcat("SELECT subject, vertex, speech_lag, emblem_lag, embspeech_lag FROM interpCCF_",h," WHERE vertex BETWEEN BEGIN_BATCH and END_BATCH"); - loop_query(batch, user, db, host, query_outline, code, config, id, h, perm, permutationSetup, batchstep); + loop_query(batch, user, db, host, query_outline, code, config, id, h, perm, batchstep); } } } From noreply at svn.ci.uchicago.edu Sun Aug 9 01:12:33 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Sun, 9 Aug 2009 01:12:33 -0500 (CDT) Subject: [Swift-commit] r3091 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy Message-ID: <20090809061233.813699CCAD@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-09 01:12:33 -0500 (Sun, 09 Aug 2009) New Revision: 3091 Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/FriedmanPerm.swift Log: production version Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/FriedmanPerm.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/FriedmanPerm.swift 2009-08-09 05:14:36 UTC (rev 3090) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/FriedmanPerm.swift 2009-08-09 06:12:33 UTC (rev 3091) @@ -39,10 +39,8 @@ string hemilist[] = ["lh"]; int batchstep = 7000; -#int permbrains[] = [1:3000:1]; -int permbrains[] = [1:2:1]; -#int mybatches[] = [1:196000:batchstep]; -int mybatches[] = [1:14000:batchstep]; +int permbrains[] = [1:2000:1]; +int mybatches[] = [1:196000:batchstep]; string id = "perminterp"; foreach h in hemilist{ From noreply at svn.ci.uchicago.edu Mon Aug 10 09:22:56 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Mon, 10 Aug 2009 09:22:56 -0500 (CDT) Subject: [Swift-commit] r3092 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy Message-ID: <20090810142256.AA0129CCAD@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-10 09:22:56 -0500 (Mon, 10 Aug 2009) New Revision: 3092 Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/surfclust.swift Log: updated swift Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/surfclust.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/surfclust.swift (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/surfclust.swift 2009-08-10 14:22:56 UTC (rev 3092) @@ -0,0 +1,29 @@ +type file{} + +(file surfclustOutput[]) SurfClust (file specFile, file surfFile, file input, float threshVal, string prefix){ + app { + SurfClust "-spec" @filename(specFile) "-surf_A" @filename(surfFile) "-input" @filename(input) "1 -rmm 2.8 -thresh_col 1 -thresh" threshVal "-amm2 2 -sort_n_nodes -out_clusterdset -out_roidset -prepend_node_index -out_fulllist -prefix" prefix; + } +} + + +string SeedRegions = ["IDEAL"]; +string hemis = ["lh","rh"]; +int vertexThresh[] = [6,9]; + +foreach seed in SeedRegions{ + foreach h in hemis{ + foreach thresh in vertexThresh{ + file HORRYspec ; + file HORRYsurf ; + file inputFile ; + string outPrefix=@strcat(h,"_",seed,"_Thresh",thresh); + string vals_name = @strcat(outPrefix,"_Clustered_r2.8_a2.0.niml.dset, "); + string msk_name = @strcat(outPrefix,"_ClstMsk_r2.8_a2.0.niml.dset, "); + string table_name = @strcat(outPrefix,"_ClstTable_r2.8_a2.0.1D"); + string out_files = @strcat(vals_name, msk_name, table_name); + file surfclustOutput[] ; + (surfclustOutput) = SurfClust(HORRYspec,HORRYsurf,inputFile,thresh,outPrefix); + } + } +} From noreply at svn.ci.uchicago.edu Mon Aug 10 09:23:57 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Mon, 10 Aug 2009 09:23:57 -0500 (CDT) Subject: [Swift-commit] r3093 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy Message-ID: <20090810142357.D38E29CCAD@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-10 09:23:57 -0500 (Mon, 10 Aug 2009) New Revision: 3093 Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/surfclust.swift Log: now looping through rmm val Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/surfclust.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/surfclust.swift 2009-08-10 14:22:56 UTC (rev 3092) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/surfclust.swift 2009-08-10 14:23:57 UTC (rev 3093) @@ -1,8 +1,10 @@ +# coded Tuesday; July 22, 2008 +# this version also loops the rmm value type file{} -(file surfclustOutput[]) SurfClust (file specFile, file surfFile, file input, float threshVal, string prefix){ +(file surfclustOutput[]) SurfClust (file specFile, file surfFile, file input, float threshVal, float rmmVal, string prefix){ app { - SurfClust "-spec" @filename(specFile) "-surf_A" @filename(surfFile) "-input" @filename(input) "1 -rmm 2.8 -thresh_col 1 -thresh" threshVal "-amm2 2 -sort_n_nodes -out_clusterdset -out_roidset -prepend_node_index -out_fulllist -prefix" prefix; + SurfClust "-spec" @filename(specFile) "-surf_A" @filename(surfFile) "-input" @filename(input) "1" "-rmm" rmmVal "-thresh_col" "1" "-thresh" threshVal "-amm2" "2" "-sort_n_nodes" "-out_clusterdset" "-out_roidset" "-prepend_node_index" "-out_fulllist" "-prefix" prefix; } } @@ -10,20 +12,23 @@ string SeedRegions = ["IDEAL"]; string hemis = ["lh","rh"]; int vertexThresh[] = [6,9]; +float rmm_vals = [2.1,2.2]; foreach seed in SeedRegions{ foreach h in hemis{ foreach thresh in vertexThresh{ - file HORRYspec ; - file HORRYsurf ; - file inputFile ; - string outPrefix=@strcat(h,"_",seed,"_Thresh",thresh); - string vals_name = @strcat(outPrefix,"_Clustered_r2.8_a2.0.niml.dset, "); - string msk_name = @strcat(outPrefix,"_ClstMsk_r2.8_a2.0.niml.dset, "); - string table_name = @strcat(outPrefix,"_ClstTable_r2.8_a2.0.1D"); - string out_files = @strcat(vals_name, msk_name, table_name); - file surfclustOutput[] ; - (surfclustOutput) = SurfClust(HORRYspec,HORRYsurf,inputFile,thresh,outPrefix); + foreach rmm in rmm_vals{ + file HORRYspec ; + file HORRYsurf ; + file inputFile ; + string outPrefix=@strcat(h,"_",seed,"_Thresh",thresh); + string vals_name = @strcat(outPrefix,"_Clustered_r",rmm,"_a2.0.niml.dset, "); + string msk_name = @strcat(outPrefix,"_ClstMsk_r",rmm,"_a2.0.niml.dset, "); + string table_name = @strcat(outPrefix,"_ClstTable_r",rmm,"_a2.0.1D"); + string out_files = @strcat(vals_name, msk_name, table_name); + file surfclustOutput[] ; + (surfclustOutput) = SurfClust(HORRYspec,HORRYsurf,inputFile,thresh,rmm,outPrefix); + } } } } From noreply at svn.ci.uchicago.edu Mon Aug 10 09:25:16 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Mon, 10 Aug 2009 09:25:16 -0500 (CDT) Subject: [Swift-commit] r3094 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy Message-ID: <20090810142516.6C05D9CCAD@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-10 09:25:16 -0500 (Mon, 10 Aug 2009) New Revision: 3094 Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/surfclust.swift Log: correctly iterating through rmm as 'float' val Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/surfclust.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/surfclust.swift 2009-08-10 14:23:57 UTC (rev 3093) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/surfclust.swift 2009-08-10 14:25:16 UTC (rev 3094) @@ -1,18 +1,19 @@ # coded Tuesday; July 22, 2008 +#---- re-coded: Sunday; August 24, 2008 # this version also loops the rmm value type file{} -(file surfclustOutput[]) SurfClust (file specFile, file surfFile, file input, float threshVal, float rmmVal, string prefix){ +(file surfclustOutput[]) SurfClust (file specFile, file surfFile, file input, int threshVal, float rmmVal, string prefix){ app { SurfClust "-spec" @filename(specFile) "-surf_A" @filename(surfFile) "-input" @filename(input) "1" "-rmm" rmmVal "-thresh_col" "1" "-thresh" threshVal "-amm2" "2" "-sort_n_nodes" "-out_clusterdset" "-out_roidset" "-prepend_node_index" "-out_fulllist" "-prefix" prefix; } } -string SeedRegions = ["IDEAL"]; -string hemis = ["lh","rh"]; +string SeedRegions[] = ["IDEAL"]; +string hemis[] = ["lh","rh"]; int vertexThresh[] = [6,9]; -float rmm_vals = [2.1,2.2]; +float rmm_vals[] = [2.5]; foreach seed in SeedRegions{ foreach h in hemis{ @@ -20,7 +21,7 @@ foreach rmm in rmm_vals{ file HORRYspec ; file HORRYsurf ; - file inputFile ; + file inputFile ; string outPrefix=@strcat(h,"_",seed,"_Thresh",thresh); string vals_name = @strcat(outPrefix,"_Clustered_r",rmm,"_a2.0.niml.dset, "); string msk_name = @strcat(outPrefix,"_ClstMsk_r",rmm,"_a2.0.niml.dset, "); From noreply at svn.ci.uchicago.edu Mon Aug 10 10:24:11 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Mon, 10 Aug 2009 10:24:11 -0500 (CDT) Subject: [Swift-commit] r3095 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy Message-ID: <20090810152411.CAA509CCAD@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-10 10:24:11 -0500 (Mon, 10 Aug 2009) New Revision: 3095 Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/surfclust.swift Log: clustering the interp output. cleaned up the code. Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/surfclust.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/surfclust.swift 2009-08-10 14:25:16 UTC (rev 3094) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/surfclust.swift 2009-08-10 15:24:11 UTC (rev 3095) @@ -1,35 +1,31 @@ -# coded Tuesday; July 22, 2008 -#---- re-coded: Sunday; August 24, 2008 -# this version also loops the rmm value +#---- re-coded: 10.August.2009 type file{} -(file surfclustOutput[]) SurfClust (file specFile, file surfFile, file input, int threshVal, float rmmVal, string prefix){ - app { - SurfClust "-spec" @filename(specFile) "-surf_A" @filename(surfFile) "-input" @filename(input) "1" "-rmm" rmmVal "-thresh_col" "1" "-thresh" threshVal "-amm2" "2" "-sort_n_nodes" "-out_clusterdset" "-out_roidset" "-prepend_node_index" "-out_fulllist" "-prefix" prefix; - } +app (file surfclustOutput[]) SurfClust (file spec, file pial, file inputFile, float thresh, float rmm, string outPrefix){ + SurfClust "-spec" @spec "-surf_A" @pial "-input" @inputFile "1" + "-rmm" rmm "-thresh_col" "1" "-thresh" thresh "-amm2" "2" "-sort_n_nodes" + "-out_clusterdset" "-out_roidset" "-prepend_node_index" "-out_fulllist" "-prefix" outPrefix; } -string SeedRegions[] = ["IDEAL"]; +string id = "interp"; string hemis[] = ["lh","rh"]; -int vertexThresh[] = [6,9]; -float rmm_vals[] = [2.5]; +float vertexThresh[] = [5.95, 8.8]; +float rmm_vals[] = [2.2, 2.5, 3.1]; -foreach seed in SeedRegions{ - foreach h in hemis{ - foreach thresh in vertexThresh{ - foreach rmm in rmm_vals{ - file HORRYspec ; - file HORRYsurf ; - file inputFile ; - string outPrefix=@strcat(h,"_",seed,"_Thresh",thresh); - string vals_name = @strcat(outPrefix,"_Clustered_r",rmm,"_a2.0.niml.dset, "); - string msk_name = @strcat(outPrefix,"_ClstMsk_r",rmm,"_a2.0.niml.dset, "); - string table_name = @strcat(outPrefix,"_ClstTable_r",rmm,"_a2.0.1D"); - string out_files = @strcat(vals_name, msk_name, table_name); - file surfclustOutput[] ; - (surfclustOutput) = SurfClust(HORRYspec,HORRYsurf,inputFile,thresh,rmm,outPrefix); - } +foreach h in hemis{ + foreach thresh in vertexThresh{ + foreach rmm in rmm_vals{ + file spec; + file pial; + file inputFile ; + string outPrefix=@strcat("output",h,"/interp",h,"Thresh",thresh); + string vals_name = @strcat(outPrefix,"_Clustered_r",rmm,"_a2.0.niml.dset, "); + string msk_name = @strcat(outPrefix,"_ClstMsk_r",rmm,"_a2.0.niml.dset, "); + string table_name = @strcat(outPrefix,"_ClstTable_r",rmm,"_a2.0.1D"); + string out_files = @strcat(vals_name, msk_name, table_name); + file surfclustOutput[]; + surfclustOutput = SurfClust(spec, pial, inputFile, thresh, rmm, outPrefix); } } } From noreply at svn.ci.uchicago.edu Mon Aug 10 10:35:29 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Mon, 10 Aug 2009 10:35:29 -0500 (CDT) Subject: [Swift-commit] r3096 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy Message-ID: <20090810153529.467139CCAD@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-10 10:35:28 -0500 (Mon, 10 Aug 2009) New Revision: 3096 Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/swift_surfclust.sh Log: shell script for executing surfclust.swift Added: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/swift_surfclust.sh =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/swift_surfclust.sh (rev 0) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/swift_surfclust.sh 2009-08-10 15:35:28 UTC (rev 3096) @@ -0,0 +1,3 @@ +#!/bin/tcsh + +swift surfclust.swift -sites.file /ci/projects/cnari/config/sites_bsd.xml -user="andric" Property changes on: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/swift_surfclust.sh ___________________________________________________________________ Name: svn:executable + * From noreply at svn.ci.uchicago.edu Tue Aug 11 09:09:57 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Tue, 11 Aug 2009 09:09:57 -0500 (CDT) Subject: [Swift-commit] r3097 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy Message-ID: <20090811140957.1712B9CCAE@vm-125-59.ci.uchicago.edu> Author: andric Date: 2009-08-11 09:09:56 -0500 (Tue, 11 Aug 2009) New Revision: 3097 Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/surfclust.swift Log: using different rmm vals and .01 thresh Modified: SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/surfclust.swift =================================================================== --- SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/surfclust.swift 2009-08-10 15:35:28 UTC (rev 3096) +++ SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy/surfclust.swift 2009-08-11 14:09:56 UTC (rev 3097) @@ -10,8 +10,8 @@ string id = "interp"; string hemis[] = ["lh","rh"]; -float vertexThresh[] = [5.95, 8.8]; -float rmm_vals[] = [2.2, 2.5, 3.1]; +float vertexThresh[] = [8.8]; +float rmm_vals[] = [4.5, 5.1]; foreach h in hemis{ foreach thresh in vertexThresh{ From noreply at svn.ci.uchicago.edu Wed Aug 19 16:04:59 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Wed, 19 Aug 2009 16:04:59 -0500 (CDT) Subject: [Swift-commit] r3098 - usertools Message-ID: <20090819210459.826739CC8B@vm-125-59.ci.uchicago.edu> Author: aespinosa Date: 2009-08-19 16:04:59 -0500 (Wed, 19 Aug 2009) New Revision: 3098 Added: usertools/ranger-falkon/ Log: Initialized Falkon implementation on Ranger From noreply at svn.ci.uchicago.edu Wed Aug 19 16:06:15 2009 From: noreply at svn.ci.uchicago.edu (noreply at svn.ci.uchicago.edu) Date: Wed, 19 Aug 2009 16:06:15 -0500 (CDT) Subject: [Swift-commit] r3099 - usertools/ranger-falkon Message-ID: <20090819210615.304F89CC8B@vm-125-59.ci.uchicago.edu> Author: aespinosa Date: 2009-08-19 16:06:15 -0500 (Wed, 19 Aug 2009) New Revision: 3099 Added: usertools/ranger-falkon/trunk/ Log: Trunk