changeset 45:aedaa66483f1 draft

Uploaded
author jjohnson
date Wed, 18 Oct 2017 16:55:57 -0400
parents 225750bf3770
children e500b50b72fd
files config_sub.sh create_reference_dataset.xml datamanager_create_reference.xml defuse.xml defuse_results_to_vcf.xml macros.xml make_html.sh tool_dependencies.xml
diffstat 8 files changed, 163 insertions(+), 188 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/config_sub.sh	Wed Oct 18 16:55:57 2017 -0400
@@ -0,0 +1,27 @@
+#!/bin/bash
+## substitute pathnames into config file
+#!/bin/bash
+SAMTOOLS_BIN=`which samtools`
+BOWTIE_BIN=`which bowtie`
+BOWTIE_BUILD_BIN=`which bowtie-build`
+BLAT_BIN=`which blat`
+FATOTWOBIT_BIN=`which faToTwoBit`
+GMAP_BIN=`which gmap`
+GMAP_BUILD_BIN=`which gmap_build`
+GMAP_SETUP_BIN=$GMAP_BUILD_BIN
+R_BIN=`which R`
+RSCRIPT_BIN=`which Rscript`
+
+cat $1 | sed "s#__SAMTOOLS_BIN__#${SAMTOOLS_BIN}#"| \
+sed "s#__BOWTIE_BIN__#${BOWTIE_BIN}#"| \
+sed "s#__BOWTIE_BUILD_BIN__#${BOWTIE_BUILD_BIN}#" | \
+sed "s#__BLAT_BIN__#${BLAT_BIN}#"| \
+sed "s#__FATOTWOBIT_BIN__#${FATOTWOBIT_BIN}#" | \
+sed "s#__GMAP_BIN__#${GMAP_BIN}#" | \
+sed "s#^gmap_setup_bin#gmap_build_bin#" | \
+sed "s#__GMAP_SETUP_BIN__#${GMAP_SETUP_BIN}#" | \
+sed "s#__GMAP_BUILD_BIN__#${GMAP_BUILD_BIN}#" | \
+sed "s#__R_BIN__#${R_BIN}#" | \
+sed "s#__RSCRIPT_BIN__#${RSCRIPT_BIN}#" > $2
+
+## if `grep __DEFUSE_PATH__ $defuse_config ${gt} /dev/null`;then sed -i'.tmp' "s#__DEFUSE_PATH__#\${DEFUSE_PATH}#" $defuse_config; fi
--- a/create_reference_dataset.xml	Mon Jan 04 15:55:00 2016 -0500
+++ b/create_reference_dataset.xml	Wed Oct 18 16:55:57 2017 -0400
@@ -5,7 +5,6 @@
     </macros>
     <requirements>
         <expand macro="defuse_requirement" />
-        <expand macro="mapping_requirements" />
     </requirements>
   <command interpreter="command"> /bin/bash $defuse_script </command>
  <inputs>
--- a/datamanager_create_reference.xml	Mon Jan 04 15:55:00 2016 -0500
+++ b/datamanager_create_reference.xml	Wed Oct 18 16:55:57 2017 -0400
@@ -1,19 +1,19 @@
-<tool id="data_manager_defuse_reference" name="DeFuse Reference DataManager" version="1.6.1" tool_type="manage_data">
+<tool id="data_manager_defuse_reference" name="DeFuse Reference DataManager" version="@DEFUSE_VERSION@.1" tool_type="manage_data">
  <description>create a defuse reference from Ensembl and UCSC sources</description>
- <requirements>
-  <requirement type="package" version="0.6.1">defuse</requirement>
-  <requirement type="package" version="0.1.18">samtools</requirement>
-  <requirement type="package" version="1.0.0">bowtie</requirement>
-  <requirement type="package" version="2013-05-09">gmap</requirement>
-  <requirement type="package" version="latest">kent</requirement>
- </requirements>
- <command interpreter="python"> datamanager_create_reference.py 
-    --dbkey $genome.ensembl_genome_version 
-    --description "$genome.ensembl_prefix $genome.ensembl_genome_version ($genome.ucsc_genome_version)"
-    --defuse_config $defuse_config
-    --defuse_script $defuse_script
-    $out_file
- </command>
+    <macros>
+        <import>macros.xml</import>
+    </macros>
+    <requirements>
+        <expand macro="defuse_requirement" />
+    </requirements>
+    <command interpreter="python"><![CDATA[
+        datamanager_create_reference.py 
+        --dbkey $genome.ensembl_genome_version 
+        --description "$genome.ensembl_prefix $genome.ensembl_genome_version ($genome.ucsc_genome_version)"
+        --defuse_config $defuse_config
+        --defuse_script $defuse_script
+        $out_file
+    ]]></command>
  <inputs>
   <conditional name="genome">
     <param name="choice" type="select" label="Select a Genome Build">
