changeset 6:0158f7356ffd

Add new outputs and params to shear_sv.xml for version 2.3
author Jim Johnson <jj@umn.edu>
date Mon, 21 Oct 2013 08:54:58 -0500
parents aaaa5a071ff0
children 8180f6b0249b
files shear_sv.xml shear_wrapper.py
diffstat 2 files changed, 42 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/shear_sv.xml	Thu Oct 17 08:01:38 2013 -0500
+++ b/shear_sv.xml	Mon Oct 21 08:54:58 2013 -0500
@@ -13,7 +13,7 @@
   -->
   <command interpreter="python">
     shear_wrapper.py -j \$SHEAR_JAR_PATH/SHEAR.jar --command sv 
-    -p $prefix 
+    -p $prefix  ## used in gerenating ouput file names
     -b $bamfile 
      #if $genomeSource.refGenomeSource == 'indexed':
        -f $genomeSource.ref_fastas.fields.path 
@@ -29,14 +29,19 @@
          -D $sv_idx.extra_files_path
        #end if
      #end if
-     --report $report
-     --sdi $sdi
+     #if $region and $region.__str__.strip() != '':
+       -r $region
+     #end if
+     $sv_only
   </command>
   <inputs>
     <param name="bamfile" type="data" format="bam" label="BAM alignment file containing the input sequences to the assembly."/> 
+    <param name="prefix" type="hidden" value="shear_sv" label="Prefix for all generated files"/>
+    <!--
     <param name="prefix" type="text" value="shear_sv" label="Prefix for all generated files">
       <validator type="regex" message="Prefix should start with a letter and contain only letter, digit, and '_' or '-' characters">[a-zA-Z0-9][_a-zA-Z0-9-]*</validator>
     </param>
+    -->
     <!-- reference data -->
     <conditional name="genomeSource">
       <param name="refGenomeSource" type="select" label="Will you select a reference genome from your history or use a cached file?">
@@ -78,13 +83,33 @@
         <param name="svidx" type="data" format="shear.svidx" label="Select a reference from history" />
       </when>
     </conditional>
+    <param name="region" type="text" value="" optional="true" label="Region of the input alignment to analyze">
+      <help>"chr1" for full chromosome or "chr1:10000-15000" for a particular region, including endpoints). 
+             Coordinates are 1-based.
+      </help>
+      <validator type="regex" message="format: chr1:100-200">^\w+(:\d+-\d+)?$</validator>
+    </param>
+    <param name="sv_only" type="boolean" truevalue="--sv-only" falsevalue="" checked="false" label="SV Only prediction mode." 
+         help="Will skip SNP/INDEL prediction and only return *.sdi and *.report results for SVs."/>
   </inputs>
   <stdio>
     <exit_code range="1:" level="fatal" description="Error" />
   </stdio>
   <outputs>
-    <data format="shear.sdi" name="sdi" label="${tool.name} on ${on_string}: ${prefix}.sdi" />
-    <data format="txt" name="report" label="${tool.name} on ${on_string}: ${prefix}.report" />
+    <data format="txt" name="report_snpindel" label="${tool.name} on ${on_string}: ${prefix}.snpindel.report" from_work_dir="shear_sv.snpindel.report">
+      <filter>sv_only == False</filter>
+    </data>
+    <data format="txt" name="report_sv" label="${tool.name} on ${on_string}: ${prefix}.sv.report" from_work_dir="shear_sv.sv.report"/>
+    <data format="txt" name="report_all" label="${tool.name} on ${on_string}: ${prefix}.all.report" from_work_dir="shear_sv.all.report">
+      <filter>sv_only == False</filter>
+    </data>
+    <data format="shear.sdi" name="sdi_snpindel" label="${tool.name} on ${on_string}: ${prefix}.snpindel.sdi" from_work_dir="shear_sv.snpindel.sdi">
+      <filter>sv_only == False</filter>
+    </data>
+    <data format="shear.sdi" name="sdi_sv" label="${tool.name} on ${on_string}: ${prefix}.sv.sdi" from_work_dir="shear_sv.sv.sdi"/>
+    <data format="shear.sdi" name="sdi_all" label="${tool.name} on ${on_string}: ${prefix}.all.sdi" from_work_dir="shear_sv.all.sdi">
+      <filter>sv_only == False</filter>
+    </data>
     <data format="shear.svidx" name="sv_idx" label="${tool.name} on ${on_string}: ${prefix}.svidx">
       <filter>genomeSource['refGenomeSource'] == 'history' and genomeSource['save_svidx'] == True</filter>
     </data>
