[Swift-commit] r2501 - in SwiftApps/SIDGrid/swift: . swift_scripts swift_scripts/R swift_scripts/db_query swift_scripts/freesurfer

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Fri Feb 6 12:50:33 CST 2009


Author: skenny
Date: 2009-02-06 12:50:33 -0600 (Fri, 06 Feb 2009)
New Revision: 2501

Added:
   SwiftApps/SIDGrid/swift/swift_scripts/
   SwiftApps/SIDGrid/swift/swift_scripts/R/
   SwiftApps/SIDGrid/swift/swift_scripts/R/ccf-perm-wf.swift
   SwiftApps/SIDGrid/swift/swift_scripts/R/permutations.swift
   SwiftApps/SIDGrid/swift/swift_scripts/db_query/
   SwiftApps/SIDGrid/swift/swift_scripts/db_query/ccf.swift
   SwiftApps/SIDGrid/swift/swift_scripts/db_query/query.swift
   SwiftApps/SIDGrid/swift/swift_scripts/freesurfer/
   SwiftApps/SIDGrid/swift/swift_scripts/freesurfer/README
   SwiftApps/SIDGrid/swift/swift_scripts/freesurfer/autorecon1.swift
   SwiftApps/SIDGrid/swift/swift_scripts/freesurfer/reconall.swift
Log:
all working swift scripts

Added: SwiftApps/SIDGrid/swift/swift_scripts/R/ccf-perm-wf.swift
===================================================================
--- SwiftApps/SIDGrid/swift/swift_scripts/R/ccf-perm-wf.swift	                        (rev 0)
+++ SwiftApps/SIDGrid/swift/swift_scripts/R/ccf-perm-wf.swift	2009-02-06 18:50:33 UTC (rev 2501)
@@ -0,0 +1,30 @@
+type file{}
+
+(file pdfFile, file resA, file resB) permScript (file scriptFile, file tsfile, file preprocR, file peakfitR){
+	app{
+		RPermInvoke @filename(scriptFile)  @filename(tsfile)  @filename(pdfFile) @filename(resA) @filename(resB);
+	}
+}
+
+
+genPerms(){
+	file script<"scripts/Shellpeak.R">;
+	file preprocR<"inputs/preprocess.Enewsmooth.R">;
+	file peakfitR<"inputs/peakfit_2.1.R">;
+	
+	int inputFileNo[] = [57:70];
+        foreach file in inputFileNo {
+                string inputName=@strcat("inputs/ts.",file);
+		string outputPDFName=@strcat("result.",file,".pdf");
+		string outputAName=@strcat("result.",file,".a");
+		string outputBName=@strcat("result.",file,".b");
+
+		file inFile<single_file_mapper; file=inputName>;
+		file outPDFFile<single_file_mapper; file=outputPDFName>;
+		file outAFile<single_file_mapper; file=outputAName>;
+		file outBFile<single_file_mapper; file=outputBName>;
+                (outPDFFile,outAFile,outBFile)=permScript(script,inFile, preprocR, peakfitR);
+        }
+}
+
+genPerms();

Added: SwiftApps/SIDGrid/swift/swift_scripts/R/permutations.swift
===================================================================
--- SwiftApps/SIDGrid/swift/swift_scripts/R/permutations.swift	                        (rev 0)
+++ SwiftApps/SIDGrid/swift/swift_scripts/R/permutations.swift	2009-02-06 18:50:33 UTC (rev 2501)
@@ -0,0 +1,35 @@
+# for running the script permutations.R
+# swift will give R the permutations number
+# and the matrices for running the t-test
+# and will produce a file <permnumber>.dat
+
+type file{}
+
+(file rout) perm_r (file infilename, file pmatrix, int pnum, string outfilename, file scriptname)
+	{
+	app
+		{
+                Rcmd  @filename(infilename) @filename(pmatrix) pnum outfilename @filename(scriptname);
+		}
+	}
+
+string user = @arg("user");
+
+## the .R script is hardcoded here to use the version which 
+## will take the commandline arg for the permutation number
+
+file r_script<single_file_mapper; file="/disks/gpfs/fmri/cnari/scripts/permutations.R">;
+
+
+file perm_matrix<single_file_mapper; file="reduced.perm.matrix">;
+file ip<single_file_mapper; file="gestureB.lh.forperm.txt">;
+
+
+foreach i in [1:10]
+	{
+	file r_out <single_file_mapper; file=@strcat(i,".dat")>;
+	r_out = perm_r(ip, perm_matrix, i, @strcat(i,".dat"), r_script);
+	}
+
+
+	