@@ -191,6 +191,7 @@
 fatotwobit_bin = __FATOTWOBIT_BIN__
 gmap_bin = __GMAP_BIN__
 gmap_setup_bin = __GMAP_SETUP_BIN__
+gmap_build_bin = __GMAP_BUILD_BIN__
 r_bin = __R_BIN__
 rscript_bin = __RSCRIPT_BIN__
 
@@ -246,29 +247,29 @@
 remove_job_temp_files                       = yes
 #end raw
   </configfile>
-  <configfile name="defuse_script">#slurp
+  <configfile name="defuse_script"><![CDATA[#slurp
 #!/bin/bash
 ## define some things for cheetah proccessing
-#set $amp = chr(38)
 #set $gt = chr(62)
 ## substitute pathnames into config file
-if `grep __DATASET_DIRECTORY__ $defuse_config ${gt} /dev/null`;then sed -i'.tmp' "s#__DATASET_DIRECTORY__#\$1#" $defuse_config; fi
-if `grep __DEFUSE_PATH__ $defuse_config ${gt} /dev/null`;then sed -i'.tmp' "s#__DEFUSE_PATH__#\${DEFUSE_PATH}#" $defuse_config; fi
-if `grep __SAMTOOLS_BIN__ $defuse_config ${gt} /dev/null` ${amp}${amp} SAMTOOLS_BIN=`which samtools`;then sed -i'.tmp' "s#__SAMTOOLS_BIN__#\${SAMTOOLS_BIN}#" $defuse_config; fi
-if `grep __BOWTIE_BIN__ $defuse_config ${gt} /dev/null` ${amp}${amp} BOWTIE_BIN=`which bowtie`;then sed -i'.tmp' "s#__BOWTIE_BIN__#\${BOWTIE_BIN}#" $defuse_config; fi
-if `grep __BOWTIE_BUILD_BIN__ $defuse_config ${gt} /dev/null` ${amp}${amp} BOWTIE_BUILD_BIN=`which bowtie-build`;then sed -i'.tmp' "s#__BOWTIE_BUILD_BIN__#\${BOWTIE_BUILD_BIN}#" $defuse_config; fi
-if `grep __BLAT_BIN__ $defuse_config ${gt} /dev/null` ${amp}${amp} BLAT_BIN=`which blat`;then sed -i'.tmp' "s#__BLAT_BIN__#\${BLAT_BIN}#" $defuse_config; fi
-if `grep __FATOTWOBIT_BIN__ $defuse_config ${gt} /dev/null` ${amp}${amp} FATOTWOBIT_BIN=`which faToTwoBit`;then sed -i'.tmp' "s#__FATOTWOBIT_BIN__#\${FATOTWOBIT_BIN}#" $defuse_config; fi
-if `grep __GMAP_BIN__ $defuse_config ${gt} /dev/null` ${amp}${amp} GMAP_BIN=`which gmap`;then sed -i'.tmp' "s#__GMAP_BIN__#\${GMAP_BIN}#" $defuse_config; fi
-if `grep __GMAP_SETUP_BIN__ $defuse_config ${gt} /dev/null` ${amp}${amp} GMAP_SETUP_BIN=`which gmap_setup`;then sed -i'.tmp' "s#__GMAP_SETUP_BIN__#\${GMAP_SETUP_BIN}#" $defuse_config; fi
-if `grep __GMAP_INDEX_DIR__ $defuse_config ${gt} /dev/null` ${amp}${amp} GMAP_INDEX_DIR=`pwd`/gmap;then sed -i'.tmp' "s#__GMAP_INDEX_DIR__#\${GMAP_INDEX_DIR}#" $defuse_config; fi
-if `grep __R_BIN__ $defuse_config ${gt} /dev/null` ${amp}${amp} R_BIN=`which R`;then sed -i'.tmp' "s#__R_BIN__#\${R_BIN}#" $defuse_config; fi
-if `grep __RSCRIPT_BIN__ $defuse_config ${gt} /dev/null` ${amp}${amp} RSCRIPT_BIN=`which Rscript`;then sed -i'.tmp' "s#__RSCRIPT_BIN__#\${RSCRIPT_BIN}#" $defuse_config; fi
+export DATASET_DIRECTORY=$1
+if `grep __DATASET_DIRECTORY__ $defuse_config > /dev/null`;then sed -i'.tmp' "s#__DATASET_DIRECTORY__#\$DATASET_DIRECTORY#" $defuse_config; fi
+if `grep __DEFUSE_PATH__ $defuse_config > /dev/null`;then sed -i'.tmp' "s#__DEFUSE_PATH__#\${DEFUSE_PATH}#" $defuse_config; fi
+if `grep __SAMTOOLS_BIN__ $defuse_config > /dev/null` && SAMTOOLS_BIN=`which samtools`;then sed -i'.tmp' "s#__SAMTOOLS_BIN__#\${SAMTOOLS_BIN}#" $defuse_config; fi
+if `grep __BOWTIE_BIN__ $defuse_config > /dev/null` && BOWTIE_BIN=`which bowtie`;then sed -i'.tmp' "s#__BOWTIE_BIN__#\${BOWTIE_BIN}#" $defuse_config; fi
+if `grep __BOWTIE_BUILD_BIN__ $defuse_config > /dev/null` && BOWTIE_BUILD_BIN=`which bowtie-build`;then sed -i'.tmp' "s#__BOWTIE_BUILD_BIN__#\${BOWTIE_BUILD_BIN}#" $defuse_config; fi
+if `grep __BLAT_BIN__ $defuse_config > /dev/null` && BLAT_BIN=`which blat`;then sed -i'.tmp' "s#__BLAT_BIN__#\${BLAT_BIN}#" $defuse_config; fi
+if `grep __FATOTWOBIT_BIN__ $defuse_config > /dev/null` && FATOTWOBIT_BIN=`which faToTwoBit`;then sed -i'.tmp' "s#__FATOTWOBIT_BIN__#\${FATOTWOBIT_BIN}#" $defuse_config; fi
+if `grep __GMAP_BIN__ $defuse_config > /dev/null` && GMAP_BIN=`which gmap`;then sed -i'.tmp' "s#__GMAP_BIN__#\${GMAP_BIN}#" $defuse_config; fi
+if `grep __GMAP_BUILD_BIN__ $defuse_config > /dev/null` && GMAP_BUILD_BIN=`which gmap_setup`;then sed -i'.tmp' "s#__GMAP_BUILD_BIN__#\${GMAP_BUILD_BIN}#" $defuse_config; fi
+if `grep __GMAP_INDEX_DIR__ $defuse_config > /dev/null` && GMAP_INDEX_DIR=`pwd`/gmap;then sed -i'.tmp' "s#__GMAP_INDEX_DIR__#\${GMAP_INDEX_DIR}#" $defuse_config; fi
+if `grep __R_BIN__ $defuse_config > /dev/null` && R_BIN=`which R`;then sed -i'.tmp' "s#__R_BIN__#\${R_BIN}#" $defuse_config; fi
+if `grep __RSCRIPT_BIN__ $defuse_config > /dev/null` && RSCRIPT_BIN=`which Rscript`;then sed -i'.tmp' "s#__RSCRIPT_BIN__#\${RSCRIPT_BIN}#" $defuse_config; fi
 ## copy config to output
 cp $defuse_config \$1/defuse_config.txt
-## Run the create_reference_dataset.pl
-perl \${DEFUSE_PATH}/scripts/create_reference_dataset.pl -c $defuse_config 
-  </configfile>
+## Run defuse_create_ref.pl
+defuse_create_ref.pl --config $defuse_config --dataset $DATASET_DIRECTORY
+  ]]></configfile>
  </configfiles>
 
  <tests>
