changeset 7:b01db2684fa5 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/samtools/samtools_view commit 6692949aa694102abb64c67d46196a822fcb61bf"
author iuc
date Tue, 21 Jan 2020 07:40:18 -0500
parents ff313de5f7f4
children bf328cec6a42
files macros.xml samtools_view.xml test-data/test.bed
diffstat 3 files changed, 618 insertions(+), 304 deletions(-) [+]
line wrap: on
line diff
--- a/macros.xml	Thu Oct 17 02:25:30 2019 -0400
+++ b/macros.xml	Tue Jan 21 07:40:18 2020 -0500
@@ -77,18 +77,18 @@
        <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>
+        <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 is mapped to the reverse strand of the reference</option>
+        <option value="32">Mate is mapped to the reverse strand of the reference</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 of the 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">Alignment is supplementary</option>
     </xml>
 
     <!-- region specification macros and tokens for tools that allow the specification 
--- a/samtools_view.xml	Thu Oct 17 02:25:30 2019 -0400
+++ b/samtools_view.xml	Tue Jan 21 07:40:18 2020 -0500
@@ -1,7 +1,42 @@
-<tool id="samtools_view" name="Samtools view" version="@TOOL_VERSION@">
-    <description>reformat, filter, or subsample</description>
+<tool id="samtools_view" name="Samtools view" version="@TOOL_VERSION@+galaxy1">
+    <description>- reformat, filter, or subsample SAM, BAM or CRAM</description>
     <macros>
-    <import>macros.xml</import>
+        <import>macros.xml</import>
+        <token name="@REF_DATA@">
+            ## additional reference data
+            #if $reffa!=None:
+                -T '$reffa'
+                -t '$reffai'
+            #end if
+        </token>
+        <xml name="read_output_formatting">
+            <yield />
+            <section name="adv_output" title="Read Reformatting Options" expanded="false">
+                <repeat name="readtags" title="Strip read tags from output">
+                    <param name="readtag" type="text" argument="-x" label="Read tag to strip" help="Read tag to exclude from output."/>
+                </repeat>
+                <param name="collapsecigar" type="boolean" argument="-B" truevalue="-B" falsevalue="" checked="false" label="Collapse backward CIGAR operation" help="Collapse the backward CIGAR operation." />
+            </section>
+        </xml>
+        <xml name="output_format_selector">
+            <conditional name="output_format">
+                <param name="oformat" type="select" label="Output format">
+                    <option value="sam">SAM</option>
+                    <option value="bam" selected="True">BAM (-b)</option>
+                    <option value="cram">CRAM (-C)</option>
+                </param>
+                <when value="sam">
+                    <yield />
+                    <param name="fmtopt" type="hidden" value="" />
+                </when>
+                <when value="bam">
+                    <param name="fmtopt" type="hidden" value="-b" />
+                </when>
+                <when value="cram">
+                    <param name="fmtopt" type="hidden" value="-C" />
+                </when>
+            </conditional>
+        </xml>
     </macros>
     <expand macro="requirements">
         <requirement type="package">gawk</requirement>
@@ -13,206 +48,308 @@
         ## prepare reference data
         @PREPARE_FASTA_IDX@
         @PREPARE_IDX@
-        #if $cond_subsample.select_subsample == 'target':
-            ##this must be done before the main command because we don't know the total # reads until execution time
-            #if str($cond_subsample.seed) == '':
-                #set seed_expr="int(rand() * 32768)"
-            #else
-                #set seed_expr=$cond_subsample.seed
-            #end if
-            #if $input.is_of_type('sam'):
-                sample_fragment=`samtools view -c infile | awk '{s=\$1} END {frac=$cond_subsample.target/s; print(frac < 1 ? "-s "  $seed_expr+frac : "")}'` &&
-            #else
-                sample_fragment=`samtools idxstats infile | awk '{s+=\$4+\$3} END {frac=$cond_subsample.target/s; print(frac < 1 ? "-s " $seed_expr+frac : "")}'` &&
-            #end if
-        #end if
-        ##call samtools view
-        samtools view
-        -@ \$addthreads
 
-        #if $outtype == 'count':
-            -c
-        #elif $outtype == 'bam':
-            -b
-        #elif $outtype == 'cram':
-            -C
-        #end if
-
-        ## filter options (regions filter is the last parameter)
-        #if $cond_filter.select_filter == 'yes':
-            #if $cond_filter.cond_region.select_region == 'bed' and str( $cond_filter.cond_region.bedfile ) != 'None'
-                -L '$cond_filter.cond_region.bedfile'
-            #end if
-            #if $cond_filter.cond_rg.select_rg == 'text':
-                -r '$cond_filter.cond_rg.readgr'
-            #else if $cond_filter.cond_rg.select_rg == 'file':
-                -R '$cond_filter.cond_rg.rgfile'
+        #if str($mode.outtype) == 'header':
+            ## call samtools view and be done
+            samtools view
+            -H ${mode.output_options.output_format.fmtopt} -o outfile
+            @REF_DATA@
+            infile
+        #else:
+            ## are filtering and/or subsampling in effect?
+            #set $with_filtering = False
+            #set $with_subsampling = False
+            #if str($mode.outtype) == 'selected_reads':
+                #set $with_filtering = True
+                #if str($mode.subsample_config.subsampling_mode.select_subsample) != 'fraction' or $mode.subsample_config.subsampling_mode.factor > 1:
+                    #set $with_subsampling = True
+                #end if
             #end if