Added: SwiftApps/SIDGrid/swift/swift_scripts/db_query/ccf.swift
===================================================================
--- SwiftApps/SIDGrid/swift/swift_scripts/db_query/ccf.swift	                        (rev 0)
+++ SwiftApps/SIDGrid/swift/swift_scripts/db_query/ccf.swift	2009-02-06 18:50:33 UTC (rev 2501)
@@ -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<single_file_mapper; file="scripts/grid_ccf.R">;
+file config<single_file_mapper; file="user.config">;
+
+string id = "backinCHI";
+
+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 <single_file_mapper; file=@strcat("results/",id,bvox,"_",evox,".qresult")>;
+	file r_result <single_file_mapper; file=@strcat(id,bvox,"_",evox,".tar")>;
+	(q_result, r_result) = run_query(med_args, r_script, config);
+}
+
+int mybatches = [0:10000:5000];
+
+foreach batch in mybatches {
+	loop_query(batch, user, db, host, query_outline, r_script, config, id);
+}

Added: SwiftApps/SIDGrid/swift/swift_scripts/db_query/query.swift
===================================================================
--- SwiftApps/SIDGrid/swift/swift_scripts/db_query/query.swift	                        (rev 0)
+++ SwiftApps/SIDGrid/swift/swift_scripts/db_query/query.swift	2009-02-06 18:50:33 UTC (rev 2501)
@@ -0,0 +1,53 @@
+## this is a script for running queries and passing the result to R
+## for analysis (via Mediator.py). 
+## all of the swift variables should be given your own values
+## for a query. in the 'query_outline', BEGIN_BATCH, END_BATCH
+## and SUBJECT will be filled-in on the remote site by Mediator.py
+## which will loop through and fill them in for each run based on the 
+## voxel range and step size you provide.
+
+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 gesture4B, gesture5B, gesture6B from emblemfemlh where voxel between BEGIN_BATCH and END_BATCH and subject=SUBJECT";
+
+file r_script<single_file_mapper; file="readInput.R">;
+file config<single_file_mapper; file="user.config">;
+
+string group_begin_vox = "1";
+string group_end_vox = "5000";
+string group_batchstep = "1000";
+
+string subj_ids = ["3","5","6","7","8","10","11","12","13","14","15"];
+foreach id,i in subj_ids {
+	string r_swift_args = @strcat("subj",id);
+	string med_args = @strcat("--user ", user,
+			  " --conf ", @filename(config),
+			  " --db ", db,
+			  " --host ", host,
+			  " --query ", query_outline,
+			  " --r_script ", @filename(r_script),
+			  " --begin_vox ", group_begin_vox,
+			  " --end_vox ", group_end_vox,
+			  " --subject ", id,
+			  " --batchstep ", "1000",
+			  " --r_swift_args ", r_swift_args,
+			  " --subject ", id);
+	file q_result <single_file_mapper; file=@strcat(id,".qresult")>;
+	file r_result <single_file_mapper; file=@strcat(id, ".tar")>;
+	(q_result, r_result) = run_query(med_args, r_script, config);
+}
+
+
+	

Added: SwiftApps/SIDGrid/swift/swift_scripts/freesurfer/README
===================================================================
--- SwiftApps/SIDGrid/swift/swift_scripts/freesurfer/README	                        (rev 0)
+++ SwiftApps/SIDGrid/swift/swift_scripts/freesurfer/README	2009-02-06 18:50:33 UTC (rev 2501)
@@ -0,0 +1,7 @@
+
+######## RECONALL 
+
+this version runs on uc/anl teragrid site using freesurfer 3. currently runs a single subject. see example
+execution below which points to the correct tc.data and sites.xml files.
+
+swift reconall.swift -sites.file /disks/gpfs/fmri/swifft/config/swift_sites_ucanl32.xml -tc.file  /disks/gpfs/fmri/swift/config/tc.data -user=skenny -subj=dude -user=skenny -inimage=001.mgz