--- a/defuse.xml	Mon Jan 04 15:55:00 2016 -0500
+++ b/defuse.xml	Wed Oct 18 16:55:57 2017 -0400
@@ -5,10 +5,33 @@
     </macros>
     <requirements>
         <expand macro="defuse_requirement" />
-        <expand macro="mapping_requirements" />
-        <expand macro="r_requirements" />
     </requirements>
-  <command interpreter="command"> /bin/bash $shscript </command>
+  <command><![CDATA[
+    #if $defuse_out.__str__ != 'None':
+        ## ln to output_dir in from_work_dir
+        mkdir -p $defuse_out.dataset.extra_files_path &&
+        ln -s $defuse_out.dataset.extra_files_path  output_dir &&
+    #else
+      mkdir -p output_dir &&
+    #end if
+    ## Put executable paths in config file
+    $__tool_directory__/config_sub.sh $defuse_config output_dir/defuse.cfg &&
+    ## copy config to output
+    cp defuse.cfg $config_txt &&
+    ## make a data_dir  and ln -s the input fastq
+    mkdir -p data_dir &&
+    ln -s "$left_pairendreads" data_dir/reads_1.fastq &&
+    ln -s "$right_pairendreads" data_dir/reads_2.fastq &&
+    ## run 
+    perl defuse_run.pl --name "$library_name" --config defuse.cfg  -1 data_dir/reads_1.fastq -2 data_dir/reads_2.fastq -o output_dir  -p \$GALAXY_SLOTS &&
+    grep -v cluster_id  output_dir/results.filtered.tsv | awk '{print $1}' > cluster_id_list && 
+    get_fusion_fastq.pl --list cluster_id_list --output output_dir --fastq1 results.fusions_1.fq --fastq2 results.fusions_2.fq && 
+    cp output_dir/results.* .  &&
+    cp `find output_dir -name defuse.log` $defuse_log 
+    #if $defuse_out.__str__ != 'None':
+        && $__tool_directory__/make_html.sh $defuse_out $defuse_out.dataset.extra_files_path
+    #end if
+  ]]></command>
  <inputs>
   <param name="left_pairendreads" type="data" format="fastq" label="left part of read pairs" help="The left and right reads pairs must be in the same order, and not have any unpaired reads.  (FASTQ interlacer will pair reads and remove the unpaired.   FASTQ de-interlacer will separate the result into left and right reads.)"/>
   <param name="right_pairendreads" type="data" format="fastq" label="right part of read pairs" help="In the same order as the left reads"/>