@@ -95,8 +120,10 @@
       <param name="bamfile" value="simulated-data.bam" ftype="bam" />
       <param name="refGenomeSource" value="history"/>
       <param name="ref_fasta" value="syn.fa" ftype="fasta" />
-      <output name="sdi"  file="shear_sv.sdi"/>
-      <output name="report"  file="shear_sv.report"/>
+      <param name="save_svidx" value="false"/>
+      <param name="sv_only" value="true"/>
+      <output name="sdi_sv"  file="shear_sv.sdi"/>
+      <output name="report_sv"  file="shear_sv.report"/>
     </test>
   </tests>
   <help>
--- a/shear_wrapper.py	Thu Oct 17 08:01:38 2013 -0500
+++ b/shear_wrapper.py	Mon Oct 21 08:54:58 2013 -0500
@@ -18,10 +18,12 @@
     parser.add_option( '-F', '--fasta_index', dest='fai', help='The .fai index file for the reference sequence fasta' )
     parser.add_option( '-t', '--twobit', dest='twobit', help='The .2bit encoding of the reference sequence fasta generated by faToTwoBit' )
     parser.add_option( '-i', '--bwa_index', dest='bwa_index', help='The bwa index of the reference sequence' )
-    parser.add_option( '-r', '--report', dest='report', help='The SHEAR output report' )
+    parser.add_option( '-R', '--report', dest='report', help='The SHEAR output report' )
     parser.add_option( '-s', '--sdi', dest='sdi', help='The SHEAR sdi input from the SHEAR sv command' )
     parser.add_option( '-o', '--output', dest='output', help='The SHEAR output assembly fasta file' )
     parser.add_option( '-D', '--svidx_dir', dest='svidx_dir', help='The SHEAR output assembly fasta file' )
+    parser.add_option( '-S', '--sv-only', dest='sv_only', action="store_true", help='SV Only prediction mode.' )
+    parser.add_option( '-r', '--region', dest='region', help='Region of the input alignment to analyze' )
     (options, args) = parser.parse_args()
 
     def make_ref(src, dest, copy=False):
@@ -50,6 +52,11 @@
     if command in ['sv']:
         args.append( '-p' )
         args.append( prefix )
+        if options.sv_only:
+            args.append('--sv-only')
+        if options.region:
+            args.append('-r')
+            args.append(options.region)
     if options.svidx_dir and command in ['sv']:
         if not os.path.isdir(options.svidx_dir):
             os.makedirs(options.svidx_dir)
@@ -220,19 +227,6 @@
         returncode = proc.wait()
         if returncode != 0:
             stop_err( 'Error running SHEAR ' + command, returncode )
-        if command in ['sv']:
-            report_path = os.path.join(os.getcwd(),prefix + '.report')
-            if os.path.exists(report_path):
-                if options.report:
-                    shutil.copy(report_path,options.report)
-            else:
-                raise Exception, 'no report file'
-            sdi_path = os.path.join(os.getcwd(),prefix + '.sdi')
-            if os.path.exists(sdi_path):
-                if options.sdi:
-                    shutil.copy(sdi_path,options.sdi)
-            else:
-                raise Exception, 'no sdi file'
     except Exception, e:
         # clean up temp dirs
         stop_err( 'Error running SHEAR %s %s' % (command,str(e)),9 )