-            #if str($cond_filter.quality) != '' and int( $cond_filter.quality ) > 0
-                -q $cond_filter.quality
-            #end if
-            #if str( $cond_filter.library ) != ''
-                -l '$cond_filter.library'
-            #end if
-            #if str( $cond_filter.cigarcons ) != ''
-                -m $cond_filter.cigarcons
-            #end if
-            #if str($cond_filter.inclusive_filter) != 'None':
-                #set $filter = $cond_filter.inclusive_filter
-                @FLAGS@
-                -f $flags
-            #end if
-            #if str($cond_filter.exclusive_filter) != 'None':
-                #set $filter = $cond_filter.exclusive_filter
-                @FLAGS@
-                -F $flags
-            #end if
-            #if str($cond_filter.exclusive_filter_all) != 'None':
-                #set $filter = $cond_filter.exclusive_filter_all
-                @FLAGS@
-                -G $flags
-            #end if
-            #for $i, $s in enumerate($cond_filter.readtags)
-                -x '${s.readtag}'
-            #end for
-        #end if
-        #if $cond_subsample.select_subsample != 'no':
-            #if $cond_subsample.select_subsample == "target":
-                ##this is calculated at execution time before the main samtools command
-                "\${sample_fragment}"
-            #else
-                #set fraction=str($cond_subsample.fraction).split('.')[1]
-                #if  str($cond_subsample.seed) == '':
-                    -s "\${RANDOM}".$fraction
-                #else
-                    -s $cond_subsample.seed.$fraction
+
+            ## are we producing one or two outputs?
+            #if str($mode.outtype) == 'selected_reads' and str($mode.output_options.reads_report_type) != 'count' and str($mode.output_options.complementary_output) == 'yes':
+                #set $with_non_selected_reads_output = True
+            #else:
+                #set $with_non_selected_reads_output = False
+	    #end if
+
+            #set $std_filters = ''
+            #set $reg_filters = ''
+            #if $with_filtering:
+                ## build string of all user-configured filter options
+                #if str($mode.filter_config.cond_region.select_region) == 'bed':
+                    #set std_filters = $std_filters + " -L '%s'" % str($mode.filter_config.cond_region.bedfile)
+                #elif str($mode.filter_config.cond_region.select_region) == 'text':
+                    #set $reg_filters = "'%s'" % str($mode.filter_config.cond_region.regions).strip()
+                #end if
+
+               #if $mode.filter_config.cond_rg.select_rg == 'text':
+                    #set $std_filters = $std_filters + " -r '%s'" % str($mode.filter_config.cond_rg.readgr)
+                #else if $mode.filter_config.cond_rg.select_rg == 'file':
+                    #set $std_filters = $std_filters + " -R '%s'" % str($mode.filter_config.cond_rg.rgfile)
+                #end if
+                #if str($mode.filter_config.quality) != '' and int($mode.filter_config.quality) > 0:
+                    #set $std_filters = $std_filters + " -q %s" % str($mode.filter_config.quality)
+                #end if
+                #if str($mode.filter_config.library):
+                    #set $std_filters = $std_filters + " -l '%s'" % str($mode.filter_config.library)
+                #end if
+                #if str($mode.filter_config.cigarcons):
+                    #set $std_filters = $std_filters + " -m %s" % str($mode.filter_config.cigarcons)
+                #end if
+                #if str($mode.filter_config.inclusive_filter) != 'None':
+                    #set $filter = str($mode.filter_config.inclusive_filter)
+                    @FLAGS@
+                    #set $std_filters = $std_filters + " -f %s" % str($flags)
+                #end if
+                #if str($mode.filter_config.exclusive_filter) != 'None':
+                    #set $filter = str($mode.filter_config.exclusive_filter)
+                    @FLAGS@
+                    #set $std_filters = $std_filters + " -F %s" % str($flags)
+                #end if
+                #if str($mode.filter_config.exclusive_filter_all) != 'None':
+                    #set $filter = str($mode.filter_config.exclusive_filter_all)
+                    @FLAGS@
+                    #set $std_filters = $std_filters + " -G %s" % str($flags)
                 #end if
             #end if
-        #end if
 
-        ## output options
-        $adv_output.header
-        $adv_output.collapsecigar
-        #if $adv_output.outputpassing == 'yes'
-            -U inv_outfile
-        #end if
-        -o outfile
+            #if $with_subsampling:
+                ## handle seed and fraction calculation for subsampling
+                #import random
+                #if str($mode.subsample_config.subsampling_mode.seed):
+                    #set $seed = int($mode.subsample_config.subsampling_mode.seed)
+                #else:
+                    #set $seed = random.randrange(32768)
+                #end if
 
-        ## additional reference data
-        #if $reffa!=None:
-            -T '$reffa'
-            -t '$reffai'
-        #end if
+                #if $mode.subsample_config.subsampling_mode.select_subsample == 'target':
+                    ##this must be done before the main command because we don't know the total # reads until execution time
+                    #if $input.is_of_type('sam') or $std_filters or $reg_filters:
+                        ## There is no index or we cannot use it because we are
+                        ## not dealing with all of the reads in the indexed
+                        ## file. We have to do an extra pass over the input to
+                        ## count the reads to subsample.
+                        sample_fragment=`samtools view -c $std_filters infile $reg_filters | awk '{s=\$1} END {frac=${mode.subsample_config.subsampling_mode.target}/s; print(frac < 1 ? $seed+frac : ".0")}'` &&
+                    #else:
+                        ## We can get the count of reads to subsample using
+                        ## an inexpensive call to idxstats.
+                        sample_fragment=`samtools idxstats infile | awk '{s+=\$4+\$3} END {frac=${mode.subsample_config.subsampling_mode.target}/s; print(frac < 1 ? $seed+frac : ".0")}'` &&
+                    #end if
+                #end if
+            #end if
 
-        ##currently reference based CRAM is disabled (see https://github.com/galaxyproject/tools-iuc/pull/1963)
-        #if $outtype=='cram':
-            --output-fmt-option no_ref
-        #end if
+            ## call samtools view
+            samtools view
+            -@ \$addthreads
+
+            #if str($mode.output_options.reads_report_type) == 'count':
+                -c
+            #else:
+                ${mode.output_options.output_format.fmtopt}
+            #end if
+
+            ## filter options (except regions filter, which is the last parameter)
+            $std_filters
+
+            #if $with_subsampling:
+                #if str($mode.subsample_config.subsampling_mode.select_subsample) == "target":
+                    ##this is calculated at execution time before the main samtools command
+                    -s \${sample_fragment}
+                #else:
+                    #set $fraction = $seed + 1 / float($mode.subsample_config.subsampling_mode.factor)
+                    -s $fraction
+                #end if
+            #end if
 