@@ -61,10 +84,18 @@
       <param name="probability_threshold" type="float" value="0.50" optional="true" label="Filter probability_threshold">
         <validator type="in_range" message="Choose a value between 0.0 and 1.0" min="0" max="1"/>
       </param>
+      <param name="multi_exon_transcripts_stats" type="select" label="Use multiple exon transcripts for stats calculations" help="should be enabled for very small libraries">
+        <option value="no" select="true">no</option>
+        <option value="yes">yes</option>
+      </param>
       <param name="covariance_sampling_density" type="float" value="0.01" optional="true" label="covariance_sampling_density">
         <help>Position density when calculating covariance</help>
         <validator type="in_range" message="Choose a value between 0.0 and 1.0" min="0" max="1"/>
       </param>
+      <param name="max_paired_alignments" type="integer" value="10" optional="true" label="max_paired_alignments">
+        <help>Maximum number of alignments for a read pair, Pairs with more alignments are filtered, default is 10</help>
+        <validator type="in_range" message="Choose a value between 0.0 and 1.0" min="1" max="100"/>
+      </param>
       <param name="denovo_assembly" type="select" label="denovo_assembly" help="">
         <option value="">Use Default</option>
         <option value="no">no</option>
@@ -76,29 +107,22 @@
       <param name="reads_per_job" type="integer" value="1000000" optional="true" label="Number of reads for each job in split" />
     </when> <!-- full -->
   </conditional>  <!-- defuse_param -->
-  <param name="breakpoints_bam" type="boolean" checked="true" truevalue="yes" falsevalue="no" label="Generate a Bam file for the fusions"/>
   <param name="keep_output" type="boolean" checked="true" truevalue="yes" falsevalue="no" label="Save DeFuse working directory files" 
          help="The defuse output working directory can be helpful for determining errors that may have occurred during the run, 
                but they require considerable diskspace, and should be deleted and purged when no longer needed."/>
+  <param name="breakpoints_bam" type="boolean" checked="false" truevalue="yes" falsevalue="no" label="Generate a Bam file for the fusions"/>
   <param name="do_get_reads" type="boolean" checked="false" truevalue="yes" falsevalue="no" label="Run get_reads on each cluster"/>
  </inputs>
- <stdio>
-   <exit_code range="1:"  level="fatal" description="Error Running Defuse" />
- </stdio>
  <outputs>
   <data format="txt" name="config_txt" label="${tool.name} on ${on_string}: config.txt"/>
   <data format="txt" name="defuse_log" label="${tool.name} on ${on_string}: defuse.log" />
   <data format="html" name="defuse_out" label="${tool.name} on ${on_string}: defuse_output (purge when no longer needed)">
     <filter>keep_output == True</filter>
   </data>
