changeset 14:019b09b37955 draft

Uploaded
author scisjnu123
date Fri, 13 Sep 2019 03:12:53 -0400
parents ec10ff509d48
children 17c5d1e6f09b
files gv/picard/picard_AddCommentsToBam.xml gv/picard/picard_AddOrReplaceReadGroups.xml gv/picard/picard_BedToIntervalList.xml gv/picard/picard_CleanSam.xml gv/picard/picard_CollectAlignmentSummaryMetrics.xml gv/picard/picard_CollectBaseDistributionByCycle.xml gv/picard/picard_CollectGcBiasMetrics.xml gv/picard/picard_CollectInsertSizeMetrics.xml gv/picard/picard_CollectRnaSeqMetrics.xml gv/picard/picard_CollectWgsMetrics.xml gv/picard/picard_DownsampleSam.xml gv/picard/picard_EstimateLibraryComplexity.xml gv/picard/picard_FastqToSam.xml gv/picard/picard_FilterSamReads.xml gv/picard/picard_FixMateInformation.xml gv/picard/picard_MarkDuplicates.xml gv/picard/picard_MarkDuplicatesWithMateCigar.xml gv/picard/picard_MeanQualityByCycle.xml gv/picard/picard_MergeBamAlignment.xml gv/picard/picard_MergeSamFiles.xml gv/picard/picard_NormalizeFasta.xml gv/picard/picard_QualityScoreDistribution.xml gv/picard/picard_ReorderSam.xml gv/picard/picard_ReplaceSamHeader.xml gv/picard/picard_RevertOriginalBaseQualitiesAndAddMateCigar.xml gv/picard/picard_RevertSam.xml gv/picard/picard_SamToFastq.xml gv/picard/picard_ValidateSamFile.xml gv/picard/read_group_macros.xml gv/picard/tool_data_table_conf.xml.sample gv/samtools_mpileup/973fea5b4bdf/samtools_mpileup/samtools_mpileup.xml gv/samtools_mpileup/973fea5b4bdf/samtools_mpileup/samtools_wrapper.py gv/samtools_mpileup/973fea5b4bdf/samtools_mpileup/test-data/gatk/gatk_table_recalibration/gatk_table_recalibration_out_1.bam gv/samtools_mpileup/973fea5b4bdf/samtools_mpileup/test-data/phiX.fasta gv/samtools_mpileup/973fea5b4bdf/samtools_mpileup/test-data/samtools/mpileup/samtools_mpileup_out_1.log gv/samtools_mpileup/973fea5b4bdf/samtools_mpileup/test-data/samtools/mpileup/samtools_mpileup_out_1.pileup gv/samtools_mpileup/973fea5b4bdf/samtools_mpileup/test-data/samtools/mpileup/samtools_mpileup_out_2.bcf gv/samtools_mpileup/973fea5b4bdf/samtools_mpileup/tool-data/fasta_indexes.loc.sample gv/samtools_mpileup/973fea5b4bdf/samtools_mpileup/tool_data_table_conf.xml.sample gv/samtools_mpileup/973fea5b4bdf/samtools_mpileup/tool_dependencies.xml gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/macros.xml gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/samtools_mpileup.xml gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/phiX.bam gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/phiX.fasta gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/phiX_1.bam gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/samtools/mpileup/samtools_mpileup_out_1.log gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/samtools/mpileup/samtools_mpileup_out_1.pileup gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/samtools/mpileup/samtools_mpileup_out_2.bcf gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/samtools_mpileup_in_1.bam gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/samtools_mpileup_out_1.log gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/samtools_mpileup_out_1.pileup gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/samtools_mpileup_out_2.log gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/samtools_mpileup_out_2.vcf gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/samtools_mpileup_out_3.log gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/samtools_mpileup_out_4.log gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/samtools_mpileup_out_4.vcf gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/tool-data/fasta_indexes.loc.sample gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/tool_data_table_conf.xml.sample gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/tool_dependencies.xml gv/samtools_sort/a430da4f04cd/samtools_sort/macros.xml gv/samtools_sort/a430da4f04cd/samtools_sort/samtools_sort.xml gv/samtools_sort/a430da4f04cd/samtools_sort/test-data/1.bam gv/samtools_sort/a430da4f04cd/samtools_sort/test-data/1_sort.bam gv/samtools_sort/a430da4f04cd/samtools_sort/test-data/1_sort_read_names.bam gv/samtools_sort/a430da4f04cd/samtools_sort/tool_dependencies.xml gv/samtools_sort/e613c1ad4c4c/samtools_sort/macros.xml gv/samtools_sort/e613c1ad4c4c/samtools_sort/samtools_sort.xml gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/1.bam gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/1_sort.bam gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/1_sort_read_names.bam gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/name.sort.expected.bam gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/name.sort.expected.sam gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/pos.sort.expected.bam gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/pos.sort.expected.sam gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/tag.as.sort.expected.bam gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/tag.as.sort.expected.sam gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/tag.fi.sort.expected.bam gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/tag.fi.sort.expected.sam gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/tag.rg.n.sort.expected.bam gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/tag.rg.n.sort.expected.sam gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/tag.rg.sort.expected.bam gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/tag.rg.sort.expected.sam gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/test_input_1_a.bam
diffstat 83 files changed, 5769 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_AddCommentsToBam.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,77 @@
+<tool name="AddCommentsToBam" id="picard_AddCommentsToBam" version="1.135">
+  <description>add comments to BAM dataset</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements" />
+  <command>
+    @java_options@
+    java -jar \$JAVA_JAR_PATH/picard.jar
+      AddCommentsToBam
+      INPUT="${inputFile}"
+      OUTPUT="${outFile}"
+      #for $element in $comments:
+        COMMENT="${element.comment}"
+      #end for
+      QUIET=true
+      VERBOSITY=ERROR
+      VALIDATION_STRINGENCY=${validation_stringency}
+  </command>
+  
+  <inputs>
+    <param format="bam" name="inputFile" type="data" label="Select SAM/BAM dataset or dataset collection" help="If empty, upload or import a SAM/BAM dataset" />
+    <repeat name="comments" title="Comment" min="1" help="You can provide multiple comments">
+          <param name="comment" type="text" size="50" label="Add this comment to BAM dataset" help="COMMENT"/>
+    </repeat>
+
+    <expand macro="VS" />
+
+  </inputs>
+
+  <outputs>
+    <data name="outFile" format="bam" label="${tool.name} on ${on_string}: BAM with comments"/>
+  </outputs>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <tests>
+  <test>
+      <param name="inputFile" value="picard_AddCommentsToBam.bam" />
+      <param name="comment" value="test1" />
+      <param name="validation_stringency" value="LENIENT" />
+      <output name="outFile" file="picard_AddCommentsToBam_test1.bam" ftype="bam" />
+    </test>
+  </tests>
+  <help>
+
+.. class:: infomark
+
+**Purpose**
+
+Adds one or more comments (@CO) to the header of a specified BAM dataset.
+
+@dataset_collections@
+
+@description@
+
+  COMMENT=String
+  C=String          Comments to add to the BAM file  This option may be specified 0 or more times. 
+
+@more_info@
+  </help>
+</tool>
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_AddOrReplaceReadGroups.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,125 @@
+<tool name="AddOrReplaceReadGroups" id="picard_AddOrReplaceReadGroups" version="1.135-gx-1">
+  <description>add or replaces read group information</description>
+  <macros>
+    <import>picard_macros.xml</import>
+    <import>read_group_macros.xml</import>
+  </macros>
+  <expand macro="requirements" />
+  <command>
+    @define_read_group_helpers@
+    #set $rg_auto_name = $read_group_name_default($inputFile)
+    @set_read_group_vars@
+    @java_options@
+    java -jar \$JAVA_JAR_PATH/picard.jar
+      AddOrReplaceReadGroups
+      INPUT="${inputFile}"
+      $format_read_group("RGLB=", $rg_lb, '"')
+      $format_read_group("RGPL=", $rg_pl, '"')
+      $format_read_group("RGPU=", $rg_pu, '"')
+      $format_read_group("RGSM=", $rg_sm, '"')
+      $format_read_group("RGID=", $rg_id, '"')
+      $format_read_group("RGDS=", $rg_ds, '"')
+      $format_read_group("RGPI=", $rg_pi, '"')
+      $format_read_group("RGDT=", $rg_dt, '"')
+      VALIDATION_STRINGENCY="${validation_stringency}"
+      QUIET=true
+      VERBOSITY=ERROR
+      OUTPUT="${outFile}"
+      
+  </command>
+  
+  <inputs>
+    <param format="bam,sam" name="inputFile" type="data" label="Select SAM/BAM dataset or dataset collection" help="If empty, upload or import a SAM/BAM dataset" />
+    <expand macro="read_group_inputs_picard" />
+    <expand macro="VS" />
+    
+  </inputs>
+  
+  <outputs>
+    <data name="outFile" format="bam" label="${tool.name} on ${on_string}: BAM with replaced/modified readgroups"/>
+  </outputs>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <tests>
+    <test>
+      <param name="inputFile" value="picard_ARRG.bam" />
+      <param name="LB" value="tumor-a" />
+      <param name="PL" value="ILLUMINA" />
+      <param name="PU" value="run-1" />
+      <param name="SM" value="sample-a" />
+      <param name="ID" value="id-1" />
+      <output name="outFile" file="picard_ARRG_test1.bam" ftype="bam" />
+    </test>
+  </tests>
+  <help>
+
+.. class:: infomark
+
+**Purpose**
+
+Add or Replace Read Groups in an input BAM or SAM file.
+
+@dataset_collections@
+
+@RG@
+
+@description@
+
+  INPUT=File
+  I=File                  Input file (bam or sam).  Required. 
+
+  OUTPUT=File
+  O=File                  Output file (bam or sam).  Required. 
+
+  SORT_ORDER=SortOrder
+  SO=SortOrder            Optional sort order to output in. If not supplied OUTPUT is in the same order as INPUT.  
+                          Default value: null. Possible values: {unsorted, queryname, coordinate} 
+
+  RGID=String
+  ID=String               Read Group ID  Default value: 1. This option can be set to 'null' to clear the default 
+                          value. 
+
+  RGLB=String
+  LB=String               Read Group Library  Required. 
+  
+  RGPL=String
+  PL=String               Read Group platform (e.g. illumina, solid)  Required. 
+
+  RGPU=String
+  PU=String               Read Group platform unit (eg. run barcode)  Required. 
+
+  RGSM=String
+  SM=String               Read Group sample name  Required. 
+
+  RGCN=String
+  CN=String               Read Group sequencing center name  Default value: null. 
+
+  RGDS=String
+  DS=String               Read Group description  Default value: null. 
+
+  RGDT=Iso8601Date
+  DT=Iso8601Date          Read Group run date  Default value: null. 
+
+  RGPI=Integer
+  PI=Integer              Read Group predicted insert size  Default value: null. 
+
+@more_info@
+  </help>
+</tool>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_BedToIntervalList.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,115 @@
+<tool name="BedToIntervalList" id="picard_BedToIntervalList" version="1.135">
+  <description>convert coordinate data into picard interval list format</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements" />
+  <command>
+    @java_options@
+    
+    #set $picard_dict = "localref.dict"
+    #set $ref_fasta = "localref.fa"     ## This is done because picards "likes" .fa extension
+    
+    ln -s "${reference_source.ref_file}" "${ref_fasta}" &amp;&amp;
+       
+    #if str( $reference_source.reference_source_selector ) == "history":
+        
+      java -jar \$JAVA_JAR_PATH/picard.jar CreateSequenceDictionary REFERENCE="${ref_fasta}" OUTPUT="${picard_dict}"
+      QUIET=true
+      VERBOSITY=ERROR
+      
+      &amp;&amp;
+      
+    #else:
+    
+      #set $ref_fasta = str( $reference_source.ref_file.fields.path ) ## getting path of reference fasta file (must end with .fa)
+      #set $picard_dict=$ref_fasta[:-2]+"dict"                        ## replacing .fa with .dict
+    
+    #end if 
+    
+    java -jar \$JAVA_JAR_PATH/picard.jar
+      BedToIntervalList
+      INPUT="${inputFile}"
+      OUTPUT="${outFile}"
+      
+      SEQUENCE_DICTIONARY="${picard_dict}"
+      QUIET=true
+      VERBOSITY=ERROR
+      
+  </command>
+  
+  <inputs>
+    
+     <conditional name="reference_source">
+      <param name="reference_source_selector" type="select" label="Load picard dictionary file from">
+        <option value="cached">Local cache</option>
+        <option value="history">History</option>
+      </param>
+      <when value="cached">
+        <param name="ref_file" type="select" label="Use dictionary from the list" help="Select genome from the list">
+          <options from_data_table="picard_indexes">
+            <filter type="sort_by" column="2" />
+            <validator type="no_options" message="No indexes are available" />
+          </options>
+          <validator type="no_options" message="A built-in dictionary is not available for the build associated with the selected input file"/>
+        </param>
+      </when>
+      <when value="history"> 
+        <param name="ref_file" type="data" format="fasta" label="Use the following dataset to create dictionary" help="You can upload a FASTA sequence to the history from which Picard will automatically generate dictionary using CreateSequenceDictionary command" />
+      </when>
+    </conditional>
+    
+    <param format="bed" name="inputFile" type="data" label="Select coordinate dataset or dataset collection" help="This can be a bed or interval dataset" />
+
+  </inputs>
+  <outputs>
+    <data name="outFile" format="picard_interval_list" label="${tool.name} on ${on_string}: Picard interval list">
+    </data>
+  </outputs>
+  <tests>
+    <test>
+      <param name="reference_source_selector" value="history" />
+      <param name="ref_file" value="picard_BedToIntervalList_ref.fa" ftype="fasta" />
+      <param name="inputFile" value="picard_BedToIntervalList.bed" ftype="bed"/>
+      <output name="outFile" file="picard_BedToIntervalList_test1.pif" ftype="picard_interval_list" lines_diff="2" />
+    </test>
+  </tests>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <help>
+
+.. class:: infomark
+
+**Purpose**
+
+Convert coordinate data (such as BED or Galaxy Interval) into Picard Interval Format.
+
+@dataset_collections@
+
+@description@
+
+  SEQUENCE_DICTIONARY=File
+  SD=File                       The sequence dictionary. You can either use dictionary pre-cached
+                                on this instance of Galaxy, or create one on teh fly from a FASTA
+                                file uploaded to history (right pane of the interface).
+
+
+@more_info@
+  </help>
+</tool>
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_CleanSam.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,57 @@
+<tool id="picard_CleanSam" name="CleanSam" version="1.135">
+  <description>perform SAM/BAM grooming</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements" />
+  <command>
+    @java_options@
+    java -jar \$JAVA_JAR_PATH/picard.jar
+    CleanSam
+    INPUT="${inputFile}"
+    OUTPUT="${outFile}"
+    QUIET=true
+    VERBOSITY=ERROR
+    VALIDATION_STRINGENCY=${validation_stringency}
+  </command>
+  
+  <inputs>
+    <param name="inputFile" type="data" format="sam,bam" label="Select SAM/BAM dataset or dataset collection" help="If empty, upload or import a SAM/BAM dataset"/>
+    
+    <expand macro="VS" />
+    
+  </inputs>
+  
+  <outputs>
+    <data name="outFile" format="bam" label="${tool.name} on ${on_string}: cleaned BAM dataset">
+    </data>
+  </outputs>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <tests>
+    <test>
+      <param name="inputFile" ftype="bam" value="picard_CleanSam.bam" />
+      <output name="outFile" file="picard_CleanSam_test1.bam" ftype="bam" />
+    </test>
+  </tests>
+  
+  <help>
+
+.. class:: infomark
+
+**Purpose**
+
+Read SAM/BAM and perform various fix-ups. Currently, the only fix-ups are:
+
+ 1. to soft-clip an alignment that hangs off the end of its reference sequence.
+ 2. to set MAPQ to 0 if a read is unmapped.
+ 
+@dataset_collections@
+ 
+@more_info@
+
+  </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_CollectAlignmentSummaryMetrics.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,133 @@
+<tool name="Collect Alignment Summary Metrics" id="picard_CASM" version="1.135">
+  <description>writes a file containing summary alignment metrics</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements" />
+  <command>
+    @java_options@
+    ##set up input files
+
+    #set $reference_fasta_filename = "localref.fa"
+    
+    #if str( $reference_source.reference_source_selector ) == "history":
+        ln -s "${reference_source.ref_file}" "${reference_fasta_filename}" &amp;&amp;
+    #else:
+        #set $reference_fasta_filename = str( $reference_source.ref_file.fields.path )
+    #end if
+    
+    java -jar \$JAVA_JAR_PATH/picard.jar
+    CollectAlignmentSummaryMetrics
+    INPUT="${inputFile}"
+    OUTPUT="${outFile}"
+    MAX_INSERT_SIZE=${maxinsert}
+    #for $sequence in $adapters:
+        ADAPTER_SEQUENCE="${sequence.adapter}"
+    #end for
+    METRIC_ACCUMULATION_LEVEL="${metric_accumulation_level}"
+    IS_BISULFITE_SEQUENCED="${bisulphite}"
+    
+    REFERENCE_SEQUENCE="${reference_fasta_filename}"
+    
+    ASSUME_SORTED="${assume_sorted}"
+
+    VALIDATION_STRINGENCY="${validation_stringency}"
+    QUIET=true
+    VERBOSITY=ERROR
+  
+  </command>
+  <inputs>
+    <param format="sam,bam" name="inputFile" type="data" label="Select SAM/BAM dataset or dataset collection" help="If empty, upload or import a SAM/BAM dataset."/>
+    <conditional name="reference_source">
+      <param name="reference_source_selector" type="select" label="Load reference genome from">
+        <option value="cached">Local cache</option>
+        <option value="history">History</option>
+      </param>
+      <when value="cached">
+        <param name="ref_file" type="select" label="Using reference genome" help="REFERENCE_SEQUENCE">
+          <options from_data_table="all_fasta">
+          </options>
+          <validator type="no_options" message="A built-in reference genome is not available for the build associated with the selected input file"/>
+        </param>
+      </when>
+      <when value="history">
+        <param name="ref_file" type="data" format="fasta" label="Use the following dataset as the reference sequence" help="REFERENCE_SEQUENCE; You can upload a FASTA sequence to the history and use it as reference" />
+      </when>
+    </conditional>
+    <param name="metric_accumulation_level" type="select" label="The level(s) at which to accumulate metrics" multiple="true" help="METRIC_ACCUMULATION_LEVEL">
+      <option value="ALL_READS" selected="True">All reads</option>
+      <option value="SAMPLE">Sample</option>
+      <option value="LIBRARY">Library</option>
+      <option value="READ_GROUP">Read group</option>
+    </param>
+    <param name="assume_sorted" type="boolean" label="Assume the input file is already sorted" checked="true" truevalue="true" falsevalue="false" help="ASSUME_SORTED"/>
+    <param name="bisulphite" type="boolean" label="Input file contains Bisulphite sequenced reads" checked="false" falsevalue="false" truevalue="true" help="IS_BISULFITE_SEQUENCED"/>
+    <repeat name="adapters" title="Adapter" min="0" help="You can provide multiple adaptor sequences">
+          <param name="adapter" type="text" size="50" label="Use this adaptor sequence" help="ADAPTER_SEQUENCE"/>
+    </repeat>
+    <param name="maxinsert" value="100000" type="integer" label="Larger paired end reads and inter-chromosomal pairs considered chimeric" size="20" help="MAX_INSERT_SIZE"/>
+    
+    <expand macro="VS" />
+    
+  </inputs>
+  
+  <outputs>
+    <data format="tabular" name="outFile" label="${tool.name} on ${on_string}: Summary stats"/>
+  </outputs>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  
+  <tests>
+    <test>
+      <param name="bisulphite" value="false" />
+      <param name="sorted" value="true" />
+      <param name="adaptors" value="" />
+      <param name="maxinsert" value="100000" />
+      <param name="reference_source_selector" value="history" />
+      <param name="ref_file" value="picard_CASM_ref.fa" />
+      <param name="inputFile" value="picard_CASM.bam" ftype="bam" />
+      <output name="outFile" file="picard_CASM_test1.tab" ftype="tabular" lines_diff="4"/>
+    </test>
+  </tests>
+  
+  <help>
+
+.. class:: infomark
+
+**Purpose**
+
+Reads a SAM or BAM file and writes a file containing summary alignment metrics.
+
+@dataset_collections@
+
+@description@
+
+  MAX_INSERT_SIZE=Integer       Paired end reads above this insert size will be considered chimeric along with 
+                                inter-chromosomal pairs.  Default value: 100000.  
+
+  ADAPTER_SEQUENCE=String       List of adapter sequences to use when processing the alignment metrics  This option may 
+                                be specified 0 or more times.  
+
+  METRIC_ACCUMULATION_LEVEL=MetricAccumulationLevel
+  LEVEL=MetricAccumulationLevel The level(s) at which to accumulate metrics.    Possible values: {ALL_READS, SAMPLE, 
+                                LIBRARY, READ_GROUP} This option may be specified 0 or more times.  
+
+  IS_BISULFITE_SEQUENCED=Boolean
+  BS=Boolean                    Whether the SAM or BAM file consists of bisulfite sequenced reads.    
+
+
+  REFERENCE_SEQUENCE=File
+  R=File                        Reference sequence fasta  Default value: null. 
+
+  ASSUME_SORTED=Boolean
+  AS=Boolean                    If true (default), then the sort order in the header file will be ignored. 
+
+@more_info@
+
+  </help>
+</tool>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_CollectBaseDistributionByCycle.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,114 @@
+<tool name="CollectBaseDistributionByCycle" id="picard_CollectBaseDistributionByCycle" version="1.135">
+  <description>charts the nucleotide distribution per cycle in a SAM or BAM dataset</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements">
+    <requirement type="package" version="3.1.2">R</requirement>
+  </expand>
+  <command>
+    @java_options@
+    ##set up input files
+
+    #set $reference_fasta_filename = "localref.fa"
+    
+    #if str( $reference_source.reference_source_selector ) == "history":
+        ln -s "${reference_source.ref_file}" "${reference_fasta_filename}" &amp;&amp;
+    #else:
+        #set $reference_fasta_filename = str( $reference_source.ref_file.fields.path )
+    #end if
+    
+    java -jar \$JAVA_JAR_PATH/picard.jar
+    CollectBaseDistributionByCycle
+    INPUT="${inputFile}"
+    OUTPUT="${outFile}"
+    CHART_OUTPUT="${pdfFile}"
+    ALIGNED_READS_ONLY="${aligned_reads_only}"
+    PF_READS_ONLY="${pf_reads_only}"
+    REFERENCE_SEQUENCE="${reference_fasta_filename}"
+    ASSUME_SORTED="${assume_sorted}"
+    
+    VALIDATION_STRINGENCY="${validation_stringency}"
+    QUIET=true
+    VERBOSITY=ERROR
+  
+  </command>
+  <inputs>
+    <param format="sam,bam" name="inputFile" type="data" label="Select SAM/BAM dataset or dataset collection" help="If empty, upload or import a SAM/BAM dataset."/>
+    <conditional name="reference_source">
+      <param name="reference_source_selector" type="select" label="Load reference genome from">
+        <option value="cached">Local cache</option>
+        <option value="history">History</option>
+      </param>
+      <when value="cached">
+        <param name="ref_file" type="select" label="Using reference genome" help="REFERENCE_SEQUENCE">
+          <options from_data_table="all_fasta">
+          </options>
+          <validator type="no_options" message="A built-in reference genome is not available for the build associated with the selected input file"/>
+        </param>
+      </when>
+      <when value="history">
+        <param name="ref_file" type="data" format="fasta" label="Use the folloing dataset as the reference sequence" help="REFERENCE_SEQUENCE; You can upload a FASTA sequence to the history and use it as reference" />
+      </when>
+    </conditional>
+    <param name="aligned_reads_only" type="boolean" label="Calculate the base distribution over aligned reads only" checked="true" truevalue="true" falsevalue="false" help="ALIGNED_READS_ONLY"/> 
+    <param name="pf_reads_only" type="boolean" label="Calculate the base distribution over PF (passing filtering) reads only" checked="true" truevalue="true" falsevalue="false" help="PF_READS_ONLY"/> 
+    <param name="assume_sorted" type="boolean" label="Assume the input file is already sorted" checked="true" truevalue="true" falsevalue="false" help="ASSUME_SORTED"/> 
+    
+    <expand macro="VS" />
+    
+  </inputs>
+  
+  <outputs>
+    <data format="tabular" name="outFile"/>
+    <data format="pdf" name="pdfFile"/>
+  </outputs>
+  
+  <tests>
+    <test>
+      <param name="aligned_reads_only" value="true" />
+      <param name="pf_reads_only" value="true" />
+      <param name="assume_sorted" value="true" />
+      <param name="reference_source_selector" value="history" />
+      <param name="ref_file" value="picard_CollectBaseDistributionByCycle_ref.fa" />
+      <param name="inputFile" value="picard_CollectBaseDistributionByCycle.bam" ftype="bam" />
+      <output name="outFile" file="picard_CollectBaseDistributionByCycle_test1.tab" ftype="tabular" lines_diff="4"/>
+    </test>
+  </tests>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <help>
+
+.. class:: infomark
+
+**Purpose**
+
+Program to chart the nucleotide distribution per cycle in a SAM or BAM file.
+
+@dataset_collections@
+
+@description@
+
+  ALIGNED_READS_ONLY=Boolean    If set to true, calculate the base distribution over aligned reads only.  Default value: 
+                                false. This option can be set to 'null' to clear the default value. Possible values: 
+                                {true, false} 
+
+  PF_READS_ONLY=Boolean         If set to true calculate the base distribution over PF reads only.  Default value: false. 
+                                This option can be set to 'null' to clear the default value. Possible values: {true, 
+                                false} 
+
+  REFERENCE_SEQUENCE=File
+  R=File                        Reference sequence fasta  Default value: null. 
+
+  ASSUME_SORTED=Boolean
+  AS=Boolean                    If true (default), then the sort order in the header file will be ignored.  Default 
+
+@more_info@
+
+  </help>
+</tool>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_CollectGcBiasMetrics.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,115 @@
+<tool name="CollectGcBiasMetrics" id="picard_CollectGcBiasMetrics" version="1.135">
+  <description>charts the GC bias metrics</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements">
+    <requirement type="package" version="3.1.2">R</requirement>
+  </expand>
+  <command>
+    @java_options@
+    ##set up input files
+
+    #set $reference_fasta_filename = "localref.fa"
+    
+    #if str( $reference_source.reference_source_selector ) == "history":
+        ln -s "${reference_source.ref_file}" "${reference_fasta_filename}" &amp;&amp;
+    #else:
+        #set $reference_fasta_filename = str( $reference_source.ref_file.fields.path )
+    #end if
+    
+    java -jar \$JAVA_JAR_PATH/picard.jar
+    CollectGcBiasMetrics
+    INPUT="${inputFile}"
+    OUTPUT="${outFile}"
+    CHART_OUTPUT="${pdfFile}"
+    SUMMARY_OUTPUT="${summaryFile}"
+    WINDOW_SIZE="${window_size}"
+    MINIMUM_GENOME_FRACTION="${minimum_genome_fraction}"
+    IS_BISULFITE_SEQUENCED="${is_bisulfite_sequenced}"
+    REFERENCE_SEQUENCE="${reference_fasta_filename}"
+    ASSUME_SORTED="${assume_sorted}"
+    
+    VALIDATION_STRINGENCY="${validation_stringency}"
+    QUIET=true
+    VERBOSITY=ERROR
+  
+  </command>
+  <inputs>
+    <param format="sam,bam" name="inputFile" type="data" label="Select SAM/BAM dataset or dataset collection" help="If empty, upload or import a SAM/BAM dataset."/>
+    <conditional name="reference_source">
+      <param name="reference_source_selector" type="select" label="Load reference genome from">
+        <option value="cached">Local cache</option>
+        <option value="history">History</option>
+      </param>
+      <when value="cached">
+        <param name="ref_file" type="select" label="Using reference genome" help="REFERENCE_SEQUENCE">
+          <options from_data_table="all_fasta">
+          </options>
+          <validator type="no_options" message="A built-in reference genome is not available for the build associated with the selected input file"/>
+        </param>
+      </when>
+      <when value="history">
+        <param name="ref_file" type="data" format="fasta" label="Use the folloing dataset as the reference sequence" help="REFERENCE_SEQUENCE; You can upload a FASTA sequence to the history and use it as reference" />
+      </when>
+    </conditional>
+    <param name="window_size" type="integer" value="100" label="The size of windows on the genome that are used to bin reads" help="WINDOW_SIZE; default=100"/>
+    <param name="minimum_genome_fraction" type="float" value="0.00005" label="For summary metrics, exclude GC windows that include less than this fraction of the genome" help="MINIMUM_GENOME_FRACTION; default=0.0005"/>
+    <param name="is_bisulfite_sequenced" type="boolean" label="Calculate the base distribution over PF (passing filtering) reads only" checked="true" truevalue="true" falsevalue="false" help="PF_READS_ONLY"/> 
+    <param name="assume_sorted" type="boolean" label="Assume the input file is already sorted" checked="true" truevalue="true" falsevalue="false" help="ASSUME_SORTED"/>
+    
+    <expand macro="VS" />
+    
+  </inputs>
+  
+  <outputs>
+    <data format="tabular" name="summaryFile" label="${tool.name} on ${on_string}: Summary stats"/>
+    <data format="tabular" name="outFile" label="${tool.name} on ${on_string}: Summary data"/>
+    <data format="pdf" name="pdfFile" label="${tool.name} on ${on_string}: Chart PDF"/>
+  </outputs>
+  
+  <tests>
+    <test>
+      <param name="window_size" value="100" />
+      <param name="minimum_genome_fraction" value="0.00005" />
+      <param name="assume_sorted" value="true" />
+      <param name="is_bisulfite_sequenced" value="true" />
+      <param name="reference_source_selector" value="history" />
+      <param name="ref_file" value="picard_CollectGcBiasMetrics_ref.fa" />
+      <param name="inputFile" value="picard_CollectGcBiasMetrics.bam" ftype="bam" />
+      <output name="outFile" file="picard_CollectGcBiasMetrics_test1.tab" ftype="tabular" lines_diff="4"/>
+    </test> 
+  </tests>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <help>
+
+.. class:: infomark
+
+**Purpose**
+
+Program to chart the nucleotide distribution per cycle in a SAM or BAM file.
+
+@dataset_collections@
+
+@description@
+
+  ALIGNED_READS_ONLY=Boolean    If set to true, calculate the base distribution over aligned reads only.  Default value: 
+                                false. Possible values: {true, false} 
+
+  PF_READS_ONLY=Boolean         If set to true calculate the base distribution over PF reads only.  Default value: false. 
+                                This option can be set to 'null' to clear the default value. Possible values: {true, 
+                                false} 
+
+  ASSUME_SORTED=Boolean
+  AS=Boolean                    If true (default), then the sort order in the header file will be ignored.  Default: True 
+
+@more_info@
+
+  </help>
+</tool>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_CollectInsertSizeMetrics.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,139 @@
+<tool name="CollectInsertSizeMetrics" id="picard_CollectInsertSizeMetrics" version="1.135">
+  <description>plots distribution of insert sizes</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements">
+    <requirement type="package" version="3.1.2">R</requirement>
+  </expand>
+  <command>
+    @java_options@
+    ##set up input files
+
+    #set $reference_fasta_filename = "localref.fa"
+    
+    #if str( $reference_source.reference_source_selector ) == "history":
+        ln -s "${reference_source.ref_file}" "${reference_fasta_filename}" &amp;&amp;
+    #else:
+        #set $reference_fasta_filename = str( $reference_source.ref_file.fields.path )
+    #end if
+    
+    java -jar \$JAVA_JAR_PATH/picard.jar
+    CollectInsertSizeMetrics
+    INPUT="${inputFile}"
+    OUTPUT="${outFile}"
+    HISTOGRAM_FILE="${histFile}"
+    DEVIATIONS="${deviations}"
+    
+    #if str( $hist_width ):
+      HISTOGRAM_WIDTH="${hist_width}"
+    #end if
+    
+    MINIMUM_PCT="${min_pct}"
+    REFERENCE_SEQUENCE="${reference_fasta_filename}"
+    ASSUME_SORTED="${assume_sorted}"
+    METRIC_ACCUMULATION_LEVEL="${metric_accumulation_level}"
+
+    VALIDATION_STRINGENCY="${validation_stringency}"
+    QUIET=true
+    VERBOSITY=ERROR
+  
+  </command>
+  <inputs>
+    <param format="sam,bam" name="inputFile" type="data" label="Select SAM/BAM dataset or dataset collection" help="If empty, upload or import a SAM/BAM dataset."/>
+    <conditional name="reference_source">
+      <param name="reference_source_selector" type="select" label="Load reference genome from">
+        <option value="cached">Local cache</option>
+        <option value="history">History</option>
+      </param>
+      <when value="cached">
+        <param name="ref_file" type="select" label="Using reference genome" help="REFERENCE_SEQUENCE">
+          <options from_data_table="all_fasta">
+          </options>
+          <validator type="no_options" message="A built-in reference genome is not available for the build associated with the selected input file"/>
+        </param>
+      </when>
+      <when value="history">
+        <param name="ref_file" type="data" format="fasta" label="Use the folloing dataset as the reference sequence" help="REFERENCE_SEQUENCE; You can upload a FASTA sequence to the history and use it as reference" />
+      </when>
+    </conditional>
+    <param name="deviations" type="float" value="10.0" label="Generate mean, sd and plots by trimming the data down to MEDIAN + DEVIATIONS*MEDIAN_ABSOLUTE_DEVIATION" help="DEVIATIONS; This option is offered because insert size data typically includes enough anomalous values from chimeras and other artifacts to make the mean and SD grossly misleading regarding the real distribution. default=10.0"/>
+    <param name="hist_width" type="integer" optional="True" label="Explicitly sets the Histogram width, overriding automatic truncation of Histogram tail" help="HISTOGRAM_WIDTH; optional"/>
+    <param name="min_pct" type="float" value="0.05" label="When generating the Histogram, discard any data categories (out of FR, TANDEM, RF) that have fewer than this percentage of overall reads" help="MINIMUM_PCT; (Range: 0 to 1). default=0.05. "/>
+    <param name="assume_sorted" type="boolean" label="Assume the input file is already sorted" checked="true" truevalue="true" falsevalue="false" help="ASSUME_SORTED"/>
+    <param name="metric_accumulation_level" type="select" label="The level(s) at which to accumulate metrics" multiple="true" help="METRIC_ACCUMULATION_LEVEL">
+      <option value="ALL_READS" selected="True">All reads</option>
+      <option value="SAMPLE">Sample</option>
+      <option value="LIBRARY">Library</option>
+      <option value="READ_GROUP">Read group</option>
+    </param>
+    
+    <expand macro="VS" />
+    
+  </inputs>
+  
+  <outputs>
+    <data format="tabular" name="outFile"/>
+    <data format="pdf" name="histFile"/>
+  </outputs>
+  
+  <tests>
+    <test>
+      <param name="metric_accumulation_level" value="ALL_READS"/>
+      <param name="deviations" value="10.0" />
+      <param name="hist_width" value="500" />
+      <param name="min_pct" value="0.05" />
+      <param name="assume_sorted" value="true" />
+      <param name="reference_source_selector" value="history" />
+      <param name="ref_file" value="picard_CollectInsertSizeMetrics_ref.fa" />
+      <param name="inputFile" value="picard_CollectInsertSizeMetrics.bam" ftype="bam" />
+      <output name="outFile" file="picard_CollectInsertSizeMetrics_test1.tab" ftype="tabular" lines_diff="4"/>
+    </test>
+  </tests>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <help>
+
+.. class:: infomark
+
+**Purpose**
+
+Reads a SAM or BAM dataset and writes a file containing metrics about the statistical distribution of insert size (excluding duplicates) and generates a Histogram plot.
+
+@dataset_collections@
+
+@description@
+
+ 
+  DEVIATIONS=Double             Generate mean, sd and plots by trimming the data down to MEDIAN + 
+                                DEVIATIONS*MEDIAN_ABSOLUTE_DEVIATION. This is done because insert size data typically 
+                                includes enough anomalous values from chimeras and other artifacts to make the mean and 
+                                sd grossly misleading regarding the real distribution.  Default value: 10.0. 
+
+  HISTOGRAM_WIDTH=Integer
+  W=Integer                     Explicitly sets the Histogram width, overriding automatic truncation of Histogram tail. 
+                                Also, when calculating mean and standard deviation, only bins &lt;= Histogram_WIDTH will be 
+                                included.  Default value: not set. 
+
+  MINIMUM_PCT=Float
+  M=Float                       When generating the Histogram, discard any data categories (out of FR, TANDEM, RF) that 
+                                have fewer than this percentage of overall reads. (Range: 0 to 1).  Default value: 0.05. 
+
+  METRIC_ACCUMULATION_LEVEL=MetricAccumulationLevel
+  LEVEL=MetricAccumulationLevel The level(s) at which to accumulate metrics.    Possible values: {ALL_READS, SAMPLE, 
+                                LIBRARY, READ_GROUP} This option may be specified 0 or more times. 
+ 
+  ASSUME_SORTED=Boolean
+  AS=Boolean                    If true (default), then the sort order in the header file will be ignored.  Default 
+                                value: true. This option can be set to 'null' to clear the default value. Possible 
+                                values: {true, false}
+                                
+@more_info@
+
+  </help>
+</tool>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_CollectRnaSeqMetrics.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,201 @@
+<tool name="CollectRnaSeqMetrics" id="picard_CollectRnaSeqMetrics" version="1.135">
+    <description> collect metrics about the alignment of RNA to various functional classes of loci in the genome</description>
+    <macros>
+        <import>picard_macros.xml</import>
+    </macros>
+    <expand macro="requirements">
+        <requirement type="package" version="3.1.2">R</requirement>
+    </expand>
+    <command>
+
+      ## Set up input files
+      
+      ## Reference sequences
+
+      #set $reference_fasta_filename = "localref.fa"
+    
+      #if str( $reference_source.reference_source_selector ) == "history":
+        ln -s "${reference_source.ref_file}" "${reference_fasta_filename}" &amp;&amp;
+      #else:
+        #set $reference_fasta_filename = str( $reference_source.ref_file.fields.path )
+      #end if
+      
+      ## refFlat data
+      ## The awk line below converts a file obtained from UCSC as specified in the tool help to refFlat format
+      
+      grep -v '^#' ${refFlat} | awk '{print $11"\t"$1"\t"$2"\t"$3"\t"$4"\t"$5"\t"$6"\t"$7"\t"$8"\t"$9"\t"$10}' > refFlat.tab &amp;&amp;
+      
+      ## Start picard command
+      
+      @java_options@
+      java -jar \$JAVA_JAR_PATH/picard.jar
+      CollectRnaSeqMetrics
+      REF_FLAT=refFlat.tab
+      
+      #if str( $ribosomal_intervals ) != "None":
+	 RIBOSOMAL_INTERVALS="${ribosomal_intervals}"
+      #end if
+      
+      STRAND_SPECIFICITY="${strand_specificity}"
+      MINIMUM_LENGTH="${minimum_length}"
+      CHART_OUTPUT="${pdfFile}"
+
+      #for $sequence_to_ignore in $ignore_list:
+	 IGNORE_SEQUENCE="${sequence_to_ignore.sequence}"
+      #end for
+      
+      RRNA_FRAGMENT_PERCENTAGE="${rrna_fragment_percentage}"
+      METRIC_ACCUMULATION_LEVEL="${metric_accumulation_level}"
+      INPUT="${inputFile}"
+      OUTPUT="${outFile}"
+      REFERENCE_SEQUENCE="${reference_fasta_filename}"
+      ASSUME_SORTED="${assume_sorted}"
+     
+      QUIET=true
+      VERBOSITY=ERROR
+      VALIDATION_STRINGENCY=${validation_stringency}
+    
+   </command>
+   
+   <inputs>
+      <param format="sam,bam" type="data" name="inputFile" label="Select SAM/BAM dataset or dataset collection" help="If empty, upload or import a SAM/BAM dataset" />
+      <conditional name="reference_source">
+	 <param name="reference_source_selector" type="select" label="Load reference genome from">
+	    <option value="cached">Local cache</option>
+	    <option value="history">History</option>
+	 </param>
+	 <when value="cached">
+	    <param name="ref_file" type="select" label="Using reference genome" help="REFERENCE_SEQUENCE">
+	       <options from_data_table="all_fasta"></options>
+	       <validator type="no_options" message="A built-in reference genome is not available for the build associated with the selected input file"/>
+	    </param>
+	 </when>
+	 <when value="history">
+	    <param name="ref_file" type="data" format="fasta" label="Use the folloing dataset as the reference sequence" help="REFERENCE_SEQUENCE; You can upload a FASTA sequence to the history and use it as reference" />
+	 </when>
+      </conditional>        
+      <param format="tabular" name="refFlat" type="data" label="Gene annotations in refFlat form" help="See &quot;Obtaining gene annotations in refFlat format&quot; below for help" />
+      <param name="ribosomal_intervals" format="picard_interval_list" type="data" optional="True" label="Location of rRNA sequences in genome, in interval_list format" help="RIBOSOMAL_INTERVALS; If not specified no bases will be identified as being ribosomal. The list of intervals can be geberated from BED or Interval datasets using Galaxy BedToIntervalList tool"/>
+      <param name="strand_specificity" type="select" label="What is the RNA-seq library strand specificity" help="STRAND_SPECIFICITY; For unpaired reads, use FIRST_READ_TRANSCRIPTION_STRAND if the reads are expected to be on the transcription strand.">
+	 <option value="NONE" select="True">None</option>
+	 <option value="FIRST_READ_TRANSCRIPTION_STRAND">First read transcription strand</option>
+	 <option value="SECOND_READ_TRANSCRIPTION_STRAND">Second read transcription strand</option>
+      </param>
+      <param name="minimum_length" type="integer" value="500" label="When calculating coverage based values use only use transcripts of this length or greater" help="MINIMUM_LENGTH; default=500"/>
+      <repeat name="ignore_list" title="Sequences to ignore" min="0" help="You can provide multiple sequences by clicking the button below">
+          <param name="sequence" type="text" size="80" label="Ignore reads matching this sequence"/>
+      </repeat>
+      <param name="rrna_fragment_percentage" type="float" value="0.8" label="This percentage of the length of a fragment must overlap one of the ribosomal intervals for a read or read pair to be considered rRNA." help="RRNA_FRAGMENT_PERCENTAGE; default=0.8"/>
+      <param name="metric_accumulation_level" type="select" label="The level(s) at which to accumulate metrics" multiple="true" help="METRIC_ACCUMULATION_LEVEL">
+	 <option value="ALL_READS" selected="True">All reads</option>
+	 <option value="SAMPLE">Sample</option>
+	 <option value="LIBRARY">Library</option>
+	 <option value="READ_GROUP">Read group</option>
+      </param>
+      <param name="assume_sorted" type="boolean" label="Assume the input file is already sorted" checked="true" truevalue="true" falsevalue="false" help="ASSUME_SORTED"/>
+      
+      <expand macro="VS" />
+
+  </inputs>
+  <outputs>
+      <data format="pdf" name="pdfFile" label="${tool.name} on ${on_string}: Chart PDF"/>
+      <data format="tabular" name="outFile" label="${tool.name} on ${on_string}: Summary stats"/>
+  </outputs>
+  
+   <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  <tests>
+    <test>
+      <param name="reference_source_selector" value="history"/>
+      <param name="ref_file" value="picard_CollectRnaSeqMetrics_ref.fa" ftype="fasta"/>
+      <param name="inputFile" value="picard_CollectRnaSeqMetrics.bam" ftype="bam"/>
+      <param name="assume_sorted" value="true" />
+      <param name="refFlat" value="picard_CollectRnaSeqMetrics.refFlat" />
+      <param name="metric_accumulation_level" value="ALL_READS" />
+      <param name="minimum_length" value="500" />
+      <param name="strand_specificity" value="NONE" />
+      <param name="rrna_fragment_percentage" value="0.8" />
+      <output name="outFile" file="picard_CollectRnaSeqMetrics_test1.tab" ftype="tabular" lines_diff="4"/>
+    </test>
+
+  </tests>
+  <help>
+
+.. class:: infomark
+
+**Purpose**
+
+Collects metrics about the alignment of RNA to various functional classes of loci in the genome: coding, intronic, UTR, intergenic, ribosomal.
+
+@dataset_collections@
+
+-----
+
+.. class:: warningmark
+
+**Obtaining gene annotations in refFlat format**
+
+This tool requires gene annotations in refFlat_ format. These data can be obtained from UCSC table browser directly through Galaxy by following these steps:
+
+   1. Click on **Get Data** in the upper part of left pane of Galaxy interface
+   2. Click on **UCSC Main** link
+   3. Set your genome and dataset of interest. It **must** be the same genome build against which you have mapped the reads contained in the BAM file you are analyzing
+   4. In the **output format** field choose **selected fields from primary and related tables**
+   5. Click **get output** button
+   6. In the first table presented at the top of the page select (using checkboxes) first 11 fields:
+      name
+      chrom
+      strand
+      txStart
+      txEnd
+      cdsStart
+      cdsEnd
+      exonCount
+      exonStarts
+      exonEnds
+      proteinId
+   7. Click **done with selection**
+   8. Click **Send query to Galaxy**
+   9. A new dataset will appear in the current Galaxy history
+   10. Use this dataset as the input for **Gene annotations in refFlat form** dropdown of this tool
+   
+.. _refFlat: http://genome.ucsc.edu/goldenPath/gbdDescriptionsOld.html#RefFlat
+
+@description@
+
+   REF_FLAT=File                 Gene annotations in refFlat form.  Format described here: 
+                                 http://genome.ucsc.edu/goldenPath/gbdDescriptionsOld.html#RefFlat  Required. 
+
+   RIBOSOMAL_INTERVALS=File      Location of rRNA sequences in genome, in interval_list format.  If not specified no bases 
+                                 will be identified as being ribosomal. Format described here: 
+                                 http://picard.sourceforge.net/javadoc/net/sf/picard/util/IntervalList.html  and can be
+				 generated from BED datasetes using Galaxy's wrapper for picard_BedToIntervalList tool
+
+   STRAND_SPECIFICITY=StrandSpecificity
+   STRAND=StrandSpecificity      For strand-specific library prep. For unpaired reads, use FIRST_READ_TRANSCRIPTION_STRAND 
+                                 if the reads are expected to be on the transcription strand.  Required. Possible values: 
+                                 {NONE, FIRST_READ_TRANSCRIPTION_STRAND, SECOND_READ_TRANSCRIPTION_STRAND} 
+
+   MINIMUM_LENGTH=Integer        When calculating coverage based values (e.g. CV of coverage) only use transcripts of this 
+                                 length or greater.  Default value: 500.
+
+   IGNORE_SEQUENCE=String        If a read maps to a sequence specified with this option, all the bases in the read are 
+                                 counted as ignored bases.  
+
+   RRNA_FRAGMENT_PERCENTAGE=Double
+                                 This percentage of the length of a fragment must overlap one of the ribosomal intervals 
+                                 for a read or read pair by this must in order to be considered rRNA.  Default value: 0.8. 
+
+   METRIC_ACCUMULATION_LEVEL=MetricAccumulationLevel
+   LEVEL=MetricAccumulationLevel The level(s) at which to accumulate metrics.    Possible values: {ALL_READS, SAMPLE, 
+                                 LIBRARY, READ_GROUP} This option may be specified 0 or more times.
+				 
+   ASSUME_SORTED=Boolean
+   AS=Boolean                    If true (default), then the sort order in the header file will be ignored.  Default 
+                                 value: true. Possible values: {true, false} 
+
+@more_info@
+
+  </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_CollectWgsMetrics.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,107 @@
+<tool name="CollectWgsMetrics" id="picard_CollectWgsMetrics" version="1.135">
+  <description>compute metrics for evaluating of whole genome sequencing experiments</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements" />
+  <command>
+    @java_options@
+    ##set up input files
+
+    #set $reference_fasta_filename = "localref.fa"
+    
+    #if str( $reference_source.reference_source_selector ) == "history":
+        ln -s "${reference_source.ref_file}" "${reference_fasta_filename}" &amp;&amp;
+    #else:
+        #set $reference_fasta_filename = str( $reference_source.ref_file.fields.path )
+    #end if
+    
+    java -jar \$JAVA_JAR_PATH/picard.jar
+    CollectWgsMetrics
+    INPUT="${inputFile}"
+    OUTPUT="${outFile}"
+    REFERENCE_SEQUENCE="${reference_fasta_filename}"
+    MINIMUM_MAPPING_QUALITY="${minimum_mapping_quality}"
+    MINIMUM_BASE_QUALITY="${minimum_base_quality}"
+    COVERAGE_CAP="${coverage_cap}"
+    
+    VALIDATION_STRINGENCY="${validation_stringency}"
+    QUIET=true
+    VERBOSITY=ERROR
+  
+  </command>
+  <inputs>
+    <param format="sam,bam" name="inputFile" type="data" label="Select SAM/BAM dataset or dataset collection" help="If empty, upload or import a SAM/BAM dataset"/>
+    <conditional name="reference_source">
+      <param name="reference_source_selector" type="select" label="Load reference genome from">
+        <option value="cached">Local cache</option>
+        <option value="history">History</option>
+      </param>
+      <when value="cached">
+        <param name="ref_file" type="select" label="Using reference genome" help="REFERENCE_SEQUENCE">
+          <options from_data_table="all_fasta">
+          </options>
+          <validator type="no_options" message="A built-in reference genome is not available for the build associated with the selected input file"/>
+        </param>
+      </when>
+      <when value="history">
+        <param name="ref_file" type="data" format="fasta" label="Use the folloing dataset as the reference sequence" help="REFERENCE_SEQUENCE; You can upload a FASTA sequence to the history and use it as reference" />
+      </when>
+    </conditional>
+    <param name="minimum_mapping_quality" type="integer" value="20" label="Minimum mapping quality for a read to contribute coverage" help="MINIMUM_MAPPING_QUALITY; default=20"/>
+    <param name="minimum_base_quality" type="integer" value="20" label="Minimum base quality for a base to contribute coverage" help="MINIMUM_BASE_QUALITY; default=20"/>
+    <param name="coverage_cap" type="integer" value="250" label="Treat bases with coverage exceeding this value as if they had coverage at this value" help="COVERAGE_CAP; default=250"/>
+
+    
+    <expand macro="VS" />
+    
+  </inputs>
+  
+  <outputs>
+    <data format="tabular" name="outFile" label="${tool.name} on ${on_string}: Summary data"/>
+  </outputs>
+  
+  <tests>
+    <test>
+      <param name="reference_source_selector" value="history" />
+      <param name="minimum_mapping_quality" value="20" />
+      <param name="minimum_base_quality" value="20" />
+      <param name="coverage_cap" value="250" />
+      <param name="ref_file" value="picard_CollectWgsMetrics_ref.fa" />
+      <param name="inputFile" value="picard_CollectWgsMetrics.bam" ftype="bam" />
+      <output name="outFile" file="picard_CollectWgsMetrics_test1.tab" ftype="tabular" lines_diff="4"/>
+    </test> 
+  </tests>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <help>
+
+.. class:: infomark
+
+**Purpose**
+
+Computes a number of metrics that are useful for evaluating coverage and performance of whole genome sequencing experiments.
+
+@dataset_collections@
+
+@description@
+
+  MINIMUM_MAPPING_QUALITY=Integer
+  MQ=Integer                    Minimum mapping quality for a read to contribute coverage.  Default value: 20. 
+
+  MINIMUM_BASE_QUALITY=Integer
+  Q=Integer                     Minimum base quality for a base to contribute coverage.  Default value: 20. 
+
+  COVERAGE_CAP=Integer
+  CAP=Integer                   Treat bases with coverage exceeding this value as if they had coverage at this value.  
+                                Default value: 250. 
+
+@more_info@
+
+  </help>
+</tool>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_DownsampleSam.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,75 @@
+<tool name="Downsample SAM/BAM" id="picard_DownsampleSam" version="1.135">
+  <description>Downsample a file to retain a subset of the reads</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements" />
+  <command>
+    @java_options@
+    java -jar
+    \$JAVA_JAR_PATH/picard.jar
+    DownsampleSam
+      INPUT="${inputFile}"
+      OUTPUT="${outFile}"
+      PROBABILITY=${probability}
+      RANDOM_SEED=${seed}
+      QUIET=true
+      VERBOSITY=ERROR
+      VALIDATION_STRINGENCY=${validation_stringency}
+  </command>
+  <inputs>
+    <param format="sam,bam" name="inputFile" type="data" label="Select SAM/BAM dataset or dataset collection" help="If empty, upload or import a SAM or BAM dataset" />
+    <param name="probability" type="float" size="4" min="0.0" max="1.0" label="Probability (between 0 and 1) that any given read will be kept" help="PROBABILITY; specify 1 to keep all reads, 0.1 to keep 10% of the reads" value="1" />
+    <param name="seed" type="integer" size="5" label="Random seed value" help="RANDOM_SEED; default=1" value="1" />
+    
+    <expand macro="VS" />
+    
+  </inputs>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <outputs>
+    <data name="outFile" format="bam" label="${tool.name} on ${on_string}: downsampled BAM"/>
+  </outputs>
+  
+  <tests>
+    <test>
+      <param name="inputFile" value="picard_DownsampleSam.bam"  ftype="bam" />
+      <param name="probability" value="0.1" />
+      <param name="seed" value="1024" />
+      <param name="validation_stringency" value="LENIENT" />
+      <output name="outFile" file="picard_DownsampleSam_test1.bam" ftype="bam"/>
+    </test>
+  </tests>
+  <help>
+
+.. class:: infomark
+
+**Purpose**
+
+Randomly down-sample a SAM or BAM file to retain a random subset of the reads. Mate-pairs are either both kept or both discarded. Reads marked as not primary alignments are all discarded. Each read is given a probability P of being retained - results with the exact same input in the same order and with the same value for RANDOM_SEED will produce the same results.
+
+@dataset_collections@
+
+@description@
+
+  INPUT=File
+  I=File              The input SAM or BAM file to downsample.  Required. 
+
+  OUTPUT=File
+  O=File              The output, downsampled, SAM or BAM file to write.  Required. 
+
+  RANDOM_SEED=Long
+  R=Long              Random seed to use if reproducibilty is desired.  Setting to null will cause multiple
+                      invocations to produce different results.
+                      
+  PROBABILITY=Double
+  P=Double            The probability of keeping any individual read, between 0 and 1. 
+                       
+
+
+@more_info@
+  </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_EstimateLibraryComplexity.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,132 @@
+<tool name="EstimateLibraryComplexity" id="picard_EstimateLibraryComplexity" version="1.135">
+  <description>assess sequence library complexity from read sequences</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements" />
+  <command>
+    @java_options@
+    
+    java -jar \$JAVA_JAR_PATH/picard.jar
+    EstimateLibraryComplexity
+    
+    INPUT="${inputFile}"
+    OUTPUT="${outFile}"
+    
+    MIN_IDENTICAL_BASES="${min_identical_bases}"
+    MAX_DIFF_RATE="${max_diff_rate}"
+    MIN_MEAN_QUALITY="${min_mean_quality}"
+    MAX_GROUP_RATIO="${max_group_ratio}"
+    #import pipes
+    READ_NAME_REGEX=${ pipes.quote( str( $read_name_regex ) ) or "''" }
+    OPTICAL_DUPLICATE_PIXEL_DISTANCE="${optical_duplicate_pixel_distance}"
+    
+    VALIDATION_STRINGENCY="${validation_stringency}"
+    QUIET=true
+    VERBOSITY=ERROR
+  
+  </command>
+  <inputs>
+    <param format="bam" name="inputFile" type="data" label="Select SAM/BAM dataset or dataset collection" help="If empty, upload or import a SAM/BAM dataset" />
+    <param name="min_identical_bases" type="integer" value="5" label="The minimum number of bases at the starts of reads that must be identical for reads to be grouped together for duplicate detection" help="MIN_IDENTICAL_BASES; In effect total_reads / 4^max_id_bases reads will be compared at a time, so lower numbers will produce more accurate results but consume exponentially more memory and CPU; default=5"/>
+    <param name="max_diff_rate" type="float" value="0.03" label="The maximum rate of differences between two reads to call them identical" help="MAX_DIFF_RATE; default=0.03"/>
+    <param name="min_mean_quality" type="integer" min="0" max="93" value="20" label="The minimum mean quality of the bases in a read pair for the read to be analyzed" help="MIN_MEAN_QUALITY; Reads with lower average quality are filtered out and not considered in any calculations; default=20"/>
+    <param name="max_group_ratio" type="integer" value="500" label="Do not process self-similar groups that are this many times over the mean expected group size" help="MAX_GROUP_RATIO; I.e. if the input contains 10m read pairs and MIN_IDENTICAL_BASES is set to 5, then the mean expected group size would be approximately 10 reads; default-500"/>
+
+    <param name="read_name_regex" type="text" size="40" value="[a-zA-Z0-9]+:[0-9]:([0-9]+):([0-9]+):([0-9]+).*." label="Regular expression that can be used to parse read names in the incoming SAM/BAM dataset" help="READ_NAME_REGEX; Read names are parsed to extract three variables: tile/region, x coordinate and y coordinate. These values are used to estimate the rate of optical duplication in order to give a more accurate estimated library size. See help below for more info; default=[a-zA-Z0-9]+:[0-9]:([0-9]+):([0-9]+):([0-9]+).*.">
+      <sanitizer>
+        <valid initial="string.printable">
+        </valid>
+      </sanitizer>
+    </param>
+    <param name="optical_duplicate_pixel_distance" type="integer" value="100" min="0" max="500" label="The maximum offset between two duplicte clusters in order to consider them optical duplicates" help="OPTICAL_DUPLICATE_PIXEL_DISTANCE; default=100"/>
+
+   <expand macro="VS" />
+    
+  </inputs> 
+  
+  <outputs>
+    <data format="tabular" name="outFile" label="${tool.name} on ${on_string}: Library complexity report"/>
+  </outputs>
+  
+  <tests>
+    <test>
+      <param name="inputFile" value="picard_EstimateLibraryComplexity.bam" ftype="bam"/>
+      <param name="min_identical_bases" value="5"/>
+      <param name="max_diff_rate" value="0.03"/>
+      <param name="min_mean_quality" value="20"/>
+      <param name="read_name_regex" value="[a-zA-Z0-9]+:[0-9]:([0-9]+):([0-9]+):([0-9]+).*."/>
+      <param name="optical_duplicate_pixel_distance" value="100"/>
+      <param name="max_group_ratio" value="500"/>
+      <param name="validation_stringency" value="LENIENT"/>
+      <output name="outFile" file="picard_EstimateLibraryComplexity_test1.tab" ftype="tabular" lines_diff="4"/>
+    </test>
+  </tests>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <help>
+
+**Purpose**
+
+Attempts to estimate library complexity from sequence of read pairs alone. Does so by sorting all reads by the first N bases (5 by default)
+of each read and then comparing reads with the first N bases identical to each other for duplicates. Reads are considered to be duplicates
+if they match each other with no gaps and an overall mismatch rate less than or equal to MAX_DIFF_RATE (0.03 by default).
+
+Reads of poor quality are filtered out so as to provide a more accurate estimate. The filtering removes reads with any no-calls in the first
+N bases or with a mean base quality lower than MIN_MEAN_QUALITY across either the first or second read.
+
+Unpaired reads are ignored in this computation.
+The algorithm attempts to detect optical duplicates separately from PCR duplicates and excludes these in the calculation of library size.
+
+Also, since there is no alignment to screen out technical reads one further filter is applied on the data. After examining all reads a Histogram
+is built of [#reads in duplicate set -> #of duplicate sets]; all bins that contain exactly one duplicate set are then removed from the Histogram
+as outliers before library size is estimated.
+
+@dataset_collections@
+
+@description@
+
+  MIN_IDENTICAL_BASES=Integer   The minimum number of bases at the starts of reads that must be identical for reads to be 
+                                grouped together for duplicate detection.  In effect total_reads / 4^max_id_bases reads 
+                                will be compared at a time, so lower numbers will produce more accurate results but 
+                                consume exponentially more memory and CPU.  Default value: 5. 
+  
+  MAX_DIFF_RATE=Double          The maximum rate of differences between two reads to call them identical.  Default value: 
+                                0.03.
+  
+  MIN_MEAN_QUALITY=Integer      The minimum mean quality of the bases in a read pair for the read to be analyzed. Reads 
+                                with lower average quality are filtered out and not considered in any calculations.  
+                                Default value: 20.
+  
+  MAX_GROUP_RATIO=Integer       Do not process self-similar groups that are this many times over the mean expected group 
+                                size. I.e. if the input contains 10m read pairs and MIN_IDENTICAL_BASES is set to 5, then 
+                                the mean expected group size would be approximately 10 reads.  Default value: 500.
+  
+  READ_NAME_REGEX=String        Regular expression that can be used to parse read names in the incoming SAM file. Read 
+                                names are parsed to extract three variables: tile/region, x coordinate and y coordinate. 
+                                These values are used to estimate the rate of optical duplication in order to give a more 
+                                accurate estimated library size. Set this option to null to disable optical duplicate 
+                                detection. The regular expression should contain three capture groups for the three 
+                                variables, in order. It must match the entire read name. Note that if the default regex 
+                                is specified, a regex match is not actually done, but instead the read name  is split on 
+                                colon character. For 5 element names, the 3rd, 4th and 5th elements are assumed to be 
+                                tile, x and y values. For 7 element names (CASAVA 1.8), the 5th, 6th, and 7th elements 
+                                are assumed to be tile, x and y values.  Default value: 
+                                [a-zA-Z0-9]+:[0-9]:([0-9]+):([0-9]+):([0-9]+).*.
+  
+  OPTICAL_DUPLICATE_PIXEL_DISTANCE=Integer  
+                                The maximum offset between two duplicte clusters in order to consider them optical 
+                                duplicates. This should usually be set to some fairly small number (e.g. 5-10 pixels) 
+                                unless using later versions of the Illumina pipeline that multiply pixel values by 10, in 
+                                which case 50-100 is more normal.  Default value: 100.
+  
+
+@more_info@
+
+  </help>
+</tool>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_FastqToSam.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,226 @@
+<tool name="FastqToSam" id="picard_FastqToSam" version="1.135">
+  <description>convert Fastq data into unaligned BAM</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements" />
+  <command>
+    @java_options@
+    
+    java -jar \$JAVA_JAR_PATH/picard.jar
+    FastqToSam
+    
+    #if str( $input_type.input_type_selector ) == "se":
+      FASTQ="${input_type.fastq}"
+    #elif str( $input_type.input_type_selector ) == "pe":
+      FASTQ="${input_type.fastq}"
+      FASTQ2="${input_type.fastq2}"
+    #else
+      FASTQ="${input_type.fastq.forward}"
+      FASTQ2="${input_type.fastq.reverse}"
+    #end if
+    
+    QUALITY_FORMAT="${quality_format}"
+    OUTPUT="${outFile}"
+    READ_GROUP_NAME="${read_group_name}"
+    SAMPLE_NAME="${sample_name}"
+    
+    #if str( $library_name ):
+      LIBRARY_NAME="${library_name}"
+    #end if
+    
+    #if str( $platform_unit ):
+      PLATFORM_UNIT="${platform_unit}"
+    #end if
+      
+    #if str( $platform ):
+      PLATFORM="${platform}"
+    #end if
+      
+    #if str( $sequencing_center ):
+      SEQUENCING_CENTER="${sequencing_center}"
+    #end if
+      
+    #if str( $predicted_insert_size ):
+      PREDICTED_INSERT_SIZE="${predicted_insert_size}"
+    #end if
+      
+    #if str( $comment ):
+      COMMENT="${comment}"
+    #end if
+      
+    #if str( $description ):
+      DESCRIPTION="${description}"
+    #end if
+      
+    #if str( $run_date ):
+      RUN_DATE="${run_date}"
+    #end if
+    
+    MIN_Q="${min_q}"
+    MAX_Q="${max_q}"
+    STRIP_UNPAIRED_MATE_NUMBER="${strip_unpairied_mate_number}"
+    ALLOW_AND_IGNORE_EMPTY_LINES="${allow_and_ignore_empty_lines}"
+    
+    SORT_ORDER=coordinate
+    VALIDATION_STRINGENCY="${validation_stringency}"
+    QUIET=true
+    VERBOSITY=ERROR
+  
+  </command>
+  <inputs>
+    <conditional name="input_type">
+      <param name="input_type_selector" type="select" label="What is your input data" help="Select between single end, paired end, and collections. See help below for full explanation of dataset types">
+        <option value="se">Single end (single dataset)</option>
+        <option value="pe">Paired end (two datasets)</option>
+        <option value="pc">Paired collection</option>
+      </param>
+      <when value="se">
+        <param name="fastq" type="data" format="fastq" label="Input fastq file for single end data" help="FASTQ"/>
+      </when>
+      <when value="pe">
+        <param name="fastq" type="data" format="fastq" label="Input fastq file for the first read in paired end data" help="FASTQ"/>
+        <param name="fastq2" type="data" format="fastq" label="Input fastq file for the second read of paired end data" help="FASTQ2"/>
+      </when>
+      <when value="pc">
+        <param name="fastq" type="data_collection" collection_type="paired" label="FASTQ paired dataset collection" help="FASTQ and FASTQ2; A collection of two datasets with forward and reverse reads. See help below on explanation of dataset collections"/>
+      </when>
+    </conditional>
+      
+    <param name="quality_format" type="select" label="Select quality encoding scheme" help="QUALITY_FORMAT">
+      <option value="Standard" selected="True">Sanger (+33)</option>
+      <option value="Illumina">Illumina (+64)</option>
+      <option value="Solexa">Solexa (+66)</option>
+    </param>
+
+    <param name="read_group_name" type="text" size="20" value="A" label="Read group name" help="READ_GROUP_NAME"/>
+    <param name="sample_name" type="text" size="20" value="sample-a" label="Sample name" help="SAMPLE_NAME"/>
+    <param name="library_name" type="text" size="20" optional="True" label="The library name" help="LIBRARY_NAME; Optional"/>
+    <param name="platform_unit" type="text" size="20" optional="True"  label="The platform unit (often run_barcode.lane)" help="PLATFORM_UNIT; Optional"/>
+    <param name="platform" type="text" size="20" optional="True"  label="The platform type (e.g. illumina, 454)" help="PLATFORM; Optional"/>
+    <param name="sequencing_center" type="text" size="20" optional="True"  label="The sequencing center from which the data originated" help="SEQUENCING_CENTER; Optional"/>
+
+    <param name="predicted_insert_size" type="integer" min="0" max="100000" optional="True" label="Predicted median insert size, to insert into the read group header" help="PREDICTED_INSERT_SIZE; Optional"/>
+    <param name="comment" type="text" size="20" optional="True" label="Comment to include in the output dataset's header" help="COMMENT; Optional"/>
+    <param name="description" type="text" size="20" optional="True" label="Optional description information" help="DESCRIPTION; Optional"/>
+    <param name="run_date" optional="True" type="text" label="Run date" help="RGDT; Optional; Format=YYYY-MM-DD (eg 1997-07-16)"/>
+    <param name="min_q" type="integer" value="0" min="0" max="100" label="Minimum quality allowed in the input fastq" help="MIN_Q; An exception will be thrown if a quality is less than this value; default=0"/>
+    <param name="max_q" type="integer" value="93" min="0" max="100" label="Minimum quality allowed in the input fastq" help="MAX_Q; An exception will be thrown if a quality is greater than this value; default=93"/>
+    <param name="strip_unpairied_mate_number" type="boolean" truevalue="true" falsevalue="false" label="If true and this is an unpaired fastq any occurance of '/1' will be removed from the end of a read name" help="STRIP_UNPAIRED_MATE_NUMBER; default=false"/>
+    <param name="allow_and_ignore_empty_lines" type="boolean" truevalue="true" falsevalue="false" label="Allow (and ignore) empty lines" help="ALLOW_AND_IGNORE_EMPTY_LINES; default=false"/>
+    
+    <expand macro="VS" />
+    
+  </inputs> 
+  
+  <outputs>
+    <data format="bam" name="outFile" label="${tool.name} on ${on_string}: reads as unaligned BAM"/>
+  </outputs>
+  
+  <tests>
+    <test>
+      <param name="input_type_selector" value="pe" />
+      <param name="quality_format" value="Standard" />
+      <param name="read_group_name" value="A" />
+      <param name="sample_name" value="sample-a" />
+      <param name="library_name" value="A"/>
+      <param name="platform_unit" value="A"/>
+      <param name="platform" value="Illumina"/>
+      <param name="sequencing_center" value="A"/>
+      <param name="predicted_insert_size" value="300"/>
+      <param name="comment" value="A"/>
+      <param name="description" value="A"/>
+      <param name="run_date" value="2014-10-10"/>
+      <param name="min_q" value="0" />
+      <param name="max_q" value="93" />
+      <param name="strip_unpairied_mate_number" value="False" />
+      <param name="allow_and_ignore_empty_lines" value="False" />
+      <param name="validation_stringency" value="LENIENT"/>
+      <param name="fastq" value="picard_FastqToSam_read1.fq" ftype="fastq" />
+      <param name="fastq2" value="picard_FastqToSam_read2.fq" ftype="fastq" />
+      <output name="outFile" file="picard_FastqToSam_test1.bam" ftype="bam" lines_diff="4"/>
+    </test> 
+  </tests>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <help>
+
+.. class:: infomark
+
+**Purpose**
+
+Computes a number of metrics that are useful for evaluating coverage and performance of whole genome sequencing experiments.
+
+@dataset_collections@
+
+@RG@
+
+@description@
+
+  FASTQ=File
+  F1=File                       Input fastq file for single end data, or first read in paired end 
+                                data.  Required.
+                                
+  FASTQ2=File
+  F2=File                       Input fastq file for the second read of paired end data (if used).  
+
+  QUALITY_FORMAT=FastqQualityFormat
+  V=FastqQualityFormat          A value describing how the quality values are encoded in the fastq.  Either Solexa for 
+                                pre-pipeline 1.3 style scores (solexa scaling + 66), Illumina for pipeline 1.3 and above 
+                                (phred scaling + 64) or Standard for phred scaled scores with a character shift of 33.  
+                                If this value is not specified, the quality format will be detected automatically.  
+                                Default value: null. Possible values: {Solexa, Illumina, Standard} 
+
+  READ_GROUP_NAME=String
+  RG=String                     Read group name  Default value: A. 
+  
+  SAMPLE_NAME=String
+  SM=String                     Sample name to insert into the read group header  Required. 
+  
+  LIBRARY_NAME=String
+  LB=String                     The library name to place into the LB attribute in the read group header.
+  
+  PLATFORM_UNIT=String
+  PU=String                     The platform unit (often run_barcode.lane) to insert into the read group header.
+  
+  PLATFORM=String
+  PL=String                     The platform type (e.g. illumina, solid) to insert into the read group header.
+  
+  SEQUENCING_CENTER=String
+  CN=String                     The sequencing center from which the data originated.
+  
+  PREDICTED_INSERT_SIZE=Integer
+  PI=Integer                    Predicted median insert size, to insert into the read group header.
+  
+  COMMENT=String
+  CO=String                     Comment to include in the merged output file's header. 
+  
+  DESCRIPTION=String
+  DS=String                     Inserted into the read group header. 
+  
+  RUN_DATE=Iso8601Date
+  DT=Iso8601Date                Date the run was produced, to insert into the read group header. 
+  
+  MIN_Q=Integer                 Minimum quality allowed in the input fastq.  An exception will be thrown if a quality is 
+                                less than this value.  Default value: 0.
+                                
+  MAX_Q=Integer                 Maximum quality allowed in the input fastq.  An exception will be thrown if a quality is 
+                                greater than this value.  Default value: 93.
+  
+  STRIP_UNPAIRED_MATE_NUMBER=Boolean
+                                If true and this is an unpaired fastq any occurance of '/1' will be removed from the end 
+                                of a read name.  Default value: false.  Possible values: {true, false} 
+  
+  ALLOW_AND_IGNORE_EMPTY_LINES=Boolean
+                                Allow (and ignore) empty lines  Default value: false. Possible values: {true, false} 
+  
+
+@more_info@
+
+  </help>
+</tool>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_FilterSamReads.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,130 @@
+<tool name="FilterSamReads" id="picard_FilterSamReads" version="1.135">
+  <description>include or exclude aligned and unaligned reads and read lists</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements" />
+  <command>
+    @java_options@
+    
+    ##Sam Sorting is performed here because FilterSamReads requires input to be in query-sorted order
+    
+    java -jar \$JAVA_JAR_PATH/picard.jar
+    SortSam
+    INPUT="${inputFile}"
+    OUTPUT=query_sorted_bam.bam
+    SORT_ORDER=queryname
+    VALIDATION_STRINGENCY=LENIENT
+    QUIET=true
+    VERBOSITY=ERROR
+    
+    &amp;&amp;
+    
+    java -jar \$JAVA_JAR_PATH/picard.jar
+    FilterSamReads
+    INPUT=query_sorted_bam.bam
+    FILTER="${filter_type.filter}"
+    
+    #if ( str( $filter_type.filter ) == "includeReadList" or str( $filter_type.filter ) == "excludeReadList" ):
+      READ_LIST_FILE="${filter_type.read_list_file}"
+    #end if
+    
+    OUTPUT="${outFile}"
+    SORT_ORDER=coordinate
+    VALIDATION_STRINGENCY="${validation_stringency}"
+    QUIET=true
+    VERBOSITY=ERROR
+  
+  </command>
+  <inputs>
+    <param name="inputFile" type="data" format="sam,bam" label="Select SAM/BAM dataset or dataset collection" help="If empty, upload or import a SAM/BAM dataset"/>
+    <conditional name="filter_type">
+      <param name="filter" type="select" label="Select filtering type" help="FILTER; see Help for deatiled info">
+        <option value="includeAligned">Include aligned</option>
+        <option value="excludeAligned">Exclude aligned</option>
+        <option value="includeReadList">Include read list</option>
+        <option value="excludeReadList">Exclude read list</option>
+      </param>
+      <when value="includeAligned"/> <!-- do nothing -->
+      <when value="excludeAligned"/> <!-- do nothing -->
+      <when value="includeReadList">
+        <param name="read_list_file" type="data" format="tabular" label="Dataset containing read names that will be INCLUDED in the output" help="READ_LIST_FILE"/>
+      </when>
+      <when value="excludeReadList">
+        <param name="read_list_file" type="data" format="tabular" label="Dataset containing read names that will be EXCLUDED in the output" help="READ_LIST_FILE"/>
+      </when>
+    </conditional>
+    
+    <expand macro="VS" />
+    
+  </inputs> 
+  
+  <outputs>
+    <data format="bam" name="outFile" label="${tool.name} on ${on_string}: filtered BAM"/>
+  </outputs>
+  
+  <tests>
+    <test>
+      <param name="inputFile" value="picard_FilterSamReads.bam" ftype="bam"/>
+      <param name="filter" value="includeReadList"/>
+      <param name="read_list_file" value="picard_FilterSamReads_read_list_file.tab" ftype="tabular"/>
+      <param name="validation_stringency" value="LENIENT"/>
+      <output name="outFile" file="picard_FilterSamReads_include_reads_test1.bam" ftype="bam" lines_diff="2"/>
+    </test>
+    <test>
+      <param name="inputFile" value="picard_FilterSamReads.bam" ftype="bam"/>
+      <param name="filter" value="excludeReadList"/>
+      <param name="read_list_file" value="picard_FilterSamReads_read_list_file.tab" ftype="tabular"/>
+      <param name="validation_stringency" value="LENIENT"/>
+      <output name="outFile" file="picard_FilterSamReads_exclude_reads_test2.bam" ftype="bam" lines_diff="2"/>
+    </test>
+  </tests>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <help>
+
+**Purpose**
+
+Computes a number of metrics that are useful for evaluating coverage and performance of whole genome sequencing experiments.
+
+------
+
+.. class:: warningmark
+
+**Warning on using this tool on BWA-MEM output**
+
+This tool will likely fail on BAM datasets generated by BWA MEM as it generates partial read alignemnts. 
+
+@dataset_collections@
+
+@description@
+
+  FILTER=Filter                 Filter.  Required. Possible values:
+                                includeAligned [OUTPUT SAM/BAM will contain aligned 
+                                reads only. (Note that *both* first and 
+                                second of paired reads must be aligned to be included
+                                in the OUTPUT SAM or BAM)], 
+                                
+                                excludeAligned [OUTPUT SAM/BAM will contain un-mapped reads only.
+                                (Note that *both* first and second of pair must be aligned to be 
+                                excluded from the OUTPUT SAM or BAM)]
+                                
+                                includeReadList [OUTPUT SAM/BAM will contain reads 
+                                that are supplied in the READ_LIST_FILE file]
+                                
+                                excludeReadList [OUTPUT bam will contain 
+                                reads that are *not* supplied in the READ_LIST_FILE file]} 
+
+  READ_LIST_FILE=File
+  RLF=File                      Read List File containing reads that will be included or excluded from the OUTPUT SAM or 
+                                BAM file.  Default value: null. 
+  
+@more_info@
+
+  </help>
+</tool>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_FixMateInformation.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,81 @@
+<tool name="FixMateInformation" id="picard_FixMateInformation" version="1.135">
+  <description>ensure that all mate-pair information is in sync between each read and it's mate pair</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements" />
+  <command>
+    @java_options@
+    
+    java -jar \$JAVA_JAR_PATH/picard.jar
+    FixMateInformation
+    INPUT="${inputFile}"
+    OUTPUT="${outFile}"
+    ASSUME_SORTED=${assume_sorted}
+    ADD_MATE_CIGAR=${add_mate_cigar}
+    
+    SORT_ORDER=coordinate
+    VALIDATION_STRINGENCY="${validation_stringency}"
+    QUIET=true
+    VERBOSITY=ERROR
+  
+  </command>
+  <inputs>
+    <param name="inputFile" multiple="True" type="data" format="sam,bam" label="Select SAM/BAM dataset or dataset collection" help="If empty, upload or import a SAM/BAM dataset"/>
+    <param name="add_mate_cigar" type="boolean" checked="true" truevalue="True" falsevalue="False" label="Adds the mate CIGAR tag (MC) if true, does not if false" help="ADD_MATE_CIGAR; default=True"/>
+    <param name="assume_sorted" type="boolean" truevalue="True" falsevalue="False" label="Assume that the input file is QUERYNAME sorted" help="ASSUME_SORTED; default=False"/>
+ 
+    <expand macro="VS" />
+    
+  </inputs> 
+  
+  <outputs>
+    <data format="bam" name="outFile" label="${tool.name} on ${on_string}: BAM with fixed mates"/>
+  </outputs>
+  
+  <tests>
+    <test>
+      <param name="inputFile" value="picard_FixMateInformation.bam" ftype="bam"/>
+      <param name="add_mate_cigar" value="True"/>
+      <param name="assume_sorted" value="False"/>
+      <param name="validation_stringency" value="LENIENT"/>
+      <output name="outFile" file="picard_FixMateInformation_test1.bam" ftype="bam" lines_diff="2"/>
+    </test>
+  </tests>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <help>
+
+**Purpose**
+
+Ensure that all mate-pair information is in sync between each read and it's mate pair. Reads marked with the secondary alignment flag are written to the output file unchanged.
+
+------
+
+.. class:: warningmark
+
+**Warning on using ASSUME_SORTED option**
+
+Datasets imported into Galaxy are automatically coordinate sorted. So use this option (set it to True) only if you are sure that this is necessary. If you are not sure - a good rule of thumb
+is to assume that the BAM you are working with is coordinate sorted.
+
+@dataset_collections@
+
+@description@
+
+  ASSUME_SORTED=Boolean
+  AS=Boolean                    If true, assume that the input file is queryname sorted, even if the header says 
+                                otherwise.  Default value: false. 
+  
+  ADD_MATE_CIGAR=Boolean
+  MC=Boolean                    Adds the mate CIGAR tag (MC) if true, does not if false.  Default value: true. 
+  
+@more_info@
+
+  </help>
+</tool>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_MarkDuplicates.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,127 @@
+<tool name="MarkDuplicates" id="picard_MarkDuplicates" version="1.135">
+  <description>examine aligned records in BAM datasets to locate duplicate molecules</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements" />
+  <command>
+    @java_options@
+    
+    java -jar \$JAVA_JAR_PATH/picard.jar
+    MarkDuplicates
+    
+    INPUT="${inputFile}"
+    OUTPUT="${outFile}"
+    
+    METRICS_FILE="${metrics_file}"
+    #for $element in $comments:
+      COMMENT="${element.comment}"
+    #end for
+    REMOVE_DUPLICATES="${remove_duplicates}"
+    ASSUME_SORTED="${assume_sorted}"
+    
+    DUPLICATE_SCORING_STRATEGY="${duplicate_scoring_strategy}"
+    
+    #import pipes
+    READ_NAME_REGEX=${ pipes.quote( str( $read_name_regex ) ) or "''" }
+    OPTICAL_DUPLICATE_PIXEL_DISTANCE="${optical_duplicate_pixel_distance}"
+    
+    VALIDATION_STRINGENCY="${validation_stringency}"
+    QUIET=true
+    VERBOSITY=ERROR
+  
+  </command>
+  <inputs>
+    <param format="bam" name="inputFile" type="data" label="Select SAM/BAM dataset or dataset collection" help="If empty, upload or import a SAM/BAM dataset"/>
+    <repeat name="comments" title="Comment" min="0" help="You can provide multiple comments">
+      <param name="comment" type="text" size="50" label="Add this comment to BAM dataset"/>
+    </repeat>
+    <param name="remove_duplicates" type="boolean" label="If true do not write duplicates to the output file instead of writing them with appropriate flags set" help="REMOVE_DUPLICATES; default=False"/>
+    <param name="assume_sorted" type="boolean" label="Assume the input file is already sorted" checked="true" truevalue="true" falsevalue="false" help="ASSUME_SORTED; default=True"/>
+
+    <param name="duplicate_scoring_strategy" type="select" label="The scoring strategy for choosing the non-duplicate among candidates" help="DUPLICATE_SCORING_STRATEGY; default=SUM_OF_BASE_QUALITIES">
+      <option value="SUM_OF_BASE_QUALITIES">SUM_OF_BASE_QUALITIES</option>
+      <option value="TOTAL_MAPPED_REFERENCE_LENGTH">TOTAL_MAPPED_REFERENCE_LENGTH</option>
+    </param>
+
+
+    <param name="read_name_regex" type="text" size="40" value="[a-zA-Z0-9]+:[0-9]:([0-9]+):([0-9]+):([0-9]+).*." label="Regular expression that can be used to parse read names in the incoming SAM/BAM dataset" help="READ_NAME_REGEX; Read names are parsed to extract three variables: tile/region, x coordinate and y coordinate. These values are used to estimate the rate of optical duplication in order to give a more accurate estimated library size. See help below for more info; default=[a-zA-Z0-9]+:[0-9]:([0-9]+):([0-9]+):([0-9]+).*.">
+      <sanitizer>
+        <valid initial="string.printable">
+        </valid>
+      </sanitizer>
+    </param>
+    <param name="optical_duplicate_pixel_distance" type="integer" value="100" min="0" max="500" label="The maximum offset between two duplicte clusters in order to consider them optical duplicates" help="OPTICAL_DUPLICATE_PIXEL_DISTANCE; default=100"/>
+
+   <expand macro="VS" />
+    
+  </inputs> 
+  
+  <outputs>
+    <data format="txt" name="metrics_file" label="${tool.name} on ${on_string}: MarkDuplicate metrics"/>
+    <data format="bam" name="outFile" label="${tool.name} on ${on_string}: MarkDuplicates BAM output"/>
+  </outputs>
+  
+  <tests>
+    <test>
+      <param name="inputFile" value="picard_MarkDuplicates.bam" ftype="bam"/>
+      <param name="comment" value="test-run"/>
+      <param name="assume_sorted" value="True"/>
+      <param name="remove_duplicates" value="True"/>
+      <param name="read_name_regex" value="[a-zA-Z0-9]+:[0-9]:([0-9]+):([0-9]+):([0-9]+).*."/>
+      <param name="optical_duplicate_pixel_distance" value="100"/>
+      <param name="duplicate_scoring_strategy" value="SUM_OF_BASE_QUALITIES"/>
+      <param name="validation_stringency" value="LENIENT"/>
+      <output name="outFile" file="picard_MarkDuplicates_test1.bam" ftype="bam" lines_diff="2"/>
+    </test>
+  </tests>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <help>
+
+**Purpose**
+
+Examines aligned records in the supplied SAM or BAM dataset to locate duplicate molecules. All records are then written to the output file with the duplicate records flagged.
+
+@dataset_collections@
+
+@description@
+
+  COMMENT=String  
+  CO=String                     Comment(s) to include in the output file's header.  This option may be specified 0 or 
+                                more times. 
+
+  REMOVE_DUPLICATES=Boolean     If true do not write duplicates to the output file instead of writing them with 
+                                appropriate flags set.  Default value: false.  
+  
+  READ_NAME_REGEX=String        Regular expression that can be used to parse read names in the incoming SAM file. Read 
+                                names are parsed to extract three variables: tile/region, x coordinate and y coordinate. 
+                                These values are used to estimate the rate of optical duplication in order to give a more 
+                                accurate estimated library size. Set this option to null to disable optical duplicate 
+                                detection. The regular expression should contain three capture groups for the three 
+                                variables, in order. It must match the entire read name. Note that if the default regex 
+                                is specified, a regex match is not actually done, but instead the read name  is split on 
+                                colon character. For 5 element names, the 3rd, 4th and 5th elements are assumed to be 
+                                tile, x and y values. For 7 element names (CASAVA 1.8), the 5th, 6th, and 7th elements 
+                                are assumed to be tile, x and y values.  Default value: 
+                                [a-zA-Z0-9]+:[0-9]:([0-9]+):([0-9]+):([0-9]+).*.
+                                
+  DUPLICATE_SCORING_STRATEGY=ScoringStrategy
+  DS=ScoringStrategy            The scoring strategy for choosing the non-duplicate among candidates.  Default value: 
+                                SUM_OF_BASE_QUALITIES. Possible values: {SUM_OF_BASE_QUALITIES, TOTAL_MAPPED_REFERENCE_LENGTH} 
+  
+  OPTICAL_DUPLICATE_PIXEL_DISTANCE=Integer
+                                The maximum offset between two duplicte clusters in order to consider them optical 
+                                duplicates. This should usually be set to some fairly small number (e.g. 5-10 pixels) 
+                                unless using later versions of the Illumina pipeline that multiply pixel values by 10, in 
+                                which case 50-100 is more normal.  Default value: 100. 
+
+@more_info@
+
+  </help>
+</tool>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_MarkDuplicatesWithMateCigar.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,160 @@
+<tool name="MarkDuplicatesWithMateCigar" id="picard_MarkDuplicatesWithMateCigar" version="1.135">
+  <description>examine aligned records in BAM datasets to locate duplicate molecules</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements" />
+  <command>
+    @java_options@
+    
+    java -jar \$JAVA_JAR_PATH/picard.jar
+    MarkDuplicatesWithMateCigar
+    
+    INPUT="${inputFile}"
+    OUTPUT="${outFile}"
+    
+    METRICS_FILE="${metrics_file}"
+    COMMENT="${comment}"
+
+    MINIMUM_DISTANCE="${minimum_distance}"
+    SKIP_PAIRS_WITH_NO_MATE_CIGAR="${skip_pairs_with_no_mate_cigar}"
+    
+    
+    REMOVE_DUPLICATES="${remove_duplicates}"
+    ASSUME_SORTED="${assume_sorted}"
+    
+    DUPLICATE_SCORING_STRATEGY="${duplicate_scoring_strategy}"
+    
+    #import pipes
+    READ_NAME_REGEX=${ pipes.quote( str( $read_name_regex ) ) or "''" }
+    OPTICAL_DUPLICATE_PIXEL_DISTANCE="${optical_duplicate_pixel_distance}"
+    
+    
+    BLOCK_SIZE=100000
+    VALIDATION_STRINGENCY="${validation_stringency}"
+    QUIET=true
+    VERBOSITY=ERROR
+  
+  </command>
+  <inputs>
+    <param format="bam" name="inputFile" type="data" label="Select SAM/BAM dataset or dataset collection" help="If empty, upload or import a SAM/BAM dataset"/>
+      <param name="comment" type="text" size="50" label="Add this comment to BAM dataset"/>
+    
+    <param name="minimum_distance" type="integer" value="-1" label="The minimum distance to buffer records to account for clipping on the 5' end of the records" help="MINIMUM_DISTANCE; Set this number to -1 to use twice the first read's read length (or 100, whichever is smaller); default=-1"/>
+    <param name="skip_pairs_with_no_mate_cigar" type="boolean" checked="true" truevalue="true" falsevalue="false" label="Skip record pairs with no mate cigar and include them in the output" help="SKIP_PAIRS_WITH_NO_MATE_CIGAR; default=True"/>
+    <param name="remove_duplicates" type="boolean" label="If true do not write duplicates to the output file instead of writing them with appropriate flags set" help="REMOVE_DUPLICATES; default=False"/>
+    <param name="assume_sorted" type="boolean" label="Assume the input file is already sorted" checked="true" truevalue="true" falsevalue="false" help="ASSUME_SORTED; default=True"/>
+
+    <param name="duplicate_scoring_strategy" type="select" label="The scoring strategy for choosing the non-duplicate among candidates" help="DUPLICATE_SCORING_STRATEGY; default=TOTAL_MAPPED_REFERENCE_LENGTH">
+      <option value="TOTAL_MAPPED_REFERENCE_LENGTH" select="True">TOTAL_MAPPED_REFERENCE_LENGTH</option>
+      <option value="SUM_OF_BASE_QUALITIES">SUM_OF_BASE_QUALITIES</option>
+    </param>
+
+
+    <param name="read_name_regex" type="text" size="40" value="[a-zA-Z0-9]+:[0-9]:([0-9]+):([0-9]+):([0-9]+).*." label="Regular expression that can be used to parse read names in the incoming SAM/BAM dataset" help="READ_NAME_REGEX; Read names are parsed to extract three variables: tile/region, x coordinate and y coordinate. These values are used to estimate the rate of optical duplication in order to give a more accurate estimated library size. See help below for more info; default=[a-zA-Z0-9]+:[0-9]:([0-9]+):([0-9]+):([0-9]+).*.">
+      <sanitizer>
+        <valid initial="string.printable">
+        </valid>
+      </sanitizer>
+    </param>
+    <param name="optical_duplicate_pixel_distance" type="integer" value="100" min="0" max="500" label="The maximum offset between two duplicte clusters in order to consider them optical duplicates" help="OPTICAL_DUPLICATE_PIXEL_DISTANCE; default=100"/>
+
+   <expand macro="VS" />
+    
+  </inputs> 
+  
+  <outputs>
+    <data format="txt" name="metrics_file" label="${tool.name} on ${on_string}: MarkDuplicate metrics"/>
+    <data format="bam" name="outFile" label="${tool.name} on ${on_string}: MarkDuplicates BAM output"/>
+  </outputs>
+  
+  <tests>
+    <test>
+      <param name="inputFile" value="picard_MarkDuplicatesWithMateCigar.bam" ftype="bam"/>
+      <param name="minimum_distance" value="-1"/>
+      <param name="skip_pairs_with_no_mate_cigar" value="True"/>
+      <param name="comment" value="test-run"/>
+      <param name="assume_sorted" value="True"/>
+      <param name="remove_duplicates" value="False"/>
+      <param name="read_name_regex" value="[a-zA-Z0-9]+:[0-9]:([0-9]+):([0-9]+):([0-9]+).*."/>
+      <param name="optical_duplicate_pixel_distance" value="100"/>
+      <param name="duplicate_scoring_strategy" value="TOTAL_MAPPED_REFERENCE_LENGTH"/>
+      <param name="validation_stringency" value="LENIENT"/>
+      <output name="outFile" file="picard_MarkDuplicatesWithMateCigar_test1.bam" ftype="bam" lines_diff="4"/>
+    </test>
+  </tests>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <help>
+
+**Purpose**
+
+Examines aligned records in the supplied SAM or BAM dataset to locate duplicate molecules. All records are then written to the output file with the duplicate records flagged.
+
+------
+
+.. class:: warningmark
+
+On the difference between **MarkDuplicates** and **picard_MarkDuplicatesWithMateCigar**
+
+From Samtools Announce MailingList_:
+
+This tool can replace MarkDuplicates if the input SAM/BAM has Mate CIGAR (MC) optional tags pre-computed
+(see the tools RevertOriginalBaseQualitiesAndAddMateCigar and FixMateInformation).  This allows the new tool
+to perform a streaming duplicate marking routine (i.e. a single-pass).  This tool cannot be used with
+alignments that have large gaps or reference skips, which happens frequently in RNA-seq data.
+
+.. _MailingList: http://sourceforge.net/p/samtools/mailman/message/32910359/
+
+@dataset_collections@
+
+@description@
+
+  MINIMUM_DISTANCE=Integer      The minimum distance to buffer records to account for clipping on the 5' end of the 
+                                records.Set this number to -1 to use twice the first read's read length (or 100, 
+                                whichever is smaller).  Default value: -1. This option can be set to 'null' to clear the 
+                                default value. 
+  
+  SKIP_PAIRS_WITH_NO_MATE_CIGAR=Boolean
+                                Skip record pairs with no mate cigar and include them in the output.  Default value: 
+                                true. This option can be set to 'null' to clear the default value. Possible values: 
+                                {true, false} 
+
+  COMMENT=String  
+  CO=String                     Comment(s) to include in the output file's header.  This option may be specified 0 or 
+                                more times. 
+
+  REMOVE_DUPLICATES=Boolean     If true do not write duplicates to the output file instead of writing them with 
+                                appropriate flags set.  Default value: false.  
+  
+  READ_NAME_REGEX=String        Regular expression that can be used to parse read names in the incoming SAM file. Read 
+                                names are parsed to extract three variables: tile/region, x coordinate and y coordinate. 
+                                These values are used to estimate the rate of optical duplication in order to give a more 
+                                accurate estimated library size. Set this option to null to disable optical duplicate 
+                                detection. The regular expression should contain three capture groups for the three 
+                                variables, in order. It must match the entire read name. Note that if the default regex 
+                                is specified, a regex match is not actually done, but instead the read name  is split on 
+                                colon character. For 5 element names, the 3rd, 4th and 5th elements are assumed to be 
+                                tile, x and y values. For 7 element names (CASAVA 1.8), the 5th, 6th, and 7th elements 
+                                are assumed to be tile, x and y values.  Default value: 
+                                [a-zA-Z0-9]+:[0-9]:([0-9]+):([0-9]+):([0-9]+).*.
+                                
+  DUPLICATE_SCORING_STRATEGY=ScoringStrategy
+  DS=ScoringStrategy            The scoring strategy for choosing the non-duplicate among candidates.  Default value: 
+                                TOTAL_MAPPED_REFERENCE_LENGTH. Possible values: {SUM_OF_BASE_QUALITIES, TOTAL_MAPPED_REFERENCE_LENGTH} 
+  
+  OPTICAL_DUPLICATE_PIXEL_DISTANCE=Integer
+                                The maximum offset between two duplicte clusters in order to consider them optical 
+                                duplicates. This should usually be set to some fairly small number (e.g. 5-10 pixels) 
+                                unless using later versions of the Illumina pipeline that multiply pixel values by 10, in 
+                                which case 50-100 is more normal.  Default value: 100. 
+
+@more_info@
+
+  </help>
+</tool>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_MeanQualityByCycle.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,111 @@
+<tool name="MeanQualityByCycle" id="picard_MeanQualityByCycle" version="1.135">
+  <description>chart distribution of base qualities</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements">
+    <requirement type="package" version="3.1.2">R</requirement>
+  </expand>
+  <command>
+    @java_options@
+    ##set up input files
+
+    #set $reference_fasta_filename = "localref.fa"
+    
+    #if str( $reference_source.reference_source_selector ) == "history":
+        ln -s "${reference_source.ref_file}" "${reference_fasta_filename}" &amp;&amp;
+    #else:
+        #set $reference_fasta_filename = str( $reference_source.ref_file.fields.path )
+    #end if
+    
+    java -jar \$JAVA_JAR_PATH/picard.jar
+    MeanQualityByCycle
+    INPUT="${inputFile}"
+    OUTPUT="${outFile}"
+    CHART_OUTPUT="${pdfFile}"
+    REFERENCE_SEQUENCE="${reference_fasta_filename}"
+    ALIGNED_READS_ONLY="${aligned_reads_only}"
+    PF_READS_ONLY="${pf_reads_only}"
+  
+    ASSUME_SORTED="${assume_sorted}"
+    
+    VALIDATION_STRINGENCY="${validation_stringency}"
+    QUIET=true
+    VERBOSITY=ERROR
+  
+  </command>
+  <inputs>
+    <param format="sam,bam" name="inputFile" type="data" label="SAM/BAM dataset or dataset collection" help="If empty, upload or import a SAM/BAM dataset."/>
+    <conditional name="reference_source">
+      <param name="reference_source_selector" type="select" label="Load reference genome from">
+        <option value="cached">Local cache</option>
+        <option value="history">History</option>
+      </param>
+      <when value="cached">
+        <param name="ref_file" type="select" label="Using reference genome" help="REFERENCE_SEQUENCE">
+          <options from_data_table="all_fasta">
+          </options>
+          <validator type="no_options" message="A built-in reference genome is not available for the build associated with the selected input file"/>
+        </param>
+      </when>
+      <when value="history">
+        <param name="ref_file" type="data" format="fasta" label="Use the folloing dataset as the reference sequence" help="REFERENCE_SEQUENCE; You can upload a FASTA sequence to the history and use it as reference" />
+      </when>
+    </conditional>
+    <param name="aligned_reads_only" type="boolean" truevalue="true" falsevalue="false" label="If set to true, calculate mean quality over aligned reads only" help="ALIGNED_READS_ONLY; default=False"/>
+    <param name="pf_reads_only" type="boolean" truevalue="true" falsevalue="false" label="If set to true calculate mean quality over reads passing quality filter" help="PF_READS_ONLY; default=False"/>
+    <param name="assume_sorted" type="boolean" label="Assume the input file is already sorted" checked="true" truevalue="true" falsevalue="false" help="ASSUME_SORTED"/>
+    
+    <expand macro="VS" />
+    
+  </inputs>
+  
+  <outputs>
+    <data format="tabular" name="outFile" label="${tool.name} on ${on_string}: Summary data"/>
+    <data format="pdf" name="pdfFile" label="${tool.name} on ${on_string}: Chart PDF"/>
+  </outputs>
+  
+  <tests>
+    <test>
+      <param name="assume_sorted" value="true" />
+      <param name="aligned_reads_only" value="false" />
+      <param name="pf_reads_only" value="false" />
+      <param name="reference_source_selector" value="history" />
+      <param name="ref_file" value="picard_MeanQualityByCycle_ref.fa" />
+      <param name="inputFile" value="picard_MeanQualityByCycle.bam" ftype="bam" />
+      <output name="outFile" file="picard_MeanQualityByCycle_test1.tab" ftype="tabular" lines_diff="4"/>
+    </test> 
+  </tests>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <help>
+
+.. class:: infomark
+
+**Purpose**
+
+Program to chart the distribution of base qualities by cycle within reads supplied in a SAM or BAM dataset. 
+
+@dataset_collections@
+
+@description@
+
+  ALIGNED_READS_ONLY=Boolean    If set to true, calculate the base distribution over aligned reads only.  Default value: 
+                                false. Possible values: {true, false} 
+
+  PF_READS_ONLY=Boolean         If set to true calculate the base distribution over PF reads only.  Default value: false. 
+                                This option can be set to 'null' to clear the default value. Possible values: {true, 
+                                false} 
+
+  ASSUME_SORTED=Boolean
+  AS=Boolean                    If true (default), then the sort order in the header file will be ignored.  Default: True 
+
+@more_info@
+
+  </help>
+</tool>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_MergeBamAlignment.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,327 @@
+<tool name="MergeBamAlignment" id="picard_MergeBamAlignment" version="1.126.1">
+  <description>merge alignment data with additional info stored in an unmapped BAM dataset</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements" />
+  <command>
+    @java_options@
+    #set $picard_dict = "localref.dict"
+    #set $ref_fasta = "localref.fa"     ## This is done because picards "likes" .fa extension
+    
+    ln -s "${reference_source.ref_file}" "${ref_fasta}" &amp;&amp;
+       
+    #if str( $reference_source.reference_source_selector ) == "history":
+        
+      java -jar \$JAVA_JAR_PATH/picard.jar CreateSequenceDictionary REFERENCE="${ref_fasta}" OUTPUT="${picard_dict}"
+      QUIET=true
+      VERBOSITY=ERROR
+      
+      &amp;&amp;
+      
+    #else:
+    
+      #set $ref_fasta = str( $reference_source.ref_file.fields.path )
+    
+    #end if
+    
+    java -jar \$JAVA_JAR_PATH/picard.jar
+    MergeBamAlignment
+      UNMAPPED_BAM="${unmapped_bam}"
+      
+      PAIRED_RUN=true ##This argument is ignored and will be removed. Required. Possible values: {true, false}
+      
+      #if str( $aligned_or_read1_and_read2.aligned_or_read1_and_read2_selector ) == "paired_one_file":
+        #for $dataset in $aligned_or_read1_and_read2.aligned_bams:
+          ALIGNED_BAM="${dataset.aligned_bam}"
+        #end for
+      #elif str( $aligned_or_read1_and_read2.aligned_or_read1_and_read2_selector ) == "paired_two_files":
+        #for $dataset in $aligned_or_read1_and_read2.read1_aligned_bams:
+          READ1_ALIGNED_BAM="${dataset.read1_aligned_bam}"
+        #end for
+        #for $dataset in $aligned_or_read1_and_read2.read2_aligned_bams:
+          READ2_ALIGNED_BAM="${dataset.read2_aligned_bam}"
+        #end for
+      #else
+        #for $dataset in $aligned_or_read1_and_read2.read1_aligned_bams:
+          READ1_ALIGNED_BAM="${dataset.read1_aligned_bam}"
+        #end for
+      #end if
+     
+      OUTPUT="${outFile}"
+      REFERENCE_SEQUENCE="${ref_fasta}"
+      
+      CLIP_ADAPTERS="${clip_adapters}"
+      IS_BISULFITE_SEQUENCE="${is_bisulfite_sequence}"
+      ALIGNED_READS_ONLY="${aligned_reads_only}"
+      MAX_INSERTIONS_OR_DELETIONS="${max_insertions_or_deletions}"
+      
+      #for $attribute in $attributes_to_retain:
+        ATTRIBUTES_TO_RETAIN="${$attribute.attribute}"
+      #end for
+      
+      #for $attribute in $attributes_to_remove:
+        ATTRIBUTES_TO_REMOVE="${$attribute.attribute}"
+      #end for
+    
+      READ1_TRIM="${read1_trim}"
+      READ2_TRIM="${read2_trim}"
+      
+      #if str( $orientations ) != "None":
+        #for $orientation in str( $orientations ).split(','):   ## See trello card https://trello.com/c/9nW02Zhd
+          EXPECTED_ORIENTATIONS="${orientation}"
+        #end for
+      #end if
+      
+      ALIGNER_PROPER_PAIR_FLAGS="${aligner_proper_pair_flags}"      
+      PRIMARY_ALIGNMENT_STRATEGY="${primary_alignment_strategy}"
+      CLIP_OVERLAPPING_READS="${clip_overlapping_reads}"
+      INCLUDE_SECONDARY_ALIGNMENTS="${include_secondary_alignments}"
+      ADD_MATE_CIGAR="${add_mate_cigar}"
+      
+      VALIDATION_STRINGENCY="${validation_stringency}"
+
+      SORT_ORDER=coordinate
+      QUIET=true
+      VERBOSITY=ERROR
+      
+  </command>
+  
+  <inputs>
+    
+     <conditional name="reference_source">
+      <param name="reference_source_selector" type="select" label="Load reference genome from">
+        <option value="cached">Local cache</option>
+        <option value="history">History</option>
+      </param>
+      <when value="cached">
+        <param name="ref_file" type="select" label="Use dictionary from the list" help="Select genome from the list">
+          <options from_data_table="picard_indexes">
+            <filter type="sort_by" column="2" />
+            <validator type="no_options" message="No indexes are available" />
+          </options>
+          <validator type="no_options" message="A built-in dictionary is not available for the build associated with the selected input file"/>
+        </param>
+      </when>
+      <when value="history"> 
+        <param name="ref_file" type="data" format="fasta" label="Use the following dataset to create dictionary" help="You can upload a FASTA sequence to the history from which Picard will automatically generate dictionary using CreateSequenceDictionary command" />
+      </when>
+    </conditional>
+    
+    <param format="sam,bam" name="unmapped_bam" type="data" label="Selected unaligned SAM or BAM with original reads" help="UNMAPPED_BAM; This dataset must be sorted in queryname order (use picard_SortSam to do this)" />
+    <conditional name="aligned_or_read1_and_read2">
+      <param name="aligned_or_read1_and_read2_selector" type="select" label="What type of aligned data do you have?">
+        <option value="paired_one_file">Paired data in a single BAM file (ALIGNED_BAM)</option>
+        <option value="paired_two_files">Paired data in separate files (READ1_ALIGNED_BAM and READ2_ALIGNED_BAM)</option>
+        <option value="single_file">Singe end data (READ1_ALIGNED_BAM)</option>
+      </param>
+      <when value="paired_one_file">
+        <repeat name="aligned_bams" title="Aligned SAM or BAM dataset" min="1" help="You can provide multiple datasets">
+          <param name="aligned_bam" type="data" format="sam,bam" label="SAM or BAM dataset(s) with alignment data" help="ALIGNED_BAM"/>
+        </repeat>
+      </when>
+      <when value="paired_two_files">
+        <repeat name="read1_aligned_bams" title="Aligned SAM or BAM dataset for Read 1" min="1" help="You can provide multiple datasets">
+          <param name="read1_aligned_bam" type="data" format="sam,bam" label="SAM or BAM dataset(s) with alignment data for Read1" help="READ1_ALIGNED_BAM"/>
+        </repeat>
+        <repeat name="read2_aligned_bams" title="Aligned SAM or BAM dataset for Read 2" min="1" help="You can provide multiple datasets">
+          <param name="read2_aligned_bam" type="data" format="sam,bam" label="SAM or BAM dataset(s) with alignment data for Read2" help="READ2_ALIGNED_BAM"/>
+        </repeat>
+      </when>
+      <when value="single_file">
+        <repeat name="read1_aligned_bams" title="Aligned SAM or BAM dataset for Single Reads" min="1" help="You can provide multiple datasets">
+          <param name="read1_aligned_bam" type="data" format="sam,bam" label="SAM or BAM dataset(s) with alignment data" help="READ1_ALIGNED_BAM"/>
+        </repeat>
+      </when>
+    </conditional>
+    
+    <param name="clip_adapters" type="boolean" checked="true" label="Whether to clip adapters where identified" help="CLIP_ADAPTERS; default=True"/>
+    <param name="is_bisulfite_sequence" type="boolean" label="Whether the data is from bisulfite sequencing (used when caculating the NM tag)" help="IS_BISULFITE_SEQUENCE; default=False"/>
+    <param name="aligned_reads_only" type="boolean" label="Whether to output only aligned reads" help="ALIGNED_READS_ONLY; default=False"/>
+    <param name="max_insertions_or_deletions" type="integer" value="1" label="The maximum number of insertions or deletions permitted for an alignment to be included" help="MAX_INSERTIONS_OR_DELETIONS; Alignments with more than this many insertions or deletions will be ignored. Set to -1 to allow any number of insertions or deletions. default=1"/>
+ 
+    <repeat name="attributes_to_retain" title="Retain the following alignment attribute" min="0" help="You can provide multiple attributes">
+      <param name="attribute" type="text" size="4" label="Reserved alignment attributes (tags starting with X, Y, or Z) that should be brought over from the alignment data when merging" help="ATTRIBUTES_TO_RETAIN; example: XA"/>
+    </repeat>
+    
+    <repeat name="attributes_to_remove" title="Remove the following alignment attribute" min="0" help="You can provide multiple attributes">
+      <param name="attribute" type="text" size="4" label="Attributes from the alignment record that should be removed when merging." help="ATTRIBUTES_TO_REMOVE; This overrides ATTRIBUTES_TO_RETAIN if they share common tags"/>
+    </repeat>
+    
+    <param name="read1_trim" type="integer" value="0" label="The number of bases trimmed from the beginning of read 1 prior to alignment" help="READ1_TRIM; default=0"/>
+    <param name="read2_trim" type="integer" value="0" label="The number of bases trimmed from the beginning of read 2 prior to alignment" help="READ2_TRIM; default=0"/>
+    
+    <param name="orientations" type="select" multiple="True" display="checkboxes" label="The expected orientation of proper read pairs" help="EXPECTED_ORIENTATIONS; multiple orinetations can be selected">
+      <option value="FR">Forward/Reverse (FR)</option>
+      <option value="RF">Reverse/Forward (RF)</option>
+      <option value="TANDEM">Tandem</option>
+    </param>
+ 
+    
+    <param name="aligner_proper_pair_flags" type="boolean" label="Use the aligner's idea of what a proper pair is rather than computing in this program" help="ALIGNER_PROPER_PAIR_FLAGS; default=False"/>
+    
+    <param name="primary_alignment_strategy" type="select" label="Strategy for selecting primary alignment when the aligner has provided more than one alignment for a pair or fragments" help="PRIMARY_ALIGNMENT_STRATEGY; see help below for more info; default=BestMapq">
+      <option value="BestMapq" selected="True">BestMapq</option>
+      <option value="EarliestFragment">EarliestFragment</option>
+      <option value="BestEndMapq">BestEndMapq</option>
+      <option value="MostDistant">MostDistant</option>
+    </param>
+    
+    <param name="clip_overlapping_reads" type="boolean" checked="True" label="For paired reads, soft clip the 3' end of each read if necessary so that it does not extend past the 5' end of its mate" help="CLIP_OVERLAPPING_READS; default=True"/>
+    <param name="include_secondary_alignments" type="boolean" checked="True" label="If false, do not write secondary alignments to output" help="INCLUDE_SECONDARY_ALIGNMENTS; default=True"/>
+    <param name="add_mate_cigar" type="boolean" checked="True" label="Adds the mate CIGAR tag (MC) if true, does not if false" help="ADD_MATE_CIGAR; default=True"/>
+    <expand macro="VS" />
+  </inputs>
+  <outputs>
+    <data name="outFile" format="bam" label="${tool.name} on ${on_string}: BAM with merged alignments"/>
+  </outputs>
+  <tests>
+    <test>
+      <param name="reference_source_selector" value="history" />
+      <param name="ref_file" value="picard_MergeBamAlignment_ref.fa" ftype="fasta" />
+      <param name="unmapped_bam" value="picard_MergeBamAlignment_unaligned.bam" ftype="bam"/>
+      <param name="aligned_or_read1_and_read2_selector" value="paired_one_file"/>
+      <param name="aligned_bam" value="picard_MergeBamAlignment_aligned.bam" ftype="bam"/>
+      <param name="clip_adapters" value="True"/>
+      <param name="is_bisulfite_sequence" value="False"/>
+      <param name="aligned_reads_only" value="False"/>
+      <param name="max_insertions_or_deletions" value="1"/>
+      <param name="read1_trim" value="0"/>
+      <param name="read2_trim" value="0"/>
+      <param name="orientation" value="FR"/>
+      <param name="aligner_proper_pair_flags" value="False"/>
+      <param name="primary_alignment_strategy" value="BestMapq"/>
+      <param name="clip_overlapping_reads" value="True"/>
+      <param name="include_secondary_alignments" value="True"/>
+      <param name="add_mate_cigar" value="True"/>
+      <output name="outFile" file="picard_MergeBamAlignment_test1.bam" ftype="bam" lines_diff="2"/>
+    </test>
+  </tests>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <help>
+
+.. class:: infomark
+
+**Purpose**
+
+Merges alignment data from a SAM or BAM dataset with additional data stored in an unmapped BAM dataset and produces a third SAM or BAM dataset of aligned and unaligned reads.
+
+@dataset_collections@
+
+@description@
+
+  UNMAPPED_BAM=File
+  UNMAPPED=File                 Original SAM or BAM file of unmapped reads, which must be in queryname order.  Required. 
+  
+  ALIGNED_BAM=File
+  ALIGNED=File                  SAM or BAM file(s) with alignment data.  This option may be specified 0 or more times.  
+                                Cannot be used in conjuction with option(s) READ1_ALIGNED_BAM (R1_ALIGNED) 
+                                READ2_ALIGNED_BAM (R2_ALIGNED)
+  
+  READ1_ALIGNED_BAM=File
+  R1_ALIGNED=File               SAM or BAM file(s) with alignment data from the first read of a pair.  This option may be 
+                                specified 0 or more times.  Cannot be used in conjuction with option(s) ALIGNED_BAM 
+                                (ALIGNED)
+  
+  READ2_ALIGNED_BAM=File
+  R2_ALIGNED=File               SAM or BAM file(s) with alignment data from the second read of a pair.  This option may 
+                                be specified 0 or more times.  Cannot be used in conjuction with option(s) ALIGNED_BAM 
+                                (ALIGNED)
+  
+  PAIRED_RUN=Boolean
+  PE=Boolean                    This argument is ignored and will be removed.  Required. Possible values: {true, false} 
+  
+  JUMP_SIZE=Integer
+  JUMP=Integer                  The expected jump size (required if this is a jumping library). Deprecated. Use 
+                                EXPECTED_ORIENTATIONS instead  Default value: null.  Cannot be used in conjuction with 
+                                option(s) EXPECTED_ORIENTATIONS (ORIENTATIONS)
+  
+  CLIP_ADAPTERS=Boolean         Whether to clip adapters where identified.  Default value: true. Possible values: {true, false} 
+  
+  IS_BISULFITE_SEQUENCE=Boolean Whether the lane is bisulfite sequence (used when caculating the NM tag).  Default value: 
+                                false. Possible values: {true, false} 
+  
+  ALIGNED_READS_ONLY=Boolean    Whether to output only aligned reads. Default value: false. Possible values: {true, false} 
+  
+  MAX_INSERTIONS_OR_DELETIONS=Integer
+  MAX_GAPS=Integer              The maximum number of insertions or deletions permitted for an alignment to be included. 
+                                Alignments with more than this many insertions or deletions will be ignored. Set to -1 to 
+                                allow any number of insertions or deletions.  Default value: 1.
+  
+  ATTRIBUTES_TO_RETAIN=String   Reserved alignment attributes (tags starting with X, Y, or Z) that should be brought over 
+                                from the alignment data when merging.  This option may be specified 0 or more times. 
+  
+  ATTRIBUTES_TO_REMOVE=String   Attributes from the alignment record that should be removed when merging.  This overrides 
+                                ATTRIBUTES_TO_RETAIN if they share common tags.  This option may be specified 0 or more 
+                                times. 
+  
+  READ1_TRIM=Integer
+  R1_TRIM=Integer               The number of bases trimmed from the beginning of read 1 prior to alignment  Default 
+                                value: 0. 
+  
+  READ2_TRIM=Integer
+  R2_TRIM=Integer               The number of bases trimmed from the beginning of read 2 prior to alignment  Default 
+                                value: 0. 
+  
+  EXPECTED_ORIENTATIONS=PairOrientation
+  ORIENTATIONS=PairOrientation  The expected orientation of proper read pairs. Replaces JUMP_SIZE  Possible values: {FR, 
+                                RF, TANDEM} This option may be specified 0 or more times.  Cannot be used in conjuction 
+                                with option(s) JUMP_SIZE (JUMP)
+  
+  ALIGNER_PROPER_PAIR_FLAGS=Boolean
+                                Use the aligner's idea of what a proper pair is rather than computing in this program.  
+                                Default value: false. Possible values: {true, false} 
+  
+  SORT_ORDER=SortOrder
+  SO=SortOrder                  The order in which the merged reads should be output.  Default value: coordinate.
+                                Possible values: {unsorted, queryname, coordinate} 
+  
+  PRIMARY_ALIGNMENT_STRATEGY=PrimaryAlignmentStrategy
+                                Strategy for selecting primary alignment when the aligner has provided more than one 
+                                alignment for a pair or fragment, and none are marked as primary, more than one is marked 
+                                as primary, or the primary alignment is filtered out for some reason. BestMapq expects 
+                                that multiple alignments will be correlated with HI tag, and prefers the pair of 
+                                alignments with the largest MAPQ, in the absence of a primary selected by the aligner. 
+                                EarliestFragment prefers the alignment which maps the earliest base in the read. Note 
+                                that EarliestFragment may not be used for paired reads. BestEndMapq is appropriate for 
+                                cases in which the aligner is not pair-aware, and does not output the HI tag. It simply 
+                                picks the alignment for each end with the highest MAPQ, and makes those alignments 
+                                primary, regardless of whether the two alignments make sense together.MostDistant is also 
+                                for a non-pair-aware aligner, and picks the alignment pair with the largest insert size. 
+                                If all alignments would be chimeric, it picks the alignments for each end with the best 
+                                MAPQ.  For all algorithms, ties are resolved arbitrarily.  Default value: BestMapq.
+                                Possible values: {BestMapq, EarliestFragment, BestEndMapq, MostDistant} 
+  
+  CLIP_OVERLAPPING_READS=BooleanFor paired reads, soft clip the 3' end of each read if necessary so that it does not 
+                                extend past the 5' end of its mate.  Default value: true. Possible values: {true, false} 
+  
+  INCLUDE_SECONDARY_ALIGNMENTS=Boolean
+                                If false, do not write secondary alignments to output.  Default value: true.
+                                Possible values: {true, false} 
+  
+  ADD_MATE_CIGAR=Boolean
+  MC=Boolean                    Adds the mate CIGAR tag (MC) if true, does not if false. Possible values: {true, false} 
+
+
+
+
+@more_info@
+  </help>
+</tool>
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_MergeSamFiles.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,92 @@
+<tool name="MergeSamFiles" id="picard_MergeSamFiles" version="1.135">
+  <description>merges multiple SAM/BAM datasets into one</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements" />
+  <command>
+    @java_options@
+    
+    java -jar \$JAVA_JAR_PATH/picard.jar
+    MergeSamFiles
+    
+    #for $element in $inputFile:
+      INPUT="${element}"
+    #end for
+    
+    OUTPUT="${outFile}"
+    MERGE_SEQUENCE_DICTIONARIES="${merge_sequence_dictionaries}"
+    
+    ASSUME_SORTED="${assume_sorted}"
+    #for $element in $comments:
+      COMMENT="${element.comment}"
+    #end for
+
+    USE_THREADING=true
+    SORT_ORDER=coordinate
+    VALIDATION_STRINGENCY="${validation_stringency}"
+    QUIET=true
+    VERBOSITY=ERROR
+  
+  </command>
+  <inputs>
+    <param format="sam,bam" name="inputFile" type="data" multiple="True" label="Select SAM/BAM dataset or dataset collection" help="If empty, upload or import a SAM/BAM dataset"/>
+    <param name="merge_sequence_dictionaries" type="boolean" label="Merge the sequence dictionaries of the datasets being merged" help="MERGE_SEQUENCE_DICTIONARIES; default=False"/>
+    <param name="assume_sorted" type="boolean" label="Assume the input file is already sorted" help="ASSUME_SORTED; default=False"/>
+
+    <repeat name="comments" title="Comment" min="0" help="You can provide multiple comments">
+      <param name="comment" type="text" size="50" label="Add this comment to BAM dataset" help="COMMENT"/>
+    </repeat>
+    
+    <expand macro="VS" />
+    
+  </inputs> 
+  
+  <outputs>
+    <data format="bam" name="outFile" label="${tool.name} on ${on_string}: Merged BAM dataset"/>
+  </outputs>
+  
+  <tests>
+    <test>
+      <param name="inputFile" value="picard_MergeSamFiles_input1.bam,picard_MergeSamFiles_input2.bam,picard_MergeSamFiles_input3.bam" ftype="bam"/>
+      <param name="assume_sorted" value="False"/>
+      <param name="merge_sequence_dictionaries" value="False"/>
+      <param name="validation_stringency" value="LENIENT"/>
+      <output name="outFile" file="picard_MergeSamFiles_test1.bam" ftype="bam" lines_diff="2"/>
+    </test>
+  </tests>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <help>
+
+**Purpose**
+
+Merges multiple SAM/BAM datasets into one.
+
+@dataset_collections@
+
+@description@
+
+  ASSUME_SORTED=Boolean
+  AS=Boolean                    If true, assume that the input files are in the same sort order as the requested output 
+                                sort order, even if their headers say otherwise.  Default value: false. This option can 
+                                be set to 'null' to clear the default value. Possible values: {true, false} 
+  
+  MERGE_SEQUENCE_DICTIONARIES=Boolean
+  MSD=Boolean                   Merge the sequence dictionaries  Default value: false. This option can be set to 'null' 
+                                to clear the default value. Possible values: {true, false} 
+  
+  COMMENT=String
+  CO=String                     Comment(s) to include in the merged output file's header.  This option may be specified 0 
+                                or more times. 
+
+
+@more_info@
+
+  </help>
+</tool>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_NormalizeFasta.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,70 @@
+<tool name="NormalizeFasta" id="picard_NormalizeFasta" version="1.135">
+  <description>normalize fasta datasets</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements" />
+  <command>
+    @java_options@
+    
+  
+    ## Two lines below are due to the fact that picard likes fasta files to have extension .fa  
+    #set $fasta_file="local_fasta.fa"
+    ln -s "${inputFile}" "${fasta_file}" &amp;&amp;    
+    
+    java -jar \$JAVA_JAR_PATH/picard.jar
+    NormalizeFasta
+    
+    INPUT="${fasta_file}"
+    OUTPUT="${outFile}"
+    LINE_LENGTH="${line_length}"
+    TRUNCATE_SEQUENCE_NAMES_AT_WHITESPACE="${truncate_sequence_names_at_whitespaces}"
+    
+    QUIET=true
+    VERBOSITY=ERROR
+  
+  </command>
+  <inputs>
+    <param format="fasta" name="inputFile" type="data" label="FASTA dataset or dataset collection" help="If empty, upload or import a FASTA dataset" />
+    <param name="line_length" type="integer" value="100" min="1" max="200" label="The line length to be used for the output fasta file" help="LINE_LENGTH; default=100"/>
+    <param name="truncate_sequence_names_at_whitespaces" type="boolean" label="Truncate sequence names at first whitespace" help="TRUNCATE_SEQUENCE_NAMES_AT_WHITESPACE; default=False"/>
+  </inputs> 
+  
+  <outputs>
+    <data format="fasta" name="outFile" label="${tool.name} on ${on_string}: Normalized FASTA dataset"/>
+  </outputs>
+  
+  <tests>
+    <test>
+      <param name="inputFile" value="picard_NormalizeFasta_ref.fa" ftype="fasta"/>
+      <param name="line_length" value="40"/>
+      <param name="truncate_sequence_names_at_whitespaces" value="False"/>
+      <output name="outFile" file="picard_NormalizeFasta_test1.fa" ftype="fasta"/>
+    </test>
+  </tests>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <help>
+
+**Purpose**
+
+Takes any dataset that conforms to the fasta format and normalizes it so that all lines of sequence except the last line per named sequence are of the same length.
+
+@dataset_collections@
+
+@description@
+
+  LINE_LENGTH=Integer           The line length to be used for the output fasta file.  Default value: 100. 
+  
+  TRUNCATE_SEQUENCE_NAMES_AT_WHITESPACE=Boolean
+                                Truncate sequence names at first whitespace.  Default value: false. Possible values: {true, false} 
+
+@more_info@
+
+  </help>
+</tool>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_QualityScoreDistribution.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,116 @@
+<tool name="QualityScoreDistribution" id="picard_QualityScoreDistribution" version="1.135">
+  <description>chart quality score distribution</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements">
+    <requirement type="package" version="3.1.2">R</requirement>
+  </expand>
+  <command>
+    @java_options@
+    ##set up input files
+
+    #set $reference_fasta_filename = "localref.fa"
+    
+    #if str( $reference_source.reference_source_selector ) == "history":
+        ln -s "${reference_source.ref_file}" "${reference_fasta_filename}" &amp;&amp;
+    #else:
+        #set $reference_fasta_filename = str( $reference_source.ref_file.fields.path )
+    #end if
+    
+    java -jar \$JAVA_JAR_PATH/picard.jar
+    QualityScoreDistribution
+    INPUT="${inputFile}"
+    OUTPUT="${outFile}"
+    CHART_OUTPUT="${pdfFile}"
+    REFERENCE_SEQUENCE="${reference_fasta_filename}"
+    ALIGNED_READS_ONLY="${aligned_reads_only}"
+    PF_READS_ONLY="${pf_reads_only}"
+    INCLUDE_NO_CALLS="${include_no_calls}"
+  
+    ASSUME_SORTED="${assume_sorted}"
+    
+    VALIDATION_STRINGENCY="${validation_stringency}"
+    QUIET=true
+    VERBOSITY=ERROR
+  
+  </command>
+  <inputs>
+    <param format="sam,bam" name="inputFile" type="data" label="Select SAM/BAM dataset or dataset collection" help="If empty, upload or import a SAM/BAM dataset"/>
+    <conditional name="reference_source">
+      <param name="reference_source_selector" type="select" label="Load reference genome from">
+        <option value="cached">Local cache</option>
+        <option value="history">History</option>
+      </param>
+      <when value="cached">
+        <param name="ref_file" type="select" label="Using reference genome" help="REFERENCE_SEQUENCE">
+          <options from_data_table="all_fasta">
+          </options>
+          <validator type="no_options" message="A built-in reference genome is not available for the build associated with the selected input file"/>
+        </param>
+      </when>
+      <when value="history">
+        <param name="ref_file" type="data" format="fasta" label="Use the folloing dataset as the reference sequence" help="REFERENCE_SEQUENCE; You can upload a FASTA sequence to the history and use it as reference" />
+      </when>
+    </conditional>
+    <param name="aligned_reads_only" type="boolean" truevalue="true" falsevalue="false" label="If set to true, calculate mean quality over aligned reads only" help="ALIGNED_READS_ONLY; default=False"/>
+    <param name="pf_reads_only" type="boolean" truevalue="true" falsevalue="false" label="If set to true calculate mean quality over reads passing quality filter" help="PF_READS_ONLY; default=False"/>
+    <param name="include_no_calls" type="boolean" label="If set to true, include quality for no-call bases in the distribution" help="INCLUDE_NO_CALLS; default=False"/>
+    <param name="assume_sorted" type="boolean" label="Assume the input file is already sorted" checked="true" truevalue="true" falsevalue="false" help="ASSUME_SORTED; default=True"/>
+    
+    <expand macro="VS" />
+    
+  </inputs>
+  
+  <outputs>
+    <data format="tabular" name="outFile" label="${tool.name} on ${on_string}: Summary data"/>
+    <data format="pdf" name="pdfFile" label="${tool.name} on ${on_string}: Chart PDF"/>
+  </outputs>
+  
+  <tests>
+    <test>
+      <param name="assume_sorted" value="true" />
+      <param name="aligned_reads_only" value="false" />
+      <param name="pf_reads_only" value="false" />
+      <param name="include_no_calls" value="false" />
+      <param name="reference_source_selector" value="history" />
+      <param name="ref_file" value="picard_QualityScoreDistribution_ref.fa" />
+      <param name="inputFile" value="picard_QualityScoreDistribution.bam" ftype="bam" />
+      <output name="outFile" file="picard_QualityScoreDistribution_test1.tab" ftype="tabular" lines_diff="4"/>
+    </test> 
+  </tests>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <help>
+
+.. class:: infomark
+
+**Purpose**
+
+Program to chart quality score distributions in a SAM or BAM dataset.
+
+@dataset_collections@
+
+@description@
+
+  ALIGNED_READS_ONLY=Boolean    If set to true, calculate the base distribution over aligned reads only.  Default value: 
+                                false. Possible values: {true, false} 
+
+  PF_READS_ONLY=Boolean         If set to true calculate the base distribution over PF reads only.  Default value: false. 
+                                Possible values: {true, false}
+                                
+  INCLUDE_NO_CALLS=Boolean      If set to true, include quality for no-call bases in the distribution.  Default value: 
+                                false. Possible values: {true, false} 
+
+  ASSUME_SORTED=Boolean
+  AS=Boolean                    If true (default), then the sort order in the header file will be ignored.  Default: True 
+
+@more_info@
+
+  </help>
+</tool>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_ReorderSam.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,130 @@
+<tool name="ReorderSam" id="picard_ReorderSam" version="1.135">
+  <description>reorder reads to match ordering in reference sequences</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements" />
+  <command>
+    @java_options@
+    #set $picard_dict = "localref.dict"
+    #set $ref_fasta = "localref.fa"     ## This is done because picards "likes" .fa extension
+    
+    ln -s "${reference_source.ref_file}" "${ref_fasta}" &amp;&amp;
+       
+    #if str( $reference_source.reference_source_selector ) == "history":
+        
+      java -jar \$JAVA_JAR_PATH/picard.jar CreateSequenceDictionary REFERENCE="${ref_fasta}" OUTPUT="${picard_dict}"
+      QUIET=true
+      VERBOSITY=ERROR
+      
+      &amp;&amp;
+      
+    #else:
+    
+      #set $ref_fasta = str( $reference_source.ref_file.fields.path )
+    
+    #end if
+    
+    java -jar \$JAVA_JAR_PATH/picard.jar
+    ReorderSam
+      INPUT="${inputFile}"
+      OUTPUT="${outFile}"
+      REFERENCE="${ref_fasta}"
+      ALLOW_INCOMPLETE_DICT_CONCORDANCE="${allow_incomplete_dict_concordance}"
+      ALLOW_CONTIG_LENGTH_DISCORDANCE="${allow_contig_length_discordance}"
+      
+      VALIDATION_STRINGENCY="${validation_stringency}"
+      QUIET=true
+      VERBOSITY=ERROR
+      
+  </command>
+  
+  <inputs>
+    
+     <conditional name="reference_source">
+      <param name="reference_source_selector" type="select" label="Load reference genome from">
+        <option value="cached">Local cache</option>
+        <option value="history">History</option>
+      </param>
+      <when value="cached">
+        <param name="ref_file" type="select" label="Use dictionary from the list" help="Select genome from the list">
+          <options from_data_table="picard_indexes">
+            <filter type="sort_by" column="2" />
+            <validator type="no_options" message="No indexes are available" />
+          </options>
+          <validator type="no_options" message="A built-in dictionary is not available for the build associated with the selected input file"/>
+        </param>
+      </when>
+      <when value="history"> 
+        <param name="ref_file" type="data" format="fasta" label="Use the following dataset to create dictionary" help="You can upload a FASTA sequence to the history from which Picard will automatically generate dictionary using CreateSequenceDictionary command" />
+      </when>
+    </conditional>
+
+    <param format="sam,bam" name="inputFile" type="data" label="Select SAM/BAM dataset or dataset collection" help="If empty, upload or import a SAM/BAM dataset"/>
+    <param name="allow_incomplete_dict_concordance" type="boolean" label="If true, then allows only a partial overlap of the BAM contigs with the new reference sequence contigs" help="ALLOW_INCOMPLETE_DICT_CONCORDANCE; By default, this tool requires a corresponding contig in the new reference for each read contig; default=False"/>
+    <param name="allow_contig_length_discordance" type="boolean" label="If true, then permits mapping from a read contig to a new reference contig with the same name but a different length" help="ALLOW_CONTIG_LENGTH_DISCORDANCE; HIGHLY DANGEROUS! Only use if you know what you are doing; default=False"/>
+    <expand macro="VS" />
+    
+  </inputs>
+  <outputs>
+    <data name="outFile" format="bam" label="${tool.name} on ${on_string}: Reordered BAM"/>
+  </outputs>
+  <tests>
+    <test>
+      <param name="reference_source_selector" value="history" />
+      <param name="ref_file" value="picard_ReorderSam_ref.fa" ftype="fasta" />
+      <param name="inputFile" value="picard_ReorderSam.bam" ftype="bam"/>
+      <param name="allow_incomplete_dict_concordance" value="false"/>
+      <param name="allow_contig_length_discordance" value="false"/>
+      <output name="outFile" file="picard_ReorderSam_test1.bam" ftype="bam" lines_diff="2"/>
+    </test>
+  </tests>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <help>
+
+.. class:: infomark
+
+**Purpose**
+
+ReorderSam reorders reads in a SAM/BAM file to match the contig ordering in a provided reference file, as determined by exact name matching of contigs.  Reads mapped to contigs absent in the new reference are dropped.
+
+@dataset_collections@
+
+----
+
+.. class:: warningmark
+
+Not to be confused with **SortSam**.
+
+@description@
+
+  ALLOW_INCOMPLETE_DICT_CONCORDANCE=Boolean
+  S=Boolean                     If true, then allows only a partial overlap of the BAM contigs with the new reference 
+                                sequence contigs.  By default, this tool requires a corresponding contig in the new 
+                                reference for each read contig  Default value: false. Possible values: {true, false} 
+  
+  ALLOW_CONTIG_LENGTH_DISCORDANCE=Boolean
+  U=Boolean                     If true, then permits mapping from a read contig to a new reference contig with the same 
+                                name but a different length.  Highly dangerous, only use if you know what you are doing.  
+                                Default value: false.  Possible values: {true, false} 
+
+@more_info@
+  </help>
+</tool>
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_ReplaceSamHeader.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,63 @@
+<tool name="ReplaceSamHeader" id="picard_ReplaceSamHeader" version="1.135">
+  <description>replace header in a SAM/BAM dataset</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements" />
+  <command>
+    @java_options@
+    
+  
+    ## Two lines below are due to the fact that picard likes fasta files to have extension .fa  
+    #set $fasta_file="local_fasta.fa"
+    ln -s "${inputFile}" "${fasta_file}" &amp;&amp;    
+    
+    java -jar \$JAVA_JAR_PATH/picard.jar
+    ReplaceSamHeader
+    
+    INPUT="${inputFile}"
+    HEADER="${header}"
+    OUTPUT="${outFile}"
+    
+    QUIET=true
+    VERBOSITY=ERROR
+  
+  </command>
+  <inputs>
+    <param format="sam,bam" name="inputFile" type="data" label="Select SAM/BAM dataset or dataset collection (header recepient dataset)" help="If empty, upload or import a SAM/BAM dataset"/>
+    <param name="header" type="data" format="sam,bam" label="SAM/BAM dataset from which Header will be read (header source dataset)" help="HEADER; If empty, upload or import a SAM/BAM dataset"/>
+  </inputs> 
+  
+  <outputs>
+    <data format="bam" name="outFile" label="${tool.name} on ${on_string}: BAM file with replaced header"/>
+  </outputs>
+  
+  <tests>
+    <test>
+      <param name="inputFile" value="picard_ReplaceSamHeader.bam" ftype="bam"/>
+      <param name="header" value="picard_ReplaceSamHeader_header.bam" ftype="bam"/>
+      <output name="outFile" file="picard_ReplaceSamHeader_test1.bam" ftype="bam"/>
+    </test>
+  </tests>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <help>
+
+**Purpose**
+
+Replace the SAMFileHeader in a SAM/BAM dataset with the given header. Validation is minimal. It is up to the user to ensure that all the elements referred to in the SAMRecords are present in the new header. Sort order of the two input datasets must be the same.
+@dataset_collections@
+
+@description@
+
+  HEADER=File                   SAM file from which SAMFileHeader will be read.  Required. 
+
+@more_info@
+
+  </help>
+</tool>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_RevertOriginalBaseQualitiesAndAddMateCigar.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,75 @@
+<tool name="RevertOriginalBaseQualitiesAndAddMateCigar" id="picard_RevertOriginalBaseQualitiesAndAddMateCigar" version="1.135">
+  <description>revert the original base qualities and add the mate cigar tag</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements" />
+  <command>
+    @java_options@
+    
+    java -jar \$JAVA_JAR_PATH/picard.jar
+    RevertOriginalBaseQualitiesAndAddMateCigar
+    
+    INPUT="${inputFile}"
+    OUTPUT="${outFile}"
+    
+    RESTORE_ORIGINAL_QUALITIES="${restore_original_qualities}"
+    MAX_RECORDS_TO_EXAMINE="${max_records_to_examine}"
+    
+    SORT_ORDER=coordinate
+    VALIDATION_STRINGENCY="${validation_stringency}"
+    QUIET=true
+    VERBOSITY=ERROR
+  
+  </command>
+  <inputs>
+    <param format="sam,bam" name="inputFile" type="data" multiple="True" label="Select SAM/BAM dataset or dataset collection" help="If empty, upload or import a SAM/BAM dataset"/>
+    <param name="restore_original_qualities" type="boolean" checked="True" label="Restore original qualities from the OQ field to the QUAL field if available" help="RESTORE_ORIGINAL_QUALITIES; default=True"/>
+    <param name="max_records_to_examine" type="integer" value="10000" min="0" label="The maximum number of records to examine to determine if we can exit early and not output, given that there are a no original base qualities (if we are to restore) and mate cigars exist. Set to 0 to never skip the dataset" help="MAX_RECORDS_TO_EXAMINE; default=10,000"/>
+
+    <expand macro="VS" />
+    
+  </inputs> 
+  
+  <outputs>
+    <data format="bam" name="outFile" label="${tool.name} on ${on_string}: Reverted BAM dataset"/>
+  </outputs>
+  
+  <tests>
+    <test>
+      <param name="inputFile" value="picard_RevertOriginalBaseQualitiesAndAddMateCigar.bam" ftype="bam"/>
+      <param name="restore_original_qualities" value="True"/>
+      <param name="max_records_to_examine" value="10000"/>
+      <param name="validation_stringency" value="LENIENT"/>
+      <output name="outFile" file="picard_RevertOriginalBaseQualitiesAndAddMateCigar_test1.bam" ftype="bam" lines_diff="2"/>
+    </test>
+  </tests>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <help>
+
+**Purpose**
+
+Reverts the original base qualities and adds the mate cigar tag to SAM or BAMs.
+
+@dataset_collections@
+
+@description@
+
+  RESTORE_ORIGINAL_QUALITIES=Boolean
+  OQ=Boolean                    True to restore original qualities from the OQ field to the QUAL field if available.  
+                                Default value: true. Possible values: {true, false} 
+  
+  MAX_RECORDS_TO_EXAMINE=IntegerThe maximum number of records to examine to determine if we can exit early and not 
+                                output, given that there are a no original base qualities (if we are to restore) and mate 
+                                cigars exist. Set to 0 to never skip the file.  Default value: 10000.
+
+@more_info@
+
+  </help>
+</tool>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_RevertSam.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,136 @@
+<tool name="RevertSam" id="picard_RevertSam" version="1.135">
+  <description>revert SAM/BAM datasets to a previous state</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements" />
+  <command>
+    @java_options@
+    
+    java -jar \$JAVA_JAR_PATH/picard.jar
+    RevertSam
+    
+    INPUT="${inputFile}"
+    OUTPUT="${outFile}"
+    
+    RESTORE_ORIGINAL_QUALITIES="${restore_original_qualities}"
+    REMOVE_DUPLICATE_INFORMATION="${remove_duplicate_information}"
+    REMOVE_ALIGNMENT_INFORMATION="${remove_alignment_information}"
+     
+    #for $attribute_to_clear in $attributes_to_clear:
+      ATTRIBUTE_TO_CLEAR="${attribute_to_clear.attribute}"
+    #end for
+    
+    SANITIZE="${sanitize}"
+    MAX_DISCARD_FRACTION="${max_discard_fraction}"
+    SAMPLE_ALIAS="${sample_alias}"
+    LIBRARY_NAME="${library_name}"
+    
+    SORT_ORDER="${sort_order}"
+    VALIDATION_STRINGENCY="${validation_stringency}"
+    QUIET=true
+    VERBOSITY=ERROR
+  
+  </command>
+  <inputs>
+    <param format="sam,bam" name="inputFile" type="data" multiple="True" label="Select SAM/BAM dataset or dataset collection" help="If empty, upload or import a SAM/BAM dataset"/>
+    <param name="restore_original_qualities" type="boolean" checked="True" label="Restore original qualities from the OQ field to the QUAL field if available" help="RESTORE_ORIGINAL_QUALITIES; default=True"/>
+    <param name="remove_duplicate_information" type="boolean" checked="True" label="Remove duplicate read flags from all reads" help="REMOVE_DUPLICATE_INFORMATION; Note that if this is true and REMOVE_ALIGNMENT_INFORMATION is set to False, the output may have the unusual but sometimes desirable trait of having unmapped reads that are marked as duplicates; default=True"/>
+    <param name="remove_alignment_information" type="boolean" checked="True" label="Remove all alignment information from the file" help="REMOVE_ALIGNMENT_INFORMATION; default=True"/>
+    <repeat name="attributes_to_clear" title="Clear attribute" min="0" help="You can provide multiple attributes">
+      <param name="attribute" type="text" size="10" label="When removing alignment information, specify optional tags to remove (e.g., XM)" help="ATTRIBUTE_TO_CLEAR"/>
+    </repeat>
+    <param name="sanitize" type="boolean" label="Discard reads in order to produce a consistent output BAM" help="SANITIZE; WARNING: This option is potentially destructive. Reads discarded include (but are not limited to) paired reads with missing mates, duplicated records, records with mismatches in length of bases and qualities. This option can only be enabled if the output sort order is queryname and will always cause sorting to occur; default=False"/>
+    <param name="max_discard_fraction" value="0.01" type="float" min="0.0" max="1.0" label="If SANITIZE=true and higher than MAX_DISCARD_FRACTION reads are discarded due to sanitization then the program will exit with an Exception instead of exiting cleanly" help="MAX_DISCARD_FRACTION; default=0.01"/>
+    <param name="sample_alias" type="text" size="40" value="null" label="The sample alias to use in the reverted output file. This will override the existing sample alias in the file and is used only if all the read groups in the input file have the same sample alias" help="SAMPLE_ALIAS; default=Null"/>
+    <param name="library_name" type="text" size="40" value="null" label="The library name to use in the reverted output file. This will override the existing sample alias in the file and is used only if all the read groups in the input file have the same sample alias" help="LIBRARY_NAME; default=Null"/>
+    <param name="sort_order" type="select" label="The sort order to create the reverted output file with" help="SORT_ORDER; Picard default=queryname; Galaxy default=coordinate">
+      <option value="coordinate" selected="True">Coordinate</option>
+      <option value="queryname">Queryname</option>
+      <option value="unsorted">Unsorted</option>
+    </param>
+    <expand macro="VS" />
+    
+  </inputs> 
+  
+  <outputs>
+    <data format="bam" name="outFile" label="${tool.name} on ${on_string}: Reverted BAM dataset"/>
+  </outputs>
+  
+  <tests>
+    <test>
+      <param name="inputFile" value="picard_RevertSam.bam" ftype="bam"/>
+      <param name="restore_original_qualities" value="True"/>
+      <param name="remove_duplicate_information" value="True"/>
+      <param name="remove_alignment_information" value="True"/>
+      <param name="attribute" value="XM"/>
+      <param name="sanitize" value="False"/>
+      <param name="max_discard_fraction" value="0.01"/>
+      <param name="sample_alias" value="null"/>
+      <param name="library_name" value="null"/>
+      <param name="sort_order" value="coordinate"/>
+      <param name="validation_stringency" value="LENIENT"/>
+      <output name="outFile" file="picard_RevertSam_test1.bam" ftype="bam" lines_diff="2"/>
+    </test>
+  </tests>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <help>
+
+**Purpose**
+
+Reverts SAM or BAM files to a previous state by removing certain types of information and/or substituting in the original quality scores when available.
+
+@dataset_collections@
+
+@description@
+
+  SORT_ORDER=SortOrder  
+  SO=SortOrder                  The sort order to create the reverted output file with.  Default value: queryname.
+                                Possible values: {unsorted, queryname, coordinate} 
+  
+  RESTORE_ORIGINAL_QUALITIES=Boolean
+  OQ=Boolean                    True to restore original qualities from the OQ field to the QUAL field if available.  
+                                Default value: true. Possible values: {true, false} 
+  
+  REMOVE_DUPLICATE_INFORMATION=Boolean
+                                Remove duplicate read flags from all reads.  Note that if this is true and 
+                                REMOVE_ALIGNMENT_INFORMATION==false,  the output may have the unusual but sometimes 
+                                desirable trait of having unmapped reads that are marked as duplicates.  Default value: 
+                                true. Possible values: {true, false} 
+  
+  REMOVE_ALIGNMENT_INFORMATION=Boolean
+                                Remove all alignment information from the file.  Default value: true. TPossible values: {true, false} 
+  
+  ATTRIBUTE_TO_CLEAR=String     When removing alignment information, the set of optional tags to remove.  This option may 
+                                be specified 0 or more times. 
+  
+  SANITIZE=Boolean              WARNING: This option is potentially destructive. If enabled will discard reads in order 
+                                to produce a consistent output BAM. Reads discarded include (but are not limited to) 
+                                paired reads with missing mates, duplicated records, records with mismatches in length of 
+                                bases and qualities. This option can only be enabled if the output sort order is 
+                                queryname and will always cause sorting to occur.  Possible values: {true, false} 
+  
+  MAX_DISCARD_FRACTION=Double   If SANITIZE=true and higher than MAX_DISCARD_FRACTION reads are discarded due to 
+                                sanitization thenthe program will exit with an Exception instead of exiting cleanly. 
+                                Output BAM will still be valid.  Default value: 0.01. 
+  
+  SAMPLE_ALIAS=String
+  ALIAS=String                  The sample alias to use in the reverted output file.  This will override the existing 
+                                sample alias in the file and is used only if all the read groups in the input file have 
+                                the same sample alias   Default value: null. 
+  
+  LIBRARY_NAME=String
+  LIB=String                    The library name to use in the reverted output file.  This will override the existing 
+                                sample alias in the file and is used only if all the read groups in the input file have 
+                                the same sample alias   Default value: null. 
+  
+@more_info@
+
+  </help>
+</tool>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_SamToFastq.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,196 @@
+<tool name="SamToFastq" id="picard_SamToFastq" version="1.135">
+  <description>extract reads and qualities from SAM/BAM dataset and convert to fastq</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements" />
+  <command>
+     
+    echo "BAM" > $report &amp;&amp;    ## This is necessary for output dataset detection (see output tags below)
+    
+    @java_options@
+    
+    java -jar \$JAVA_JAR_PATH/picard.jar
+    SamToFastq
+    
+    INPUT="${inputFile}"
+    
+    #if str( $output_per_rg ) == "true":
+      OUTPUT_PER_RG=true
+      OUTPUT_DIR=.
+    #elif str( $output_per_rg ) == "false" and str( $interleave ) == "false":
+      FASTQ=READ1.fastq
+      SECOND_END_FASTQ=READ2.fastq
+      UNPAIRED_FASTQ=UNPAIRED_READS.fastq
+    #elif str( $output_per_rg ) == "false" and str( $interleave ) == "true":
+      FASTQ=INTERLEAVED.fastq
+    #end if
+  
+    RE_REVERSE="${re_reverse}"
+    INTERLEAVE="${interleave}"
+    INCLUDE_NON_PF_READS="${include_non_pf_reads}"
+    CLIPPING_ATTRIBUTE="${clipping_attribute}"
+    CLIPPING_ACTION="${clipping_action}"
+    READ1_TRIM="${read1_trim}"
+    
+    #if int($read1_max_bases_to_write) > -1:
+      READ1_MAX_BASES_TO_WRITE="${read1_max_bases_to_write}"
+    #end if
+    
+    READ2_TRIM="${read2_trim}"
+    
+    #if int($read2_max_bases_to_write) > -1:
+      READ2_MAX_BASES_TO_WRITE="${read2_max_bases_to_write}"
+    #end if
+    
+    INCLUDE_NON_PRIMARY_ALIGNMENTS="${include_non_primary_alignments}"
+    
+    
+    VALIDATION_STRINGENCY="${validation_stringency}"
+    QUIET=true
+    VERBOSITY=ERROR
+  
+  </command>
+  <inputs>
+    
+    <param format="sam,bam" name="inputFile" type="data" label="Select SAM/BAM dataset or dataset collection" help="If empty, upload or import a SAM/BAM dataset"/>
+    <param name="output_per_rg" type="boolean" checked="False" label="Do you want to output a fastq file per read group (two fastq files per read group if the group is paired)" help="OUTPUT_PER_RG; default=False"/>
+    <param name="re_reverse" type="boolean" checked="True" label="Re-reverse bases and qualities of reads with negative strand flag set before writing them to fastq" help="RE_REVERSE; default=True"/>
+    <param name="interleave" type="boolean" label="Will generate an interleaved fastq if paired, each line will have /1 or /2 to describe which end it came from" help="INTERLEAVE; default=False"/>
+    <param name="include_non_pf_reads" type="boolean" label="Include non-PF reads from the SAM/BAM dataset into the output FASTQ" help="INCLUDE_NON_PF_READS; PF means 'passes filtering'. Reads whose 'not passing quality controls' flag is set are non-PF reads; default=False"/>
+    <param name="clipping_attribute" type="text" size="4" value="null" label="The attribute that stores the position at which the SAM/BAM record should be clipped" help="CLIPPING_ATTRIBUTE; default=null"/>
+    <param name="clipping_action" type="text" size="10" value="null" label="The action that should be taken with clipped reads: 'X' means the reads and qualities should be trimmed at the clipped position; 'N' means the bases should be changed to Ns in the clipped region; and any integer means that the base qualities should be set to that value in the clipped region" help="CLIPPING_ACTION; default=null"/>
+    <param name="read1_trim" type="integer" value="0" min="0" label="The number of bases to trim from the beginning of read 1" help="READ1_TRIM; default=0"/>
+    <param name="read1_max_bases_to_write" type="integer" value="-1" label="The maximum number of bases to write from read 1 after trimming" help="READ1_MAX_BASES_TO_WRITE; If there are fewer than this many bases left after trimming, all will be written. If this value is null then all bases left after trimming will be written; default=null (-1)"/>
+    <param name="read2_trim" type="integer" value="0" min="0" label="The number of bases to trim from the beginning of read 2" help="READ2_TRIM; default=0"/>
+    <param name="read2_max_bases_to_write" type="integer" value="-1" label="The maximum number of bases to write from read 2 after trimming" help="READ2_MAX_BASES_TO_WRITE; If there are fewer than this many bases left after trimming, all will be written. If this value is null then all bases left after trimming will be written; default=null (-1)"/>
+    <param name="include_non_primary_alignments" type="boolean" label="If true, include non-primary alignments in the output" help="INCLUDE_NON_PRIMARY_ALIGNMENTS; Support of non-primary alignments in SamToFastq is not comprehensive, so there may be exceptions if this is set to true and there are paired reads with non-primary alignments; default=False"/>
+    
+    <expand macro="VS" />
+    
+  </inputs> 
+  
+  <outputs>
+    <!-- here dataset discovery is based on fact that if OUTPUT_PER_RG=true this tool automatically adds .fastq extension to emitted files -->
+    <data format="txt" name="report" label="SamToFastq run" hidden="true">
+      <discover_datasets pattern="(?P&lt;designation&gt;.+)\.fastq" ext="fastqsanger" visible="true"/>
+    </data>
+  </outputs>
+  
+  <tests>
+    <test>
+      <param name="inputFile" value="picard_SamToFastq.bam" ftype="bam"/>
+      <param name="output_per_rg" value="false"/>
+      <param name="re_reverse" value="true"/>
+      <param name="interleave" value="true"/>
+      <param name="include_non_pf_reads" value="false"/>
+      <param name="clipping_attribute" value="null" />
+      <param name="clipping_action" value="null" />
+      <param name="read1_trim" value="0" />
+      <param name="read1_max_bases_to_write" value="-1"/>
+      <param name="read2_trim" value="0" />
+      <param name="read2_max_bases_to_write" value="-1"/>
+      <param name="include_non_primary_alignments" value="false"/>   
+      <output name="report">
+        <assert_contents>
+          <has_line line="BAM" />
+        </assert_contents>
+        <discovered_dataset designation="INTERLEAVED" file="picard_SamToFastq_test1.fq" ftype="fastqsanger"/>
+      </output>
+    </test>
+  </tests>
+  
+  <stdio>
+    <exit_code range="1:"  level="fatal"/>
+  </stdio>
+  
+  <help>
+
+**Purpose**
+
+Extracts read sequences and qualities from the input SAM/BAM dataset and outputs them in Sanger fastq format. In the RE_REVERSE=True mode (default behavior), if the read is aligned and the alignment is to the reverse strand on the genome, the read's sequence from input SAM.BAM dataset will be reverse-complemented prior to writing it to fastq in order restore correctly the original read sequence as it was generated by the sequencer.
+
+-----
+
+.. class:: warningmark
+
+**DANGER: Multiple Outputs**
+
+Generating per readgroup fastq (setting **OUTPUT_PER_RG** to True) may produce very large numbers of outputs. Know what you are doing!
+
+@dataset_collections@
+
+@description@
+
+  FASTQ=File
+  F=File                        Output fastq file (single-end fastq or, if paired, first end of the pair fastq).  
+                                Required.  Cannot be used in conjuction with option(s) OUTPUT_PER_RG (OPRG)
+  
+  SECOND_END_FASTQ=File
+  F2=File                       Output fastq file (if paired, second end of the pair fastq).  Default value: null.  
+                                Cannot be used in conjuction with option(s) OUTPUT_PER_RG (OPRG)
+  
+  UNPAIRED_FASTQ=File
+  FU=File                       Output fastq file for unpaired reads; may only be provided in paired-fastq mode  Default 
+                                value: null.  Cannot be used in conjuction with option(s) OUTPUT_PER_RG (OPRG)
+  
+  OUTPUT_PER_RG=Boolean
+  OPRG=Boolean                  Output a fastq file per read group (two fastq files per read group if the group is 
+                                paired).  Default value: false. Possible values: {true, false}  Cannot be used in
+                                conjuction with option(s) SECOND_END_FASTQ (F2) UNPAIRED_FASTQ (FU) FASTQ (F)
+  
+  OUTPUT_DIR=File
+  ODIR=File                     Directory in which to output the fastq file(s).  Used only when OUTPUT_PER_RG is true.  
+                                Default value: null. 
+  
+  RE_REVERSE=Boolean
+  RC=Boolean                    Re-reverse bases and qualities of reads with negative strand flag set before writing them 
+                                to fastq  Default value: true. Possible values: {true, false} 
+  
+  INTERLEAVE=Boolean
+  INTER=Boolean                 Will generate an interleaved fastq if paired, each line will have /1 or /2 to describe 
+                                which end it came from  Default value: false. Possible values: {true, false} 
+  
+  INCLUDE_NON_PF_READS=Boolean
+  NON_PF=Boolean                Include non-PF reads from the SAM file into the output FASTQ files. PF means 'passes 
+                                filtering'. Reads whose 'not passing quality controls' flag is set are non-PF reads.  
+                                Default value: false. Possible values: {true, false} 
+  
+  CLIPPING_ATTRIBUTE=String
+  CLIP_ATTR=String              The attribute that stores the position at which the SAM record should be clipped  Default 
+                                value: null. 
+  
+  CLIPPING_ACTION=String
+  CLIP_ACT=String               The action that should be taken with clipped reads: 'X' means the reads and qualities 
+                                should be trimmed at the clipped position; 'N' means the bases should be changed to Ns in 
+                                the clipped region; and any integer means that the base qualities should be set to that 
+                                value in the clipped region.  Default value: null. 
+  
+  READ1_TRIM=Integer
+  R1_TRIM=Integer               The number of bases to trim from the beginning of read 1.  Default value: 0. 
+  
+  READ1_MAX_BASES_TO_WRITE=Integer
+  R1_MAX_BASES=Integer          The maximum number of bases to write from read 1 after trimming. If there are fewer than 
+                                this many bases left after trimming, all will be written.  If this value is null then all 
+                                bases left after trimming will be written.  Default value: null. 
+  
+  READ2_TRIM=Integer
+  R2_TRIM=Integer               The number of bases to trim from the beginning of read 2.  Default value: 0. 
+  
+  READ2_MAX_BASES_TO_WRITE=Integer
+  R2_MAX_BASES=Integer          The maximum number of bases to write from read 2 after trimming. If there are fewer than 
+                                this many bases left after trimming, all will be written.  If this value is null then all 
+                                bases left after trimming will be written.  Default value: null. 
+  
+  INCLUDE_NON_PRIMARY_ALIGNMENTS=Boolean
+                                If true, include non-primary alignments in the output.  Support of non-primary alignments 
+                                in SamToFastq is not comprehensive, so there may be exceptions if this is set to true and 
+                                there are paired reads with non-primary alignments.  Default value: false.
+                                Possible values: {true, false} 
+  
+@more_info@
+
+  </help>
+</tool>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/picard_ValidateSamFile.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,226 @@
+<tool name="ValidateSamFile" id="picard_ValidateSamFile" version="1.135">
+  <description>assess validity of SAM/BAM dataset</description>
+  <macros>
+    <import>picard_macros.xml</import>
+  </macros>
+  <expand macro="requirements" />
+  <command>
+    
+    ##set the maximum number of open file to hard maximum or 4096 if on a mac (mac gives 'unlimited' as output of `ulimit -Hn` command
+    
+    [ `ulimit -Hn` = unlimited ] &amp;&amp; ulimit -Sn 4096 || ulimit -Sn `ulimit -Hn`
+    
+    &amp;&amp;
+    
+    ##set up input files
+
+    #set $reference_fasta_filename = "localref.fa"
+    
+    #if str( $reference_source.reference_source_selector ) == "history":
+        ln -s "${reference_source.ref_file}" "${reference_fasta_filename}" &amp;&amp;
+    #else:
+        #set $reference_fasta_filename = str( $reference_source.ref_file.fields.path )
+    #end if
+    
+    @java_options@
+    
+    java -jar \$JAVA_JAR_PATH/picard.jar
+    ValidateSamFile
+    
+    INPUT="${inputFile}"
+    OUTPUT="${outFile}"
+    MODE="${mode}"
+    
+    #if str( $ignore ) != "None":
+      #for $element in str( $ignore ).split(','):   ## See trello card https://trello.com/c/9nW02Zhd
+        IGNORE="${element}"
+      #end for
+    #end if
+    
+    MAX_OUTPUT="${max_output}"
+    REFERENCE_SEQUENCE="${reference_fasta_filename}"
+    IGNORE_WARNINGS="${ignore_warnings}"
+    IS_BISULFITE_SEQUENCED="${is_bisulfite_sequenced}"
+    MAX_OPEN_TEMP_FILES=`ulimit -Sn`
+     
+    VERBOSITY=ERROR
+    QUIET=true
+   
+  </command>
+  <inputs>
+    <param format="sam,bam" name="inputFile" type="data" label="SAM/BAM dataset or dataset collection" help="If empty, upload or import a SAM/BAM dataset." />
+     <conditional name="reference_source">
+      <param name="reference_source_selector" type="select" label="Load reference genome from">
+        <option value="cached">Local cache</option>
+        <option value="history">History</option>
+      </param>
+      <when value="cached">
+        <param name="ref_file" type="select" label="Use dictionary from the list" help="Select genome from the list">
+          <options from_data_table="picard_indexes">
+            <filter type="sort_by" column="2" />
+            <validator type="no_options" message="No indexes are available" />
+          </options>
+          <validator type="no_options" message="A built-in dictionary is not available for the build associated with the selected input file"/>
+        </param>
+      </when>
+      <when value="history"> 
+        <param name="ref_file" type="data" format="fasta" label="Use the following dataset to create dictionary" help="You can upload a FASTA sequence to the history from which Picard will automatically generate dictionary using CreateSequenceDictionary command" />
+      </when>
+    </conditional>
+     
+    <param name="mode" type="select" label="Select output mode" help="MODE">
+      <option value="VERBOSE">Verbose</option>
+      <option value="SUMMARY">Summary</option>
+    </param>
+    <param name="ignore" type="select" multiple="true" display="checkboxes" label="Select validation error types to ignore" help="IGNORE">
+      <option value="INVALID_QUALITY_FORMAT">INVALID_QUALITY_FORMAT</option>
+      <option value="INVALID_FLAG_PROPER_PAIR">INVALID_FLAG_PROPER_PAIR</option>
+      <option value="INVALID_FLAG_MATE_UNMAPPED"/>
+      <option value="MISMATCH_FLAG_MATE_UNMAPPED"/>
+      <option value="INVALID_FLAG_MATE_NEG_STRAND"/>
+      <option value="MISMATCH_FLAG_MATE_NEG_STRAND"/>
+      <option value="INVALID_FLAG_FIRST_OF_PAIR"/>
+      <option value="INVALID_FLAG_SECOND_OF_PAIR"/>
+      <option value="PAIRED_READ_NOT_MARKED_AS_FIRST_OR_SECOND"/>
+      <option value="INVALID_FLAG_NOT_PRIM_ALIGNMENT"/>
+      <option value="INVALID_FLAG_SUPPLEMENTARY_ALIGNMENT"/>
+      <option value="INVALID_FLAG_READ_UNMAPPED"/>
+      <option value="INVALID_INSERT_SIZE"/>
+      <option value="INVALID_MAPPING_QUALITY"/>
+      <option value="INVALID_CIGAR"/>
+      <option value="ADJACENT_INDEL_IN_CIGAR"/>
+      <option value="INVALID_MATE_REF_INDEX"/>
+      <option value="MISMATCH_MATE_REF_INDEX"/>
+      <option value="INVALID_REFERENCE_INDEX"/>
+      <option value="INVALID_ALIGNMENT_START"/>
+      <option value="MISMATCH_MATE_ALIGNMENT_START"/>
+      <option value="MATE_FIELD_MISMATCH"/>
+      <option value="INVALID_TAG_NM"/>
+      <option value="MISSING_TAG_NM"/>
+      <option value="MISSING_HEADER"/>
+      <option value="MISSING_SEQUENCE_DICTIONARY"/>
+      <option value="MISSING_READ_GROUP"/>
+      <option value="RECORD_OUT_OF_ORDER"/>
+      <option value="READ_GROUP_NOT_FOUND"/>
+      <option value="RECORD_MISSING_READ_GROUP"/>
+      <option value="INVALID_INDEXING_BIN"/>
+      <option value="MISSING_VERSION_NUMBER"/>
+      <option value="INVALID_VERSION_NUMBER"/>
+      <option value="TRUNCATED_FILE"/>
+      <option value="MISMATCH_READ_LENGTH_AND_QUALS_LENGTH"/>
+      <option value="EMPTY_READ"/>
+      <option value="CIGAR_MAPS_OFF_REFERENCE"/>
+      <option value="MISMATCH_READ_LENGTH_AND_E2_LENGTH"/>
+      <option value="MISMATCH_READ_LENGTH_AND_U2_LENGTH"/>
+      <option value="E2_BASE_EQUALS_PRIMARY_BASE"/>
+      <option value="BAM_FILE_MISSING_TERMINATOR_BLOCK"/>
+      <option value="UNRECOGNIZED_HEADER_TYPE"/>
+      <option value="POORLY_FORMATTED_HEADER_TAG"/>
+      <option value="HEADER_TAG_MULTIPLY_DEFINED"/>
+      <option value="HEADER_RECORD_MISSING_REQUIRED_TAG"/>
+      <option value="INVALID_DATE_STRING"/>
+      <option value="TAG_VALUE_TOO_LARGE"/>
+      <option value="INVALID_INDEX_FILE_POINTER"/>
+      <option value="INVALID_PREDICTED_MEDIAN_INSERT_SIZE"/>
+      <option value="DUPLICATE_READ_GROUP_ID"/>
+      <option value="MISSING_PLATFORM_VALUE"/>
+      <option value="INVALID_PLATFORM_VALUE"/>
+      <option value="DUPLICATE_PROGRAM_GROUP_ID"/>
+      <option value="MATE_NOT_FOUND"/>
+      <option value="MATES_ARE_SAME_END"/>
+      <option value="MISMATCH_MATE_CIGAR_STRING"/>
+      <option value="MATE_CIGAR_STRING_INVALID_PRESENCE"/>
+    </param>
+    <param name="max_output" type="integer" value="100" label="The maximum number of lines output in verbose mode" help="MAX_OUTPUT; default=100"/>
+    <param name="ignore_warnings" type="boolean" label="If true, only report errors and ignore warnings" help="IGNORE_WARNINGS; default=False"/>
+    <param name="validate_index" type="boolean" checked="True" label="If true and input is a BAM file with an index file, also validates the index" help="VALIDATE_INDEX; default=True"/>
+    <param name="is_bisulfite_sequenced" type="boolean" label="Whether the SAM or BAM file consists of bisulfite sequenced reads" help="IS_BISULFITE_SEQUENCED; If so, C->T is not counted as an error in computing the value of the NM tag; default=False"/>
+    
+  </inputs> 
+  
+  <outputs>
+    <data format="txt" name="outFile" label="${tool.name} on ${on_string}: BAM validation summary"/>
+  </outputs>
+  
+  <tests>
+    <test>
+      <param name="inputFile" value="picard_ValidateSamFile.bam" ftype="bam"/>
+      <param name="reference_source_selector" value="history"/>
+      <param name="ref_file" value="picard_ValidateSamFile_ref.fa"/>
+      <param name="mode" value="VERBOSE"/>
+      <param name="ignore" value="INVALID_QUALITY_FORMAT,INVALID_FLAG_PROPER_PAIR"/>
+      <param name="max_output" value="100"/>
+      <param name="ignore_warnings" value="Fasle"/>
+      <param name="validate_index" value="True"/>
+      <param name="is_bisulfite_sequenced" value="False"/>
+      <output name="outFile" file="picard_ValidateSamFile_test1.txt" ftype="txt"/>
+    </test>
+  </tests>
+  
+  <stdio>
+    <exit_code range="1:"  level="warning"/>
+  </stdio>
+  
+  <help>
+
+**Purpose**
+
+Reads a SAM/BAM dataset and report on its validity.
+
+@dataset_collections@
+
+@description@
+
+  MODE=Mode
+  M=Mode                        Mode of output  Default value: VERBOSE. This option can be set to 'null' to clear the 
+                                default value. Possible values: {VERBOSE, SUMMARY} 
+  
+  IGNORE=Type                   List of validation error types to ignore.  Possible values: {INVALID_QUALITY_FORMAT, 
+                                INVALID_FLAG_PROPER_PAIR, INVALID_FLAG_MATE_UNMAPPED, MISMATCH_FLAG_MATE_UNMAPPED, 
+                                INVALID_FLAG_MATE_NEG_STRAND, MISMATCH_FLAG_MATE_NEG_STRAND, INVALID_FLAG_FIRST_OF_PAIR, 
+                                INVALID_FLAG_SECOND_OF_PAIR, PAIRED_READ_NOT_MARKED_AS_FIRST_OR_SECOND, 
+                                INVALID_FLAG_NOT_PRIM_ALIGNMENT, INVALID_FLAG_SUPPLEMENTARY_ALIGNMENT, 
+                                INVALID_FLAG_READ_UNMAPPED, INVALID_INSERT_SIZE, INVALID_MAPPING_QUALITY, INVALID_CIGAR, 
+                                ADJACENT_INDEL_IN_CIGAR, INVALID_MATE_REF_INDEX, MISMATCH_MATE_REF_INDEX, 
+                                INVALID_REFERENCE_INDEX, INVALID_ALIGNMENT_START, MISMATCH_MATE_ALIGNMENT_START, 
+                                MATE_FIELD_MISMATCH, INVALID_TAG_NM, MISSING_TAG_NM, MISSING_HEADER, 
+                                MISSING_SEQUENCE_DICTIONARY, MISSING_READ_GROUP, RECORD_OUT_OF_ORDER, 
+                                READ_GROUP_NOT_FOUND, RECORD_MISSING_READ_GROUP, INVALID_INDEXING_BIN, 
+                                MISSING_VERSION_NUMBER, INVALID_VERSION_NUMBER, TRUNCATED_FILE, 
+                                MISMATCH_READ_LENGTH_AND_QUALS_LENGTH, EMPTY_READ, CIGAR_MAPS_OFF_REFERENCE, 
+                                MISMATCH_READ_LENGTH_AND_E2_LENGTH, MISMATCH_READ_LENGTH_AND_U2_LENGTH, 
+                                E2_BASE_EQUALS_PRIMARY_BASE, BAM_FILE_MISSING_TERMINATOR_BLOCK, UNRECOGNIZED_HEADER_TYPE, 
+                                POORLY_FORMATTED_HEADER_TAG, HEADER_TAG_MULTIPLY_DEFINED, 
+                                HEADER_RECORD_MISSING_REQUIRED_TAG, INVALID_DATE_STRING, TAG_VALUE_TOO_LARGE, 
+                                INVALID_INDEX_FILE_POINTER, INVALID_PREDICTED_MEDIAN_INSERT_SIZE, 
+                                DUPLICATE_READ_GROUP_ID, MISSING_PLATFORM_VALUE, INVALID_PLATFORM_VALUE, 
+                                DUPLICATE_PROGRAM_GROUP_ID, MATE_NOT_FOUND, MATES_ARE_SAME_END, 
+                                MISMATCH_MATE_CIGAR_STRING, MATE_CIGAR_STRING_INVALID_PRESENCE} This option may be 
+                                specified 0 or more times. 
+  
+  MAX_OUTPUT=Integer
+  MO=Integer                    The maximum number of lines output in verbose mode  Default value: 100. This option can 
+                                be set to 'null' to clear the default value. 
+  
+  REFERENCE_SEQUENCE=File
+  R=File                        Reference sequence file, the NM tag check will be skipped if this is missing  Default 
+                                value: null. 
+  
+  IGNORE_WARNINGS=Boolean       If true, only report errors and ignore warnings.  Default value: false. This option can 
+                                be set to 'null' to clear the default value. Possible values: {true, false} 
+  
+  VALIDATE_INDEX=Boolean        If true and input is a BAM file with an index file, also validates the index.  Default 
+                                value: true. This option can be set to 'null' to clear the default value. Possible 
+                                values: {true, false} 
+  
+  IS_BISULFITE_SEQUENCED=Boolean
+  BISULFITE=Boolean             Whether the SAM or BAM file consists of bisulfite sequenced reads. If so, C->T is not 
+                                counted as an error in computing the value of the NM tag.  Default value: false. This 
+                                option can be set to 'null' to clear the default value. Possible values: {true, false} 
+  
+@more_info@
+
+  </help>
+</tool>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/read_group_macros.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,294 @@
+<macros>
+    <!-- Import this at the top of your command block and then
+         define rg_auto_name. -->
+    <token name="@define_read_group_helpers@">
+#def identifier_or_name($input1)
+    #if hasattr($input1, 'element_identifier')
+        #return $input1.element_identifier
+    #else
+        #return $input1.name.rstrip('.gz').rstrip('.fastq').rstrip('.fq')
+    #end if
+#end def
+
+#def clean(name)
+    #import re
+    #set $name_clean = re.sub('[^\w\-_\.]', '_', $name)
+    #return $name_clean
+#end def
+
+#def read_group_name_default($input1, $input2=None)
+    #if $input2 is None
+        #return $clean($identifier_or_name($input1))
+    #else
+        #import itertools
+        #set $input_name1 = $clean($identifier_or_name($input1))
+        #set $input_name2 = $clean($identifier_or_name($input2))
+        #set $common_prefix = ''.join([c[0] for c in itertools.takewhile(lambda x: all(x[0] == y for y in x), itertools.izip(*[$input_name1, $input_name2]))])
+        #if len($common_prefix) > 3
+            #return $common_prefix
+        #else
+            #return $input_name1
+        #end if
+    #end if
+#end def
+
+#def format_read_group(prefix, value, quote='', arg='')
+    #if $value
+        #return $arg + $quote + $prefix + $value + $quote
+    #else
+        #return ''
+    #end if
+#end def
+
+#def rg_param(name)
+    #if $varExists("rg")
+        #return $rg.get($name, None)
+    #else
+        #return $getVar($name, None)
+    #end if
+#end def
+
+#set $use_rg = True
+    </token>
+    <!-- preconditions use_rg and rg_auto_name have been
+         defined.
+    -->
+    <token name="@set_read_group_vars@">
+#if $use_rg
+    #if $rg_param('read_group_id_conditional') is None
+        #set $rg_id = $rg_auto_name
+    #elif $rg_param('read_group_id_conditional').do_auto_name
+        #set $rg_id = $rg_auto_name
+    #else
+        #set $rg_id = str($rg_param('read_group_id_conditional').ID)
+    #end if
+
+    #if $rg_param('read_group_sm_conditional') is None
+        #set $rg_sm = ''
+    #elif $rg_param('read_group_sm_conditional').do_auto_name
+        #set $rg_sm = $rg_auto_name
+    #else
+        #set $rg_sm = str($rg_param('read_group_sm_conditional').SM)
+    #end if
+
+    #if $rg_param('PL')
+        #set $rg_pl = str($rg_param('PL'))
+    #else
+        #set $rg_pl = ''
+    #end if
+
+    #if $rg_param('read_group_lb_conditional') is None
+        #set $rg_lb = ''
+    #elif $rg_param('read_group_lb_conditional').do_auto_name
+        #set $rg_lb = $rg_auto_name
+    #else
+        #set $rg_lb = str($rg_param('read_group_lb_conditional').LB)
+    #end if
+
+    #if $rg_param('CN')
+        #set $rg_cn = str($rg_param('CN'))
+    #else
+        #set $rg_cn = ''
+    #end if
+
+    #if $rg_param("DS")
+        #set $rg_ds = str($rg_param("DS"))
+    #else
+        #set $rg_ds = ''
+    #end if
+
+    #if $rg_param("DT")
+        #set $rg_dt = str($rg_param("DT"))
+    #else
+        #set $rg_dt = ''
+    #end if
+
+    #if $rg_param("FO")
+        #set $rg_fo = str($rg_param("FO"))
+    #else
+        #set $rg_fo = ''
+    #end if
+
+    #if $rg_param("KS")
+        #set $rg_ks = str($rg_param("KS"))
+    #else
+        #set $rg_ks = ''
+    #end if
+
+    #if $rg_param("PG")
+        #set $rg_pg = str($rg_param("PG"))
+    #else
+        #set $rg_pg = ''
+    #end if
+
+    #if str($rg_param("PI"))
+        #set $rg_pi = str($rg_param("PI"))
+    #else
+        #set $rg_pi = ''
+    #end if
+
+    #if $rg_param("PU")
+        #set $rg_pu = str($rg_param("PU"))
+    #else
+        #set $rg_pu = ''
+    #end if
+#end if
+    </token>
+    <token name="@set_use_rg_var@">
+#set $use_rg = str($rg.rg_selector) != "do_not_set"
+    </token>
+    <xml name="read_group_auto_name_conditional">
+        <param name="do_auto_name" type="boolean" label="Auto-assign" help="Use dataset name or collection information to automatically assign this value" checked="no" />
+        <when value="true">
+        </when>
+        <when value="false">
+            <yield />
+        </when>
+    </xml>
+    <xml name="read_group_id_param">
+        <param name="ID" type="text" value="" size="20" label="Read group identifier (ID)" help="This value must be unique among multiple samples in your experiment" optional="false">
+            <validator type="empty_field" />
+        </param>
+    </xml>
+    <xml name="read_group_id_conditional">
+        <conditional name="read_group_id_conditional">
+            <expand macro="read_group_auto_name_conditional">
+                <expand macro="read_group_id_param" />
+            </expand>
+        </conditional>
+    </xml>
+    <xml name="read_group_sm_param">
+        <param name="SM" type="text" value="" size="20" label="Read group sample name (SM)" help="This value should be descriptive. Use pool name where a pool is being sequenced" />
+    </xml>
+    <xml name="read_group_sm_conditional">
+        <conditional name="read_group_sm_conditional">
+            <expand macro="read_group_auto_name_conditional">
+                <expand macro="read_group_sm_param" />
+            </expand>
+        </conditional>
+    </xml>
+    <!-- Above SM param is optional (for SAM/BAM spec, this is required
+         as per Picard.
+    -->
+    <xml name="read_group_sm_param_required">
+        <param name="SM" type="text" value="" size="20" label="Read group sample name (SM)" optional="false" help="This value should be descriptive. Use pool name where a pool is being sequenced">
+            <validator type="empty_field" />
+        </param>
+    </xml>
+    <xml name="read_group_sm_required_conditional">
+        <conditional name="read_group_sm_conditional">
+            <expand macro="read_group_auto_name_conditional">
+                <expand macro="read_group_sm_param" />
+            </expand>
+        </conditional>
+    </xml>
+    <xml name="read_group_pl_param">
+        <param name="PL" type="select" label="Platform/technology used to produce the reads (PL)">
+            <option value="CAPILLARY">CAPILLARY</option>
+            <option value="LS454">LS454</option>
+            <option selected="True" value="ILLUMINA">ILLUMINA</option>
+            <option value="SOLID">SOLID</option>
+            <option value="HELICOS">HELICOS</option>
+            <option value="IONTORRENT">IONTORRENT</option>
+            <option value="PACBIO">PACBIO</option>
+        </param>
+    </xml>
+    <xml name="read_group_lb_param">
+        <param name="LB" type="text" size="25" label="Library name (LB)" optional="true" />
+    </xml>
+    <xml name="read_group_lb_conditional">
+        <conditional name="read_group_lb_conditional">
+            <expand macro="read_group_auto_name_conditional">
+                <expand macro="read_group_lb_param" />
+            </expand>
+        </conditional>
+    </xml>
+    <xml name="read_group_lb_required_param">
+        <param name="LB" type="text" size="25" label="Library name (LB)" optional="false">
+            <validator type="empty_field" />
+        </param>
+    </xml>
+    <xml name="read_group_lb_required_conditional">
+        <conditional name="read_group_lb_conditional">
+            <expand macro="read_group_auto_name_conditional">
+                <expand macro="read_group_lb_required_param" />
+            </expand>
+        </conditional>
+    </xml>
+    <xml name="read_group_cn_param">
+        <param name="CN" type="text" size="25" label="Sequencing center that produced the read (CN)" />
+    </xml>
+    <xml name="read_group_ds_param">
+        <param name="DS" type="text" size="25" label="Description (DS)" />
+    </xml>
+    <xml name="read_group_dt_param">
+        <param name="DT" type="text" size="25" label="Date that run was produced (DT)" help="ISO8601 format date or date/time, like YYYY-MM-DD" />
+    </xml>
+    <xml name="read_group_fo_param">
+        <param name="FO" type="text" size="25" optional="true" label="Flow order (FO)" help="The array of nucleotide bases that correspond to the nucleotides used for each flow of each read. Multi-base flows are encoded in IUPAC format, and non-nucleotide flows by various other characters. Format: /\*|[ACMGRSVTWYHKDBN]+/">
+          <validator type="regex" message="Invalid flow order">\*|[ACMGRSVTWYHKDBN]+$</validator>
+        </param>
+    </xml>
+    <xml name="read_group_ks_param">
+        <param name="KS" type="text" size="25" label="The array of nucleotide bases that correspond to the key sequence of each read (KS)" />
+    </xml>
+    <xml name="read_group_pg_param">
+        <param name="PG" type="text" size="25" label="Programs used for processing the read group (PG)" />
+    </xml>
+    <xml name="read_group_pi_param">
+        <param name="PI" type="integer" optional="true" label="Predicted median insert size (PI)" />
+    </xml>
+    <xml name="read_group_pu_param">
+        <param name="PU" type="text" size="25" label="Platform unit (PU)" help="Unique identifier (e.g. flowcell-barcode.lane for Illumina or slide for SOLiD)" optional="True" />
+    </xml>
+    <xml name="read_group_pu_required_param">
+        <param name="PU" type="text" size="25" label="Platform unit (PU)" help="Unique identifier (e.g. flowcell-barcode.lane for Illumina or slide for SOLiD)" optional="False" />
+    </xml>
+    <!-- Only ID is required - all groups available -->
+    <xml name="read_group_inputs_spec">
+        <expand macro="read_group_id_conditional" />
+        <expand macro="read_group_sm_conditional" />
+        <expand macro="read_group_pl_param" />
+        <expand macro="read_group_lb_conditional" />
+        <expand macro="read_group_cn_param" />
+        <expand macro="read_group_ds_param" />
+        <expand macro="read_group_dt_param" />
+        <expand macro="read_group_fo_param" />
+        <expand macro="read_group_ks_param" />
+        <expand macro="read_group_pg_param" />
+        <expand macro="read_group_pi_param" />
+        <expand macro="read_group_pu_param" />
+    </xml>
+    <!-- ID, SM, LB, PU, PL all required - not ks, pg, or fo params. -->
+    <xml name="read_group_inputs_picard">
+        <expand macro="read_group_id_conditional" />
+        <expand macro="read_group_sm_required_conditional" />
+        <expand macro="read_group_lb_required_conditional" />
+        <expand macro="read_group_pl_param" />
+        <expand macro="read_group_pu_required_param" />
+        <expand macro="read_group_cn_param" />
+        <expand macro="read_group_ds_param" />
+        <expand macro="read_group_pi_param" />
+        <expand macro="read_group_dt_param" />
+    </xml>
+    <xml name="read_group_conditional">
+        <conditional name="rg">
+            <param name="rg_selector" type="select" label="Set read groups information?" help="Specifying read group information can greatly simplify your downstream analyses by allowing combining multiple datasets.">
+                <option value="set">Set read groups (SAM/BAM specification)</option>
+                <option value="set_picard">Set read groups (Picard style)</option>
+                <option value="set_id_auto">Automatically assign ID</option>
+                <option value="do_not_set" selected="True">Do not set</option>
+            </param>
+            <when value="set_picard">
+                <expand macro="read_group_inputs_picard" />
+            </when>
+            <when value="set">
+                <expand macro="read_group_inputs_spec" />
+            </when>
+            <when value="set_id_auto">
+            </when>
+            <when value="do_not_set">
+            </when>
+        </conditional>
+    </xml>
+</macros>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/picard/tool_data_table_conf.xml.sample	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,8 @@
+<!-- Use the file tool_data_table_conf.xml.oldlocstyle if you don't want to update your loc files as changed in revision 4550:535d276c92bc-->
+<tables>
+    <!-- Location of Picard dict file and other files -->
+    <table name="picard_indexes" comment_char="#">
+        <columns>value, dbkey, name, path</columns>
+        <file path="tool-data/picard_index.loc" />
+    </table>
+</tables>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_mpileup/973fea5b4bdf/samtools_mpileup/samtools_mpileup.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,213 @@
+<tool id="samtools_mpileup" name="MPileup" version="0.0.3">
+  <description>SNP and indel caller</description>
+  <requirements>
+      <requirement type="package" version="0.1.19">samtools</requirement>
+  </requirements>
+  <command interpreter="python">samtools_wrapper.py
+    -p 'samtools mpileup'
+    --stdout "${output_log}"
+    #if $reference_source.reference_source_selector != "history":
+        -p '-f "${reference_source.ref_file.fields.path}"'
+    #else:
+        -d "-f" "${reference_source.ref_file}" "fa" "reference_input"
+    #end if
+    #for $i, $input_bam in enumerate( $reference_source.input_bams ):
+        -d " " "${input_bam.input_bam}" "${input_bam.input_bam.ext}" "bam_input_${i}"
+        -d "" "${input_bam.input_bam.metadata.bam_index}" "bam_index" "bam_input_${i}" ##hardcode galaxy ext type as bam_index
+    #end for
+    -p '
+    #if str( $advanced_options.advanced_options_selector ) == "advanced":
+        ${advanced_options.skip_anomalous_read_pairs}
+        ${advanced_options.disable_probabilistic_realignment}
+        -C "${advanced_options.coefficient_for_downgrading}"
+        -d "${advanced_options.max_reads_per_bam}"
+        ${advanced_options.extended_BAQ_computation}
+        #if str( $advanced_options.position_list ) != 'None':
+          -l "${advanced_options.position_list}"
+        #end if
+        -q "${advanced_options.minimum_mapping_quality}"
+        -Q "${advanced_options.minimum_base_quality}"
+        #if str( $advanced_options.region_string ):
+            -r "${advanced_options.region_string}"
+        #end if
+        ${advanced_options.output_per_sample_read_depth}
+        ${advanced_options.output_per_sample_strand_bias_p_value}
+    #end if
+    #if str( $genotype_likelihood_computation_type.genotype_likelihood_computation_type_selector ) == 'perform_genotype_likelihood_computation':
+        ##-g or -u
+        -g
+        -e "${genotype_likelihood_computation_type.gap_extension_sequencing_error_probability}"
+        -h "${genotype_likelihood_computation_type.coefficient_for_modeling_homopolymer_errors}"
+        #if str( $genotype_likelihood_computation_type.perform_indel_calling.perform_indel_calling_selector ) == 'perform_indel_calling':
+            -L "${genotype_likelihood_computation_type.perform_indel_calling.skip_indel_calling_above_sample_depth}"
+        #else:
+            -I
+        #end if
+        -o "${genotype_likelihood_computation_type.gap_open_sequencing_error_probability}"
+        #if len( $genotype_likelihood_computation_type.platform_list_repeat ):
+            -P "${ ",".join( [ str( platform.platform_entry ) for platform in $genotype_likelihood_computation_type.platform_list_repeat ] ) }"
+        #end if
+    #end if
+    &gt; "${output_mpileup}"
+    '
+  </command>
+  <inputs>
+    <conditional name="reference_source">
+      <param name="reference_source_selector" type="select" label="Choose the source for the reference list">
+        <option value="cached">Locally cached</option>
+        <option value="history">History</option>
+      </param>
+      <when value="cached">
+        <repeat name="input_bams" title="BAM file" min="1">
+          <param name="input_bam" type="data" format="bam" label="BAM file">
+            <validator type="unspecified_build" />
+            <validator type="dataset_metadata_in_data_table" table_name="fasta_indexes" metadata_name="dbkey" metadata_column="1" message="Sequences are not currently available for the specified build." /> <!-- fixme!!! this needs to be a select -->
+          </param>
+        </repeat>
+        <param name="ref_file" type="select" label="Using reference genome">
+          <options from_data_table="fasta_indexes">
+            <!-- <filter type="data_meta" ref="input_bam" key="dbkey" column="1" /> does not yet work in a repeat...-->
+          </options>
+        </param>
+      </when>
+      <when value="history"> <!-- FIX ME!!!! -->
+        <repeat name="input_bams" title="BAM file" min="1">
+          <param name="input_bam" type="data" format="bam" label="BAM file">
+            <validator type="metadata" check="bam_index" message="Metadata missing, click the pencil icon in the history item and use the auto-detect feature to correct this issue." />
+          </param>
+        </repeat>
+        <param name="ref_file" type="data" format="fasta" label="Using reference file" />
+      </when>
+    </conditional>
+
+    
+    <conditional name="genotype_likelihood_computation_type">
+      <param name="genotype_likelihood_computation_type_selector" type="select" label="Genotype Likelihood Computation">
+        <option value="perform_genotype_likelihood_computation">Perform genotype likelihood computation</option>
+        <option value="do_not_perform_genotype_likelihood_computation" selected="True">Do not perform genotype likelihood computation</option>
+      </param>
+      <when value="perform_genotype_likelihood_computation">
+          <param name="gap_extension_sequencing_error_probability" type="integer" value="20" label="Phred-scaled gap extension sequencing error probability" />
+          <param name="coefficient_for_modeling_homopolymer_errors" type="integer" value="100" label="Coefficient for modeling homopolymer errors." />
+          <conditional name="perform_indel_calling">
+            <param name="perform_indel_calling_selector" type="select" label="Perform INDEL calling">
+              <option value="perform_indel_calling" selected="True">Perform INDEL calling</option>
+              <option value="do_not_perform_indel_calling">Do not perform INDEL calling</option>
+            </param>
+            <when value="perform_indel_calling">
+              <param name="skip_indel_calling_above_sample_depth" type="integer" value="250" label="Skip INDEL calling if the average per-sample depth is above" />
+            </when>
+            <when value="do_not_perform_indel_calling" />
+          </conditional>
+          <param name="gap_open_sequencing_error_probability" type="integer" value="40" label="Phred-scaled gap open sequencing error probability" />
+          <repeat name="platform_list_repeat" title="Platform for INDEL candidates">
+            <param name="platform_entry" type="text" value="" label="Platform to use for INDEL candidates" />
+          </repeat>
+      </when>
+      <when value="do_not_perform_genotype_likelihood_computation">
+          <!-- Do nothing here -->
+      </when>
+    </conditional>
+    <conditional name="advanced_options">
+      <param name="advanced_options_selector" type="select" label="Set advanced options">
+        <option value="basic" selected="True">Basic</option>
+        <option value="advanced">Advanced</option>
+      </param>
+      <when value="advanced">
+        <param name="skip_anomalous_read_pairs" type="boolean" truevalue="-A" falsevalue="" checked="False" label="Do not skip anomalous read pairs in variant calling" />
+        <param name="disable_probabilistic_realignment" type="boolean" truevalue="-B" falsevalue="" checked="False" label="	Disable probabilistic realignment for the computation of base alignment quality (BAQ)" />
+        <param name="coefficient_for_downgrading" type="integer" value="0" label="Coefficient for downgrading mapping quality for reads containing excessive mismatches" />
+        <param name="max_reads_per_bam" type="integer" value="250" label="Max reads per BAM" />
+        <param name="extended_BAQ_computation" type="boolean" truevalue="-E" falsevalue="" checked="False" label="Extended BAQ computation" />
+        <param name="position_list" type="data" format="bed" label="List of regions or sites on which to operate" optional="True" />
+        <param name="minimum_mapping_quality" type="integer" value="0" label="Minimum mapping quality for an alignment to be used" />
+        <param name="minimum_base_quality" type="integer" value="13" label="Minimum base quality for a base to be considered" />
+        <param name="region_string" type="text" value="" label="Only generate pileup in region" />
+        <param name="output_per_sample_read_depth" type="boolean" truevalue="-D" falsevalue="" checked="False" label="Output per-sample read depth" />
+        <param name="output_per_sample_strand_bias_p_value" type="boolean" truevalue="-S" falsevalue="" checked="False" label="Output per-sample Phred-scaled strand bias P-value" />
+      </when>
+      <when value="basic" />
+    </conditional>
+  </inputs>
+  <outputs>
+    <data format="pileup" name="output_mpileup" label="${tool.name} on ${on_string}">
+      <change_format>
+        <when input="genotype_likelihood_computation_type.genotype_likelihood_computation_type_selector" value="perform_genotype_likelihood_computation" format="bcf" />
+      </change_format>
+    </data>
+    <data format="txt" name="output_log" label="${tool.name} on ${on_string} (log)" />
+  </outputs>
+  <tests>
+      <test>
+          <param name="reference_source_selector" value="history" />
+          <param name="ref_file" value="phiX.fasta" ftype="fasta" />
+          <param name="input_bam" value="gatk/gatk_table_recalibration/gatk_table_recalibration_out_1.bam" ftype="bam" />
+          <param name="genotype_likelihood_computation_type_selector" value="do_not_perform_genotype_likelihood_computation" />
+          <param name="advanced_options_selector" value="basic" />
+          <output name="output_mpileup" file="samtools/mpileup/samtools_mpileup_out_1.pileup" /> 
+          <output name="output_log" file="samtools/mpileup/samtools_mpileup_out_1.log" />
+      </test>
+      <test>
+          <param name="reference_source_selector" value="history" />
+          <param name="ref_file" value="phiX.fasta" ftype="fasta" />
+          <param name="input_bam" value="gatk/gatk_table_recalibration/gatk_table_recalibration_out_1.bam" ftype="bam" />
+          <param name="genotype_likelihood_computation_type_selector" value="perform_genotype_likelihood_computation" />
+          <param name="gap_extension_sequencing_error_probability" value="20" />
+          <param name="coefficient_for_modeling_homopolymer_errors" value="100" />
+          <param name="perform_indel_calling_selector" value="perform_indel_calling" />
+          <param name="skip_indel_calling_above_sample_depth" value="250" />
+          <param name="gap_open_sequencing_error_probability" value="40" />
+          <param name="platform_list_repeat" value="0" />
+          <param name="advanced_options_selector" value="basic" />
+          <output name="output_mpileup" file="samtools/mpileup/samtools_mpileup_out_2.bcf" /> 
+          <output name="output_log" file="samtools/mpileup/samtools_mpileup_out_1.log" />
+      </test>
+  </tests>
+  <help>
+**What it does**
+
+ Generate BCF or pileup for one or multiple BAM files. Alignment records are grouped by sample identifiers in @RG header lines. If sample identifiers are absent, each input file is regarded as one sample. 
+
+------
+
+**Settings**::
+
+ Input Options:
+ -6 	Assume the quality is in the Illumina 1.3+ encoding.
+ -A Do not skip anomalous read pairs in variant calling.
+ -B 	Disable probabilistic realignment for the computation of base alignment quality (BAQ). BAQ is the Phred-scaled probability of a read base being misaligned. Applying this option greatly helps to reduce false SNPs caused by misalignments.
+ -b FILE 	List of input BAM files, one file per line [null]
+ -C INT 	Coefficient for downgrading mapping quality for reads containing excessive mismatches. Given a read with a phred-scaled probability q of being generated from the mapped position, the new mapping quality is about sqrt((INT-q)/INT)*INT. A zero value disables this functionality; if enabled, the recommended value for BWA is 50. [0]
+ -d INT 	At a position, read maximally INT reads per input BAM. [250]
+ -E 	Extended BAQ computation. This option helps sensitivity especially for MNPs, but may hurt specificity a little bit.
+ -f FILE 	The faidx-indexed reference file in the FASTA format. The file can be optionally compressed by razip. [null]
+ -l FILE 	BED or position list file containing a list of regions or sites where pileup or BCF should be generated [null]
+ -q INT 	Minimum mapping quality for an alignment to be used [0]
+ -Q INT 	Minimum base quality for a base to be considered [13]
+ -r STR 	Only generate pileup in region STR [all sites]
+ Output Options:
+ 	
+ -D 	Output per-sample read depth
+ -g 	Compute genotype likelihoods and output them in the binary call format (BCF).
+ -S 	Output per-sample Phred-scaled strand bias P-value
+ -u 	Similar to -g except that the output is uncompressed BCF, which is preferred for piping.
+ 
+ Options for Genotype Likelihood Computation (for -g or -u):
+  	
+ -e INT 	Phred-scaled gap extension sequencing error probability. Reducing INT leads to longer indels. [20]
+ -h INT 	Coefficient for modeling homopolymer errors. Given an l-long homopolymer run, the sequencing error of an indel of size s is modeled as INT*s/l. [100]
+ -I 	Do not perform INDEL calling
+ -L INT 	Skip INDEL calling if the average per-sample depth is above INT. [250]
+ -o INT 	Phred-scaled gap open sequencing error probability. Reducing INT leads to more indel calls. [40]
+ -P STR 	Comma dilimited list of platforms (determined by @RG-PL) from which indel candidates are obtained. It is recommended to collect indel candidates from sequencing technologies that have low indel error rate such as ILLUMINA. [all]
+
+------
+
+**Citation**
+
+For the underlying tool, please cite `Li H, Handsaker B, Wysoker A, Fennell T, Ruan J, Homer N, Marth G, Abecasis G, Durbin R; 1000 Genome Project Data Processing Subgroup. The Sequence Alignment/Map format and SAMtools. Bioinformatics. 2009 Aug 15;25(16):2078-9. &lt;http://www.ncbi.nlm.nih.gov/pubmed/19505943&gt;`_
+
+If you use this tool in Galaxy, please cite Blankenberg D, et al. *In preparation.*
+
+  </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_mpileup/973fea5b4bdf/samtools_mpileup/samtools_wrapper.py	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,110 @@
+#!/usr/bin/env python
+#Dan Blankenberg
+
+"""
+A wrapper script for running SAMTools commands.
+"""
+
+import sys, optparse, os, tempfile, subprocess, shutil
+from string import Template
+
+GALAXY_EXT_TO_SAMTOOLS_EXT = { 'bam_index':'bam.bai', } #items not listed here will use the galaxy extension as-is
+GALAXY_EXT_TO_SAMTOOLS_FILE_TYPE = GALAXY_EXT_TO_SAMTOOLS_EXT #for now, these are the same, but could be different if needed
+DEFAULT_SAMTOOLS_PREFIX = "SAMTools_file"
+CHUNK_SIZE = 2**20 #1mb
+
+
+def cleanup_before_exit( tmp_dir ):
+    if tmp_dir and os.path.exists( tmp_dir ):
+        shutil.rmtree( tmp_dir )
+
+def SAMTOOLS_filename_from_galaxy( galaxy_filename, galaxy_ext, target_dir = None, prefix = None ):
+    suffix = GALAXY_EXT_TO_SAMTOOLS_EXT.get( galaxy_ext, galaxy_ext )
+    if prefix is None:
+        prefix = DEFAULT_SAMTOOLS_PREFIX
+    if target_dir is None:
+        target_dir = os.getcwd()
+    SAMTools_filename = os.path.join( target_dir, "%s.%s" % ( prefix, suffix ) )
+    os.symlink( galaxy_filename, SAMTools_filename )
+    return SAMTools_filename
+
+def SAMTOOLS_filetype_argument_substitution( argument, galaxy_ext ):
+    return argument % dict( file_type = GALAXY_EXT_TO_SAMTOOLS_FILE_TYPE.get( galaxy_ext, galaxy_ext ) )
+
+def open_file_from_option( filename, mode = 'rb' ):
+    if filename:
+        return open( filename, mode = mode )
+    return None
+
+def html_report_from_directory( html_out, dir ):
+    html_out.write( '<html>\n<head>\n<title>Galaxy - SAMTOOLS Output</title>\n</head>\n<body>\n<p/>\n<ul>\n' )
+    for fname in sorted( os.listdir( dir ) ):
+        html_out.write(  '<li><a href="%s">%s</a></li>\n' % ( fname, fname ) )
+    html_out.write( '</ul>\n</body>\n</html>\n' )
+
+def __main__():
+    #Parse Command Line
+    parser = optparse.OptionParser()
+    parser.add_option( '-p', '--pass_through', dest='pass_through_options', action='append', type="string", help='These options are passed through directly to SAMTOOLS, without any modification.' )
+    parser.add_option( '-d', '--dataset', dest='datasets', action='append', type="string", nargs=4, help='"-argument" "original_filename" "galaxy_filetype" "name_prefix"' )
+    parser.add_option( '', '--stdout', dest='stdout', action='store', type="string", default=None, help='If specified, the output of stdout will be written to this file.' )
+    parser.add_option( '', '--stderr', dest='stderr', action='store', type="string", default=None, help='If specified, the output of stderr will be written to this file.' )
+    parser.add_option( '', '--html_report_from_directory', dest='html_report_from_directory', action='append', type="string", nargs=2, help='"Target HTML File" "Directory"')
+    (options, args) = parser.parse_args()
+    
+    tmp_dir = tempfile.mkdtemp( prefix='tmp-SAMTOOLS-' )
+    
+    #set up stdout and stderr output options
+    stdout = open_file_from_option( options.stdout, mode = 'wb' )
+    stderr = open_file_from_option( options.stderr, mode = 'wb' )
+    #if no stderr file is specified, we'll use our own
+    if stderr is None:
+        stderr = tempfile.NamedTemporaryFile( prefix="SAMTOOLS-stderr-", dir=tmp_dir )
+    
+    if options.pass_through_options:
+        cmd = ' '.join( options.pass_through_options )
+    else:
+        cmd = ''
+    return_code = None
+    if options.datasets:
+        for ( dataset_arg, filename, galaxy_ext, prefix ) in options.datasets:
+            SAMTools_filename = SAMTOOLS_filename_from_galaxy( filename, galaxy_ext, target_dir = tmp_dir, prefix = prefix )
+            if dataset_arg:
+                if '>' in cmd:
+                    cmd = cmd.replace( '>', '  %s "%s" >' % ( SAMTOOLS_filetype_argument_substitution( dataset_arg, galaxy_ext ), SAMTools_filename ), 1 )
+                else:
+                    cmd = '%s %s "%s"' % ( cmd, SAMTOOLS_filetype_argument_substitution( dataset_arg, galaxy_ext ), SAMTools_filename )
+            #auto index fasta files:
+            if galaxy_ext == 'fa':
+                index_cmd = 'samtools faidx %s' % ( SAMTools_filename )
+                proc = subprocess.Popen( args=index_cmd, stdout=stdout, stderr=stderr, shell=True, cwd=tmp_dir )
+                return_code = proc.wait()
+                if return_code:
+                    break
+    if return_code is None or not return_code:
+        proc = subprocess.Popen( args=cmd, stdout=stdout, stderr=stderr, shell=True, cwd=tmp_dir )
+        return_code = proc.wait()
+    if return_code:
+        stderr_target = sys.stderr
+    else:
+        if stdout:
+            stderr_target = stdout
+        else:
+            stderr_target = sys.stdout
+    stderr.flush()
+    stderr.seek(0)
+    while True:
+        chunk = stderr.read( CHUNK_SIZE )
+        if chunk:
+            stderr_target.write( chunk )
+        else:
+            break
+    stderr.close()
+    #generate html reports
+    if options.html_report_from_directory:
+        for ( html_filename, html_dir ) in options.html_report_from_directory:
+            html_report_from_directory( open( html_filename, 'wb' ), html_dir )
+    
+    cleanup_before_exit( tmp_dir )
+
+if __name__=="__main__": __main__()
Binary file gv/samtools_mpileup/973fea5b4bdf/samtools_mpileup/test-data/gatk/gatk_table_recalibration/gatk_table_recalibration_out_1.bam has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_mpileup/973fea5b4bdf/samtools_mpileup/test-data/phiX.fasta	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,79 @@
+>phiX174
+GAGTTTTATCGCTTCCATGACGCAGAAGTTAACACTTTCGGATATTTCTGATGAGTCGAAAAATTATCTT
+GATAAAGCAGGAATTACTACTGCTTGTTTACGAATTAAATCGAAGTGGACTGCTGGCGGAAAATGAGAAA
+ATTCGACCTATCCTTGCGCAGCTCGAGAAGCTCTTACTTTGCGACCTTTCGCCATCAACTAACGATTCTG
+TCAAAAACTGACGCGTTGGATGAGGAGAAGTGGCTTAATATGCTTGGCACGTTCGTCAAGGACTGGTTTA
+GATATGAGTCACATTTTGTTCATGGTAGAGATTCTCTTGTTGACATTTTAAAAGAGCGTGGATTACTATC
+TGAGTCCGATGCTGTTCAACCACTAATAGGTAAGAAATCATGAGTCAAGTTACTGAACAATCCGTACGTT
+TCCAGACCGCTTTGGCCTCTATTAAGCTCATTCAGGCTTCTGCCGTTTTGGATTTAACCGAAGATGATTT
+CGATTTTCTGACGAGTAACAAAGTTTGGATTGCTACTGACCGCTCTCGTGCTCGTCGCTGCGTTGAGGCT
+TGCGTTTATGGTACGCTGGACTTTGTGGGATACCCTCGCTTTCCTGCTCCTGTTGAGTTTATTGCTGCCG
+TCATTGCTTATTATGTTCATCCCGTCAACATTCAAACGGCCTGTCTCATCATGGAAGGCGCTGAATTTAC
+GGAAAACATTATTAATGGCGTCGAGCGTCCGGTTAAAGCCGCTGAATTGTTCGCGTTTACCTTGCGTGTA
+CGCGCAGGAAACACTGACGTTCTTACTGACGCAGAAGAAAACGTGCGTCAAAAATTACGTGCAGAAGGAG
+TGATGTAATGTCTAAAGGTAAAAAACGTTCTGGCGCTCGCCCTGGTCGTCCGCAGCCGTTGCGAGGTACT
+AAAGGCAAGCGTAAAGGCGCTCGTCTTTGGTATGTAGGTGGTCAACAATTTTAATTGCAGGGGCTTCGGC
+CCCTTACTTGAGGATAAATTATGTCTAATATTCAAACTGGCGCCGAGCGTATGCCGCATGACCTTTCCCA
+TCTTGGCTTCCTTGCTGGTCAGATTGGTCGTCTTATTACCATTTCAACTACTCCGGTTATCGCTGGCGAC
+TCCTTCGAGATGGACGCCGTTGGCGCTCTCCGTCTTTCTCCATTGCGTCGTGGCCTTGCTATTGACTCTA
+CTGTAGACATTTTTACTTTTTATGTCCCTCATCGTCACGTTTATGGTGAACAGTGGATTAAGTTCATGAA
+GGATGGTGTTAATGCCACTCCTCTCCCGACTGTTAACACTACTGGTTATATTGACCATGCCGCTTTTCTT
+GGCACGATTAACCCTGATACCAATAAAATCCCTAAGCATTTGTTTCAGGGTTATTTGAATATCTATAACA
+ACTATTTTAAAGCGCCGTGGATGCCTGACCGTACCGAGGCTAACCCTAATGAGCTTAATCAAGATGATGC
+TCGTTATGGTTTCCGTTGCTGCCATCTCAAAAACATTTGGACTGCTCCGCTTCCTCCTGAGACTGAGCTT
+TCTCGCCAAATGACGACTTCTACCACATCTATTGACATTATGGGTCTGCAAGCTGCTTATGCTAATTTGC
+ATACTGACCAAGAACGTGATTACTTCATGCAGCGTTACCGTGATGTTATTTCTTCATTTGGAGGTAAAAC
+CTCTTATGACGCTGACAACCGTCCTTTACTTGTCATGCGCTCTAATCTCTGGGCATCTGGCTATGATGTT
+GATGGAACTGACCAAACGTCGTTAGGCCAGTTTTCTGGTCGTGTTCAACAGACCTATAAACATTCTGTGC
+CGCGTTTCTTTGTTCCTGAGCATGGCACTATGTTTACTCTTGCGCTTGTTCGTTTTCCGCCTACTGCGAC
+TAAAGAGATTCAGTACCTTAACGCTAAAGGTGCTTTGACTTATACCGATATTGCTGGCGACCCTGTTTTG
+TATGGCAACTTGCCGCCGCGTGAAATTTCTATGAAGGATGTTTTCCGTTCTGGTGATTCGTCTAAGAAGT
+TTAAGATTGCTGAGGGTCAGTGGTATCGTTATGCGCCTTCGTATGTTTCTCCTGCTTATCACCTTCTTGA
+AGGCTTCCCATTCATTCAGGAACCGCCTTCTGGTGATTTGCAAGAACGCGTACTTATTCGCCACCATGAT
+TATGACCAGTGTTTCCAGTCCGTTCAGTTGTTGCAGTGGAATAGTCAGGTTAAATTTAATGTGACCGTTT
+ATCGCAATCTGCCGACCACTCGCGATTCAATCATGACTTCGTGATAAAAGATTGAGTGTGAGGTTATAAC
+GCCGAAGCGGTAAAAATTTTAATTTTTGCCGCTGAGGGGTTGACCAAGCGAAGCGCGGTAGGTTTTCTGC
+TTAGGAGTTTAATCATGTTTCAGACTTTTATTTCTCGCCATAATTCAAACTTTTTTTCTGATAAGCTGGT
+TCTCACTTCTGTTACTCCAGCTTCTTCGGCACCTGTTTTACAGACACCTAAAGCTACATCGTCAACGTTA
+TATTTTGATAGTTTGACGGTTAATGCTGGTAATGGTGGTTTTCTTCATTGCATTCAGATGGATACATCTG
+TCAACGCCGCTAATCAGGTTGTTTCTGTTGGTGCTGATATTGCTTTTGATGCCGACCCTAAATTTTTTGC
+CTGTTTGGTTCGCTTTGAGTCTTCTTCGGTTCCGACTACCCTCCCGACTGCCTATGATGTTTATCCTTTG
+AATGGTCGCCATGATGGTGGTTATTATACCGTCAAGGACTGTGTGACTATTGACGTCCTTCCCCGTACGC
+CGGGCAATAATGTTTATGTTGGTTTCATGGTTTGGTCTAACTTTACCGCTACTAAATGCCGCGGATTGGT
+TTCGCTGAATCAGGTTATTAAAGAGATTATTTGTCTCCAGCCACTTAAGTGAGGTGATTTATGTTTGGTG
+CTATTGCTGGCGGTATTGCTTCTGCTCTTGCTGGTGGCGCCATGTCTAAATTGTTTGGAGGCGGTCAAAA
+AGCCGCCTCCGGTGGCATTCAAGGTGATGTGCTTGCTACCGATAACAATACTGTAGGCATGGGTGATGCT
+GGTATTAAATCTGCCATTCAAGGCTCTAATGTTCCTAACCCTGATGAGGCCGCCCCTAGTTTTGTTTCTG
+GTGCTATGGCTAAAGCTGGTAAAGGACTTCTTGAAGGTACGTTGCAGGCTGGCACTTCTGCCGTTTCTGA
+TAAGTTGCTTGATTTGGTTGGACTTGGTGGCAAGTCTGCCGCTGATAAAGGAAAGGATACTCGTGATTAT
+CTTGCTGCTGCATTTCCTGAGCTTAATGCTTGGGAGCGTGCTGGTGCTGATGCTTCCTCTGCTGGTATGG
+TTGACGCCGGATTTGAGAATCAAAAAGAGCTTACTAAAATGCAACTGGACAATCAGAAAGAGATTGCCGA
+GATGCAAAATGAGACTCAAAAAGAGATTGCTGGCATTCAGTCGGCGACTTCACGCCAGAATACGAAAGAC
+CAGGTATATGCACAAAATGAGATGCTTGCTTATCAACAGAAGGAGTCTACTGCTCGCGTTGCGTCTATTA
+TGGAAAACACCAATCTTTCCAAGCAACAGCAGGTTTCCGAGATTATGCGCCAAATGCTTACTCAAGCTCA
+AACGGCTGGTCAGTATTTTACCAATGACCAAATCAAAGAAATGACTCGCAAGGTTAGTGCTGAGGTTGAC
+TTAGTTCATCAGCAAACGCAGAATCAGCGGTATGGCTCTTCTCATATTGGCGCTACTGCAAAGGATATTT
+CTAATGTCGTCACTGATGCTGCTTCTGGTGTGGTTGATATTTTTCATGGTATTGATAAAGCTGTTGCCGA
+TACTTGGAACAATTTCTGGAAAGACGGTAAAGCTGATGGTATTGGCTCTAATTTGTCTAGGAAATAACCG
+TCAGGATTGACACCCTCCCAATTGTATGTTTTCATGCCTCCAAATCTTGGAGGCTTTTTTATGGTTCGTT
+CTTATTACCCTTCTGAATGTCACGCTGATTATTTTGACTTTGAGCGTATCGAGGCTCTTAAACCTGCTAT
+TGAGGCTTGTGGCATTTCTACTCTTTCTCAATCCCCAATGCTTGGCTTCCATAAGCAGATGGATAACCGC
+ATCAAGCTCTTGGAAGAGATTCTGTCTTTTCGTATGCAGGGCGTTGAGTTCGATAATGGTGATATGTATG
+TTGACGGCCATAAGGCTGCTTCTGACGTTCGTGATGAGTTTGTATCTGTTACTGAGAAGTTAATGGATGA
+ATTGGCACAATGCTACAATGTGCTCCCCCAACTTGATATTAATAACACTATAGACCACCGCCCCGAAGGG
+GACGAAAAATGGTTTTTAGAGAACGAGAAGACGGTTACGCAGTTTTGCCGCAAGCTGGCTGCTGAACGCC
+CTCTTAAGGATATTCGCGATGAGTATAATTACCCCAAAAAGAAAGGTATTAAGGATGAGTGTTCAAGATT
+GCTGGAGGCCTCCACTATGAAATCGCGTAGAGGCTTTACTATTCAGCGTTTGATGAATGCAATGCGACAG
+GCTCATGCTGATGGTTGGTTTATCGTTTTTGACACTCTCACGTTGGCTGACGACCGATTAGAGGCGTTTT
+ATGATAATCCCAATGCTTTGCGTGACTATTTTCGTGATATTGGTCGTATGGTTCTTGCTGCCGAGGGTCG
+CAAGGCTAATGATTCACACGCCGACTGCTATCAGTATTTTTGTGTGCCTGAGTATGGTACAGCTAATGGC
+CGTCTTCATTTCCATGCGGTGCATTTTATGCGGACACTTCCTACAGGTAGCGTTGACCCTAATTTTGGTC
+GTCGGGTACGCAATCGCCGCCAGTTAAATAGCTTGCAAAATACGTGGCCTTATGGTTACAGTATGCCCAT
+CGCAGTTCGCTACACGCAGGACGCTTTTTCACGTTCTGGTTGGTTGTGGCCTGTTGATGCTAAAGGTGAG
+CCGCTTAAAGCTACCAGTTATATGGCTGTTGGTTTCTATGTGGCTAAATACGTTAACAAAAAGTCAGATA
+TGGACCTTGCTGCTAAAGGTCTAGGAGCTAAAGAATGGAACAACTCACTAAAAACCAAGCTGTCGCTACT
+TCCCAAGAAGCTGTTCAGAATCAGAATGAGCCGCAACTTCGGGATGAAAATGCTCACAATGACAAATCTG
+TCCACGGAGTGCTTAATCCAACTTACCAAGCTGGGTTACGACGCGACGCCGTTCAACCAGATATTGAAGC
+AGAACGCAAAAAGAGAGATGAGATTGAGGCTGGGAAAAGTTACTGTAGCCGACGTTTTGGCGGCGCAACC
+TGTGACGACAAATCTGCTCAAATTTATGCGCGCTTCGATAAAAATGATTGGCGTATCCAACCTGCA
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_mpileup/973fea5b4bdf/samtools_mpileup/test-data/samtools/mpileup/samtools_mpileup_out_1.log	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,2 @@
+[mpileup] 1 samples in 1 input files
+<mpileup> Set max per-file depth to 8000
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_mpileup/973fea5b4bdf/samtools_mpileup/test-data/samtools/mpileup/samtools_mpileup_out_1.pileup	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,43 @@
+phiX174	1411	A	1	^P.	$
+phiX174	1412	G	3	.^D.^F.	"$$
+phiX174	1413	C	5	...^D.^F.	"""$$
+phiX174	1414	G	6	.....^F.	#####$
+phiX174	1415	C	7	......^F.	%%%%%%&
+phiX174	1416	C	8	.......^F.	$$$$$$$$
+phiX174	1417	G	9	........^F.	"#######$
+phiX174	1418	T	10	.........^F.	"""""""""$
+phiX174	1419	G	10	..........	"""""'&'%$
+phiX174	1420	G	10	..........	""""""""""
+phiX174	1421	A	10	..........	""""""""""
+phiX174	1422	T	10	..........	""""""""""
+phiX174	1423	G	10	..........	"""""""""#
+phiX174	1424	C	10	..A.AAAAAA	%"""""""""
+phiX174	1425	C	10	..........	$$$"""""""
+phiX174	1426	T	10	..........	#####"""""
+phiX174	1427	G	10	..........	######""""
+phiX174	1428	A	10	..........	""""""""""
+phiX174	1429	C	10	..........	((((((&(""
+phiX174	1430	C	10	..........	$$$$$$$$$"
+phiX174	1431	G	10	..........	##########
+phiX174	1432	T	10	..........	""""""""""
+phiX174	1433	A	10	..........	##########
+phiX174	1434	C	10	..........	((((((&(%$
+phiX174	1435	C	10	..........	$$$$$$$$$$
+phiX174	1436	G	10	..........	##########
+phiX174	1437	A	10	..........	"""""""""!
+phiX174	1438	G	10	..........	"""""####!
+phiX174	1439	G	10	..........	"""""""""!
+phiX174	1440	C	10	..........	"""""""""!
+phiX174	1441	T	10	..........	""""""""#!
+phiX174	1442	A	10	..........	$$$%%%&&%!
+phiX174	1443	A	10	.-1C.-1C..-1C......	"""""""""!
+phiX174	1444	C	10	**.*......	&%"!"""""!
+phiX174	1445	C	10	..........	&%&!%%%&%!
+phiX174	1446	C	10	..........	"""!"""""!
+phiX174	1447	T	10	.$..$.......	#"#!"""""!
+phiX174	1448	A	8	.$..$.....	#!#%%$$!
+phiX174	1449	A	6	.$.$....	!""""!
+phiX174	1450	T	4	.$...	"""!
+phiX174	1451	G	3	.$..	#"!
+phiX174	1452	A	2	.$.	"!
+phiX174	1453	G	1	.$	!
Binary file gv/samtools_mpileup/973fea5b4bdf/samtools_mpileup/test-data/samtools/mpileup/samtools_mpileup_out_2.bcf has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_mpileup/973fea5b4bdf/samtools_mpileup/tool-data/fasta_indexes.loc.sample	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,29 @@
+#This is a sample file distributed with Galaxy that enables tools
+#to use a directory of Samtools indexed sequences data files.  You will need
+#to create these data files and then create a fasta_indexes.loc file
+#similar to this one (store it in this directory) that points to
+#the directories in which those files are stored. The fasta_indexes.loc
+#file has this format (white space characters are TAB characters):
+#
+# <unique_build_id>	<dbkey>	<display_name>	<file_base_path>
+#
+#So, for example, if you had hg19 Canonical indexed stored in
+#
+# /depot/data2/galaxy/hg19/sam/,
+#
+#then the fasta_indexes.loc entry would look like this:
+#
+#hg19canon	hg19	Human (Homo sapiens): hg19 Canonical	/depot/data2/galaxy/hg19/sam/hg19canon.fa
+#
+#and your /depot/data2/galaxy/hg19/sam/ directory
+#would contain hg19canon.fa and hg19canon.fa.fai files.
+#
+#Your fasta_indexes.loc file should include an entry per line for
+#each index set you have stored.  The file in the path does actually
+#exist, but it should never be directly used. Instead, the name serves
+#as a prefix for the index file.  For example:
+#
+#hg18canon	hg18	Human (Homo sapiens): hg18 Canonical	/depot/data2/galaxy/hg18/sam/hg18canon.fa
+#hg18full	hg18	Human (Homo sapiens): hg18 Full	/depot/data2/galaxy/hg18/sam/hg18full.fa
+#hg19canon	hg19	Human (Homo sapiens): hg19 Canonical	/depot/data2/galaxy/hg19/sam/hg19canon.fa
+#hg19full	hg19	Human (Homo sapiens): hg19 Full	/depot/data2/galaxy/hg19/sam/hg19full.fa
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_mpileup/973fea5b4bdf/samtools_mpileup/tool_data_table_conf.xml.sample	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,7 @@
+<!-- Use the file tool_data_table_conf.xml.oldlocstyle if you don't want to update your loc files as changed in revision 4550:535d276c92bc-->
+<tables>
+    <table name="fasta_indexes" comment_char="#">
+        <columns>value, dbkey, name, path</columns>
+        <file path="tool-data/fasta_indexes.loc" />
+    </table>
+</tables>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_mpileup/973fea5b4bdf/samtools_mpileup/tool_dependencies.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<tool_dependency>
+    <package name="samtools" version="0.1.19">
+        <repository changeset_revision="1ef76f8d8e52" name="package_samtools_0_1_19" owner="devteam" toolshed="http://toolshed.g2.bx.psu.edu" />
+    </package>
+</tool_dependency>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/macros.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,70 @@
+<macros>
+    <xml name="requirements">
+        <requirements>
+            <requirement type="package" version="1.2">samtools</requirement>
+            <yield/>
+        </requirements>
+    </xml>
+    <xml name="citations">
+        <citations>
+            <citation type="bibtex">
+                @misc{SAM_def,
+                title={Definition of SAM/BAM format},
+                url = {https://samtools.github.io/hts-specs/SAMv1.pdf},}
+            </citation>
+            <citation type="doi">10.1093/bioinformatics/btp352</citation>
+            <citation type="doi">10.1093/bioinformatics/btr076</citation>
+            <citation type="doi">10.1093/bioinformatics/btr509</citation>
+            <citation type="bibtex">
+                @misc{Danecek_et_al,
+                Author={Danecek, P., Schiffels, S., Durbin, R.},
+                title={Multiallelic calling model in bcftools (-m)},
+                url = {http://samtools.github.io/bcftools/call-m.pdf},}
+            </citation>
+            <citation type="bibtex">
+                @misc{Durbin_VCQC,
+                Author={Durbin, R.},
+                title={Segregation based metric for variant call QC},
+                url = {http://samtools.github.io/bcftools/rd-SegBias.pdf},}
+            </citation>
+            <citation type="bibtex">
+                @misc{Li_SamMath,
+                Author={Li, H.},
+                title={Mathematical Notes on SAMtools Algorithms},
+                url = {http://www.broadinstitute.org/gatk/media/docs/Samtools.pdf},}
+            </citation>
+            <citation type="bibtex">
+                @misc{SamTools_github,
+                title={SAMTools GitHub page},
+                url = {https://github.com/samtools/samtools},}
+            </citation>
+        </citations>
+    </xml>
+    <xml name="version_command">
+        <version_command>samtools --version | head -n 1 | awk '{ print $2 }'</version_command>
+    </xml>
+    <xml name="stdio">
+        <stdio>
+            <exit_code range="1:" level="fatal" description="Error" />
+        </stdio>
+    </xml>
+    <token name="@no-chrom-options@">
+-----
+
+.. class:: warningmark
+
+**No options available? How to re-detect metadata**
+
+If you see a &quot;No options available&quot; within the &quot;**Select references (chromosomes and contigs) you would like to restrict bam to**&quot; drop down, you need to re-detect metadata for the dataset you are trying to process. To do this follow these steps:
+
+1. Click on the **pencil** icon adjacent to the dataset in the history
+2. A new menu will appear in the center pane of the interface
+3. Click **Datatype** tab
+4. Set **New Type** to **BAM**
+5. Click **Save**
+
+The medatada will be re-detected and you will be able to see the list of reference sequences in the &quot;**Select references (chromosomes and contigs) you would like to restrict bam to**&quot; drop-down.
+
+    </token>
+
+</macros>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/samtools_mpileup.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,372 @@
+<tool id="samtools_mpileup" name="MPileup" version="2.0">
+    <description>call variants</description>
+    <macros>
+        <import>macros.xml</import>
+    </macros>
+    <expand macro="requirements" />
+    <expand macro="stdio" />
+    <expand macro="version_command" />
+    <command>
+    <![CDATA[
+    #if $reference_source.reference_source_selector == "history":
+       ln -s "${reference_source.ref_file}" && samtools faidx `basename "${reference_source.ref_file}"` && samtools mpileup
+    #else:
+        samtools mpileup
+    #end if
+    #if $reference_source.reference_source_selector != "history":
+        -f "${reference_source.ref_file.fields.path}"
+    #else:
+        -f "${reference_source.ref_file}"
+    #end if
+    #for $i, $input_bam in enumerate( $reference_source.input_bams ):
+        "${input_bam.input_bam}"
+    #end for
+    #if str( $advanced_options.advanced_options_selector ) == "advanced":
+        #if str( $advanced_options.filter_by_flags.filter_flags ) == "filter":
+            #if $advanced_options.filter_by_flags.require_flags:
+                --rf ${sum([int(flag) for flag in str($advanced_options.filter_by_flags.require_flags).split(',')])}
+            #end if
+            #if $advanced_options.filter_by_flags.exclude_flags:
+                --ff ${sum([int(flag) for flag in str($advanced_options.filter_by_flags.exclude_flags).split(',')])}
+            #end if
+        #end if
+        #if str( $advanced_options.limit_by_region.limit_by_regions ) == "paste":
+            -l "$pasted_regions"
+        #elif str( $advanced_options.limit_by_region.limit_by_regions ) == "history"
+            -l "$advanced_options.limit_by_region.bed_regions"
+        #end if
+        #if str( $advanced_options.exclude_read_group.exclude_read_groups ) == "paste":
+            -G "$excluded_read_groups"
+        #elif str( $advanced_options.exclude_read_group.exclude_read_groups ) == "history"
+            -G "$advanced_options.exclude_read_group.read_groups"
+        #end if
+        ${advanced_options.skip_anomalous_read_pairs}
+        ${advanced_options.disable_probabilistic_realignment}
+        -C "${advanced_options.coefficient_for_downgrading}"
+        -d "${advanced_options.max_reads_per_bam}"
+        ${advanced_options.extended_BAQ_computation}
+        -q "${advanced_options.minimum_mapping_quality}"
+        -Q "${advanced_options.minimum_base_quality}"
+        #if str( $advanced_options.region_string ):
+            -r "${advanced_options.region_string}"
+        #end if
+        
+    #end if
+    #if str( $genotype_likelihood_computation_type.genotype_likelihood_computation_type_selector ) == 'perform_genotype_likelihood_computation':
+        ##
+
+        ${genotype_likelihood_computation_type.output_format}
+        ${genotype_likelihood_computation_type.compressed}
+        
+        #if str( $genotype_likelihood_computation_type.output_tags ) != "None":
+            -output-tags "${genotype_likelihood_computation_type.output_tags}"
+        #end if
+
+        #if str( $genotype_likelihood_computation_type.perform_indel_calling.perform_indel_calling_selector ) == 'perform_indel_calling':
+            -o "${genotype_likelihood_computation_type.perform_indel_calling.gap_open_sequencing_error_probability}"
+            -e "${genotype_likelihood_computation_type.perform_indel_calling.gap_extension_sequencing_error_probability}"
+            -h "${genotype_likelihood_computation_type.perform_indel_calling.coefficient_for_modeling_homopolymer_errors}"
+            -L "${genotype_likelihood_computation_type.perform_indel_calling.skip_indel_calling_above_sample_depth}"
+            -m "${genotype_likelihood_computation_type.perform_indel_calling.minimum_gapped_reads_for_indel_candidates}"
+            --open-prob "${genotype_likelihood_computation_type.perform_indel_calling.open_seq_error_probability}"
+            -F "${genotype_likelihood_computation_type.perform_indel_calling.minimum_gapped_read_fraction}"
+            ${genotype_likelihood_computation_type.perform_indel_calling.gapped_read_per_sample}
+            #if len( $genotype_likelihood_computation_type.perform_indel_calling.platform_list_repeat ):
+                -P "${ ",".join( [ str( platform.platform_entry ) for platform in $genotype_likelihood_computation_type.perform_indel_calling.platform_list_repeat ] ) }"
+            #end if
+        #elif str( $genotype_likelihood_computation_type.perform_indel_calling.perform_indel_calling_selector ) == 'do_not_perform_indel_calling':
+            -I
+        #end if
+        
+         
+    #else:
+        ${genotype_likelihood_computation_type.base_position_on_reads}
+        ${genotype_likelihood_computation_type.output_mapping_quality}
+    #end if
+    --output "$output_mpileup" 2> "$output_log"
+    ]]>
+    </command>
+    <inputs>
+        <conditional name="reference_source">
+            <param label="Choose the source for the reference genome" name="reference_source_selector" type="select">
+                <option value="cached">Use a built-in genome</option>
+                <option value="history">Use a genome from the history</option>
+            </param>
+            <when value="cached">
+                <repeat min="1" name="input_bams" title="BAM file">
+                    <param format="bam" label="BAM file" name="input_bam" type="data">
+                        <validator type="unspecified_build" />
+                        <validator message="Sequences are not currently available for the specified build." metadata_column="1" metadata_name="dbkey" table_name="fasta_indexes" type="dataset_metadata_in_data_table" />
+                    </param>
+                </repeat>
+                <param label="Using reference genome" name="ref_file" type="select">
+                    <options from_data_table="fasta_indexes" />
+                </param>
+            </when>
+            <when value="history">
+                <repeat min="1" name="input_bams" title="BAM file">
+                    <param format="bam" label="BAM file" name="input_bam" type="data">
+                        <validator check="bam_index" message="Metadata missing, click the pencil icon in the history item and use the auto-detect feature to correct this issue." type="metadata" />
+                    </param>
+                </repeat>
+                <param format="fasta" label="Using reference genome" name="ref_file" type="data" />
+            </when>
+        </conditional>
+        <conditional name="genotype_likelihood_computation_type">
+            <param label="Genotype Likelihood Computation" name="genotype_likelihood_computation_type_selector" type="select">
+                <option selected="True" value="perform_genotype_likelihood_computation">Perform genotype likelihood computation (--VCF, --BCF options)</option>
+                <option value="do_not_perform_genotype_likelihood_computation">Do not perform genotype likelihood computation (output pileup)</option>
+            </param>
+            <when value="perform_genotype_likelihood_computation">
+                <param label="Choose the output format" name="output_format" type="select">
+                    <option value="--VCF">VCF</option>
+                    <option value="--BCF">BCF</option>
+                </param>
+                <param checked="False" falsevalue="--uncompressed" label="Compress output" name="compressed" truevalue="" type="boolean" help="--incompressed; default=False"/>
+                <param name="output_tags" optional="True" type="select" multiple="True" display="checkboxes" label="Optional tags to output" help="--output-tags">
+                    <option value="DP">DP (Number of high-quality bases)</option>
+                    <option value="DPR">DRP (Number of high-quality bases for each observed allele)</option>
+                    <option value="DV">DV (Number of high-quality non-reference bases)</option>
+                    <option value="DP4">DP4 (Number of high-quality ref-forward, ref-reverse, alt-forward and alt-reverse bases)</option>
+                    <option value="INFO/DPR">INFO/DPR (Number of high-quality bases for each observed allele)</option>
+                    <option value="SP">SP (Phred-scaled strand bias P-value)</option>
+                </param>
+                <conditional name="perform_indel_calling">
+                    <param label="Perform INDEL calling" name="perform_indel_calling_selector" type="select">
+                        <option selected="True" value="perform_indel_calling_def">Perform INDEL calling using default options</option>
+                        <option value="perform_indel_calling">Perform INDEL calling and set advanced options</option>
+                        <option value="do_not_perform_indel_calling">Do not perform INDEL calling</option>
+                    </param>
+                    <when value="perform_indel_calling_def" />
+                    <when value="perform_indel_calling">
+                        <param label="Phred-scaled gap open sequencing error probability" name="gap_open_sequencing_error_probability" type="integer" value="40" help="--open-prob; Reducing this value leads to more indel calls; default=40"/>
+                        <param label="Phred-scaled gap extension sequencing error probability" name="gap_extension_sequencing_error_probability" type="integer" value="20" help="--ext-prob;  Reducing this value leads to longer indels. default=20"/>
+                        <param label="Coefficient for modeling homopolymer errors." name="coefficient_for_modeling_homopolymer_errors" type="integer" value="100" help="--tandem-qual; default=100"/>
+                        <param label="Skip INDEL calling if the average per-sample depth is above" name="skip_indel_calling_above_sample_depth" type="integer" value="250" help="--max-idepth; default=250"/>
+                        <param label="Minimum gapped reads for indel candidates" name="minimum_gapped_reads_for_indel_candidates" type="integer" value="1" help="--min-ireads; default=1"/>
+                        <param label="Phred-scaled gap open sequencing error probability" name="open_seq_error_probability" type="integer" value="40" help="--open-prob; Reducing this value leads to more indel calls; default=40"/>
+                        <param label="Minimum fraction of gapped reads" name="minimum_gapped_read_fraction" type="float" value="0.002" help="--gap-frac; default=0.002"/>
+                        <param checked="False" falsevalue="" label="Apply --min-ireads and --gap-frac values on a per-sample basis" name="gapped_read_per_sample" truevalue="-p" type="boolean" help="--per-sample-mF;  by default both options are applied to reads pooled from all samples"/>
+                        <repeat name="platform_list_repeat" title="Platform for INDEL candidates">
+                            <param label="Platform to use for INDEL candidates" name="platform_entry" type="text" value="" help="It is recommended to collect indel candidates from sequencing technologies that have low indel error rate such as ILLUMINA"/>
+                        </repeat>
+                    </when>
+                    <when value="do_not_perform_indel_calling" />
+                </conditional>
+                
+            </when>
+            <when value="do_not_perform_genotype_likelihood_computation">
+                <param checked="False" falsevalue="" label="Output base positions on reads" name="base_position_on_reads" truevalue="-O" type="boolean" help="--output-BP"/>
+                <param checked="False" falsevalue="" label="Output mapping quality" name="output_mapping_quality" truevalue="-s" type="boolean" help="--output-MQ"/>
+            </when>
+        </conditional>
+        <conditional name="advanced_options">
+            <param label="Set advanced options" name="advanced_options_selector" type="select">
+                <option selected="True" value="basic">Basic</option>
+                <option value="advanced">Advanced</option>
+            </param>
+            <when value="advanced">
+                <conditional name="filter_by_flags">
+                    <param label="Set filter by flags" name="filter_flags" type="select">
+                        <option selected="True" value="nofilter">Do not filter</option>
+                        <option value="filter">Filter by flags to exclude or require</option>
+                    </param>
+                    <when value="filter">
+                        <param display="checkboxes" label="Require" multiple="True" name="require_flags" type="select" help="--incl-flags">
+                            <option value="1">Read is paired</option>
+                            <option value="2">Read is mapped in a proper pair</option>
+                            <option value="4">The read is unmapped</option>
+                            <option value="8">The mate is unmapped</option>
+                            <option value="16">Read strand</option>
+                            <option value="32">Mate strand</option>
+                            <option value="64">Read is the first in a pair</option>
+                            <option value="128">Read is the second in a pair</option>
+                            <option value="256">The alignment or this read is not primary</option>
+                            <option value="512">The read fails platform/vendor quality checks</option>
+                            <option value="1024">The read is a PCR or optical duplicate</option>
+                        </param>
+                        <param display="checkboxes" label="Exclude" multiple="True" name="exclude_flags" type="select" help="--excl-flags">
+                            <option value="1">Read is paired</option>
+                            <option value="2">Read is mapped in a proper pair</option>
+                            <option value="4">The read is unmapped</option>
+                            <option value="8">The mate is unmapped</option>
+                            <option value="16">Read strand</option>
+                            <option value="32">Mate strand</option>
+                            <option value="64">Read is the first in a pair</option>
+                            <option value="128">Read is the second in a pair</option>
+                            <option value="256">The alignment or this read is not primary</option>
+                            <option value="512">The read fails platform/vendor quality checks</option>
+                            <option value="1024">The read is a PCR or optical duplicate</option>
+                        </param>
+                    </when>
+                    <when value="nofilter" />
+                </conditional>
+                <conditional name="limit_by_region">
+                    <param label="Select regions to call" name="limit_by_regions" type="select">
+                        <option selected="True" value="no_limit">Do not limit</option>
+                        <option value="history">From an uploaded BED file (--positions)</option>
+                        <option value="paste">Paste a list of regions or BED (--region)</option>
+                    </param>
+                    <when value="history">
+                        <param format="bed" label="BED file" name="bed_regions" type="data" help="--positions">
+                            <validator type="dataset_ok_validator" />
+                        </param>
+                    </when>
+                    <when value="paste">
+                        <param area="true" help="Paste a list of regions in BED format or as a list of chromosomes and positions" label="Regions" name="region_paste" size="10x35" type="text"/>
+                    </when>
+                    <when value="no_limit" />
+                </conditional>
+                <conditional name="exclude_read_group">
+                    <param label="Select read groups to exclude" name="exclude_read_groups" type="select" help="--exclude-RG">
+                        <option selected="True" value="no_limit">Do not exclude</option>
+                        <option value="history">From an uploaded text file</option>
+                        <option value="paste">Paste a list of read groups</option>
+                    </param>
+                    <when value="history">
+                        <param format="txt" label="Text file" name="read_groups" type="data">
+                            <validator type="dataset_ok_validator" />
+                        </param>
+                    </when>
+                    <when value="paste">
+                        <param area="true" help="Paste a list of read groups" label="Read groups" name="group_paste" size="10x35" type="text" />
+                    </when>
+                    <when value="no_limit" />
+                </conditional>
+                <param checked="False" falsevalue="" label="Disable read-pair overlap detection" name="ignore_overlaps" truevalue="-x" type="boolean" help="--ignore-overlaps"/>
+                <param checked="False" falsevalue="" label="Do not skip anomalous read pairs in variant calling" name="skip_anomalous_read_pairs" truevalue="-A" type="boolean" help="--count-orphans"/>
+                <param checked="False" falsevalue="" label="Disable probabilistic realignment for the computation of base alignment quality (BAQ)" name="disable_probabilistic_realignment" truevalue="-B" type="boolean" help="--no-BAQ; BAQ is the Phred-scaled probability of a read base being misaligned. Applying this option greatly helps to reduce false SNPs caused by misalignments"/>
+                <param label="Coefficient for downgrading mapping quality for reads containing excessive mismatches" name="coefficient_for_downgrading" type="integer" value="0" help="--adjust-MQ; Given a read with a phred-scaled probability q of being generated from the mapped position, the new mapping quality is about sqrt((INT-q)/INT)*INT. A zero value disables this functionality; if enabled, the recommended value for BWA is 50. default=0"/>
+                <param label="Max reads per BAM" max="1024" min="1" name="max_reads_per_bam" type="integer" value="250" help="--max-depth; default=250"/>
+                <param checked="False" falsevalue="" label="Redo BAQ computation" name="extended_BAQ_computation" truevalue="-E" type="boolean" help="--redo-BAQ; ignore existing BQ tags"/>
+                <param label="Minimum mapping quality for an alignment to be used" name="minimum_mapping_quality" type="integer" value="0" help="-min-MQ; default=0"/>
+                <param label="Minimum base quality for a base to be considered" name="minimum_base_quality" type="integer" value="13" help="--min-BQ; default=13"/>
+                <param label="Only generate pileup in region" name="region_string" type="text" value="" help="--region; If used in conjunction with --positions, then considers the intersection of the two requests. Defaults to all sites" />
+            </when>
+            <when value="basic" />
+        </conditional>
+    </inputs>
+    <outputs>
+        <data format="pileup" label="${tool.name} on ${on_string}" name="output_mpileup">
+            <change_format>
+                <when format="bcf" input="genotype_likelihood_computation_type.output_format" value="--BCF" />
+                <when format="vcf" input="genotype_likelihood_computation_type.output_format" value="--VCF" />
+            </change_format>
+        </data>
+        <data format="txt" label="${tool.name} on ${on_string} (log)" name="output_log" />
+    </outputs>
+    <tests>
+        <test>
+            <param name="reference_source_selector" value="history" />
+            <param ftype="fasta" name="ref_file" value="phiX.fasta" />
+            <param ftype="bam" name="input_bam" value="samtools_mpileup_in_1.bam" />
+            <param name="genotype_likelihood_computation_type_selector" value="do_not_perform_genotype_likelihood_computation" />
+            <param name="advanced_options_selector" value="basic" />
+            <param name="base_position_on_reads" value="true" />
+            <param name="output_mapping_quality" value="true" />
+            <output file="samtools_mpileup_out_1.pileup" name="output_mpileup" />
+            <output file="samtools_mpileup_out_1.log" name="output_log" />
+        </test>
+        <test>
+            <param name="reference_source_selector" value="history" />
+            <param ftype="fasta" name="ref_file" value="phiX.fasta" />
+            <param ftype="bam" name="input_bam" value="phiX.bam" />
+            <param name="genotype_likelihood_computation_type_selector" value="perform_genotype_likelihood_computation" />
+            <param name="gap_extension_sequencing_error_probability" value="20" />
+            <param name="coefficient_for_modeling_homopolymer_errors" value="100" />
+            <param name="perform_indel_calling_selector" value="perform_indel_calling" />
+            <param name="skip_indel_calling_above_sample_depth" value="250" />
+            <param name="gap_open_sequencing_error_probability" value="40" />
+            <param name="platform_list_repeat" value="0" />
+            <param name="advanced_options_selector" value="basic" />
+            <param name="genotype_likelihood_computation_type|output_format" value="VCF" />
+            <output file="samtools_mpileup_out_2.vcf" ftype="vcf" lines_diff="8" name="output_mpileup" />
+            <output file="samtools_mpileup_out_2.log" name="output_log" />
+        </test>
+    </tests>
+    <help>
+<![CDATA[
+**What it does**
+
+Report variants for one or multiple BAM files. Alignment records are grouped by sample identifiers in @RG header lines. If sample identifiers are absent, each input file is regarded as one sample. 
+
+------
+
+**Input options**::
+
+  -6, --illumina1.3+      quality is in the Illumina-1.3+ encoding
+  -A, --count-orphans     do not discard anomalous read pairs
+  -b, --bam-list FILE     list of input BAM filenames, one per line
+  -B, --no-BAQ            disable BAQ (per-Base Alignment Quality)
+  -C, --adjust-MQ INT     adjust mapping quality; recommended:50, disable:0 [0]
+  -d, --max-depth INT     max per-BAM depth; avoids excessive memory usage [250]
+  -E, --redo-BAQ          recalculate BAQ on the fly, ignore existing BQs
+  -f, --fasta-ref FILE    faidx indexed reference sequence file
+  -G, --exclude-RG FILE   exclude read groups listed in FILE
+  -l, --positions FILE    skip unlisted positions (chr pos) or regions (BED)
+  -q, --min-MQ INT        skip alignments with mapQ smaller than INT [0]
+  -Q, --min-BQ INT        skip bases with baseQ/BAQ smaller than INT [13]
+  -r, --region REG        region in which pileup is generated
+  -R, --ignore-RG         ignore RG tags (one BAM = one sample)
+  --rf, --incl-flags STR|INT  required flags: skip reads with mask bits unset []
+  --ff, --excl-flags STR|INT  filter flags: skip reads with mask bits set
+                                            [UNMAP,SECONDARY,QCFAIL,DUP]
+  -x, --ignore-overlaps   disable read-pair overlap detection
+
+**Output options**::
+
+  -o, --output FILE       write output to FILE [standard output]
+  -g, --BCF               generate genotype likelihoods in BCF format
+  -v, --VCF               generate genotype likelihoods in VCF format
+
+**Output options for mpileup format** (without -g/-v)::
+
+  -O, --output-BP         output base positions on reads
+  -s, --output-MQ         output mapping quality
+
+**Output options for genotype likelihoods** (when -g/-v is used)::
+
+  -t, --output-tags LIST  optional tags to output: DP,DPR,DV,DP4,INFO/DPR,SP []
+  -u, --uncompressed      generate uncompressed VCF/BCF output
+
+**SNP/INDEL genotype likelihoods options** (effective with -g/-v)::
+
+  -e, --ext-prob INT      Phred-scaled gap extension seq error probability [20]
+  -F, --gap-frac FLOAT    minimum fraction of gapped reads [0.002]
+  -h, --tandem-qual INT   coefficient for homopolymer errors [100]
+  -I, --skip-indels       do not perform indel calling
+  -L, --max-idepth INT    maximum per-sample depth for INDEL calling [250]
+  -m, --min-ireads INT    minimum number gapped reads for indel candidates [1]
+  -o, --open-prob INT     Phred-scaled gap open seq error probability [40]
+  -p, --per-sample-mF     apply -m and -F per-sample for increased sensitivity
+  -P, --platforms STR     comma separated list of platforms for indels [all]
+
+**Notes**: Assuming diploid individuals.
+]]>
+    </help>
+    <configfiles>
+        <configfile name="excluded_read_groups">
+<![CDATA[
+#set pasted_data = ''
+#if str( $advanced_options.advanced_options_selector ) == "advanced":
+    #if str( $advanced_options.exclude_read_group.exclude_read_groups ) == "paste":
+        #set pasted_data = '\t'.join( str( $advanced_options.exclude_read_group['read_groups'] ).split() )
+    #end if
+#end if
+${pasted_data}
+]]>
+        </configfile>
+        <configfile name="pasted_regions">
+<![CDATA[
+#set pasted_data = ''
+#if str( $advanced_options.advanced_options_selector ) == "advanced":
+    #if str( $advanced_options.limit_by_region.limit_by_regions ) == "paste":
+        #set pasted_data = '\t'.join( str( $advanced_options.limit_by_region['region_paste'] ).split() )
+    #end if
+#end if
+${pasted_data}
+]]>
+        </configfile>
+    </configfiles>
+    <expand macro="citations" />
+</tool>
Binary file gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/phiX.bam has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/phiX.fasta	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,79 @@
+>phiX174
+GAGTTTTATCGCTTCCATGACGCAGAAGTTAACACTTTCGGATATTTCTGATGAGTCGAAAAATTATCTT
+GATAAAGCAGGAATTACTACTGCTTGTTTACGAATTAAATCGAAGTGGACTGCTGGCGGAAAATGAGAAA
+ATTCGACCTATCCTTGCGCAGCTCGAGAAGCTCTTACTTTGCGACCTTTCGCCATCAACTAACGATTCTG
+TCAAAAACTGACGCGTTGGATGAGGAGAAGTGGCTTAATATGCTTGGCACGTTCGTCAAGGACTGGTTTA
+GATATGAGTCACATTTTGTTCATGGTAGAGATTCTCTTGTTGACATTTTAAAAGAGCGTGGATTACTATC
+TGAGTCCGATGCTGTTCAACCACTAATAGGTAAGAAATCATGAGTCAAGTTACTGAACAATCCGTACGTT
+TCCAGACCGCTTTGGCCTCTATTAAGCTCATTCAGGCTTCTGCCGTTTTGGATTTAACCGAAGATGATTT
+CGATTTTCTGACGAGTAACAAAGTTTGGATTGCTACTGACCGCTCTCGTGCTCGTCGCTGCGTTGAGGCT
+TGCGTTTATGGTACGCTGGACTTTGTGGGATACCCTCGCTTTCCTGCTCCTGTTGAGTTTATTGCTGCCG
+TCATTGCTTATTATGTTCATCCCGTCAACATTCAAACGGCCTGTCTCATCATGGAAGGCGCTGAATTTAC
+GGAAAACATTATTAATGGCGTCGAGCGTCCGGTTAAAGCCGCTGAATTGTTCGCGTTTACCTTGCGTGTA
+CGCGCAGGAAACACTGACGTTCTTACTGACGCAGAAGAAAACGTGCGTCAAAAATTACGTGCAGAAGGAG
+TGATGTAATGTCTAAAGGTAAAAAACGTTCTGGCGCTCGCCCTGGTCGTCCGCAGCCGTTGCGAGGTACT
+AAAGGCAAGCGTAAAGGCGCTCGTCTTTGGTATGTAGGTGGTCAACAATTTTAATTGCAGGGGCTTCGGC
+CCCTTACTTGAGGATAAATTATGTCTAATATTCAAACTGGCGCCGAGCGTATGCCGCATGACCTTTCCCA
+TCTTGGCTTCCTTGCTGGTCAGATTGGTCGTCTTATTACCATTTCAACTACTCCGGTTATCGCTGGCGAC
+TCCTTCGAGATGGACGCCGTTGGCGCTCTCCGTCTTTCTCCATTGCGTCGTGGCCTTGCTATTGACTCTA
+CTGTAGACATTTTTACTTTTTATGTCCCTCATCGTCACGTTTATGGTGAACAGTGGATTAAGTTCATGAA
+GGATGGTGTTAATGCCACTCCTCTCCCGACTGTTAACACTACTGGTTATATTGACCATGCCGCTTTTCTT
+GGCACGATTAACCCTGATACCAATAAAATCCCTAAGCATTTGTTTCAGGGTTATTTGAATATCTATAACA
+ACTATTTTAAAGCGCCGTGGATGCCTGACCGTACCGAGGCTAACCCTAATGAGCTTAATCAAGATGATGC
+TCGTTATGGTTTCCGTTGCTGCCATCTCAAAAACATTTGGACTGCTCCGCTTCCTCCTGAGACTGAGCTT
+TCTCGCCAAATGACGACTTCTACCACATCTATTGACATTATGGGTCTGCAAGCTGCTTATGCTAATTTGC
+ATACTGACCAAGAACGTGATTACTTCATGCAGCGTTACCGTGATGTTATTTCTTCATTTGGAGGTAAAAC
+CTCTTATGACGCTGACAACCGTCCTTTACTTGTCATGCGCTCTAATCTCTGGGCATCTGGCTATGATGTT
+GATGGAACTGACCAAACGTCGTTAGGCCAGTTTTCTGGTCGTGTTCAACAGACCTATAAACATTCTGTGC
+CGCGTTTCTTTGTTCCTGAGCATGGCACTATGTTTACTCTTGCGCTTGTTCGTTTTCCGCCTACTGCGAC
+TAAAGAGATTCAGTACCTTAACGCTAAAGGTGCTTTGACTTATACCGATATTGCTGGCGACCCTGTTTTG
+TATGGCAACTTGCCGCCGCGTGAAATTTCTATGAAGGATGTTTTCCGTTCTGGTGATTCGTCTAAGAAGT
+TTAAGATTGCTGAGGGTCAGTGGTATCGTTATGCGCCTTCGTATGTTTCTCCTGCTTATCACCTTCTTGA
+AGGCTTCCCATTCATTCAGGAACCGCCTTCTGGTGATTTGCAAGAACGCGTACTTATTCGCCACCATGAT
+TATGACCAGTGTTTCCAGTCCGTTCAGTTGTTGCAGTGGAATAGTCAGGTTAAATTTAATGTGACCGTTT
+ATCGCAATCTGCCGACCACTCGCGATTCAATCATGACTTCGTGATAAAAGATTGAGTGTGAGGTTATAAC
+GCCGAAGCGGTAAAAATTTTAATTTTTGCCGCTGAGGGGTTGACCAAGCGAAGCGCGGTAGGTTTTCTGC
+TTAGGAGTTTAATCATGTTTCAGACTTTTATTTCTCGCCATAATTCAAACTTTTTTTCTGATAAGCTGGT
+TCTCACTTCTGTTACTCCAGCTTCTTCGGCACCTGTTTTACAGACACCTAAAGCTACATCGTCAACGTTA
+TATTTTGATAGTTTGACGGTTAATGCTGGTAATGGTGGTTTTCTTCATTGCATTCAGATGGATACATCTG
+TCAACGCCGCTAATCAGGTTGTTTCTGTTGGTGCTGATATTGCTTTTGATGCCGACCCTAAATTTTTTGC
+CTGTTTGGTTCGCTTTGAGTCTTCTTCGGTTCCGACTACCCTCCCGACTGCCTATGATGTTTATCCTTTG
+AATGGTCGCCATGATGGTGGTTATTATACCGTCAAGGACTGTGTGACTATTGACGTCCTTCCCCGTACGC
+CGGGCAATAATGTTTATGTTGGTTTCATGGTTTGGTCTAACTTTACCGCTACTAAATGCCGCGGATTGGT
+TTCGCTGAATCAGGTTATTAAAGAGATTATTTGTCTCCAGCCACTTAAGTGAGGTGATTTATGTTTGGTG
+CTATTGCTGGCGGTATTGCTTCTGCTCTTGCTGGTGGCGCCATGTCTAAATTGTTTGGAGGCGGTCAAAA
+AGCCGCCTCCGGTGGCATTCAAGGTGATGTGCTTGCTACCGATAACAATACTGTAGGCATGGGTGATGCT
+GGTATTAAATCTGCCATTCAAGGCTCTAATGTTCCTAACCCTGATGAGGCCGCCCCTAGTTTTGTTTCTG
+GTGCTATGGCTAAAGCTGGTAAAGGACTTCTTGAAGGTACGTTGCAGGCTGGCACTTCTGCCGTTTCTGA
+TAAGTTGCTTGATTTGGTTGGACTTGGTGGCAAGTCTGCCGCTGATAAAGGAAAGGATACTCGTGATTAT
+CTTGCTGCTGCATTTCCTGAGCTTAATGCTTGGGAGCGTGCTGGTGCTGATGCTTCCTCTGCTGGTATGG
+TTGACGCCGGATTTGAGAATCAAAAAGAGCTTACTAAAATGCAACTGGACAATCAGAAAGAGATTGCCGA
+GATGCAAAATGAGACTCAAAAAGAGATTGCTGGCATTCAGTCGGCGACTTCACGCCAGAATACGAAAGAC
+CAGGTATATGCACAAAATGAGATGCTTGCTTATCAACAGAAGGAGTCTACTGCTCGCGTTGCGTCTATTA
+TGGAAAACACCAATCTTTCCAAGCAACAGCAGGTTTCCGAGATTATGCGCCAAATGCTTACTCAAGCTCA
+AACGGCTGGTCAGTATTTTACCAATGACCAAATCAAAGAAATGACTCGCAAGGTTAGTGCTGAGGTTGAC
+TTAGTTCATCAGCAAACGCAGAATCAGCGGTATGGCTCTTCTCATATTGGCGCTACTGCAAAGGATATTT
+CTAATGTCGTCACTGATGCTGCTTCTGGTGTGGTTGATATTTTTCATGGTATTGATAAAGCTGTTGCCGA
+TACTTGGAACAATTTCTGGAAAGACGGTAAAGCTGATGGTATTGGCTCTAATTTGTCTAGGAAATAACCG
+TCAGGATTGACACCCTCCCAATTGTATGTTTTCATGCCTCCAAATCTTGGAGGCTTTTTTATGGTTCGTT
+CTTATTACCCTTCTGAATGTCACGCTGATTATTTTGACTTTGAGCGTATCGAGGCTCTTAAACCTGCTAT
+TGAGGCTTGTGGCATTTCTACTCTTTCTCAATCCCCAATGCTTGGCTTCCATAAGCAGATGGATAACCGC
+ATCAAGCTCTTGGAAGAGATTCTGTCTTTTCGTATGCAGGGCGTTGAGTTCGATAATGGTGATATGTATG
+TTGACGGCCATAAGGCTGCTTCTGACGTTCGTGATGAGTTTGTATCTGTTACTGAGAAGTTAATGGATGA
+ATTGGCACAATGCTACAATGTGCTCCCCCAACTTGATATTAATAACACTATAGACCACCGCCCCGAAGGG
+GACGAAAAATGGTTTTTAGAGAACGAGAAGACGGTTACGCAGTTTTGCCGCAAGCTGGCTGCTGAACGCC
+CTCTTAAGGATATTCGCGATGAGTATAATTACCCCAAAAAGAAAGGTATTAAGGATGAGTGTTCAAGATT
+GCTGGAGGCCTCCACTATGAAATCGCGTAGAGGCTTTACTATTCAGCGTTTGATGAATGCAATGCGACAG
+GCTCATGCTGATGGTTGGTTTATCGTTTTTGACACTCTCACGTTGGCTGACGACCGATTAGAGGCGTTTT
+ATGATAATCCCAATGCTTTGCGTGACTATTTTCGTGATATTGGTCGTATGGTTCTTGCTGCCGAGGGTCG
+CAAGGCTAATGATTCACACGCCGACTGCTATCAGTATTTTTGTGTGCCTGAGTATGGTACAGCTAATGGC
+CGTCTTCATTTCCATGCGGTGCATTTTATGCGGACACTTCCTACAGGTAGCGTTGACCCTAATTTTGGTC
+GTCGGGTACGCAATCGCCGCCAGTTAAATAGCTTGCAAAATACGTGGCCTTATGGTTACAGTATGCCCAT
+CGCAGTTCGCTACACGCAGGACGCTTTTTCACGTTCTGGTTGGTTGTGGCCTGTTGATGCTAAAGGTGAG
+CCGCTTAAAGCTACCAGTTATATGGCTGTTGGTTTCTATGTGGCTAAATACGTTAACAAAAAGTCAGATA
+TGGACCTTGCTGCTAAAGGTCTAGGAGCTAAAGAATGGAACAACTCACTAAAAACCAAGCTGTCGCTACT
+TCCCAAGAAGCTGTTCAGAATCAGAATGAGCCGCAACTTCGGGATGAAAATGCTCACAATGACAAATCTG
+TCCACGGAGTGCTTAATCCAACTTACCAAGCTGGGTTACGACGCGACGCCGTTCAACCAGATATTGAAGC
+AGAACGCAAAAAGAGAGATGAGATTGAGGCTGGGAAAAGTTACTGTAGCCGACGTTTTGGCGGCGCAACC
+TGTGACGACAAATCTGCTCAAATTTATGCGCGCTTCGATAAAAATGATTGGCGTATCCAACCTGCA
+
Binary file gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/phiX_1.bam has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/samtools/mpileup/samtools_mpileup_out_1.log	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,2 @@
+[mpileup] 1 samples in 1 input files
+<mpileup> Set max per-file depth to 8000
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/samtools/mpileup/samtools_mpileup_out_1.pileup	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,43 @@
+phiX174	1411	A	1	^P.	$
+phiX174	1412	G	3	.^D.^F.	"$$
+phiX174	1413	C	5	...^D.^F.	"""$$
+phiX174	1414	G	6	.....^F.	#####$
+phiX174	1415	C	7	......^F.	%%%%%%&
+phiX174	1416	C	8	.......^F.	$$$$$$$$
+phiX174	1417	G	9	........^F.	"#######$
+phiX174	1418	T	10	.........^F.	"""""""""$
+phiX174	1419	G	10	..........	"""""'&'%$
+phiX174	1420	G	10	..........	""""""""""
+phiX174	1421	A	10	..........	""""""""""
+phiX174	1422	T	10	..........	""""""""""
+phiX174	1423	G	10	..........	"""""""""#
+phiX174	1424	C	10	..A.AAAAAA	%"""""""""
+phiX174	1425	C	10	..........	$$$"""""""
+phiX174	1426	T	10	..........	#####"""""
+phiX174	1427	G	10	..........	######""""
+phiX174	1428	A	10	..........	""""""""""
+phiX174	1429	C	10	..........	((((((&(""
+phiX174	1430	C	10	..........	$$$$$$$$$"
+phiX174	1431	G	10	..........	##########
+phiX174	1432	T	10	..........	""""""""""
+phiX174	1433	A	10	..........	##########
+phiX174	1434	C	10	..........	((((((&(%$
+phiX174	1435	C	10	..........	$$$$$$$$$$
+phiX174	1436	G	10	..........	##########
+phiX174	1437	A	10	..........	"""""""""!
+phiX174	1438	G	10	..........	"""""####!
+phiX174	1439	G	10	..........	"""""""""!
+phiX174	1440	C	10	..........	"""""""""!
+phiX174	1441	T	10	..........	""""""""#!
+phiX174	1442	A	10	..........	$$$%%%&&%!
+phiX174	1443	A	10	.-1C.-1C..-1C......	"""""""""!
+phiX174	1444	C	10	**.*......	&%"!"""""!
+phiX174	1445	C	10	..........	&%&!%%%&%!
+phiX174	1446	C	10	..........	"""!"""""!
+phiX174	1447	T	10	.$..$.......	#"#!"""""!
+phiX174	1448	A	8	.$..$.....	#!#%%$$!
+phiX174	1449	A	6	.$.$....	!""""!
+phiX174	1450	T	4	.$...	"""!
+phiX174	1451	G	3	.$..	#"!
+phiX174	1452	A	2	.$.	"!
+phiX174	1453	G	1	.$	!
Binary file gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/samtools/mpileup/samtools_mpileup_out_2.bcf has changed
Binary file gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/samtools_mpileup_in_1.bam has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/samtools_mpileup_out_1.log	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,3 @@
+[fai_load] build FASTA index.
+[mpileup] 1 samples in 1 input files
+<mpileup> Set max per-file depth to 8000
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/samtools_mpileup_out_1.pileup	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,43 @@
+phiX174	1411	A	0				1
+phiX174	1412	G	0				2,1,1
+phiX174	1413	C	0				3,2,2,1,1
+phiX174	1414	G	0				4,3,3,2,2,1
+phiX174	1415	C	0				5,4,4,3,3,2,1
+phiX174	1416	C	0				6,5,5,4,4,3,2,1
+phiX174	1417	G	0				7,6,6,5,5,4,3,2,1
+phiX174	1418	T	0				8,7,7,6,6,5,4,3,2,1
+phiX174	1419	G	0				9,8,8,7,7,6,5,4,3,2
+phiX174	1420	G	0				10,9,9,8,8,7,6,5,4,3
+phiX174	1421	A	0				11,10,10,9,9,8,7,6,5,4
+phiX174	1422	T	0				12,11,11,10,10,9,8,7,6,5
+phiX174	1423	G	0				13,12,12,11,11,10,9,8,7,6
+phiX174	1424	C	0				14,13,13,12,12,11,10,9,8,7
+phiX174	1425	C	0				15,14,14,13,13,12,11,10,9,8
+phiX174	1426	T	0				16,15,15,14,14,13,12,11,10,9
+phiX174	1427	G	0				17,16,16,15,15,14,13,12,11,10
+phiX174	1428	A	0				18,17,17,16,16,15,14,13,12,11
+phiX174	1429	C	0				19,18,18,17,17,16,15,14,13,12
+phiX174	1430	C	0				20,19,19,18,18,17,16,15,14,13
+phiX174	1431	G	0				21,20,20,19,19,18,17,16,15,14
+phiX174	1432	T	0				22,21,21,20,20,19,18,17,16,15
+phiX174	1433	A	0				23,22,22,21,21,20,19,18,17,16
+phiX174	1434	C	0				24,23,23,22,22,21,20,19,18,17
+phiX174	1435	C	0				25,24,24,23,23,22,21,20,19,18
+phiX174	1436	G	0				26,25,25,24,24,23,22,21,20,19
+phiX174	1437	A	0				27,26,26,25,25,24,23,22,21,20
+phiX174	1438	G	0				28,27,27,26,26,25,24,23,22,21
+phiX174	1439	G	0				29,28,28,27,27,26,25,24,23,22
+phiX174	1440	C	0				30,29,29,28,28,27,26,25,24,23
+phiX174	1441	T	0				31,30,30,29,29,28,27,26,25,24
+phiX174	1442	A	0				32,31,31,30,30,29,28,27,26,25
+phiX174	1443	A	0				33,32,32,31,31,30,29,28,27,26
+phiX174	1444	C	0				34,33,33,32,32,31,30,29,28,27
+phiX174	1445	C	0				34,33,34,32,33,32,31,30,29,28
+phiX174	1446	C	0				35,34,35,33,34,33,32,31,30,29
+phiX174	1447	T	0				36,35,36,34,35,34,33,32,31,30
+phiX174	1448	A	0				36,35,36,35,34,33,32,31
+phiX174	1449	A	0				36,36,35,34,33,32
+phiX174	1450	T	0				36,35,34,33
+phiX174	1451	G	0				36,35,34
+phiX174	1452	A	0				36,35
+phiX174	1453	G	0				36
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/samtools_mpileup_out_2.log	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,3 @@
+[fai_load] build FASTA index.
+[mpileup] 1 samples in 1 input files
+<mpileup> Set max per-file depth to 8000
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/samtools_mpileup_out_2.vcf	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,22 @@
+##fileformat=VCFv4.2
+##FILTER=<ID=PASS,Description="All filters passed">
+##samtoolsVersion=1.1+htslib-1.1
+##samtoolsCommand=samtools mpileup --VCF --uncompressed -f /tmp/tmpId8vOP/tmp3bubIE/database/files/000/dataset_735.dat -g -e 20 -h 100 -L 250 -m 1 --open-prob 40 -F 0.002 -e 40 --output /tmp/tmpId8vOP/tmp3bubIE/database/files/000/dataset_736.dat /tmp/tmpId8vOP/tmp3bubIE/database/files/000/dataset_734.dat
+##reference=file:///tmp/tmpId8vOP/tmp3bubIE/database/files/000/dataset_735.dat
+##contig=<ID=phiX174,length=5386>
+##ALT=<ID=X,Description="Represents allele(s) other than observed.">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=IDV,Number=1,Type=Integer,Description="Maximum number of reads supporting an indel">
+##INFO=<ID=IMF,Number=1,Type=Float,Description="Maximum fraction of reads supporting an indel">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Raw read depth">
+##INFO=<ID=VDB,Number=1,Type=Float,Description="Variant Distance Bias for filtering splice-site artefacts in RNA-seq data (bigger is better)",Version="3">
+##INFO=<ID=RPB,Number=1,Type=Float,Description="Mann-Whitney U test of Read Position Bias (bigger is better)">
+##INFO=<ID=MQB,Number=1,Type=Float,Description="Mann-Whitney U test of Mapping Quality Bias (bigger is better)">
+##INFO=<ID=BQB,Number=1,Type=Float,Description="Mann-Whitney U test of Base Quality Bias (bigger is better)">
+##INFO=<ID=MQSB,Number=1,Type=Float,Description="Mann-Whitney U test of Mapping Quality vs Strand Bias (bigger is better)">
+##INFO=<ID=SGB,Number=1,Type=Float,Description="Segregation based metric.">
+##INFO=<ID=MQ0F,Number=1,Type=Float,Description="Fraction of MQ0 reads (smaller is better)">
+##INFO=<ID=I16,Number=16,Type=Float,Description="Auxiliary tag used for calling, see description of bcf_callret1_t in bam2bcf.h">
+##INFO=<ID=QS,Number=R,Type=Float,Description="Auxiliary tag used for calling">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="List of Phred-scaled genotype likelihoods">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	/tmp/tmpId8vOP/tmp3bubIE/database/files/000/dataset_734.dat
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/samtools_mpileup_out_3.log	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,2 @@
+[mpileup] 1 samples in 1 input files
+<mpileup> Set max per-file depth to 8000
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/samtools_mpileup_out_4.log	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,2 @@
+[mpileup] 1 samples in 1 input files
+<mpileup> Set max per-file depth to 8000
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/test-data/samtools_mpileup_out_4.vcf	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,22 @@
+##fileformat=VCFv4.2
+##FILTER=<ID=PASS,Description="All filters passed">
+##samtoolsVersion=1.1+htslib-1.1
+##samtoolsCommand=samtools mpileup --VCF --uncompressed -f /var/galaxy/workspace/CleanGalaxy/tool-data/phiX/sam_indexes/phiX/phiX.fa -C 0 -d 200 -E -q 0 -Q 43 -g -e 20 -h 100 -L 250 -m 1 --open-prob 40 -F 0.002 -e 40 --output /tmp/tmp5TzrZC/tmpDtGVov/database/files/000/dataset_756.dat /tmp/tmp5TzrZC/tmpDtGVov/database/files/000/dataset_755.dat
+##reference=file:///var/galaxy/workspace/CleanGalaxy/tool-data/phiX/sam_indexes/phiX/phiX.fa
+##contig=<ID=phiX174,length=5386>
+##ALT=<ID=X,Description="Represents allele(s) other than observed.">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=IDV,Number=1,Type=Integer,Description="Maximum number of reads supporting an indel">
+##INFO=<ID=IMF,Number=1,Type=Float,Description="Maximum fraction of reads supporting an indel">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Raw read depth">
+##INFO=<ID=VDB,Number=1,Type=Float,Description="Variant Distance Bias for filtering splice-site artefacts in RNA-seq data (bigger is better)",Version="3">
+##INFO=<ID=RPB,Number=1,Type=Float,Description="Mann-Whitney U test of Read Position Bias (bigger is better)">
+##INFO=<ID=MQB,Number=1,Type=Float,Description="Mann-Whitney U test of Mapping Quality Bias (bigger is better)">
+##INFO=<ID=BQB,Number=1,Type=Float,Description="Mann-Whitney U test of Base Quality Bias (bigger is better)">
+##INFO=<ID=MQSB,Number=1,Type=Float,Description="Mann-Whitney U test of Mapping Quality vs Strand Bias (bigger is better)">
+##INFO=<ID=SGB,Number=1,Type=Float,Description="Segregation based metric.">
+##INFO=<ID=MQ0F,Number=1,Type=Float,Description="Fraction of MQ0 reads (smaller is better)">
+##INFO=<ID=I16,Number=16,Type=Float,Description="Auxiliary tag used for calling, see description of bcf_callret1_t in bam2bcf.h">
+##INFO=<ID=QS,Number=R,Type=Float,Description="Auxiliary tag used for calling">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="List of Phred-scaled genotype likelihoods">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	/tmp/tmp5TzrZC/tmpDtGVov/database/files/000/dataset_755.dat
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/tool-data/fasta_indexes.loc.sample	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,29 @@
+#This is a sample file distributed with Galaxy that enables tools
+#to use a directory of Samtools indexed sequences data files.  You will need
+#to create these data files and then create a fasta_indexes.loc file
+#similar to this one (store it in this directory) that points to
+#the directories in which those files are stored. The fasta_indexes.loc
+#file has this format (white space characters are TAB characters):
+#
+# <unique_build_id>	<dbkey>	<display_name>	<file_base_path>
+#
+#So, for example, if you had hg19 Canonical indexed stored in
+#
+# /depot/data2/galaxy/hg19/sam/,
+#
+#then the fasta_indexes.loc entry would look like this:
+#
+#hg19canon	hg19	Human (Homo sapiens): hg19 Canonical	/depot/data2/galaxy/hg19/sam/hg19canon.fa
+#
+#and your /depot/data2/galaxy/hg19/sam/ directory
+#would contain hg19canon.fa and hg19canon.fa.fai files.
+#
+#Your fasta_indexes.loc file should include an entry per line for
+#each index set you have stored.  The file in the path does actually
+#exist, but it should never be directly used. Instead, the name serves
+#as a prefix for the index file.  For example:
+#
+#hg18canon	hg18	Human (Homo sapiens): hg18 Canonical	/depot/data2/galaxy/hg18/sam/hg18canon.fa
+#hg18full	hg18	Human (Homo sapiens): hg18 Full	/depot/data2/galaxy/hg18/sam/hg18full.fa
+#hg19canon	hg19	Human (Homo sapiens): hg19 Canonical	/depot/data2/galaxy/hg19/sam/hg19canon.fa
+#hg19full	hg19	Human (Homo sapiens): hg19 Full	/depot/data2/galaxy/hg19/sam/hg19full.fa
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/tool_data_table_conf.xml.sample	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,7 @@
+<!-- Use the file tool_data_table_conf.xml.oldlocstyle if you don't want to update your loc files as changed in revision 4550:535d276c92bc-->
+<tables>
+    <table name="fasta_indexes" comment_char="#">
+        <columns>value, dbkey, name, path</columns>
+        <file path="tool-data/fasta_indexes.loc" />
+    </table>
+</tables>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_mpileup/aa0ef6f0ee89/samtools_mpileup/tool_dependencies.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<tool_dependency>
+    <package name="samtools" version="1.2">
+        <repository changeset_revision="6eea04363026" name="package_samtools_1_2" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" />
+    </package>
+</tool_dependency>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_sort/a430da4f04cd/samtools_sort/macros.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,70 @@
+<macros>
+    <xml name="requirements">
+        <requirements>
+            <requirement type="package" version="1.2">samtools</requirement>
+            <yield/>
+        </requirements>
+    </xml>
+    <xml name="citations">
+        <citations>
+            <citation type="bibtex">
+                @misc{SAM_def,
+                title={Definition of SAM/BAM format},
+                url = {https://samtools.github.io/hts-specs/SAMv1.pdf},}
+            </citation>
+            <citation type="doi">10.1093/bioinformatics/btp352</citation>
+            <citation type="doi">10.1093/bioinformatics/btr076</citation>
+            <citation type="doi">10.1093/bioinformatics/btr509</citation>
+            <citation type="bibtex">
+                @misc{Danecek_et_al,
+                Author={Danecek, P., Schiffels, S., Durbin, R.},
+                title={Multiallelic calling model in bcftools (-m)},
+                url = {http://samtools.github.io/bcftools/call-m.pdf},}
+            </citation>
+            <citation type="bibtex">
+                @misc{Durbin_VCQC,
+                Author={Durbin, R.},
+                title={Segregation based metric for variant call QC},
+                url = {http://samtools.github.io/bcftools/rd-SegBias.pdf},}
+            </citation>
+            <citation type="bibtex">
+                @misc{Li_SamMath,
+                Author={Li, H.},
+                title={Mathematical Notes on SAMtools Algorithms},
+                url = {http://www.broadinstitute.org/gatk/media/docs/Samtools.pdf},}
+            </citation>
+            <citation type="bibtex">
+                @misc{SamTools_github,
+                title={SAMTools GitHub page},
+                url = {https://github.com/samtools/samtools},}
+            </citation>
+        </citations>
+    </xml>
+    <xml name="version_command">
+        <version_command>samtools --version | head -n 1 | awk '{ print $2 }'</version_command>
+    </xml>
+    <xml name="stdio">
+        <stdio>
+            <exit_code range="1:" level="fatal" description="Error" />
+        </stdio>
+    </xml>
+    <token name="@no-chrom-options@">
+-----
+
+.. class:: warningmark
+
+**No options available? How to re-detect metadata**
+
+If you see a &quot;No options available&quot; within the &quot;**Select references (chromosomes and contigs) you would like to restrict bam to**&quot; drop down, you need to re-detect metadata for the dataset you are trying to process. To do this follow these steps:
+
+1. Click on the **pencil** icon adjacent to the dataset in the history
+2. A new menu will appear in the center pane of the interface
+3. Click **Datatype** tab
+4. Set **New Type** to **BAM**
+5. Click **Save**
+
+The medatada will be re-detected and you will be able to see the list of reference sequences in the &quot;**Select references (chromosomes and contigs) you would like to restrict bam to**&quot; drop-down.
+
+    </token>
+
+</macros>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_sort/a430da4f04cd/samtools_sort/samtools_sort.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,40 @@
+<tool id="samtools_sort" name="Sort" version="2.0">
+    <description>BAM dataset</description>
+    <macros>
+    <import>macros.xml</import>
+  </macros>
+  <expand macro="requirements"></expand>
+    <expand macro="stdio"></expand>
+    <expand macro="version_command"></expand>
+    <command>samtools sort $sort_mode -@ \${GALAXY_SLOTS:-1} -o "${output1}" -O bam -T dataset "${input1}"</command>
+    <inputs>
+        <param name="input1" type="data" format="bam" label="BAM File" />
+        <param name="sort_mode" type="select" label="Sort by ">
+            <option value="" selected="True">Chromosomal coordinates</option>
+            <option value="-n">Read names (-n)</option>
+        </param>
+    </inputs>
+    <outputs>
+        <data name="output1" format="bam" />
+    </outputs>
+    <tests>
+        <test>
+            <param name="input1" value="1.bam" ftype="bam" />
+            <output name="output1" file="1_sort.bam" ftype="bam" sort="True"/>
+        </test>
+        <test>
+            <param name="input1" value="1.bam" ftype="bam" />
+            <param name="sort_mode" value="-n"/>
+            <output name="output1" file="1_sort_read_names.bam" ftype="bam" sort="True"/>
+        </test>
+    </tests>
+    <help>
+
+**What it does**
+
+This tool uses ``samtools sort`` command to sort BAM datasets in coordinate or read name order.
+
+
+    </help>
+    <expand macro="citations"></expand>
+</tool>
Binary file gv/samtools_sort/a430da4f04cd/samtools_sort/test-data/1.bam has changed
Binary file gv/samtools_sort/a430da4f04cd/samtools_sort/test-data/1_sort.bam has changed
Binary file gv/samtools_sort/a430da4f04cd/samtools_sort/test-data/1_sort_read_names.bam has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_sort/a430da4f04cd/samtools_sort/tool_dependencies.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<tool_dependency>
+    <package name="samtools" version="1.2">
+        <repository changeset_revision="6eea04363026" name="package_samtools_1_2" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" />
+    </package>
+</tool_dependency>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_sort/e613c1ad4c4c/samtools_sort/macros.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,172 @@
+<macros>
+    <xml name="requirements">
+        <requirements>
+            <requirement type="package" version="@TOOL_VERSION@">samtools</requirement>
+            <yield/>
+        </requirements>
+    </xml>
+    <token name="@TOOL_VERSION@">1.9</token>
+    <token name="@FLAGS@">#set $flags = sum(map(int, str($filter).split(',')))</token>
+    <token name="@PREPARE_IDX@"><![CDATA[
+        ##prepare input and indices 
+        ln -s '$input' infile &&
+        #if $input.is_of_type('bam'):
+            #if str( $input.metadata.bam_index ) != "None":
+                ln -s '${input.metadata.bam_index}' infile.bai &&
+            #else:
+                samtools index infile infile.bai &&
+            #end if
+        #elif $input.is_of_type('cram'):
+            #if str( $input.metadata.cram_index ) != "None":
+                ln -s '${input.metadata.cram_index}' infile.crai &&
+            #else:
+                samtools index infile infile.crai &&
+            #end if
+        #end if
+    ]]></token>
+    <token name="@PREPARE_IDX_MULTIPLE@"><![CDATA[
+        ##prepare input and indices 
+        #for $i, $bam in enumerate( $input_bams ):
+            ln -s '$bam' '${i}' &&
+            #if $bam.is_of_type('bam'):
+                #if str( $bam.metadata.bam_index ) != "None":
+                    ln -s '${bam.metadata.bam_index}' '${i}.bai' &&
+                #else:
+                    samtools index '${i}' '${i}.bai' &&
+                #end if
+            #elif $bam.is_of_type('cram'):
+                #if str( $bam.metadata.cram_index ) != "None":
+                    ln -s '${bam.metadata.cram_index}' '${i}.crai' &&
+                #else:
+                    samtools index '${i}' '${i}.crai' &&
+                #end if
+            #end if
+        #end for
+    ]]></token>
+    <token name="@PREPARE_FASTA_IDX@"><![CDATA[
+        ##checks for reference data ($addref_cond.addref_select=="history" or =="cached")
+        ##and sets the -t/-T parameters accordingly:
+        ##- in case of history a symbolic link is used because samtools (view) will generate
+        ##  the index which might not be possible in the directory containing the fasta file
+        ##- in case of cached the absolute path is used which allows to read the cram file
+        ##  without specifying the reference
+        #if $addref_cond.addref_select == "history":
+            ln -s '${addref_cond.ref}' reference.fa &&
+            samtools faidx reference.fa &&
+            #set reffa="reference.fa"
+            #set reffai="reference.fa.fai"
+        #elif $addref_cond.addref_select == "cached":
+            #set reffa=str($addref_cond.ref.fields.path)
+            #set reffai=str($addref_cond.ref.fields.path)+".fai"
+        #else
+            #set reffa=None
+            #set reffai=None
+        #end if
+    ]]></token>
+    <token name="@ADDTHREADS@"><![CDATA[
+        ##compute the number of ADDITIONAL threads to be used by samtools (-@)
+        addthreads=\${GALAXY_SLOTS:-1} && (( addthreads-- )) &&
+    ]]></token>
+    <token name="@ADDMEMORY@"><![CDATA[
+        ##compute the number of memory available to samtools sort (-m)
+        ##use only 75% of available: https://github.com/samtools/samtools/issues/831
+        addmemory=\${GALAXY_MEMORY_MB_PER_SLOT:-768} && 
+        ((addmemory=addmemory*75/100)) &&
+    ]]></token>
+    <xml name="seed_input">
+       <param name="seed" type="integer" optional="True" label="Seed for random number generator" help="If empty a random seed is used." /> 
+    </xml>
+    <xml name="flag_options">
+        <option value="1">read is paired</option>
+        <option value="2">read is mapped in a proper pair</option>
+        <option value="4">read is unmapped</option>
+        <option value="8">mate is unmapped</option>
+        <option value="16">read reverse strand</option>
+        <option value="32">mate reverse strand</option>
+        <option value="64">read is the first in a pair</option>
+        <option value="128">read is the second in a pair</option>
+        <option value="256">alignment or read is not primary</option>
+        <option value="512">read fails platform/vendor quality checks</option>
+        <option value="1024">read is a PCR or optical duplicate</option>
+        <option value="2048">supplementary alignment</option>
+    </xml>
+
+    <!-- region specification macros and tokens for tools that allow the specification 
+         of region by bed file / space separated list of regions -->
+    <token name="@REGIONS_FILE@"><![CDATA[
+        #if $cond_region.select_region == 'tab':
+            -t '$cond_region.targetregions'
+        #end if
+    ]]></token>
+    <token name="@REGIONS_MANUAL@"><![CDATA[
+        #if $cond_region.select_region == 'text':
+            #for $i, $x in enumerate($cond_region.regions_repeat):
+               '${x.region}'
+            #end for
+        #end if
+    ]]></token>
+    <xml name="regions_macro">
+        <conditional name="cond_region">
+            <param name="select_region" type="select" label="Filter by regions" help="restricts output to only those alignments which overlap the specified region(s)">
+                <option value="no" selected="True">No</option>
+                <option value="text">Manualy specify regions</option>
+                <option value="tab">Regions from tabular file</option>
+            </param>
+            <when value="no"/>
+            <when value="text">
+                <repeat name="regions_repeat" min="1" default="1" title="Regions">
+                    <param name="region" type="text" label="region" help="format chr:from-to">
+                        <validator type="regex" message="Required format: CHR[:FROM[-TO]]; where CHR: string containing any character except quotes, whitespace and colon; FROM and TO: any integer">^[^\s'\":]+(:\d+(-\d+){0,1}){0,1}$</validator>
+                    </param>
+                </repeat>
+            </when>
+            <when value="tab">
+                <param name="targetregions" argument="-t/--target-regions" type="data" format="tabular" label="Target regions file" help="Do stats in these regions only. Tab-delimited file chr,from,to (1-based, inclusive)" />
+            </when>
+        </conditional>
+    </xml>
+
+    <xml name="citations">
+        <citations>
+            <citation type="bibtex">
+                @misc{SAM_def,
+                title={Definition of SAM/BAM format},
+                url = {https://samtools.github.io/hts-specs/},}
+            </citation>
+            <citation type="doi">10.1093/bioinformatics/btp352</citation>
+            <citation type="doi">10.1093/bioinformatics/btr076</citation>
+            <citation type="doi">10.1093/bioinformatics/btr509</citation>
+            <citation type="bibtex">
+                @misc{Danecek_et_al,
+                Author={Danecek, P., Schiffels, S., Durbin, R.},
+                title={Multiallelic calling model in bcftools (-m)},
+                url = {http://samtools.github.io/bcftools/call-m.pdf},}
+            </citation>
+            <citation type="bibtex">
+                @misc{Durbin_VCQC,
+                Author={Durbin, R.},
+                title={Segregation based metric for variant call QC},
+                url = {http://samtools.github.io/bcftools/rd-SegBias.pdf},}
+            </citation>
+            <citation type="bibtex">
+                @misc{Li_SamMath,
+                Author={Li, H.},
+                title={Mathematical Notes on SAMtools Algorithms},
+                url = {http://www.broadinstitute.org/gatk/media/docs/Samtools.pdf},}
+            </citation>
+            <citation type="bibtex">
+                @misc{SamTools_github,
+                title={SAMTools GitHub page},
+                url = {https://github.com/samtools/samtools},}
+            </citation>
+        </citations>
+    </xml>
+    <xml name="version_command">
+        <version_command><![CDATA[samtools 2>&1 | grep Version]]></version_command>
+    </xml>
+    <xml name="stdio">
+        <stdio>
+            <exit_code range="1:" level="fatal" description="Error" />
+        </stdio>
+    </xml>
+</macros>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_sort/e613c1ad4c4c/samtools_sort/samtools_sort.xml	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,169 @@
+<tool id="samtools_sort" name="Samtools sort" profile="18.01" version="2.0.3">
+    <description>order of storing aligned sequences</description>
+    <macros>
+        <import>macros.xml</import>
+    </macros>
+    <expand macro="requirements"/>
+    <expand macro="stdio"/>
+    <expand macro="version_command"/>
+    <command><![CDATA[
+        @ADDTHREADS@
+	@ADDMEMORY@
+        samtools sort
+            -@ \$addthreads
+            -m \$addmemory"M"
+            ###if str(compression):
+            ##    -l '$compression'
+            ###end if
+            $prim_key_cond.prim_key_select
+            #if $prim_key_cond.prim_key_select == '-t':
+                $prim_key_cond.tag
+                $prim_key_cond.sec_key_select
+            #end if
+            -O bam
+            -T sorttmp
+            '${input1}'
+             > '${output1}'
+    ]]></command>
+    <inputs>
+        <param name="input1" type="data" format="sam,unsorted.bam,cram" label="BAM File" />
+        <conditional name="prim_key_cond">
+            <param name="prim_key_select" type="select" label="Primary sort key">
+                <option value="">coordinate</option>
+                <option value="-n">name (-n)</option>
+                <option value="-t">tag (-t)</option>
+            </param>
+            <when value=""/>
+            <when value="-n"/>
+            <when value="-t">
+                <param name="tag" type="text" optional="false" argument="-t" label="Alignment tag"/>
+                <param name="sec_key_select" type="select" label="Secondary sort key">
+                    <option value="">coordinate</option>
+                    <option value="-n">name (-n)</option>
+                </param>
+           </when>
+        </conditional>
+        <!--<param name="compression" type="integer" argument="-l" optional="True" min="0" max="9" label="compression level" help="0 (uncompressed) to 9 (best)"/>-->
+    </inputs>
+    <outputs>
+       <data name="output1" format="bam">
+            <change_format>
+                <when input="prim_key_cond.prim_key_select" value="" format="bam" />
+                <when input="prim_key_cond.prim_key_select" value="-n" format="qname_sorted.bam" />
+                <when input="prim_key_cond.prim_key_select" value="-t" format="unsorted.bam" />
+            </change_format>
+        </data>
+    </outputs>
+    <tests>
+        <!-- tests from https://github.com/samtools/samtools/blob/9ce8c64493f7ea3fa69bc5c1ac980b1a8e3dcf1f/test/test.pl#L2464 -->
+        <!-- # Pos sort -->
+        <test>
+            <param name="input1" value="test_input_1_a.bam" ftype="bam" />
+            <output name="output1" file="pos.sort.expected.bam" ftype="bam"/>
+        </test>
+    	<!-- test_cmd($opts, out=>"sort/pos.sort.expected.sam", cmd=>"$$opts{bin}/samtools sort${threads}  $$opts{path}/dat/test_input_1_a.bam -O SAM -o -"); -->
+
+        <!-- # Name sort -->
+        <test>
+            <param name="input1" value="test_input_1_a.bam" ftype="bam" />
+            <conditional name="prim_key_cond">
+                <param name="prim_key_select" value="-n"/>
+            </conditional>
+            <output name="output1" file="name.sort.expected.bam" ftype="qname_sorted.bam"/>
+        </test>
+	<!--    test_cmd($opts, out=>"sort/name.sort.expected.sam", cmd=>"$$opts{bin}/samtools sort${threads} -n  $$opts{path}/dat/test_input_1_a.bam -O SAM -o -");-->
+
+        <!-- # Tag sort (RG) (considers output and name sorted) -->
+        <test>
+            <param name="input1" value="test_input_1_a.bam" ftype="bam" />
+            <conditional name="prim_key_cond">
+                <param name="prim_key_select" value="-t"/>
+                <param name="tag" value="RG"/>
+            </conditional>
+            <output name="output1" file="tag.rg.sort.expected.bam" ftype="unsorted.bam"/>
+        </test>
+    <!--test_cmd($opts, out=>"sort/tag.rg.sort.expected.sam", cmd=>"$$opts{bin}/samtools sort${threads} -t RG  $$opts{path}/dat/test_input_1_a.bam -O SAM -o -");-->
+
+        <!-- # Tag sort (RG); secondary by name -->
+        <test>
+            <param name="input1" value="test_input_1_a.bam" ftype="bam" />
+            <conditional name="prim_key_cond">
+                <param name="prim_key_select" value="-t"/>
+                <param name="tag" value="RG"/>
+                <param name="sec_key_select" value="-n"/>
+            </conditional>
+            <output name="output1" file="tag.rg.n.sort.expected.bam" ftype="unsorted.bam"/>
+        </test>
+    <!--test_cmd($opts, out=>"sort/tag.rg.n.sort.expected.sam", cmd=>"$$opts{bin}/samtools sort${threads} -n -t RG  $$opts{path}/dat/test_input_1_a.bam -O SAM -o -");-->
+
+        <!-- # Tag sort (AS) -->
+        <test>
+            <param name="input1" value="test_input_1_a.bam" ftype="bam" />
+            <conditional name="prim_key_cond">
+                <param name="prim_key_select" value="-t"/>
+                <param name="tag" value="AS"/>
+                <param name="sec_key_select" value=""/>
+            </conditional>
+            <output name="output1" file="tag.as.sort.expected.bam" ftype="unsorted.bam"/>
+        </test>
+    <!--test_cmd($opts, out=>"sort/tag.as.sort.expected.sam", cmd=>"$$opts{bin}/samtools sort${threads} -t AS $$opts{path}/dat/test_input_1_d.sam -O SAM -o -");-->
+
+        <!-- # Tag sort (FI) -->
+        <test>
+            <param name="input1" value="test_input_1_a.bam" ftype="bam" />
+            <conditional name="prim_key_cond">
+                <param name="prim_key_select" value="-t"/>
+                <param name="tag" value="FI"/>
+            </conditional>
+            <output name="output1" file="tag.fi.sort.expected.bam" ftype="unsorted.bam"/>
+        </test>
+    <!--test_cmd($opts, out=>"sort/tag.fi.sort.expected.sam", cmd=>"$$opts{bin}/samtools sort${threads} -t FI $$opts{path}/dat/test_input_1_d.sam -O SAM -o -");-->
+
+        <!-- tests from old version -->
+        <test>
+            <param name="input1" value="1.bam" ftype="bam" />
+            <output name="output1" file="1_sort.bam" ftype="bam" sort="True"/>
+        </test>
+        <test>
+            <param name="input1" value="1.bam" ftype="bam" />
+            <conditional name="prim_key_cond">
+                <param name="prim_key_select" value="-n"/>
+            </conditional>
+            <output name="output1" file="1_sort_read_names.bam" ftype="qname_sorted.bam"/>
+        </test>
+    </tests>
+    <help>
+**What it does**
+
+Sort alignments by leftmost coordinates, or by read name when -n is used. 
+An appropriate @HD-SO sort order header tag will be added or an existing 
+one updated if necessary. 
+
+**Ordering Rules**
+
+The following rules are used for ordering records.
+
+If option -t is in use, records are first sorted by the value of the given
+alignment tag, and then by position or name (if using -n). For example, “-t RG”
+will make read group the primary sort key. The rules for ordering by tag are:
+
+- Records that do not have the tag are sorted before ones that do.
+- If the types of the tags are different, they will be sorted so that single
+  character tags (type A) come before array tags (type B), then string tags
+  (types H and Z), then numeric tags (types f and i).
+- Numeric tags (types f and i) are compared by value. Note that comparisons of
+  floating-point values are subject to issues of rounding and precision.
+- String tags (types H and Z) are compared based on the binary contents of the
+  tag using the C strcmp(3) function.
+- Character tags (type A) are compared by binary character value.
+- No attempt is made to compare tags of other types — notably type B array values will not be compared. 
+
+When the -n option is present, records are sorted by name. Names are compared so as to give a “natural” ordering — i.e. sections consisting of digits are compared numerically while all other sections are compared based on their binary representation. This means “a1” will come before “b1” and “a9” will come before “a10”. Records with the same name will be ordered according to the values of the READ1 and READ2 flags (see flags).
+
+When the -n option is not present, reads are sorted by reference (according to the order of the @SQ header records), then by position in the reference, and then by the REVERSE flag.
+
+This has now been removed. The previous out.prefix argument (and -f option, if any) should be changed to an appropriate combination of -T PREFIX and -o FILE. The previous -o option should be removed, as output defaults to standard output. 
+
+    </help>
+    <expand macro="citations"/>
+</tool>
Binary file gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/1.bam has changed
Binary file gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/1_sort.bam has changed
Binary file gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/1_sort_read_names.bam has changed
Binary file gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/name.sort.expected.bam has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/name.sort.expected.sam	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,28 @@
+@HD	VN:1.4	SO:queryname
+@SQ	SN:insert	LN:599
+@SQ	SN:ref1	LN:45
+@SQ	SN:ref2	LN:40
+@SQ	SN:ref3	LN:4
+@RG	ID:fish	PG:donkey
+@RG	ID:cow	PU:13_&^&&*(:332
+@RG	PU:*9u8jkjjkjd:	ID:colt
+@PG	ID:bull	PP:donkey
+@PG	ID:donkey
+@PG	ID:moose
+@PG	PP:moose	ID:cow
+@CO	
+r000	99	insert	50	30	10M	=	80	30	ATTTAGCTAC	AAAAAAAAAA	RG:Z:cow	PG:Z:bull
+r000	211	insert	80	30	10M	=	50	-30	CCCAATCATT	AAAAAAAAAA	RG:Z:cow	PG:Z:bull
+r001	83	ref1	37	30	9M	=	7	-39	CAGCGCCAT	*	RG:Z:fish	PG:Z:colt
+r001	163	ref1	7	30	8M4I4M1D3M	=	37	39	TTAGATAAAGAGGATACTG	*	XX:B:S,12561,2,20,112	YY:i:100	RG:Z:fish	PG:Z:colt
+r002	0	ref1	9	30	1S2I6M1P1I1P1I4M2I	*	0	0	AAAAGATAAGGGATAAA	*	XA:Z:abc	XB:i:-10	PG:Z:colt
+r003	0	ref1	9	30	5H6M	*	0	0	AGCTAA	*	RG:Z:cow
+r003	16	ref1	29	30	6H5M	*	0	0	TAGGC	*	RG:Z:cow	PG:Z:colt
+r004	0	ref1	16	30	6M14N1I5M	*	0	0	ATAGCTCTCAGC	*	RG:Z:colt	PG:Z:colt
+u1	4	*	0	30	23M	*	0	0	TAATTAAGTCTACAGAAAAAAAA	???????????????????????
+x1	0	ref2	1	30	20M	*	0	0	AGGTTTTATAAAACAAATAA	*	RG:Z:colt	PG:Z:bull
+x2	0	ref2	2	30	21M	*	0	0	GGTTTTATAAAACAAATAATT	?????????????????????	RG:Z:colt	PG:Z:bull
+x3	0	ref2	6	30	9M4I13M	*	0	0	TTATAAAACAAATAATTAAGTCTACA	??????????????????????????	RG:Z:fish	PG:Z:bull
+x4	0	ref2	10	30	25M	*	0	0	CAAATAATTAAGTCTACAGAGCAAC	?????????????????????????	RG:Z:fish	PG:Z:bull
+x5	0	ref2	12	30	24M	*	0	0	AATAATTAAGTCTACAGAGCAACT	????????????????????????	RG:Z:fish	PG:Z:bull
+x6	0	ref2	14	30	23M	*	0	0	TAATTAAGTCTACAGAGCAACTA	???????????????????????	RG:Z:cow
Binary file gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/pos.sort.expected.bam has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/pos.sort.expected.sam	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,28 @@
+@HD	VN:1.4	SO:coordinate
+@SQ	SN:insert	LN:599
+@SQ	SN:ref1	LN:45
+@SQ	SN:ref2	LN:40
+@SQ	SN:ref3	LN:4
+@RG	ID:fish	PG:donkey
+@RG	ID:cow	PU:13_&^&&*(:332
+@RG	PU:*9u8jkjjkjd:	ID:colt
+@PG	ID:bull	PP:donkey
+@PG	ID:donkey
+@PG	ID:moose
+@PG	PP:moose	ID:cow
+@CO	
+r000	99	insert	50	30	10M	=	80	30	ATTTAGCTAC	AAAAAAAAAA	RG:Z:cow	PG:Z:bull
+r000	211	insert	80	30	10M	=	50	-30	CCCAATCATT	AAAAAAAAAA	RG:Z:cow	PG:Z:bull
+r001	163	ref1	7	30	8M4I4M1D3M	=	37	39	TTAGATAAAGAGGATACTG	*	XX:B:S,12561,2,20,112	YY:i:100	RG:Z:fish	PG:Z:colt
+r002	0	ref1	9	30	1S2I6M1P1I1P1I4M2I	*	0	0	AAAAGATAAGGGATAAA	*	XA:Z:abc	XB:i:-10	PG:Z:colt
+r003	0	ref1	9	30	5H6M	*	0	0	AGCTAA	*	RG:Z:cow
+r004	0	ref1	16	30	6M14N1I5M	*	0	0	ATAGCTCTCAGC	*	RG:Z:colt	PG:Z:colt
+r003	16	ref1	29	30	6H5M	*	0	0	TAGGC	*	RG:Z:cow	PG:Z:colt
+r001	83	ref1	37	30	9M	=	7	-39	CAGCGCCAT	*	RG:Z:fish	PG:Z:colt
+x1	0	ref2	1	30	20M	*	0	0	AGGTTTTATAAAACAAATAA	*	RG:Z:colt	PG:Z:bull
+x2	0	ref2	2	30	21M	*	0	0	GGTTTTATAAAACAAATAATT	?????????????????????	RG:Z:colt	PG:Z:bull
+x3	0	ref2	6	30	9M4I13M	*	0	0	TTATAAAACAAATAATTAAGTCTACA	??????????????????????????	RG:Z:fish	PG:Z:bull
+x4	0	ref2	10	30	25M	*	0	0	CAAATAATTAAGTCTACAGAGCAAC	?????????????????????????	RG:Z:fish	PG:Z:bull
+x5	0	ref2	12	30	24M	*	0	0	AATAATTAAGTCTACAGAGCAACT	????????????????????????	RG:Z:fish	PG:Z:bull
+x6	0	ref2	14	30	23M	*	0	0	TAATTAAGTCTACAGAGCAACTA	???????????????????????	RG:Z:cow
+u1	4	*	0	30	23M	*	0	0	TAATTAAGTCTACAGAAAAAAAA	???????????????????????
Binary file gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/tag.as.sort.expected.bam has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/tag.as.sort.expected.sam	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,24 @@
+@HD	VN:1.4	SO:unknown
+@SQ	SN:insert	LN:599
+@SQ	SN:ref1	LN:45
+@SQ	SN:ref2	LN:40
+@SQ	SN:ref3	LN:4
+@PG	ID:llama
+@RG	ID:fish	PG:llama
+@RG	ID:cow	PU:13_&^&&*(:332	PG:donkey
+@RG	PU:*9u8jkjjkjd:	ID:colt
+@PG	ID:bull	PP:donkey
+@PG	ID:donkey
+@CO	Do you know?
+r006	16	ref1	29	30	6H5M	*	0	0	TAGGC	*	RG:Z:colt	PG:Z:donkey	FI:i:3
+x11	0	ref2	12	30	24M	*	0	0	AATAATTAAGTCTACAGAGCAACT	????????????????????????	RG:Z:cow	PG:Z:bull	FI:Z:a
+r007	0	ref1	16	30	6M14N1I5M	*	0	0	ATAGCTCTCAGC	*	RG:Z:colt	PG:Z:donkey	AS:i:-5	FI:f:3.5
+x10	0	ref2	10	30	25M	*	0	0	CAAATAATTAAGTCTACAGAGCAAC	?????????????????????????	RG:Z:cow	PG:Z:bull	AS:i:0	FI:A:b
+r007	0	ref1	9	30	5H6M	*	0	0	AGCTAA	*	RG:Z:colt	PG:Z:donkey	AS:i:1	FI:i:4
+r005	163	ref1	7	30	8M4I4M1D3M	=	37	39	TTAGATAAAGAGGATACTG	*	XX:B:S,12561,2,20,112	YY:i:100	RG:Z:colt	PG:Z:donkey	AS:i:10	FI:i:5
+x8	0	ref2	2	30	21M	*	0	0	GGTTTTATAAAACAAATAATT	?????????????????????	RG:Z:cow	PG:Z:bull	AS:i:10	FI:f:1.5
+r006	0	ref1	9	30	1S2I6M1P1I1P1I4M2I	*	0	0	AAAAGATAAGGGATAAA	*	XA:Z:abc	XB:i:-10	RG:Z:colt	PG:Z:donkey	AS:i:20	FI:f:4.5
+x9	0	ref2	6	30	9M4I13M	*	0	0	TTATAAAACAAATAATTAAGTCTACA	??????????????????????????	RG:Z:cow	PG:Z:bull	AS:i:20	FI:i:1
+x7	0	ref2	1	30	20M	*	0	0	AGGTTTTATAAAACAAATAA	*	RG:Z:cow	PG:Z:bull	AS:i:50	FI:i:2
+r005	83	ref1	37	30	9M	=	7	-39	CAGCGCCAT	*	RG:Z:colt	PG:Z:donkey	AS:i:100	FI:f:2.5
+x12	0	ref2	14	30	23M	*	0	0	TAATTAAGTCTACAGAGCAACTA	???????????????????????	RG:Z:cow	PG:Z:bull	AS:i:65100
Binary file gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/tag.fi.sort.expected.bam has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/tag.fi.sort.expected.sam	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,24 @@
+@HD	VN:1.4	SO:unknown
+@SQ	SN:insert	LN:599
+@SQ	SN:ref1	LN:45
+@SQ	SN:ref2	LN:40
+@SQ	SN:ref3	LN:4
+@PG	ID:llama
+@RG	ID:fish	PG:llama
+@RG	ID:cow	PU:13_&^&&*(:332	PG:donkey
+@RG	PU:*9u8jkjjkjd:	ID:colt
+@PG	ID:bull	PP:donkey
+@PG	ID:donkey
+@CO	Do you know?
+x12	0	ref2	14	30	23M	*	0	0	TAATTAAGTCTACAGAGCAACTA	???????????????????????	RG:Z:cow	PG:Z:bull	AS:i:65100
+x10	0	ref2	10	30	25M	*	0	0	CAAATAATTAAGTCTACAGAGCAAC	?????????????????????????	RG:Z:cow	PG:Z:bull	AS:i:0	FI:A:b
+x11	0	ref2	12	30	24M	*	0	0	AATAATTAAGTCTACAGAGCAACT	????????????????????????	RG:Z:cow	PG:Z:bull	FI:Z:a
+x9	0	ref2	6	30	9M4I13M	*	0	0	TTATAAAACAAATAATTAAGTCTACA	??????????????????????????	RG:Z:cow	PG:Z:bull	AS:i:20	FI:i:1
+x8	0	ref2	2	30	21M	*	0	0	GGTTTTATAAAACAAATAATT	?????????????????????	RG:Z:cow	PG:Z:bull	AS:i:10	FI:f:1.5
+x7	0	ref2	1	30	20M	*	0	0	AGGTTTTATAAAACAAATAA	*	RG:Z:cow	PG:Z:bull	AS:i:50	FI:i:2
+r005	83	ref1	37	30	9M	=	7	-39	CAGCGCCAT	*	RG:Z:colt	PG:Z:donkey	AS:i:100	FI:f:2.5
+r006	16	ref1	29	30	6H5M	*	0	0	TAGGC	*	RG:Z:colt	PG:Z:donkey	FI:i:3
+r007	0	ref1	16	30	6M14N1I5M	*	0	0	ATAGCTCTCAGC	*	RG:Z:colt	PG:Z:donkey	AS:i:-5	FI:f:3.5
+r007	0	ref1	9	30	5H6M	*	0	0	AGCTAA	*	RG:Z:colt	PG:Z:donkey	AS:i:1	FI:i:4
+r006	0	ref1	9	30	1S2I6M1P1I1P1I4M2I	*	0	0	AAAAGATAAGGGATAAA	*	XA:Z:abc	XB:i:-10	RG:Z:colt	PG:Z:donkey	AS:i:20	FI:f:4.5
+r005	163	ref1	7	30	8M4I4M1D3M	=	37	39	TTAGATAAAGAGGATACTG	*	XX:B:S,12561,2,20,112	YY:i:100	RG:Z:colt	PG:Z:donkey	AS:i:10	FI:i:5
Binary file gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/tag.rg.n.sort.expected.bam has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/tag.rg.n.sort.expected.sam	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,28 @@
+@HD	VN:1.4	SO:unknown
+@SQ	SN:insert	LN:599
+@SQ	SN:ref1	LN:45
+@SQ	SN:ref2	LN:40
+@SQ	SN:ref3	LN:4
+@RG	ID:fish	PG:donkey
+@RG	ID:cow	PU:13_&^&&*(:332
+@RG	PU:*9u8jkjjkjd:	ID:colt
+@PG	ID:bull	PP:donkey
+@PG	ID:donkey
+@PG	ID:moose
+@PG	PP:moose	ID:cow
+@CO	
+r002	0	ref1	9	30	1S2I6M1P1I1P1I4M2I	*	0	0	AAAAGATAAGGGATAAA	*	XA:Z:abc	XB:i:-10	PG:Z:colt
+u1	4	*	0	30	23M	*	0	0	TAATTAAGTCTACAGAAAAAAAA	???????????????????????
+r004	0	ref1	16	30	6M14N1I5M	*	0	0	ATAGCTCTCAGC	*	RG:Z:colt	PG:Z:colt
+x1	0	ref2	1	30	20M	*	0	0	AGGTTTTATAAAACAAATAA	*	RG:Z:colt	PG:Z:bull
+x2	0	ref2	2	30	21M	*	0	0	GGTTTTATAAAACAAATAATT	?????????????????????	RG:Z:colt	PG:Z:bull
+r000	99	insert	50	30	10M	=	80	30	ATTTAGCTAC	AAAAAAAAAA	RG:Z:cow	PG:Z:bull
+r000	211	insert	80	30	10M	=	50	-30	CCCAATCATT	AAAAAAAAAA	RG:Z:cow	PG:Z:bull
+r003	0	ref1	9	30	5H6M	*	0	0	AGCTAA	*	RG:Z:cow
+r003	16	ref1	29	30	6H5M	*	0	0	TAGGC	*	RG:Z:cow	PG:Z:colt
+x6	0	ref2	14	30	23M	*	0	0	TAATTAAGTCTACAGAGCAACTA	???????????????????????	RG:Z:cow
+r001	83	ref1	37	30	9M	=	7	-39	CAGCGCCAT	*	RG:Z:fish	PG:Z:colt
+r001	163	ref1	7	30	8M4I4M1D3M	=	37	39	TTAGATAAAGAGGATACTG	*	XX:B:S,12561,2,20,112	YY:i:100	RG:Z:fish	PG:Z:colt
+x3	0	ref2	6	30	9M4I13M	*	0	0	TTATAAAACAAATAATTAAGTCTACA	??????????????????????????	RG:Z:fish	PG:Z:bull
+x4	0	ref2	10	30	25M	*	0	0	CAAATAATTAAGTCTACAGAGCAAC	?????????????????????????	RG:Z:fish	PG:Z:bull
+x5	0	ref2	12	30	24M	*	0	0	AATAATTAAGTCTACAGAGCAACT	????????????????????????	RG:Z:fish	PG:Z:bull
Binary file gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/tag.rg.sort.expected.bam has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/tag.rg.sort.expected.sam	Fri Sep 13 03:12:53 2019 -0400
@@ -0,0 +1,28 @@
+@HD	VN:1.4	SO:unknown
+@SQ	SN:insert	LN:599
+@SQ	SN:ref1	LN:45
+@SQ	SN:ref2	LN:40
+@SQ	SN:ref3	LN:4
+@RG	ID:fish	PG:donkey
+@RG	ID:cow	PU:13_&^&&*(:332
+@RG	PU:*9u8jkjjkjd:	ID:colt
+@PG	ID:bull	PP:donkey
+@PG	ID:donkey
+@PG	ID:moose
+@PG	PP:moose	ID:cow
+@CO	
+r002	0	ref1	9	30	1S2I6M1P1I1P1I4M2I	*	0	0	AAAAGATAAGGGATAAA	*	XA:Z:abc	XB:i:-10	PG:Z:colt
+u1	4	*	0	30	23M	*	0	0	TAATTAAGTCTACAGAAAAAAAA	???????????????????????
+r004	0	ref1	16	30	6M14N1I5M	*	0	0	ATAGCTCTCAGC	*	RG:Z:colt	PG:Z:colt
+x1	0	ref2	1	30	20M	*	0	0	AGGTTTTATAAAACAAATAA	*	RG:Z:colt	PG:Z:bull
+x2	0	ref2	2	30	21M	*	0	0	GGTTTTATAAAACAAATAATT	?????????????????????	RG:Z:colt	PG:Z:bull
+r000	99	insert	50	30	10M	=	80	30	ATTTAGCTAC	AAAAAAAAAA	RG:Z:cow	PG:Z:bull
+r000	211	insert	80	30	10M	=	50	-30	CCCAATCATT	AAAAAAAAAA	RG:Z:cow	PG:Z:bull
+r003	0	ref1	9	30	5H6M	*	0	0	AGCTAA	*	RG:Z:cow
+r003	16	ref1	29	30	6H5M	*	0	0	TAGGC	*	RG:Z:cow	PG:Z:colt
+x6	0	ref2	14	30	23M	*	0	0	TAATTAAGTCTACAGAGCAACTA	???????????????????????	RG:Z:cow
+r001	163	ref1	7	30	8M4I4M1D3M	=	37	39	TTAGATAAAGAGGATACTG	*	XX:B:S,12561,2,20,112	YY:i:100	RG:Z:fish	PG:Z:colt
+r001	83	ref1	37	30	9M	=	7	-39	CAGCGCCAT	*	RG:Z:fish	PG:Z:colt
+x3	0	ref2	6	30	9M4I13M	*	0	0	TTATAAAACAAATAATTAAGTCTACA	??????????????????????????	RG:Z:fish	PG:Z:bull
+x4	0	ref2	10	30	25M	*	0	0	CAAATAATTAAGTCTACAGAGCAAC	?????????????????????????	RG:Z:fish	PG:Z:bull
+x5	0	ref2	12	30	24M	*	0	0	AATAATTAAGTCTACAGAGCAACT	????????????????????????	RG:Z:fish	PG:Z:bull
Binary file gv/samtools_sort/e613c1ad4c4c/samtools_sort/test-data/test_input_1_a.bam has changed