-        infile
-        
-        ## region filter need to be at the end
-        #if $cond_filter.select_filter == 'yes' and $cond_filter.cond_region.select_region == 'text':
-            '$cond_filter.cond_region.regions'
-        #end if
+            ## output options
+            #if str($mode.output_options.reads_report_type) == 'count':
+                -o outfile
+            #else:
+                ## output options
+                #if str($mode.output_options.output_format.oformat) == 'sam':
+                    ${mode.output_options.output_format.with_header}
+                #end if
+                ${mode.output_options.adv_output.collapsecigar}
+                #for $s in $mode.output_options.adv_output.readtags:
+                    -x '${s.readtag}'
+                #end for
+                #if str($mode.output_options.reads_report_type) == 'retained'
+                    -o outfile
+                    #if $with_non_selected_reads_output:
+                        -U inv_outfile
+                    #end if
+                #else:
+                    -U outfile
+                    #if $with_non_selected_reads_output:
+                        -o inv_outfile
+                    #else:
+                        -o /dev/null
+                    #end if
+                #end if
 
-        ## if data is converted from an unsorted file (SAM, CRAM, or unsorted BAM) to BAM
-        ## then sort the output by coordinate, 
-        #if not $input.is_of_type('bam') and $outtype == 'bam':
-            && samtools sort
-                -@ \$addthreads -m \${GALAXY_MEMORY_MB:-768}M -T "\${TMPDIR:-.}"
-                -O bam
-                -o 'tmpsam'
-                outfile
-                && mv tmpsam outfile
-            #if $adv_output.outputpassing == 'yes':
-                && samtools sort
-                    -@ \$addthreads -m \${GALAXY_MEMORY_MB:-768}M -T "\${TMPDIR:-.}"
-                    -O bam
-                    -o 'tmpsam'
-                    inv_outfile
-                && mv tmpsam inv_outfile
+                ##currently reference based CRAM is disabled (see https://github.com/galaxyproject/tools-iuc/pull/1963)
+                #if $mode.output_options.output_format.oformat == 'cram':
+                    --output-fmt-option no_ref
+                #end if
             #end if
+
+            @REF_DATA@
+
+            infile
+
+            ## region filter needs to be at the end
+            $reg_filters
+
+            #if str($mode.output_options.reads_report_type) != 'count':
+                ## if data is converted from an unsorted file (SAM, CRAM, or unsorted BAM) to BAM
+                ## then sort the output by coordinate,
+                #if not $input.is_of_type('bam') and str($mode.output_options.output_format.oformat) == 'bam':
+                    && samtools sort
+                        -@ \$addthreads -m \${GALAXY_MEMORY_MB:-768}M -T "\${TMPDIR:-.}"
+                        -O bam
+                        -o tmpsam
+                        outfile
+                        && mv tmpsam outfile
+                    #if $with_non_selected_reads_output:
+                        && samtools sort
+                            -@ \$addthreads -m \${GALAXY_MEMORY_MB:-768}M -T "\${TMPDIR:-.}"
+                            -O bam
+                            -o tmpsam
+                            inv_outfile
+                        && mv tmpsam inv_outfile
+                    #end if
+                #end if
+            #end if
+
+            ##end of reads and count-specific section
         #end if
     ]]></command>
     <inputs>
         <!-- note unsorted bam includes all derived bam types (inlcuding bam which is sorted) -->
         <param name="input" format="sam,unsorted.bam,cram" type="data" label="SAM/BAM/CRAM data set" />
-        <param name="outtype" type="select" argument="-b/-C/-c" label="Output type">
-            <help>Select output type. In case of counts only the total number of alignments is returned. All filters are taken into account</help>
-            <option value="sam">SAM</option>
-            <option value="bam">BAM (-b)</option>
-            <option value="cram">CRAM (-C)</option>
-            <option value="count">Count of alignments (-c)</option>
-        </param>
-        <conditional name="cond_filter">
-            <param name="select_filter" type="select" label="Filter alignment">
-                <option value="yes">Yes</option>
-                <option value="no" selected="True">No</option>
+        <conditional name="mode">
+            <param name="outtype" type="select" label="What would you like to look at?">
+                <option value="all_reads">All reads in the input dataset</option>
+                <option value="selected_reads">A filtered/subsampled selection of reads</option>
+                <option value="header">Just the input header (-H)</option>
             </param>
-            <when value="yes">
-                <conditional name="cond_region">
-                    <param name="select_region" type="select" label="Filter by regions">
-                        <option value="no" selected="True">No</option>
-                        <option value="text">Manualy specify regions</option>
-                        <option value="bed">Regions from BED file</option>
+            <when value="all_reads">
+                <conditional name="output_options">
+                    <param name="reads_report_type" type="select" label="What would you like to have reported?">
+                        <option value="retained">The actual reads</option>
+                        <option value="count">The count of reads (-c)</option>
+                    </param>
+                    <when value="retained">
+                        <expand macro="read_output_formatting" />
+                        <expand macro="output_format_selector">
+                            <param name="with_header" type="boolean" truevalue="-h" falsevalue="" checked="True"
+                            label="Include SAM header in the output?" />
+                        </expand>
+                    </when>
+                    <when value="count" />
+                </conditional>
+            </when>
+            <when value="selected_reads">
+                <section name="filter_config" title="Configure filters" expanded="false">
+                    <conditional name="cond_region">
+                        <param name="select_region" type="select" label="Filter by regions">
+                            <option value="no" selected="True">No</option>
+                            <option value="text">Manualy specify regions</option>
+                            <option value="bed">Regions from BED file</option>
+                        </param>
+                        <when value="no"/>
+                        <when value="text">
+                            <param name="regions" type="text" optional="false" label="Filter by regions" help="One or more space-separated region specifications to restrict output to only those alignments which overlap the specified region(s)."/>
+                        </when>
+                        <when value="bed">
+                            <param name="bedfile" format="bed" argument="-L" optional="false" type="data" label="Filter by intervals in a bed file" help="Only output alignments overlapping the intervals in the input bed file." />
+                        </when>
+                    </conditional>
+                    <conditional name="cond_rg">
+                        <param name="select_rg" type="select" label="Filter by readgroup">
+                            <option value="no" selected="True">No</option>
+                            <option value="text">Single read group </option>
+                            <option value="file">Read groups from file</option>
+                        </param>
+                        <when value="no"/>
+                        <when value="text">
+                            <param name="readgr" type="text" argument="-r" label="Filter by read group" help="Only output alignments in read group." />
+                        </when>
+                        <when value="file">
+                            <param name="rgfile" type="data" format="tabular" argument="-R" label="Filter by read groups in file" help="Output alignments in read groups listed in FILE." />
+                        </when>
+                    </conditional>
+                    <param name="quality" type="integer" argument="-q" optional="true" min="0" label="Filter by quality" help="Skip alignments with MAPQ smaller than INT." />
+                    <param name="library" type="text" argument="-l" optional="true" label="Filter by library" help="Only output alignments in library STR" />
+                    <param name="cigarcons" type="integer" argument="-m" optional="true" min="0" label="Filter by number of CIGAR bases consuming query sequence" help="Only output alignments with number of CIGAR bases consuming query sequence greater than or equal INT." />
+                    <param name="inclusive_filter" argument="-f" type="select" multiple="True" label="Require that these flags are set">
+                        <expand macro="flag_options" />
+                    </param>
+                    <param name="exclusive_filter" argument="-F" type="select" multiple="True" label="Exclude reads with any of the following flags set">
+                        <expand macro="flag_options" />
                     </param>