-  <data format="defuse.results.tsv" name="results_classify_tsv" label="${tool.name} on ${on_string}: results.classify.tsv" />
-  <data format="defuse.results.tsv" name="results_filtered_tsv" label="${tool.name} on ${on_string}: results.filtered.tsv" />
-  <data format="html" name="fusion_reads" label="${tool.name} on ${on_string}: fusion_reads">
-    <filter>do_get_reads == True</filter>
-  </data>
-  <data format="bam" name="fusions_bam" label="${tool.name} on ${on_string}: fusions.bam">
-    <filter>breakpoints_bam == True</filter>
-  </data>
+  <data format="defuse.results.tsv" name="results_classify_tsv" label="${tool.name} on ${on_string}: results.classify.tsv" from_work_dir="results.classify.tsv"/>
+  <data format="defuse.results.tsv" name="results_filtered_tsv" label="${tool.name} on ${on_string}: results.filtered.tsv" from_work_dir="results.filtered.tsv"/>
+  <data format="fastqsanger" name="results_fusions1_fq" label="${tool.name} on ${on_string}: fusions_1.fq" from_work_dir="results.fusions_1.fq" />
+  <data format="fastqsanger" name="results_fusions2_fq" label="${tool.name} on ${on_string}: fusions_2.fq" from_work_dir="results.fusions_2.fq" />
   <!--
    expression_plot
    circos plot
@@ -107,7 +131,6 @@
  <configfiles>
   <configfile name="defuse_config">
 #import re
-#set $ds = chr(36)
 #if $refGenomeSource.genomeSource == "history":
 #set config_file = $refGenomeSource.config.__str__
 #else 
@@ -323,6 +346,12 @@
 #except
 --phred33-quals
 #end try
+bowtie_params = #slurp
+#try
+$ref_dict['bowtie_params']
+#except
+--chunkmbs 200
+#end try
 max_insert_size = #slurp
 #if $defuse_param.settings == "full" and $defuse_param.max_insert_size.__str__ != "":
 $defuse_param.max_insert_size
@@ -481,6 +510,19 @@
 #end if
 positive_controls                           = \$(data_directory)/controls.txt
 
+# Use multiple exon transcripts for stats calculations (yes/no)
+# should be enabled for very small libraries
+multi_exon_transcripts_stats = #slurp
+#if $defuse_param.settings == "full" and $defuse_param.multi_exon_transcripts_stats.__str__ != ""
+$defuse_param.multi_exon_transcripts_stats
+#else
+#try
+$ref_dict['multi_exon_transcripts_stats']
+#except
+no
+#end try
+#end if
+
 # Position density when calculating covariance
 covariance_sampling_density = #slurp
 #if $defuse_param.settings == "full" and $defuse_param.covariance_sampling_density.__str__ != ""
@@ -492,6 +534,20 @@
 0.01
 #end try
 #end if
+
+# Maximum number of alignments for a read pair
+# Pairs with more alignments are filtered
+max_paired_alignments = #slurp
+#if $defuse_param.settings == "full" and $defuse_param.max_paired_alignments.__str__ != ""
+$defuse_param.max_paired_alignments
+#else
+#try
+$ref_dict['max_paired_alignments']
+#except
+10
+#end try
+#end if
+
 # Number of reads for each job in split
 reads_per_job = #slurp
 #if $defuse_param.settings == "full" and $defuse_param.reads_per_job.__str__ != ""
@@ -512,117 +568,10 @@
 remove_job_files                            = yes
 remove_job_temp_files                       = yes
 
+qsub_params                                 = ""
+
 #end raw
 
