[Swift-commit] r3076 - SwiftApps/SIDGrid/swift/projects/andric/ccf_emblem/NonParametric_lag_analy

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Fri Aug 7 14:56:55 CDT 2009


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 <single_file_mapper; file=@strcat("Qresults/",h,id,bvox,".qresult")>;
+    file r_result <single_file_mapper; file=@strcat(outName,".txt")>;
+    (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<single_file_mapper; file="scripts/FriedmanTest.R">;
 file config<single_file_mapper; file="user.config">;
 
+## mapping the R code
+Rscript code<single_file_mapper; file="scripts/FriedmanTest.R">;
 
-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 <single_file_mapper; file=@strcat("results/",theoutprefix,".qresult")>;
-    file r_result <single_file_mapper; file=@strcat(theoutprefix,".txt")>;
-    (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);
     }
 }




More information about the Swift-commit mailing list