-                    <when value="no"/>
-                    <when value="text">
-                        <param name="regions" type="text" optional="false" label="Filter by regions" help="One or more space-separated region specifications to restrict output to only those alignments which overlap the specified region(s)."/>
+                    <param name="exclusive_filter_all" argument="-G" type="select" multiple="True" label="Exclude reads with all of the following flags set">
+                        <expand macro="flag_options" />
+                    </param>
+                </section>
+                <section name="subsample_config" title="Configure subsampling" expanded="false">
+                    <conditional name="subsampling_mode">
+                        <param name="select_subsample" type="select" argument="-s" label="Subsample alignment">
+                            <option value="fraction">Specify a downsampling factor</option>
+                            <option value="target">Specify a target # of reads</option>
+                        </param>
+                        <when value="fraction">
+                            <param name="factor" type="float" optional="False" value="1" min="1" label="Downsampling factor" help="The factor by which to downsample the input reads. A fraction of approx. 1/factor of the reads will be kept (default: 1 = no downsampling)." />
+                            <expand macro="seed_input" />
+                        </when>
+                        <when value="target">
+                            <param name="target" type="integer" optional="False" min="0" value="" label="Target # of reads" help="Sets the approx. target number of reads to subsample." />
+                            <expand macro="seed_input" />
+                        </when>
+                    </conditional>
+                </section>
+                <conditional name="output_options">
+                    <param name="reads_report_type" type="select"
+                    label="What would you like to have reported?"
+                    help="Hint: To invert all of the filtering/subsampling logic configured above, choose 'Reads dropped during filtering and subsampling'.">
+                        <option value="retained">All reads retained after filtering and subsampling</option>
+                        <option value="dropped">Reads dropped during filtering and subsampling</option>
+                        <option value="count">The count of retained reads (-c)</option>
+                    </param>
+                    <when value="retained">
+                        <expand macro="read_output_formatting">
+                            <param name="complementary_output" type="boolean" truevalue="yes" falsevalue="no" checked="false"
+                            label="Produce extra dataset with dropped reads?" />
+                        </expand>
+                        <expand macro="output_format_selector">
+                            <param name="with_header" type="boolean" truevalue="-h" falsevalue="" checked="True"
+                            label="Include SAM header in the output?" />
+                        </expand>
                     </when>
-                    <when value="bed">
-                        <param name="bedfile" format="bed" argument="-L" optional="false" type="data" label="Filter by intervals in a bed file" help="Only output alignments overlapping the intervals in the input bed file." />
+                    <when value="dropped">
+                        <expand macro="read_output_formatting">
+                            <param name="complementary_output" type="boolean" truevalue="yes" falsevalue="no" checked="false"
+                            label="Produce extra dataset with retained reads?" />
+                        </expand>
+                        <expand macro="output_format_selector">
+                            <param name="with_header" type="boolean" truevalue="-h" falsevalue="" checked="True"
+                            label="Include SAM header in the output?" />
+                        </expand>
+                    </when>
+                    <when value="count" />
+                </conditional>
+            </when>
+            <when value="header">
+                <conditional name="output_options">
+                    <param name="reads_report_type" type="select" label="What would you like to have reported?">
+                        <option value="">The header in ...</option>
+                    </param>
+                    <when value="">
+                        <expand macro="output_format_selector" />
                     </when>
                 </conditional>
-                <conditional name="cond_rg">
-                    <param name="select_rg" type="select" label="Filter by readgroup">
-                        <option value="no" selected="True">No</option>
-                        <option value="text">Single read group </option>
-                        <option value="file">Read groups from file</option>
-                    </param>
-                    <when value="no"/>
-                    <when value="text">
-                        <param name="readgr" type="text" argument="-r" label="Filter by read group" help="Only output alignments in read group." />
-                    </when>
-                    <when value="file">
-                        <param name="rgfile" type="data" format="tabular" argument="-R" label="Filter by read groups in file" help="Output alignments in read groups listed in FILE." />
-                    </when>
-                </conditional>
-                <param name="quality" type="integer" argument="-q" optional="true" min="0" label="Filter by quality" help="Skip alignments with MAPQ smaller than INT." />
-                <param name="library" type="text" argument="-l" optional="true" label="Filter by library" help="Only output alignments in library STR" />
-                <param name="cigarcons" type="integer" argument="-m" optional="true" min="0" label="Filter by number of CIGAR bases consuming query sequence" help="Only output alignments with number of CIGAR bases consuming query sequence greater than or equal INT." />
-                <param name="inclusive_filter" argument="-f" type="select" multiple="True" label="Require that these flags are set">
-                    <expand macro="flag_options" />
-                </param>
-                <param name="exclusive_filter" argument="-F" type="select" multiple="True" label="Exclude reads with any of the following flags set">
-                    <expand macro="flag_options" />
-                </param>
-                <param name="exclusive_filter_all" argument="-G" type="select" multiple="True" label="Exclude reads with all of the following flags set">
-                    <expand macro="flag_options" />
-                </param>
-                <!-- TODO could also make this a text field (comma/space separated) -->
-                <repeat name="readtags" title="Filter by read tags">
-                    <param name="readtag" type="text" argument="-x" label="Filter by read tag" help="Read tag to exclude from output."/>
-                </repeat>
             </when>
