changeset 128:de93d8e8a096 draft

Uploaded
author greg
date Wed, 22 Nov 2017 08:37:10 -0500
parents 1c49e78e4ee7
children d064db60a06d
files ideas.xml
diffstat 1 files changed, 64 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
--- a/ideas.xml	Wed Nov 22 08:36:59 2017 -0500
+++ b/ideas.xml	Wed Nov 22 08:37:10 2017 -0500
@@ -26,6 +26,8 @@
 $prep_input_config
 #if str($specify_genomic_window) == "yes":
     -bed '$specify_genomic_window_cond.bed_input'
+    #import collections
+    chroms = collections.OrderedDict()
 #else:
     -gsz '$chromInfo'
     -wsz $specify_genomic_window_cond.window_size
@@ -53,25 +55,72 @@
 && ls tmp/*.bed.gz > file2.txt
 && paste <(cat file1.txt) <(cat file2.txt) -d' ' > $prep_output_config
 ##############################################
-## If using a genomic window bed file, then
-## generate a text file that categorizes the
-## window positions by chromosome to enable
+## If using a genomic window bed file, categorize
+## the window positions by chromosome to enable
 ## the IDEAS -inv option.
 ##############################################
 #if str($specify_genomic_window) == "yes":
-  && python '$__tool_directory__/create_window_positions_by_chrom.py'
-  --input '$specify_genomic_window_cond.bed_input'
-  --output $window_positions_by_chrom
+    $categorize_window_positions_by_chrom
+    #for chrom, tup in $chroms.items():
+        && ideas
+        '$prep_output_config'
+        $ideas_options
+    #end for
+#else:
+    && ideas
+    '$prep_output_config'
+    $ideas_options
+    && mv ./*.cluster '$output_txt_dir'
+    && mv ./*.para '$output_txt_dir'
+    && mv ./*.profile '$output_txt_dir'
+    && mv ./*.state '$output_txt_dir'
+    -o '$project_name'
+    #if str($save_ideas_log) == "yes":
+        > $output_log
+    #else:
+        > /dev/null
+    #end if
+    && Rscript '$__tool_directory__/create_heatmap.R'
+    -i '$output_txt_dir'
+    -o '$output_pdf_dir'
 #end if
-##############################################
-## Run IDEAS
-##############################################
-&& ideas
-'$prep_output_config'
-#set specify_genomic_window = $specify_genomic_window_cond.specify_genomic_window
-#if str($specify_genomic_window) == "yes":
+    ]]></command>
+    <configfiles>
+        <configfile name="categorize_window_positions_by_chrom"><![CDATA[#with #open($specify_genomic_window_cond.bed_input, 'r') as fh:
+    #for count, line in enumerate($fh):
+        $line = $line.strip()
+        #if not $line or $line.startswith('#'):
+            #continue
+        items = $line.split('\t')
+        chrom = $items[0]
+        #if $chrom in $chroms:
+            tup = $chroms[$chrom]
+            $tup[1] += 1
+            $chroms[$chrom] = $tup
+        else:
+            $chroms[$chrom] = [$count, $count+1]]]></configfile>
+        <configfile name="gen_prep_input_config"><![CDATA[#if str($cell_type_epigenetic_factor_cond.cell_type_epigenetic_factor) == "extract":
+    #set input_name_positions = $cell_type_epigenetic_factor_cond.input_name_positions
+    #for $i in $cell_type_epigenetic_factor_cond.input:
+        #set file_name_with_ext = $i.name
+        #assert str($file_name_with_ext).find("-") >= 0, "The selected input '%s' is invalid because it does not include the '-' character which is required when setting cell type and epigenetic factor names by extracting them from the input file names." % $file_name_with_ext
+        #set file_name = $file_name_with_ext.split(".")[0]
+        #if str($input_name_positions) == "cell_first":
+            #set cell_type_name = $file_name.split("-")[0]
+            #set epigenetic_factor_name = $file_name.split("-")[1]
+        #else:
+            #set cell_type_name = $file_name.split("-")[1]
+            #set epigenetic_factor_name = $file_name.split("-")[0]
+        #end if
+${cell_type_name} ${epigenetic_factor_name} ${i}
+    #end for
+#else:
+    #for $input_items in $cell_type_epigenetic_factor_cond.input_repeat:
+${input_items.cell_type_name} ${input_items.epigenetic_factor_name} ${input_items.input}
+    #end for
+#end if]]></configfile>
+        <configfile name="ideas_options"><![CDATA[#if str($specify_genomic_window) == "yes":
     '$specify_genomic_window_cond.bed_input'
-    -inv $window_positions_by_chrom
 #else:
     $tmp_dir/*.bed
 #end if
@@ -102,42 +151,7 @@
     -maxerr $maxerr
 #end if
 -rseed $rseed
--thread \${GALAXY_SLOTS:-4}
--o '$project_name'
-#if str($save_ideas_log) == "yes":
-    > $output_log
-#else:
-    > /dev/null
-#end if
-&& mv ./*.cluster '$output_txt_dir'
-&& mv ./*.para '$output_txt_dir'
-&& mv ./*.profile '$output_txt_dir'
-&& mv ./*.state '$output_txt_dir'
-&& Rscript '$__tool_directory__/create_heatmap.R'
--i '$output_txt_dir'
--o '$output_pdf_dir'
-    ]]></command>
-    <configfiles>
-        <configfile name="gen_prep_input_config"><![CDATA[#if str($cell_type_epigenetic_factor_cond.cell_type_epigenetic_factor) == "extract":
-    #set input_name_positions = $cell_type_epigenetic_factor_cond.input_name_positions
-    #for $i in $cell_type_epigenetic_factor_cond.input:
-        #set file_name_with_ext = $i.name
-        #assert str($file_name_with_ext).find("-") >= 0, "The selected input '%s' is invalid because it does not include the '-' character which is required when setting cell type and epigenetic factor names by extracting them from the input file names." % $file_name_with_ext
-        #set file_name = $file_name_with_ext.split(".")[0]
-        #if str($input_name_positions) == "cell_first":
-            #set cell_type_name = $file_name.split("-")[0]
-            #set epigenetic_factor_name = $file_name.split("-")[1]
-        #else:
-            #set cell_type_name = $file_name.split("-")[1]
-            #set epigenetic_factor_name = $file_name.split("-")[0]
-        #end if
-${cell_type_name} ${epigenetic_factor_name} ${i}
-    #end for
-#else:
-    #for $input_items in $cell_type_epigenetic_factor_cond.input_repeat:
-${input_items.cell_type_name} ${input_items.epigenetic_factor_name} ${input_items.input}
-    #end for
-#end if]]></configfile>
+-thread \${GALAXY_SLOTS:-4}]]></configfile>
     </configfiles>
     <inputs>
         <conditional name="cell_type_epigenetic_factor_cond">