Added: SwiftApps/SIDGrid/swift/swift_scripts/freesurfer/autorecon1.swift
===================================================================
--- SwiftApps/SIDGrid/swift/swift_scripts/freesurfer/autorecon1.swift	                        (rev 0)
+++ SwiftApps/SIDGrid/swift/swift_scripts/freesurfer/autorecon1.swift	2009-02-06 18:50:33 UTC (rev 2501)
@@ -0,0 +1,51 @@
+type file {}						
+type mgzfile;
+
+(file job_00) new_subject (string subj, mgzfile inimage) { 			
+    app {
+        create_subject @arg("user") subj @inimage stdout=@filename(job_00);
+    }
+}
+
+(file job_01) autorecon1_4 (string subj, file job_00) {
+    app {
+	reconall @arg("user") @strcat("-s ", subj, " -nuintensitycor") stdout=@filename(job_01);
+    }
+}
+
+(file job_02) autorecon1_5 (string subj, file job_01) {
+    app {
+	reconall @arg("user") @strcat("-s ", subj, " -talairach") stdout=@filename(job_02);
+    }
+}
+
+(file job_03) autorecon1_6 (string subj, file job_02) {
+    app {
+	reconall @arg("user") @strcat("-s ", subj, " -normalization") stdout=@filename(job_03);
+    }
+}
+
+(file job_04) autorecon1_7 (string subj, file job_03) {
+    app {
+	reconall @arg("user") @strcat("-s ", subj, " -skullstrip") stdout=@filename(job_04);
+    }
+}
+
+### tars the subject dir on remote site for tranfer back to host
+
+(file subject_data) get_subject (string subj, file job_04) {
+    app {
+	get_subject @arg("subject_path") subj @subject_data;
+	}
+}
+
+mgzfile inimage <single_file_mapper;file=@arg("inimage")>;
+string subj = @arg("subj");
+
+file sigstring00 = new_subject(subj, inimage);		
+file sigstring01 = autorecon1_4(subj, sigstring00);
+file sigstring02 = autorecon1_5(subj, sigstring01);
+file sigstring03 = autorecon1_6(subj, sigstring02);
+file sigstring04 = autorecon1_7(subj, sigstring03);
+file subject_data <single_file_mapper;file=@arg("subj_tree")>;
+subject_data = get_subject(subj, sigstring04);

Added: SwiftApps/SIDGrid/swift/swift_scripts/freesurfer/reconall.swift
===================================================================
--- SwiftApps/SIDGrid/swift/swift_scripts/freesurfer/reconall.swift	                        (rev 0)
+++ SwiftApps/SIDGrid/swift/swift_scripts/freesurfer/reconall.swift	2009-02-06 18:50:33 UTC (rev 2501)
@@ -0,0 +1,43 @@
+	type file {}						
+type mgzfile;
+
+(file subj_dir) recon1 (string subj, mgzfile inimage) { 			
+    app {
+        recon1 @arg("user") subj @inimage;
+    }
+}
+
+(file subj_dirL) recon2L (string subj, file subj_dir) {
+    app {
+	recon2L @arg("user") subj @subj_dir;
+	}
+}
+
+
+(file subj_dirR) recon2R (string subj, file subj_dir) {
+    app {
+	recon2R @arg("user") subj @subj_dir;
+	}
+}
+
+(file subj_dirCOMPLETE) reconFINAL (string subj, file subj_dirL, file subj_dirR) {
+    app {
+	reconFINAL @arg("user") subj @subj_dirL @subj_dirR;
+	}
+}
+	
+
+mgzfile inimage <single_file_mapper;file=@arg("inimage")>;
+string subj = @arg("subj");
+file subject_data <single_file_mapper;file=@strcat(subj, ".tar")>;
+file subject_data2L <single_file_mapper;file=@strcat(subj,"L.tar")>;
+file subject_data2R <single_file_mapper;file=@strcat(subj,"R.tar")>;
+file subject_dataCOMPLETE <single_file_mapper;file=@strcat(subj,"COMPLETE.tar")>;
+
+subject_data = recon1(subj, inimage);
+subject_data2L = recon2L (subj, subject_data);
+subject_data2R = recon2R (subj, subject_data);
+subject_dataCOMPLETE = reconFINAL (subj, subject_data2L, subject_data2R);
+
+
+




More information about the Swift-commit mailing list