-            <when value="no"/>
-        </conditional>
-        <conditional name="cond_subsample">
-            <param name="select_subsample" type="select" argument="-s" label="Subsample alignment">
-                <option value="fraction">Specify a fraction to keep</option>
-                <option value="target">Specify a target # of reads</option>
-                <option value="no" selected="True">No downsampling</option>
-            </param>
-            <when value="fraction">
-                <param name="fraction" type="float" optional="False" value="0.5" min="0" max="1" label="Subsampling fraction" help="sets the fraction of templates/pairs to subsample." />
-                <expand macro="seed_input" />
-            </when>
-            <when value='target'>
-                <param name="target" type="integer" optional="False" value="" min="0"  label="Target # of reads" help="sets the target number of reads to subsample." />
-                <expand macro="seed_input" />
-            </when>
-            <when value="no"/>
         </conditional>
         <conditional name="addref_cond">
             <param name="addref_select" type="select" label="Reference data">
@@ -234,53 +371,37 @@
                 </param>
             </when>
         </conditional>
-        <section name="adv_output" title="Output Options" expanded="false">
-            <param name="header" type="select" argument="-h/-H" label="Header options">
-                <option value="-h" selected="True">Include header in SAM output (-h)</option>
-                <option value="-H">Return header only (-H)</option>
-                <option value="">Exclude header</option>
-            </param>
-            <param name="outputpassing" type="boolean" argument="-U" truevalue="yes" falsevalue="no" checked="false" label="Output alignments not passing the filter" help="Write alignments that are not selected by the various filter options to an extra data set. When this option is used, all alignments (or all alignments intersecting the regions specified) are written to either the output data set or this extra output data set, but never both." />
-            <param name="collapsecigar" type="boolean" argument="-B" truevalue="-B" falsevalue="" checked="false" label="Collapse backward CIGAR operation" help="Collapse the backward CIGAR operation." />
-        </section>
     </inputs>
     <outputs>
         <!-- TODO do I need an action for dbkey? -->
         <data name="outputsam" format_source="input" from_work_dir="outfile" label="${tool.name} on ${on_string}: filtered alignments">
-            <filter>outtype != 'count'</filter>
-            <!-- TODO is change_format deprecated? how can I modify the type for the different bam types? -->
+            <filter>mode['outtype'] == 'header' or mode['output_options']['reads_report_type'] != 'count'</filter>
             <change_format>
-                <when input="outtype" value="sam" format="sam" />
-                <when input="outtype" value="bam" format="bam" />
-                <when input="outtype" value="cram" format="cram" />
+                <when input="mode.output_options.output_format.oformat" value="sam" format="sam" />
+                <when input="mode.output_options.output_format.oformat" value="bam" format="bam" />
+                <when input="mode.output_options.output_format.oformat" value="cram" format="cram" />
             </change_format>
         </data>
         <data name="invoutputsam" format_source="input" from_work_dir="inv_outfile"  label="${tool.name} on ${on_string}: unfiltered alignments">
-            <filter>adv_output['outputpassing'] == 'yes' and outtype != 'count'</filter>
+            <filter>mode['outtype'] == 'selected_reads' and mode['output_options']['reads_report_type'] != 'count' and mode['output_options']['complementary_output']</filter>
             <change_format>
-                <when input="outtype" value="sam" format="sam" />
-                <when input="outtype" value="bam" format="bam" />
-                <when input="outtype" value="cram" format="cram" />
+                <when input="mode.output_options.output_format.oformat" value="sam" format="sam" />
+                <when input="mode.output_options.output_format.oformat" value="bam" format="bam" />
+                <when input="mode.output_options.output_format.oformat" value="cram" format="cram" />
             </change_format>
         </data>
         <data name="outputcnt" format="txt" from_work_dir="outfile" label="${tool.name} on ${on_string}: Counts">
-            <filter>outtype == 'count'</filter>
+            <filter>mode['outtype'] != 'header' and mode['output_options']['reads_report_type'] == 'count'</filter>
         </data>
     </outputs>
     <tests>
         <!-- sam to bam (copied from the sam_to_bam tool) -->
         <test>
             <param name="input" ftype="sam" value="sam_to_bam_in1.sam" />
-            <param name="outtype" value="bam" />
-            <conditional name="addref_cond">
-                <param name="addref_select" value="history" />
-                <param name="ref" ftype="fasta" dbkey="equCab2" value="chr_m.fasta" />
-            </conditional>
             <output name="outputsam" ftype="bam" file="sam_to_bam_out1.bam" />
         </test>
         <test>
             <param name="input" ftype="sam" dbkey="equCab2" value="sam_to_bam_in1.sam" />
-            <param name="outtype" value="bam" />
             <conditional name="addref_cond">
                 <param name="addref_select" value="cached" />
                 <param name="ref" value="equCab2chrM" />
@@ -289,7 +410,6 @@
         </test>
         <test>
             <param name="input" ftype="sam" value="sam_to_bam_noheader_in2.sam" />
-            <param name="outtype" value="bam" />
             <conditional name="addref_cond">
                 <param name="addref_select" value="history" />
                 <param name="ref" ftype="fasta" dbkey="equCab2" value="chr_m.fasta" />
@@ -299,79 +419,141 @@
         <!-- bam to cram + region filter (adapted from bam_to_cram tool)-->
         <test>
             <param name="input" value="test.bam" ftype="bam" />
-            <param name="outtype" value="cram" />
+            <conditional name="mode">
+                <param name="outtype" value="selected_reads" />
+                <section name="filter_config">
+                    <conditional name="cond_region">
+                        <param name="select_region" value="no"/>
+                    </conditional>
+                </section>
+                <conditional name="output_options">
+                    <conditional name="output_format">
+                        <param name="oformat" value="cram" />
+                    </conditional>
+                </conditional>
+            </conditional>
             <conditional name="addref_cond">
                 <param name="addref_select" value="history" />
                 <param name="ref" value="test.fa" />
             </conditional>
-            <conditional name="cond_filter">
-                <param name="select_filter" value="yes" />
-                <conditional name="cond_region">
-                    <param name="select_region" value="no"/>
-                </conditional>
-            </conditional>
             <output name="outputsam" file="test.cram" ftype="cram" compare="sim_size" delta="250" />
         </test>
        <!-- count alignments -->
        <test>
             <param name="input" value="test.bam" ftype="bam" />
