From 39afa828956e05065d12eb80bea3a8e3f3e75433 Mon Sep 17 00:00:00 2001
From: Christopher Schmied <schmied@mpi-cbg.de>
Date: Thu, 11 Jun 2015 14:42:53 +0200
Subject: [PATCH] Added dublicate_transformations.bsh

Added a switch in .yaml file for selecting dublication of transformation
Added a part in the snakefile for dublication of the transformation
in the pipeline
---
 spim_registration/timelapse/Snakefile         | 34 +++++++++++++++++--
 .../timelapse/tomancak_test_cluster.yaml      |  9 +++--
 2 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/spim_registration/timelapse/Snakefile b/spim_registration/timelapse/Snakefile
index 812dccc..178e91c 100755
--- a/spim_registration/timelapse/Snakefile
+++ b/spim_registration/timelapse/Snakefile
@@ -253,9 +253,37 @@ rule timelapse:
                                     jdir=JOBDIR)
         cmd_string += " > {log} 2>&1 && touch {output}"
         shell(cmd_string)
-        
+
+rule dublicate_transformations:
+    input: rules.timelapse.output, merged_xml="{xml_base}_merge.xml"
+    output: rules.timelapse.output[0] + "_dublicate"
+    log: "{xml_base}_dublicate_transformations.log"
+    run:
+        cmd_string = produce_string(
+        	"""{fiji-prefix} {fiji-app} 
+        -Dimage_file_directory={jdir} \
+	-Dmerged_xml={merged_xml} \
+	-Dprocess_timepoint_timelapse={timelapse_process_timepoints} \
+	-Dprocess_illumination={reg_process_illumination} \
+	-Dprocess_angle={reg_process_angle} \
+	-Dsource_dublication={source_dublication} \
+	-Dtarget_dublication={target_dublication} \
+	-Dduplicate_which_transformations={duplicate_which_transformations} \
+        -- --no-splash {path_bsh}""",     	
+                                    config["common"],
+                                    config["registration"],
+                                    config["timelapse"],
+                                    config["dublicate_channel"],
+                                    path_bsh=config["common"]["bsh_directory"] + config["Dublicate_transformations"]["bsh_file"],
+                                    jdir=JOBDIR,
+                                    file_id_w="{wildcards.file_id}",
+                                    merged_xml_file="{input.merged_xml}"
+        )
+        cmd_string += " > {log} 2>&1 && touch {output}"
+        shell(cmd_string)
+
 rule fusion:
-    input: rules.timelapse.output, "{xml_base}-{file_id,\d+}-00.h5", merged_xml="{xml_base}_merge.xml"
+    input: [ str("{xml_base}_merge.xml_" + config["common"]["transformation_switch"] ) ], "{xml_base}-{file_id,\d+}-00.h5", merged_xml="{xml_base}_merge.xml" # rules.timelapse.output, "{xml_base}-{file_id,\d+}-00.h5", merged_xml="{xml_base}_merge.xml"
     output: "{xml_base}-{file_id,\d+}-00.h5_fusion"
     log: "{xml_base}-{file_id,\d+}-00-fusion.log"
     run:
@@ -327,7 +355,7 @@ rule external_transform:
         shell(cmd_string)
 
 rule deconvolution:
-    input: rules.timelapse.output, "{xml_base}-{file_id,\d+}-00.h5", merged_xml="{xml_base}_merge.xml" # rules.external_transform.output, "{xml_base}-{file_id,\d+}-00.h5", merged_xml="{xml_base}_merge.xml"
+    input: [ str("{xml_base}_merge.xml_" + config["common"]["transformation_switch"] ) ], "{xml_base}-{file_id,\d+}-00.h5", merged_xml="{xml_base}_merge.xml" # rules.timelapse.output, "{xml_base}-{file_id,\d+}-00.h5", merged_xml="{xml_base}_merge.xml" # rules.external_transform.output, "{xml_base}-{file_id,\d+}-00.h5", merged_xml="{xml_base}_merge.xml"
     output: "{xml_base}-{file_id,\d+}-00.h5_deconvolution"
     log: "{xml_base}-{file_id,\d+}-00-deconvolution.log"
     run:
diff --git a/spim_registration/timelapse/tomancak_test_cluster.yaml b/spim_registration/timelapse/tomancak_test_cluster.yaml
index 77c7621..60b1688 100755
--- a/spim_registration/timelapse/tomancak_test_cluster.yaml
+++ b/spim_registration/timelapse/tomancak_test_cluster.yaml
@@ -15,8 +15,10 @@ common: {
   pixel_distance_y: '0.28590106964',
   pixel_distance_z: '1.50000',
   pixel_unit: "um",
-  fusion_switch: "deconvolution"
-  # fusion_switch: "fusion"
+  # transformation_switch: "timelapse_dublicate",
+  transformation_switch: "timelapse",
+  # fusion_switch: "deconvolution"
+  fusion_switch: "fusion"
   }
               
 define_xml_czi: {
@@ -92,7 +94,8 @@ timelapse: {
 Dublicate_transformations: {
   source_dublication: "red",
   target_dublication: "green",
-  bsh_file: "dublicate_channel.bsh"
+  duplicate_which_transformations: '"Replace all transformations"',
+  bsh_file: "Dublicate_transformations.bsh"
   }
   
 fusion: {
-- 
GitLab