-
-  </configfile>
-  <configfile name="shscript">
-#!/bin/bash
-## define some things for cheetah proccessing
-#set $ds = chr(36)
-#set $amp = chr(38)
-#set $gt = chr(62)
-#set $lt = chr(60)
-#set $echo_cmd = 'echo'
-## Find the defuse.pl in the galaxy tool path
-#import Cheetah.FileUtils
-## declare a bash function for converting a results tsv into html with links to the get_reads output files
-results2html() {
-  rlts=${ds}1
-  rslt_name=`basename ${ds}rlts`
-  html=${ds}2
-  echo '${lt}html${gt}${lt}head${gt}${lt}title${gt}Defuse '${ds}rslt_name'${lt}/title${gt}${lt}/head${gt}${lt}body${gt}' ${gt}  ${ds}html
-  echo '${lt}h2${gt}Defuse '${ds}rslt_name'${lt}/h2${gt}${lt}table${gt}' ${gt}${gt}  ${ds}html
-  if [ -z "${ds}3" ]  
-  then
-    awk '${ds}1 ~ /cluster_id/{printf("${lt}tr${gt}");for (i = 1; i ${lt}= NF; i++) {printf("${lt}th${gt}%s${lt}/th${gt}", ${ds}i);}; printf("${lt}/tr${gt}\n");}\
-         ${ds}1 ~ /[1-9][0-9]*/{printf("${lt}tr${gt}");for (i = 1; i ${lt}= NF; i++) {printf("${lt}td${gt}%s${lt}/td${gt}", ${ds}i);}; printf("${lt}/tr${gt}\n");}' ${ds}rlts ${gt}${gt} ${ds}html
-    echo '${lt}/table${gt}' ${gt}${gt} ${ds}html
-    echo '${lt}/body${gt}${lt}/html${gt}' ${gt}${gt}  ${ds}html
-  else
-    export _EFP=${ds}3
-    mkdir -p ${ds}_EFP
-    awk '${ds}1 ~ /cluster_id/{printf("${lt}tr${gt}");for (i = 1; i ${lt}= NF; i++) {printf("${lt}th${gt}%s${lt}/th${gt}", ${ds}i);}; printf("${lt}/tr${gt}\n");}\
-         ${ds}1 ~ /[1-9][0-9]*/{fn="cluster_"${ds}1"_reads.txt"; \
-          printf("${lt}tr${gt}${lt}td${gt}${lt}a href=\"%s\"${gt}%s${lt}/a${gt}${lt}/td${gt}",fn, ${ds}1);for (i = 2; i ${lt}= NF; i++) {printf("${lt}td${gt}%s${lt}/td${gt}", ${ds}i);}; printf("${lt}/tr${gt}\n");}' ${ds}rlts ${gt}${gt} ${ds}html
-    echo '${lt}/table${gt}' ${gt}${gt} ${ds}html
-    echo '${lt}/body${gt}${lt}/html${gt}' ${gt}${gt}  ${ds}html
-    for i in `awk '${ds}1 ~ /[1-9][0-9]*/{print ${ds}1}' ${ds}rlts`;
-      do fn=cluster_${ds}{i}_reads.txt;
-      pn=${ds}_EFP/${ds}fn;
-      perl \${DEFUSE_PATH}/scripts/get_reads.pl -c $defuse_config -o output_dir -i ${ds}i ${gt} ${ds}pn;
-    done
-  fi
-}
-## substitute pathnames into config file
-if `grep __DEFUSE_PATH__ $defuse_config ${gt} /dev/null`;then sed -i'.tmp' "s#__DEFUSE_PATH__#\${DEFUSE_PATH}#" $defuse_config; fi
-if `grep __SAMTOOLS_BIN__ $defuse_config ${gt} /dev/null` ${amp}${amp} SAMTOOLS_BIN=`which samtools`;then sed -i'.tmp' "s#__SAMTOOLS_BIN__#\${SAMTOOLS_BIN}#" $defuse_config; fi
-if `grep __BOWTIE_BIN__ $defuse_config ${gt} /dev/null` ${amp}${amp} BOWTIE_BIN=`which bowtie`;then sed -i'.tmp' "s#__BOWTIE_BIN__#\${BOWTIE_BIN}#" $defuse_config; fi
-if `grep __BOWTIE_BUILD_BIN__ $defuse_config ${gt} /dev/null` ${amp}${amp} BOWTIE_BUILD_BIN=`which bowtie-build`;then sed -i'.tmp' "s#__BOWTIE_BUILD_BIN__#\${BOWTIE_BUILD_BIN}#" $defuse_config; fi
-if `grep __BLAT_BIN__ $defuse_config ${gt} /dev/null` ${amp}${amp} BLAT_BIN=`which blat`;then sed -i'.tmp' "s#__BLAT_BIN__#\${BLAT_BIN}#" $defuse_config; fi
-if `grep __FATOTWOBIT_BIN__ $defuse_config ${gt} /dev/null` ${amp}${amp} FATOTWOBIT_BIN=`which faToTwoBit`;then sed -i'.tmp' "s#__FATOTWOBIT_BIN__#\${FATOTWOBIT_BIN}#" $defuse_config; fi
-if `grep __GMAP_BIN__ $defuse_config ${gt} /dev/null` ${amp}${amp} GMAP_BIN=`which gmap`;then sed -i'.tmp' "s#__GMAP_BIN__#\${GMAP_BIN}#" $defuse_config; fi
-if `grep __GMAP_SETUP_BIN__ $defuse_config ${gt} /dev/null` ${amp}${amp} GMAP_SETUP_BIN=`which gmap_setup`;then sed -i'.tmp' "s#__GMAP_SETUP_BIN__#\${GMAP_SETUP_BIN}#" $defuse_config; fi
-if `grep __R_BIN__ $defuse_config ${gt} /dev/null` ${amp}${amp} R_BIN=`which R`;then sed -i'.tmp' "s#__R_BIN__#\${R_BIN}#" $defuse_config; fi
-if `grep __RSCRIPT_BIN__ $defuse_config ${gt} /dev/null` ${amp}${amp} RSCRIPT_BIN=`which Rscript`;then sed -i'.tmp' "s#__RSCRIPT_BIN__#\${RSCRIPT_BIN}#" $defuse_config; fi
-
-
-## copy config to output
-cp $defuse_config $config_txt
-## make a data_dir  and ln -s the input fastq
-mkdir -p data_dir
-## ln -s "$left_pairendreads" data_dir/reads_1.fastq
-## ln -s "$right_pairendreads" data_dir/reads_2.fastq
-cp "$left_pairendreads" data_dir/reads_1.fastq
-cp "$right_pairendreads" data_dir/reads_2.fastq
-## ln to output_dir in from_work_dir
-#if $defuse_out.__str__ != 'None':
-mkdir -p $defuse_out.dataset.extra_files_path
-ln -s $defuse_out.dataset.extra_files_path  output_dir
-#else
-mkdir -p output_dir
-#end if
-## run defuse.pl
-perl \${DEFUSE_PATH}/scripts/defuse.pl -name "$library_name" -c $defuse_config -1 data_dir/reads_1.fastq -2 data_dir/reads_2.fastq -o output_dir  -p \$GALAXY_SLOTS
-## copy primary results to output datasets
-if [ -e output_dir/log/defuse.log ]; then cp output_dir/log/defuse.log $defuse_log; fi
-## if [ -e output_dir/results.tsv ]; then cp output_dir/results.tsv $results_tsv; fi
-if [ -e output_dir/results.filtered.tsv ]; then cp output_dir/results.filtered.tsv $results_filtered_tsv; fi
-if [ -e output_dir/results.classify.tsv ]; then cp output_dir/results.classify.tsv $results_classify_tsv; fi
-#if $breakpoints_bam:
-if [ -e output_dir/results.filtered.tsv ] ${amp}${amp}  [ -e output_dir/breakpoints.genome.psl ]
-then
-  awk "\\$10 ~ /^(`awk '\\$1 ~ /[0-9]+/{print \\$1}' output_dir/results.filtered.tsv | tr '\n' '|'`)\\$/{print \\$0}" output_dir/breakpoints.genome.psl > breakpoints.genome.filtered.psl ${amp}${amp}
-  psl2sam.pl breakpoints.genome.filtered.psl > breakpoints.genome.filtered.sam ${amp}${amp}
-  samtools view -b -T /panfs/roc/rissdb/galaxy/genomes/NCBIM37/defuse/defuse.reference.fa -o breakpoints.genome.filtered.bam breakpoints.genome.filtered.sam ${amp}${amp}
-  samtools sort breakpoints.genome.filtered.bam breakpoints ${amp}${amp}
-  ## samtools index breakpoints.bam
-  cp breakpoints.bam $fusions_bam
-fi
-#end if
-## create html with links for output_dir
-#if $defuse_out.__str__ != 'None':
-if [ -e $defuse_out ]
-then
-  echo '${lt}html${gt}${lt}head${gt}${lt}title${gt}Defuse Output${lt}/title${gt}${lt}/head${gt}${lt}body${gt}' ${gt} $defuse_out
-  echo '${lt}h2${gt}Defuse Output Files${lt}/h2${gt}${lt}ul${gt}' ${gt}${gt}  $defuse_out
-  pushd $defuse_out.dataset.extra_files_path
-  for f in `find -L . -maxdepth 1 -type f`; 
-   do fn=`basename ${ds}f`; echo '${lt}li${gt}${lt}a href="'${ds}fn'"${gt}'${ds}fn'${lt}/a${gt}${lt}/li${gt}' ${gt}${gt}  $defuse_out; 
-  done
-  popd
-  echo '${lt}/ul${gt}' ${gt}${gt} $defuse_out
-  echo '${lt}/body${gt}${lt}/html${gt}' ${gt}${gt}  $defuse_out
-fi
-#end if
-## run get_reads.pl on each cluster
-#if $fusion_reads.__str__ != 'None':
-if [ -e output_dir/results.filtered.tsv -a -e $fusion_reads ] 
-then
-  mkdir -p $fusion_reads.dataset.extra_files_path
-  results2html output_dir/results.filtered.tsv $fusion_reads $fusion_reads.dataset.extra_files_path
-fi
-#end if
   </configfile>
  </configfiles>
 