-            <param name="outtype" value="count" />
+            <conditional name="mode">
+                <param name="outtype" value="all_reads" />
+                <conditional name="output_options">
+                    <param name="reads_report_type" value="count" />
+                </conditional>
+            </conditional>
             <output name="outputcnt" file="test_counts.tab" ftype="txt" />
         </test>
         <test>
             <param name="input" value="test.sam" ftype="sam" />
-            <param name="outtype" value="cram" />
+            <conditional name="mode">
+                <param name="outtype" value="selected_reads" />
+                <section name="filter_config">
+                    <conditional name="cond_region">
+                        <param name="select_region" value="no"/>
+                    </conditional>
+                </section>
+                <conditional name="output_options">
+                    <conditional name="output_format">
+                        <param name="oformat" value="cram" />
+                    </conditional>
+                </conditional>
+            </conditional>
             <conditional name="addref_cond">
                 <param name="addref_select" value="history" />
                 <param name="ref" value="test.fa" />
             </conditional>
-            <conditional name="cond_filter">
-                <param name="select_filter" value="yes" />
-                <conditional name="cond_region">
-                    <param name="select_region" value="no"/>
-                </conditional>
-            </conditional>
             <output name="outputsam" file="test.cram" ftype="cram" compare="sim_size" delta="250" />
         </test>
         <test>
             <param name="input" value="test.bam" ftype="bam" />
-            <param name="outtype" value="cram" />
+            <conditional name="mode">
+                <param name="outtype" value="selected_reads" />
+                <section name="filter_config">
+                    <conditional name="cond_region">
+                        <param name="select_region" value="text"/>
+                        <param name="regions" value="CHROMOSOME_I" />
+                    </conditional>
+                </section>
+                <conditional name="output_options">
+                    <conditional name="output_format">
+                        <param name="oformat" value="cram" />
+                    </conditional>
+                </conditional>
+            </conditional>
             <conditional name="addref_cond">
                 <param name="addref_select" value="history" />
                 <param name="ref" value="test.fa" />
             </conditional>
-            <conditional name="cond_filter">
-                <param name="select_filter" value="yes" />
-                <conditional name="cond_region">
-                    <param name="select_region" value="text"/>
-                    <param name="regions" value="CHROMOSOME_I" />
-                </conditional>
-            </conditional>
             <output name="outputsam" file="test.cram" ftype="cram" compare="sim_size" delta="250" />
         </test>
         <!-- bam to sam + header options (adapted from bam_to_sam tool)-->
         <test>
             <param ftype="bam" name="input" value="bam_to_sam_in1.bam" />
-            <param name="outtype" value="sam" />
-            <param name="header" value="-h" />
+            <conditional name="mode">
+                <conditional name="output_options">
+                    <conditional name="output_format">
+                        <param name="oformat" value="sam" />
+                        <param name="with_header" value="true" />
+                    </conditional>
+                </conditional>
+            </conditional>
             <output file="bam_to_sam_out1.sam" ftype="sam" name="outputsam" />
         </test>
         <test>
             <param ftype="bam" name="input" value="bam_to_sam_in1.bam" />
-            <param name="outtype" value="sam" />
-            <param name="header" value="-H" />
+            <conditional name="mode">
+                <param name="outtype" value="header" />
+                <conditional name="output_options">
+                    <conditional name="output_format">
+                        <param name="oformat" value="sam" />
+                    </conditional>
+                </conditional>
+            </conditional>
             <output file="bam_to_sam_out2.sam" ftype="sam" name="outputsam" />
         </test>
         <test>
             <param ftype="bam" name="input" value="bam_to_sam_in1.bam" />
-            <param name="outtype" value="sam" />
-            <param name="header" value="" />
+            <conditional name="mode">
+                <conditional name="output_options">
+                    <conditional name="output_format">
+                        <param name="oformat" value="sam" />
+                        <param name="with_header" value="false" />
+                    </conditional>
+                </conditional>
+            </conditional>
             <output file="bam_to_sam_out3.sam" ftype="sam" name="outputsam" />
         </test>
         <!-- cram to bam + region (adapted from cram_to_bam tool)-->
         <test>
             <param name="input" value="test.cram" ftype="cram" />
-            <param name="outtype" value="bam" />
+            <conditional name="addref_cond">
+                <param name="addref_select" value="history" />
+                <param name="ref" value="test.fa" />
+            </conditional>
+            <output name="outputsam" file="test.bam" ftype="bam" />
+        </test>
+        <test>
+            <param name="input" value="test.cram" ftype="cram" />
+            <conditional name="mode">
+                <param name="outtype" value="selected_reads" />
+                <section name="filter_config">
+                    <conditional name="cond_region">
+                        <param name="select_region" value="text"/>
+                        <param name="regions" value="CHROMOSOME_I" />
+                    </conditional>
+                </section>
+                <conditional name="output_options">
+                    <conditional name="output_format">
+                        <param name="oformat" value="bam" />
+                    </conditional>
+                </conditional>
+            </conditional>
             <conditional name="addref_cond">
                 <param name="addref_select" value="history" />
                 <param name="ref" value="test.fa" />
@@ -380,76 +562,177 @@
         </test>
         <test>
             <param name="input" value="test.cram" ftype="cram" />
-            <param name="outtype" value="bam" />
+            <conditional name="mode">
+                <param name="outtype" value="selected_reads" />
+                <section name="filter_config">
+                    <conditional name="cond_region">
+                        <param name="select_region" value="bed" />
+                        <param name="bedfile" value="test.bed" ftype="bed" />
+                    </conditional>
+                </section>
+                <conditional name="output_options">
+                    <conditional name="output_format">
+                        <param name="oformat" value="bam" />
+                    </conditional>
+                </conditional>
+            </conditional>
             <conditional name="addref_cond">
                 <param name="addref_select" value="history" />
                 <param name="ref" value="test.fa" />
             </conditional>
-            <param name="target_region" value="region" />
-            <param name="region_string" value="CHROMOSOME_I" />
-            <output name="outputsam" file="test.bam" ftype="bam" />
-        </test>
-        <test>
-            <param name="input" value="test.cram" ftype="cram" />
-            <param name="outtype" value="bam" />
-            <conditional name="addref_cond">
-                <param name="addref_select" value="history" />
-                <param name="ref" value="test.fa" />
-            </conditional>
-            <param name="target_region" value="regions_bed_file" />
-            <param name="regions_bed_file" value="test.bed" ftype="bed" />
-
             <output name="outputsam" file="test.bam" ftype="bam" />
         </test>
         <test>
             <param name="input" value="test2.cram" dbkey="equCab2" ftype="cram" />
