changeset 3:529f702f943e draft

Uploaded
author holtgrewe
date Mon, 06 May 2013 12:55:44 -0400
parents 08cb79ffac4c
children 1a5ea7128b6a
files ngs_roi/app.py roi_details.xml roi_plot_thumbnails.xml roi_report.xml roi_table.xml
diffstat 5 files changed, 19 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/ngs_roi/app.py	Mon May 06 12:46:46 2013 -0400
+++ b/ngs_roi/app.py	Mon May 06 12:55:44 2013 -0400
@@ -44,8 +44,16 @@
     def __init__(self, args):
         self.args = args
 
+    def _mkLinks(self):
+        """Create symlink."""
+        subprocess.call(['ln', '-s', self.args.in_file, self.args.in_file + '.roi'])
+
+    def _rmLinks(self):
+        """Remove symlink."""
+        subprocess.call(['rm', '-f', self.args.in_file + '.roi'])
+
     def run(self):
-        cmd_args = ['-if', self.args.in_file,
+        cmd_args = ['-if', self.args.in_file + '.roi',
                     '-o', os.path.join(self.args.out_dir, 'thumbnail_'),
                     '--max-rois', self.args.max_rois,
                     '--max-value', self.args.max_value,
@@ -59,8 +67,10 @@
         #import pdb; pdb.set_trace()
         import sys
         print >>sys.stderr, 'Running %s' % ' '.join(cmd_args)
+        self._mkLinks()
         p = subprocess.Popen(cmd_args, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
         res = p.wait()
+        self._rmLinks()
         if res:
             print 'ERROR', p.stdin, p.stderr
         return res
--- a/roi_details.xml	Mon May 06 12:46:46 2013 -0400
+++ b/roi_details.xml	Mon May 06 12:55:44 2013 -0400
@@ -3,10 +3,6 @@
     <description>ROI Details</description>
 
     <command interpreter="python">
-    ln -s ${input} ${input}.${ext}
-
-    ;
-
     roi_details.py --in-file $input --out-file "$out_file" --out-dir "$out_file.files_path"
     #if $max_rois    # --max-rois $max_rois #end if
     #if $link_target # --link-target $link_target #end if
@@ -16,10 +12,6 @@
     #if $ucsc_org    # --ucsc-org $ucsc_org #end if
     #if $ucsc_db     # --ucsc-db $ucsc_db #end if
     #if $ucsc_chr_prefix # --ucsc-chr-prefix "$ucsc_chr_prefix" #end if
-
-    ;
-
-    rm -f ${input} ${input}.${ext}
     </command>
 
     <!--
--- a/roi_plot_thumbnails.xml	Mon May 06 12:46:46 2013 -0400
+++ b/roi_plot_thumbnails.xml	Mon May 06 12:55:44 2013 -0400
@@ -3,12 +3,8 @@
   <description>Create ROI thumbnail plot grids.</description>
   <!-- First execute HTMl generation (will also create output path), then
        perform PNG creation. -->
-  <command>
-    ln -s ${input} ${input}.${input.ext}
-
-    ;
-
-    python roi_plot_thumbnails.py --in-file $input --out-file "$out_file" --out-dir "$out_file.files_path"
+  <command interpreter="python">
+    roi_plot_thumbnails.py --in-file $input --out-file "$out_file" --out-dir "$out_file.files_path"
     #if $max_rois    # --max-rois $max_rois #end if
     #if $num_rows    # --num-rows $num_rows #end if
     #if $num_cols    # --num-cols $num_cols #end if
@@ -24,6 +20,10 @@
 
     &amp;&amp;
 
+    ln -s ${input} ${input}.${input.ext}
+
+    ;
+
     roi_plot_thumbnails -if $input -o "${out_file.files_path}/thumbnail_"
     #if $max_rois    # --max-rois $max_rois #end if
     #if $num_rows    # --num-rows $num_rows #end if
--- a/roi_report.xml	Mon May 06 12:46:46 2013 -0400
+++ b/roi_report.xml	Mon May 06 12:55:44 2013 -0400
@@ -3,15 +3,7 @@
     <description>ROI Overview Report</description>
 
     <command interpreter="python">
-    ln -s ${input} ${input}.${input.ext}
-
-    ;
-
     roi_report.py --in-file $input --out-file "$out_file" --out-dir "$out_file.files_path"
-
-    ;
-
-    rm -f ${input}.${input.ext}
     </command>
 
     <!--
--- a/roi_table.xml	Mon May 06 12:46:46 2013 -0400
+++ b/roi_table.xml	Mon May 06 12:55:44 2013 -0400
@@ -2,12 +2,8 @@
 <tool id="roi_table" name="ROI Table">
     <description>ROI Overview Report</description>
 
-    <command>
-    ln -s ${input} ${input}.${input.ext}
-      
-    ;
-
-    python roi_table.py --in-file $input --out-file "$out_file" --out-dir "$out_file.files_path"
+    <command interpreter="python">
+    roi_table.py --in-file $input --out-file "$out_file" --out-dir "$out_file.files_path"
     #if $max_rois    # --max-rois $max_rois #end if
     #if $plot_height # --plot-height $plot_height #end if
     #if $plot_width  # --plot-width $plot_width #end if
@@ -18,10 +14,6 @@
     #if $ucsc_org    # --ucsc-org $ucsc_org #end if
     #if $ucsc_db     # --ucsc-db $ucsc_db #end if
     #if $ucsc_chr_prefix # --ucsc-chr-prefix "$ucsc_chr_prefix" #end if
-
-    ;
-
-    rm -f ${input}.${input.ext}
     </command>
 
     <!--