--- a/defuse_results_to_vcf.xml	Mon Jan 04 15:55:00 2016 -0500
+++ b/defuse_results_to_vcf.xml	Wed Oct 18 16:55:57 2017 -0400
@@ -1,10 +1,15 @@
 <?xml version="1.0"?>
 <tool id="defuse_results_to_vcf" name="Defuse Results to VCF" version="0.6.1">
   <description>generate a VCF from a DeFuse Results file</description>
-  <requirements>
-    <requirement type="package" version="0.6.1">defuse</requirement>
-  </requirements>
-  <command interpreter="python">defuse_results_to_vcf.py  --input $defuse_results --reference ${defuse_results.metadata.dbkey} --output $vcf
+    <macros>
+        <import>macros.xml</import>
+    </macros>
+    <requirements>
+        <expand macro="defuse_requirement" />
+    </requirements>
+  <command><![CDATA[
+     python '$__tool_directory__/defuse_results_to_vcf.py  --input $defuse_results --reference ${defuse_results.metadata.dbkey} --output $vcf
+  ]]>
   </command>
   <inputs>
     <param name="defuse_results" type="data" format="defuse.results.tsv" label="Defuse Results file"/> 
--- a/macros.xml	Mon Jan 04 15:55:00 2016 -0500
+++ b/macros.xml	Wed Oct 18 16:55:57 2017 -0400
@@ -1,5 +1,5 @@
 <macros>