-            <param name="outtype" value="bam" />
+            <conditional name="mode">
+                <param name="outtype" value="selected_reads" />
+                <section name="filter_config">
+                    <conditional name="cond_region">
+                        <param name="select_region" value="no"/>
+                    </conditional>
+                </section>
+                <conditional name="output_options">
+                    <conditional name="output_format">
+                        <param name="oformat" value="bam" />
+                    </conditional>
+                </conditional>
+            </conditional>
             <conditional name="addref_cond">
                 <param name="addref_select" value="cached" />
                 <param name="ref" value="equCab2chrM" />
             </conditional>
-            <conditional name="cond_region">
-                <param name="select_region" value="no"/>
-            </conditional>
             <output name="outputsam" file="sam_to_bam_out2.bam" ftype="bam" />
         </test>
         <!-- sampling options-->
         <test>
             <param name="input" value="test.sam" ftype="sam" />
-            <param name="outtype" value="sam" />
-            <conditional name="cond_subsample">
-                <param name="select_subsample" value="target" />
-                <param name="target" value="2" />
+            <conditional name="mode">
+                <param name="outtype" value="selected_reads" />
+                <section name="subsample_config">
+                    <conditional name="subsampling_mode">
+                        <param name="select_subsample" value="target" />
+                        <param name="target" value="2" />
+                    </conditional>
+                </section>
+                <conditional name="output_options">
+                    <conditional name="output_format">
+                        <param name="oformat" value="sam" />
+                    </conditional>
+                </conditional>
             </conditional>
             <output name="outputsam" file="test_ds.sam" ftype="sam" compare="diff" lines_diff="6" />
         </test>
         <test>
             <param name="input" value="test.sam" ftype="sam" />
-            <param name="outtype" value="sam" />
-            <conditional name="cond_subsample">
-                <param name="select_subsample" value="target" />
-                <param name="seed" value="7" />
-                <param name="target" value="2" />
+            <conditional name="mode">
+                <param name="outtype" value="selected_reads" />
+                <section name="subsample_config">
+                    <conditional name="subsampling_mode">
+                        <param name="select_subsample" value="target" />
+                        <param name="target" value="20" />
+                    </conditional>
+                </section>
+                <conditional name="output_options">
+                    <conditional name="output_format">
+                        <param name="oformat" value="sam" />
+                    </conditional>
+                </conditional>
+            </conditional>
+            <output name="outputsam" file="test.sam" ftype="sam" />
+        </test>
+        <test>
+            <param name="input" value="test.sam" ftype="sam" />
+            <conditional name="mode">
+                <param name="outtype" value="selected_reads" />
+                <section name="subsample_config">
+                    <conditional name="subsampling_mode">
+                        <param name="select_subsample" value="target" />
+                        <param name="seed" value="7" />
+                        <param name="target" value="2" />
+                    </conditional>
+                </section>
+                <conditional name="output_options">
+                    <conditional name="output_format">
+                        <param name="oformat" value="sam" />
+                    </conditional>
+                </conditional>
             </conditional>
             <output name="outputsam" file="test_ds.sam" ftype="sam" compare="diff" lines_diff="6" />
         </test>
         <test>
             <param name="input" value="test.bam" ftype="bam" />
-            <param name="outtype" value="bam" />
-            <conditional name="cond_subsample">
-                <param name="select_subsample" value="target" />
-                <param name="seed" value="7" />
-                <param name="target" value="2" />
+            <conditional name="mode">
+                <param name="outtype" value="selected_reads" />
+                <section name="subsample_config">
+                    <conditional name="subsampling_mode">
+                        <param name="select_subsample" value="target" />
+                        <param name="seed" value="7" />
+                        <param name="target" value="2" />
+                    </conditional>
+                </section>
+                <conditional name="output_options">
+                    <conditional name="output_format">
+                        <param name="oformat" value="bam" />
+                    </conditional>
+                </conditional>
+            </conditional>
+            <output name="outputsam" file="test_ds.bam" ftype="bam" />
+        </test>
+        <test>
+            <param name="input" value="test.bam" ftype="bam" />
+            <conditional name="mode">
+                <param name="outtype" value="selected_reads" />
+                <section name="subsample_config">
+                    <conditional name="subsampling_mode">
+                        <param name="select_subsample" value="target" />
+                        <param name="seed" value="7" />
+                        <param name="target" value="20" />
+                    </conditional>
+                </section>
+                <conditional name="output_options">
+                    <conditional name="output_format">
+                        <param name="oformat" value="bam" />
+                    </conditional>
+                </conditional>
+            </conditional>
+            <output name="outputsam" file="test.bam" ftype="bam" />
+        </test>
+        <test>
+            <param name="input" value="test.bam" ftype="bam" />
+            <conditional name="mode">
+                <param name="outtype" value="selected_reads" />
+                <section name="subsample_config">
+                    <conditional name="subsampling_mode">
+                        <param name="select_subsample" value="fraction" />
+                        <param name="seed" value="7" />
+                        <param name="factor" value="5" />
+                    </conditional>
+                </section>
+                <conditional name="output_options">
+                    <conditional name="output_format">
+                        <param name="oformat" value="bam" />
+                    </conditional>
+                </conditional>
             </conditional>
             <output name="outputsam" file="test_ds.bam" ftype="bam" />
         </test>        
         <test>
             <param name="input" value="test.bam" ftype="bam" />
-            <param name="outtype" value="bam" />
-            <conditional name="cond_subsample">
-                <param name="select_subsample" value="fraction" />
-                <param name="seed" value="7" />
-                <param name="fraction" value=".2" />
+            <conditional name="mode">
+                <param name="outtype" value="selected_reads" />
+                <section name="subsample_config">
+                    <conditional name="subsampling_mode">
+                        <param name="select_subsample" value="fraction" />
+                        <param name="seed" value="7" />
+                        <param name="factor" value="1.25" />
+                    </conditional>
+                </section>
+                <conditional name="output_options">
+                    <param name="reads_report_type" value="dropped" />
+                    <conditional name="output_format">
+                        <param name="oformat" value="bam" />
+                    </conditional>
+                </conditional>
             </conditional>
             <output name="outputsam" file="test_ds.bam" ftype="bam" />
         </test>        