-    <token name="@DEFUSE_VERSION@">0.6.2</token>
+    <token name="@DEFUSE_VERSION@">0.8.1</token>
     <xml name="defuse_requirement">
             <requirement type="package" version="@DEFUSE_VERSION@">defuse</requirement>
     </xml>
@@ -7,7 +7,7 @@
             <requirement type="package" version="0.1.19">samtools</requirement>
             <requirement type="package" version="1.0.0">bowtie</requirement>
             <requirement type="package" version="2013-05-09">gmap</requirement>
-            <requirement type="package" version="latest">kent</requirement>
+            <requirement type="package" version="35x1">blat</requirement>
     </xml>
     <xml name="r_requirements">
             <requirement type="package" version="3.1.2">R</requirement>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make_html.sh	Wed Oct 18 16:55:57 2017 -0400
@@ -0,0 +1,18 @@
+#!/bin/bash
+## create html with links for output_dir 
+## usage:  make_html.sh dataset_path dataset_extra_file_path 
+defuse_out=$1
+extra_files_path=$2
+if [ -e $defuse_out ]
+then
+  echo '<html><head><title>Defuse Output</title></head><body>' > $defuse_out
+  echo '<h2>Defuse Output Files</h2><ul>' >>  $defuse_out
+  pushd $extra_files_path
+  for f in `find -L . -maxdepth 1 -type f`;
+   do fn=`basename ${f}`; echo '<li><a href="'${fn}'">'${fn}'</a></li>' >>  $defuse_out;
+  done
+  popd
+  echo '</ul>' >> $defuse_out
+  echo '</body></html>' >>  $defuse_out
+fi
+
--- a/tool_dependencies.xml	Mon Jan 04 15:55:00 2016 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-<?xml version="1.0"?>
-<tool_dependency>
-    <package name="defuse" version="0.6.2">
-        <repository changeset_revision="bf5636f162fe" name="package_defuse_0_6_2" owner="jjohnson" toolshed="https://testtoolshed.g2.bx.psu.edu" />
-    </package>
-    <package name="samtools" version="0.1.19">
-        <repository changeset_revision="0e56e4dac6e7" name="package_samtools_0_1_19" owner="iuc" toolshed="https://testtoolshed.g2.bx.psu.edu" />
-    </package>
-    <package name="bowtie" version="1.0.0">
-        <repository changeset_revision="e682af6a72cd" name="package_bowtie_1_0_0" owner="jjohnson" toolshed="https://testtoolshed.g2.bx.psu.edu" />
-    </package>
-    <package name="gmap" version="2013-05-09">
-        <repository changeset_revision="8bacc25e2023" name="package_gmap_2013_05_09" owner="jjohnson" toolshed="https://testtoolshed.g2.bx.psu.edu" />
-    </package>
-    <package name="kent" version="latest">
-        <repository changeset_revision="822c8d19cfe3" name="package_kent" owner="jjohnson" toolshed="https://testtoolshed.g2.bx.psu.edu" />
-    </package>
-    <package name="R" version="3.1.2">
-        <repository changeset_revision="73cd1d529330" name="package_r_3_1_2" owner="iuc" toolshed="https://testtoolshed.g2.bx.psu.edu" />
-    </package>
-    <package name="ada" version="2.0.3">
-        <repository changeset_revision="50f0e0825d41" name="package_r_ada_2_0_3" owner="jjohnson" toolshed="https://testtoolshed.g2.bx.psu.edu" />
-    </package>
-</tool_dependency>