@@ -459,20 +742,32 @@
 
 Samtools view can: 
 
-1. filter alignments according to various criteria 
-2. convert between alignment formats (SAM, BAM, CRAM)
+1. convert between alignment formats (SAM, BAM, CRAM)
+2. filter and subsample alignments according to user-specified criteria
+3. count the reads in the input dataset or those retained after filtering
+   and subsampling
+4. obtain just the header of the input in any supported format
+  
+In addition, the tool has (limited) options to modify read records during conversion and/or filtering by:
 
-With no options or regions specified, prints all alignments in the specified input alignment file (in SAM, BAM, or CRAM format) to standard output in SAM format (with no header). 
+- stripping them of user-specified tags
+- collapsing backward CIGAR operations if they are specified in their CIGAR
+  fields
+
+With default settings, the tool generates a BAM dataset with the header and
+reads found in the input dataset (which can be in SAM, BAM, or CRAM format).
 
 **Alignment format conversion**
 
+By changing the *Output format* it is possible to convert an input dataset to
+another format.
 Inputs of type SAM, BAM, and CRAM are accepted and can be converted to each of these formats (alternatively alignment counts can be computed) by selecting the appropriate "Output type". 
 
 .. class:: infomark 
 
-samtools view allows to specify a reference sequence. This is required for SAM input with missing @SQ headers (which include sequence names, length, md5, etc) and useful (and sometimes necessary) for CRAM input and output. In the following the use of reference sequence in the CRAM format is detailed. 
-CRAM is (intended as a primarily) a reference-based compressed format, i.e. only differences between the stored sequences and the reference are stored. As a consequence the reference that was used to generate the alignemnts is always needed in order to interpret the alignments (a checksum stored in the CRAM file is used to verify that the only the correct sequence can be used), i.e. the CRAM file on its own is not useful per default. This allows for a more space efficient storage compared to BAM. 
-But it is also possible to use CRAM without a reference with the disadvantage that the reference is stored explicitely (as in SAM and BAM). 
+The tool allows you to specify a reference sequence. This is required for SAM input with missing @SQ headers (which include sequence names, length, md5, etc) and useful (and sometimes necessary) for CRAM input and output. In the following the use of the reference sequence in the CRAM format is detailed.
+CRAM is (primarily) a reference-based compressed format, i.e. only sequence differences between aligned reads and the reference are stored. As a consequence, the reference that was used during read mapping is needed in order to interpret the alignment records (a checksum stored in the CRAM file is used to verify that only the correct reference sequence can be used). This allows for more space-efficient storage than with BAM format, but such a CRAM file is not usable without its reference.
+It is also possible, however, to use CRAM without a reference with the disadvantage that the reference sequence gets stored then explicitely (as in SAM and BAM).
 
 The Galaxy tool **currently generates only CRAM without reference sequence**.
 
@@ -480,8 +775,17 @@
 
 **Filtering alignments**
 
-samtools view allows to filter alignements based on various criteria, i.e. the output will contain only alignemnts matching all criteria (an additional output containing the remaining alignments can be created additionally, see "Output alignments not passing the filter" in "output options"): e.g. by regions (see below), alignment quality (see below), and tags or flags set in the alignments. 
+If you ask for *A filtered/subsampled selection of reads*, the tool will allow
+you to specify filter conditions and/or to choose a subsampling strategy, and
+the output will contain one of the following depending on your choice under
+*What would you like to have reported?*:
 
+- All reads retained after filtering and subsampling
+- Reads dropped during filtering and subsampling
+
+If instead you want to *split* the input reads based on your criteria and
+obtain *two* datasets, one with the retained and one with the dropped reads, check
+the *Produce extra dataset with dropped/retained reads?* option.
 
 
 **Filtering by regions**
@@ -490,21 +794,30 @@
 
 Regions can be specified as: RNAME[:STARTPOS[-ENDPOS]] and all position coordinates are 1-based.
 
-Important note: when multiple regions are given, some alignments may be output multiple times if they overlap more than one of the specified regions.
+.. class:: Warning mark
+
+When multiple regions are given, some alignments may be output multiple times if they overlap more than one of the specified regions.
 
 Examples of region specifications:
 
-- chr1 Output all alignments mapped to the reference sequence named 'chr1' (i.e. @SQ SN:chr1).
-- chr2:1000000 The region on chr2 beginning at base position 1,000,000 and ending at the end of the chromosome.
-- chr3:1000-2000 The 1001bp region on chr3 beginning at base position 1,000 and ending at base position 2,000 (including both end positions).
-- '*' Output the unmapped reads at the end of the file. (This does not include any unmapped reads placed on a reference sequence alongside their mapped mates.)
-- . Output all alignments. (Mostly unnecessary as not specifying a region at all has the same effect.)
+``chr1``
+   Output all alignments mapped to the reference sequence named 'chr1' (i.e. @SQ SN:chr1).
+
+``chr2:1000000``
+   The region on chr2 beginning at base position 1,000,000 and ending at the end of the chromosome.
+
+``chr3:1000-2000``
+   The 1001bp region on chr3 beginning at base position 1,000 and ending at base position 2,000 (including both end positions).
+
+``*``
+   Output the unmapped reads at the end of the file. (This does not include any unmapped reads placed on a reference sequence alongside their mapped mates.)
+
+``.``
+   Output all alignments. (Mostly unnecessary as not specifying a region at all has the same effect.)
 
 **Filtering by quality**
 
-This filters based on the MAPQ column of the SAM format which gives an estimate about the correct placement of the alignemnt. Note that aligners do not follow a consistent definition. 
-
-The -x, -B, and -s options modify the data which is contained in each alignment.
+This filters based on the MAPQ column of the SAM format which gives an estimate about the correct placement of the alignment. Note that aligners do not follow a consistent definition. 
     </help>
     <expand macro="citations"/>
 </tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test.bed	Tue Jan 21 07:40:18 2020 -0500
@@ -0,0 +1,1 @@
+CHROMOSOME_I	1	120