changeset 3:bb3f59096c8e draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tools/coverm commit 2d02165f40a9f8206a69716b2302bc58f5364982
author iuc
date Wed, 26 Jul 2023 07:35:03 +0000
parents 5bf5792b0996
children 0ff4b0e5a3bc
files coverm_genome.xml macros.xml
diffstat 2 files changed, 856 insertions(+), 699 deletions(-) [+]
line wrap: on
line diff
--- a/coverm_genome.xml	Tue Mar 28 08:36:25 2023 +0000
+++ b/coverm_genome.xml	Wed Jul 26 07:35:03 2023 +0000
@@ -3,555 +3,668 @@
     <macros>
         <import>macros.xml</import>
     </macros>
+    <expand macro="bio_tools"/>
     <expand macro="requirements"/>
     <command><![CDATA[
-         #if $reads.read_type == "single" or $reads.read_type == "interleaved"
-            mkdir -p reads1 &&
-            #set file_paths1 = []
-            #for $input_file in $reads.single
-                
-                #set $fname = $input_file.element_identifier.replace(" ","_")
-                #set $file_path = 'reads1/' + $fname
-                ln -s '$input_file' '$file_path' &&
-                $file_paths1.append($file_path)
-            #end for
-        #else if $reads.read_type == "bam"
-            mkdir -p bam &&
-            #set bam_files = []
-            #for $input_file in $reads.bam
-                
-                #set $fname = $input_file.element_identifier.replace(" ","_")
-                #set $file_path = 'bam/' + $fname
-                ln -s '$input_file' '$file_path' &&
-                $bam_files.append($file_path)
+#import re
+
+#set $single_fp = []
+#set $fw_fp = []
+#set $rv_fp = []
+#set $interl_fp = []
+#set $ref_fp = []
+#set $bam_fp = []
+#set $genome_fp = []
+
+mkdir 'single/' && 
+mkdir 'fw/' &&
+mkdir 'rv/' && 
+mkdir 'interl/' && 
+mkdir 'ref/' && 
+mkdir 'bam/' &&
+
+#if $mapped.mapped == 'mapped'
+    @BAMS@
+    #if $mapped.genome.ref_or_genome == 'genomic'
+        #if $mapped.genome.genomic.source == 'history'
+            #for $i, $genome in enumerate($mapped.genome.genomic.genome_fasta_files)
+                #set $fn = re.sub('[^\s\w\-\\.]', '_', str($genome.element_identifier))
+                #silent $genome_fp.append( $fn )
+ln -s '$genome' '$fn' &&
             #end for
-        #else if $reads.read_type == "paired"
-            mkdir -p paired_reads1 &&
-            #set fw_reads1 = []
-            #for $input_file in $reads.read1
-                
-                #set $fname = $input_file.element_identifier.replace(" ","_")
-                #set $file_path = 'paired_reads1/' + str($fname)
-                ln -s '$input_file' '$file_path' &&
-                $fw_reads1.append($file_path)
-            #end for
-            #set rv_reads1 = []
-            #for $input_file in $reads.read2
-                
-                #set $fname = $input_file.element_identifier.replace(" ","_")
-                #set $file_path = 'paired_reads1/' + str($fname)
-                ln -s '$input_file' '$file_path' &&
-                $rv_reads1.append($file_path)
-            #end for
-            #silent $fw_reads1.sort()
-            #silent $rv_reads1.sort()
         #else
-            mkdir -p paired_reads &&
-            #set paired_reads1 = []
-            #for $i, $input_file in enumerate($reads.paired_reads)
-                #set $file_path = 'paired_reads/fw' + str($i)
-                ln -s '$input_file.forward' '$file_path' &&
-                $paired_reads1.append($file_path)
-                #set $file_path = 'paired_reads/rv' + str($i)
-                ln -s '$input_file.reverse' '$file_path' &&
-                $paired_reads1.append($file_path)
-            #end for
-        #end if           
-        #if $add_reads.extra_read.read_type == "single" or $add_reads.extra_read.read_type == "interleaved"
-            mkdir -p add_reads1 &&
-            #set add_file_paths1 = []
-            #for $input_file in $add_reads.extra_read.single
-                #set $fname = $input_file.element_identifier.replace(" ","_")
-                #set $file_path = 'add_reads1/' + $fname
-                ln -s '$input_file' '$file_path' &&
-                $add_file_paths1.append($file_path)
-            #end for
-        #else if $add_reads.extra_read.read_type == "bam"
-            mkdir -p add_bam &&
-            #set add_bam_files = []
-            #for $input_file in $reads.bam
-                #set $fname = $input_file.element_identifier.replace(" ","_")
-                #set $file_path = 'add_bam/' + $fname
-                ln -s '$input_file' '$file_path' &&
-                $add_bam_files.append($file_path)
-            #end for
-        #else if $add_reads.extra_read.read_type == "paired"
-            mkdir -p add_paired_reads1 &&
-            #set add_fw_reads1 = []
-            #for $input_file in $add_reads.extra_read.read1
-                #set $fname = $input_file.element_identifier.replace(" ","_")
-                #set $file_path = 'add_paired_reads1/' + str($fname)
-                ln -s '$input_file' '$file_path' &&
-                $add_fw_reads1.append($file_path)
-            #end for
-            #set add_rv_reads1 = []
-            #for $input_file in $add_reads.extra_read.read2
-                #set $fname = $input_file.element_identifier.replace(" ","_")
-                #set $file_path = 'add_paired_reads1/' + str($fname)
-                ln -s '$input_file' '$file_path' &&
-                $add_rv_reads1.append($file_path)
-            #end for
-            #silent $add_fw_reads1.sort()
-            #silent $add_rv_reads1.sort()
-        #else if $add_reads.extra_read.read_type == "paired_collection"
-            mkdir -p add_paired_reads &&
-            #set add_paired_reads1 = []
-            #for $i, $input_file in enumerate($add_reads.extra_read.paired_reads)
-                #set $ext = $input_file.forward.ext
-                #set $file_path = 'add_paired_reads/fw' + str($i) + '.' + $ext
-                ln -s '$input_file.forward' '$file_path' &&
-                $add_paired_reads1.append($file_path)
-                #set $file_path = 'add_paired_reads/rv' + str($i) + '.' + $ext
-                ln -s '$input_file.reverse' '$file_path' &&
-                $add_paired_reads1.append($file_path)
+            #for $i, $genome in enumerate($mapped.genome.genomic.genome_fasta_files)
+                #set $fn = re.sub('[^\s\w\-\\.]', '_', str($genome.fields.path.element_identifier))
+                #silent $genome_fp.append( $fn )
+ln -s '$genome' '$fn' &&
             #end for
         #end if
-        #if $reads.genome.ref_or_genome == "genomic"
-                mkdir -p genomes &&
-                #set genome_files = []
-            #if $reads.genome.genomic.source == "history"
-                #for $input_file in $reads.genome.genomic.fasta_history
-                    
-                    #set $fname = $input_file.element_identifier.replace(" ","_")
-                    #set $file_path = 'genomes/' + $fname
-                    ln -s '$input_file' '$file_path' &&
-                    $genome_files.append($file_path)
-                #end for
-             #else
-                #for $input_file in $reads.genome.genomic.fasta_builtin
-                    #set $ext = $input_file.fields.path.ext
-                    #set $fname = $input_file.fields.path.element_identifier.replace(" ","_")
-                    #set $file_path = 'genomes/' + $fname
-                    ln -s '$input_file' '$file_path' &&
-                    $genome_files.append($file_path)
-                #end for
+    #end if
+#else
+    #if $mapped.mode.mode == 'individual'
+        @INDIVIDUAL_ASSEMBLY_READS@
+        #if $mapped.mode.genome.ref_or_genome == 'genomic'
+            @GENOME_FOR_READS@
+        #else
+            #set $ref = $mapped.mode.genome.reference
+            @INDIVIDUAL_ASSEMBLY_REF@
+        #end if
+    #else
+        @CO_ASSEMBLY_ALL_READS@
+        #if $mapped.mode.genome.ref_or_genome == 'genomic'
+            @GENOME_FOR_READS@
+        #else
+            #set $refs = $mapped.mode.genome.reference
+            @CO_ASSEMBLY_REF@
+        #end if
+    #end if
+#end if
+
+mkdir 'representative-fasta/' &&
+coverm 
+    genome
+#if $mapped.mapped == 'mapped'
+    -b
+    #for $bam in $bam_fp
+        '$bam'
+    #end for
+    #if $mapped.genome.ref_or_genome == 'contigs'
+    $mapped.genome.cond_single_genome.single_genome
+        #if $mapped.genome.cond_single_genome.single_genome == ''
+            #if $mapped.genome.cond_single_genome.genome_contig_definition.choice == 'genome-definition'
+    --genome-definition '$mapped.genome.cond_single_genome.genome_contig_definition.genome_definition'
+            #else if $mapped.genome.cond_single_genome.genome_contig_definition.choice == 'separator'
+    --separator '$mapped.genome.cond_single_genome.genome_contig_definition.separator'
             #end if
-        #else if $reads.genome.ref_or_genome != "none"
-            mkdir -p reference &&
-            #set ref_files = []
-                #for $input_file in $reads.genome.ref_source
-                    #set $fname = $input_file.element_identifier.replace(" ","_")
-                    #set $file_path = 'reference/' + $fname
-                    ln -s '$input_file' '$file_path' &&
-                    $ref_files.append($file_path)
-                #end for
-            #if $reads.genome.add_genome.add_genome == "true"
-                mkdir -p genomes &&
-                #set genome_files = []
-                #if $reads.genome.add_genome.add_genomic == "history"
-                    #for $input_file in $reads.genome.add_genome.add_genomic.fasta_history
-                        #set $fname = $input_file.element_identifier.replace(" ","_")
-                        #set $file_path = 'genomes/' + $fname
-                        ln -s '$input_file' '$file_path' &&
-                        $genome_files.append($file_path)
-                    #end for
-                #else
-                    #for $input_file in $reads.genome.add_genome.add_genomic.fasta_builtin
-                        #set $ext = $input_file.fields.path.ext
-                        #set $fname = $input_file.fields.path.element_identifier.replace(" ","_")
-                        #set $file_path = 'genomes/' + $fname
-                        ln -s '$input_file' '$file_path' &&
-                        $genome_files.append($file_path)
-                    #end for
-                #end if
+        #end if
+    $mapped.sharded
+    #else
+    --genome-fasta-files
+        #for $genome in $genome_fp
+        '$genome'
+        #end for
+    #end if
+#else
+    #if $fw_fp
+    -1
+        #for $read in $fw_fp
+        '$read'
+        #end for
+    -2
+        #for $read in $rv_fp
+        '$read'
+        #end for
+    #else if $single_fp
+    --single
+        #for $read in $single_fp
+        '$read'
+        #end for
+    #else if $interl_fp
+    --interleaved
+        #for $read in $interl_fp
+        '$read'
+        #end for
+    #end if
+    
+    --mapper '$mapped.mapper'
+    #if $mapped.mode.genome.ref_or_genome == 'contigs'
+    --reference
+        #for $ref in $ref_fp
+        '$ref'
+        #end for
+    $mapped.mode.genome.cond_single_genome.single_genome
+        #if $mapped.mode.genome.cond_single_genome.single_genome == ''
+            #if $mapped.mode.genome.cond_single_genome.genome_contig_definition.choice == 'genome-definition'
+    --genome-definition '$mapped.mode.genome.cond_single_genome.genome_contig_definition.genome_definition'
+            #else if $mapped.mode.genome.cond_single_genome.genome_contig_definition.choice == 'separator'
+    --separator '$mapped.mode.genome.cond_single_genome.genome_contig_definition.separator'
             #end if
         #end if
-        
-        mkdir ./representative-fasta/ &&
-        coverm genome
-            #if $reads.read_type == 'paired'
-                -1
-                #for $read in $fw_reads1
-                    '${read}'
-                #end for
-                -2
-                #for $read in $rv_reads1
-                    '${read}'
-                #end for
-            #else if $reads.read_type == 'paired_collection'
-                --coupled
-                #for $read in $paired_reads1
-                    '${read}'
-                #end for
-            #else if $reads.read_type == 'single'
-                --single
-                #for $read in $file_paths1
-                    '${read}'
-                #end for
-            #else if $reads.read_type == 'interleaved'
-                --interleaved
-                #for $read in $file_paths1
-                    '${read}'
-                #end for
-            #else if $reads.read_type == 'bam'
-                -b
-                #for $read in $bam_files
-                    '${read}'
-                #end for
-            #end if
+        #if $mapped.mode.mode == 'co'
+    $mapped.mode.genome.sharded
+        #end if
+    #else
+    --genome-fasta-files
+        #for $genome in $genome_fp
+        '$genome'
+        #end for
+    #end if
+#end if
 
-            #if $add_reads.extra_read.read_type == 'paired'
-                -1
-                #for $read in $add_fw_reads1
-                    '${read}'
-                #end for
-                -2
-                #for $read in $add_rv_reads1
-                    '${read}'
-                #end for
-            #else if $add_reads.extra_read.read_type == 'paired_collection'
-                --coupled
-                #for $read in $add_paired_reads1
-                    '${read}'
-                #end for
-            #else if $add_reads.extra_read.read_type == 'single'
-                --single
-                #for $read in $add_file_paths1
-                    '${read}'
-                #end for
-            #else if $add_reads.extra_read.read_type == 'interleaved'
-                --interleaved
-                #for $read in $add_file_paths1
-                    '${read}'
-                #end for
-            #else if $add_reads.extra_read.read_type == 'bam'
-                #for $read in $add_bam_files
-                    '${read}'
-                #end for
-            #end if
-            
+    $exclude_genomes_from_deshard
+    --min-read-aligned-length $alignment.min_read_aligned_length
+    --min-read-percent-identity $alignment.min_read_percent_identity
+    --min-read-aligned-percent $alignment.min_read_aligned_percent
+    $alignment.proper_pairs_only.proper_pairs_only
+#if $alignment.proper_pairs_only.proper_pairs_only != ''
+    --min-read-aligned-length-pair $alignment.proper_pairs_only.min_read_aligned_length_pair
+    --min-read-percent-identity-pair $alignment.proper_pairs_only.min_read_percent_identity_pair
+    --min-read-aligned-percent-pair $alignment.proper_pairs_only.min_read_aligned_percent_pair
+#end if
+
+    --methods
+#for method in $cov.methods
+        '$method'
+#end for
+    --min-covered-fraction $cov.min_covered_fraction
+    --contig-end-exclusion $cov.contig_end_exclusion
+    --trim-min $cov.trim_min
+    --trim-max $cov.trim_max
 
-            #if $reads.genome.ref_or_genome == "genomic":
-                -f
-                #for $genome in $genome_files
-                    '${genome}'
-                #end for
-            #else if $reads.genome.ref_or_genome != "none" and $reads.genome.ref_or_genome != "genomic":
-                --reference
-                #for $reference in $ref_files
-                    '${reference}'
-                #end for
-                #if $reads.genome.cond_single_genome.single_genome != "false"
-                    $reads.genome.cond_single_genome.single_genome
-                    #if $reads.genome.cond_single_genome.genome_definition
-                        --genome-definition $reads.genome.cond_single_genome.genome_definition
-                    #end if
-                #else
-                    #if $reads.genome.cond_single_genome.separator
-                        -s "$reads.genome.cond_single_genome.separator"
-                    #end if
-                #end if
-                #if $reads.genome.add_genome.add_genome == "true"
-                    -f
-                    #for $genome in $genome_files
-                        '${genome}'
-                    #end for
-                #end if
-            #else if $reads.genome.ref_or_genome == "none":
-                #if $reads.genome.separator:
-                    -s "$reads.genome.separator"
-                #end if
-                $reads.genome.single_genome
-            #end if
+    $derep.dereplicate.dereplicate
+#if $derep.dereplicate.dereplicate != ''
+    --dereplication-ani $derep.dereplicate.dereplication_ani
+    --dereplication-aligned-fraction $derep.dereplicate.dereplication_aligned_fraction
+    --dereplication-fragment-length $derep.dereplicate.dereplication_fragment_length
+    --dereplication-prethreshold-ani $derep.dereplicate.dereplication_prethreshold_ani
+    --dereplication-quality-formula '$derep.dereplicate.dereplication_quality_formula'
+    --dereplication-precluster-method '$derep.dereplicate.dereplication_precluster_method'
+#end if
+#if $derep.checkm_tab_table
+    --chekm-tab-table '$derep.checkm_tab_table'
+#end if
+#if $derep.genome_info:
+    --genome-info '$derep.genome_info'
+#end if
+#if $derep.min_completeness != "":
+    --min-completeness $derep.min_completeness
+#end if
+#if $derep.max_contamination != "":
+    --max-contamination $derep.max_contamination
+#end if
+    
+    --output-format '$out.output_format'
+    --output-file '$output'
+    $out.no_zeros
+#if $out.dereplication_output_cluster_definition:
+    --dereplication-output-cluster-definition '$cluster_definition'
+#end if
+#if $out.dereplication_output_representative_fasta_directory_copy:
+    --dereplication-output-representative-fasta-directory-copy './representative-fasta/'
+#end if
+    --threads \${GALAXY_SLOTS:-1}
 
-            $derep.dereplicate
-            #if $derep.checkm_tab_table:
-                --chekm-tab-table '$derep.checkm_tab_table'
-            #end if
-            #if $derep.genome_info:
-                --genome-info '$derep.genome_info'
-            #end if
-            #if $derep.min_completeness != "":
-                --min-completeness $derep.min_completeness
-            #end if
-            #if $derep.max_contamination != "":
-                --max-contamination $derep.max_contamination
-            #end if
-            #if $derep.dereplication_ani != "":
-                --dereplication-ani $derep.dereplication_ani
-            #end if
-            #if $derep.dereplication_aligned_fraction != "":
-                --dereplication-aligned-fraction $derep.dereplication_aligned_fraction
-            #end if
-            #if $derep.dereplication_fragment_length != "":
-                --dereplication-fragment-length $derep.dereplication_fragment_length
-            #end if
-            #if $derep.dereplication_prethreshold_ani != "":
-                --dereplication-prethreshold-ani $derep.dereplication_prethreshold_ani
-            #end if
-            #if $derep.dereplication_quality_formula:
-                --dereplication-quality-formula $derep.dereplication_quality_formula
-            #end if
-            #if $derep.dereplication_precluster_method:
-                --dereplication-precluster-method $derep.dereplication_precluster_method
-            #end if
-
-            $shar.sharded
-            $shar.exclude_genomes_from_deshard
-
-            #if $mapping.mapper:
-                --mapper $mapping.mapper
-            #end if
-            #if $mapping.min_read_aligned_length:
-                --min-read-aligned-length $mapping.min_read_aligned_length
-            #end if
-            #if $mapping.min_read_percent_identity:
-                --min-read-percent-identity $mapping.min_read_percent_identity
-            #end if
-            #if $mapping.min_read_aligned_percent:
-                --min-read-aligned-percent $mapping.min_read_aligned_percent
-            #end if
-            #if $mapping.min_read_aligned_length_pair:
-                --min-read-aligned-length-pair $mapping.min_read_aligned_length_pair
-            #end if
-            #if $mapping.min_read_percent_identity_pair:
-                --min-read-percent-identity-pair $mapping.min_read_percent_identity_pair
-            #end if
-            #if $mapping.min_read_aligned_percent_pair:
-                --min-read-aligned-percent-pair $mapping.min_read_aligned_percent_pair
-            #end if
-            $mapping.proper_pairs_only
-            $mapping.exclude_supplementary
-
-            --methods $cov.relative_abundance $cov.mean $cov.cond_methods.trimmed_mean $cov.covered_bases $cov.covered_fraction
-            $cov.variance $cov.length $cov.count $cov.metabat $cov.coverage_histogram $cov.reads_per_base 
-            $cov.rpkm $cov.tpm
-            #if $cov.min_covered_fraction != "":
-                --min-covered-fraction $cov.min_covered_fraction
-            #end if
-            #if $cov.contig_end_exclusion != "":
-                --contig-end-exclusion $cov.contig_end_exclusion
-            #end if
-            #if $cov.cond_methods.trimmed_mean == "trimmed_mean"
-                #if $cov.cond_methods.trim_min:
-                    --trim-min $cov.cond_methods.trim_min
-                #end if
-                #if $cov.cond_methods.trim_max:
-                    --trim_max $cov.cond_methods.trim_max
-                #end if
-            #end if
-
-            #if $out.output_format:
-                --output-format $out.output_format
-            #end if
-            #if $out.dereplication_output_cluster_definition:
-                --dereplication-output-cluster-definition '$cluster_definition'
-            #end if
-            #if $out.dereplication_output_representative_fasta_directory_copy:
-                --dereplication-output-representative-fasta-directory-copy ./representative-fasta/
-            #end if
-            $out.no_zeros
-            --output-file output.tsv
-            --threads \${GALAXY_SLOTS:-1}
-
-        #if $derep.dereplicate and $out.dereplication_output_cluster_definition
-            && sed -i -e 's@genomes/@@g; s/\.fna//g' '$cluster_definition'
-        #end if
+#if $derep.dereplicate.dereplicate and $out.dereplication_output_cluster_definition
+    && sed -i -e 's@genomes/@@g; s/\.fna//g' '$cluster_definition'
+#end if
     ]]></command>
     <inputs>
-        <expand macro="reads" />
-        <expand macro="add_reads" />
-        <section name="derep" title="Dereplication options" expanded="false">
-            <param argument="--dereplicate" type="boolean" truevalue="--dereplicate" falsevalue="" optional="true" 
-                label="Do genome dereplication via average nucleotide identity (ANI)" 
-                help="Choose a genome to represent all within a small distance, using Dashing for 
-                    preclustering and FastANI for final ANI calculation. When this flag is used, 
-                    dereplication occurs transparently through the Galah method."/>
-            <param argument="--checkm-tab-table" type="data" format="tsv" optional="true" 
-                label="Use checkM table" help="It is used for defining genome quality, which is used both for filtering 
-                    and to rank genomes during clustering"/>
+        <conditional name="mapped">
+            <expand macro="mapped"/>
+            <when value="mapped">
+                <expand macro="mapped_params"/>
+                <conditional name="genome">
+                    <param name="ref_or_genome" type="select" label="Genome definition">
+                        <option value="contigs" selected="true">From contigs in the BAM file(s)</option>
+                        <option value="genomic">From FASTA files with each genome</option>
+                    </param>
+                    <when value="contigs">
+                        <expand macro="cond_single_genome"/>
+                    </when>
+                    <when value="genomic">
+                        <expand macro="genomic"/>
+                    </when>
+                </conditional>
+            </when>
+            <when value="not-mapped">
+                <conditional name="mode">
+                    <expand macro="assembly_mode"/>
+                    <when value="individual">
+                        <expand macro="individual_assembly_reads"/>
+                        <conditional name="genome">
+                            <expand macro="ref_or_genome"/>
+                            <when value="contigs">
+                                <expand macro="individual_assembly_reference"/>
+                                <expand macro="cond_single_genome"/>
+                            </when>
+                            <when value="genomic">
+                                <expand macro="genomic"/>
+                            </when>
+                        </conditional>
+                    </when>
+                    <when value="co">
+                        <expand macro="co_assembly_reads"/>
+                        <repeat name="extra_reads" title="Additional reads">
+                            <expand macro="co_assembly_reads"/>
+                        </repeat>
+                        <conditional name="genome">
+                            <expand macro="ref_or_genome"/>
+                            <when value="contigs">
+                                <expand macro="co_assembly_reference"/>
+                                <expand macro="cond_single_genome"/>
+                            </when>
+                            <when value="genomic">
+                                <expand macro="genomic"/>
+                            </when>
+                        </conditional>
+                    </when>
+                </conditional>
+                <expand macro="mapping"/>
+            </when>
+        </conditional>
+        <param argument="--exclude-genomes-from-deshard" type="boolean" truevalue="--exclude-genomes-from-deshard" falsevalue="" checked="false" label="Exclude genomes from deshard" 
+            help="Ignore genomes whose name appears in this newline-separated file when combining shards." />
+        <expand macro="alignment"/>
+        <section name="cov" title="Coverage calculation options" expanded="false">
+            <param argument="--methods" type="select" multiple="true" label="Method(s) for calculating coverage">
+                <option value="relative_abundance" selected="true">relative_abundance: Percentage relative abundance of each genome, and the unmapped read percentage</option>
+                <option value="mean">mean: Average number of aligned reads overlapping each position on the contig</option>
+                <expand macro="cov_method_options"/>
+            </param>
+            <expand macro="coverage_params"/>
+        </section>
+        <section name="derep" title="Dereplication / Genome clustering" expanded="false">
+            <conditional name="dereplicate">
+                <param argument="--dereplicate" type="select" label="Do genome dereplication via average nucleotide identity (ANI)?" help="When this is run, 
+                    dereplication occurs transparently through the Galah method.">
+                    <option value="--dereplicate">Yes</option>
+                    <option value="" selected="false">No</option>
+                </param>
+                <when value="--dereplicate">
+                    <param argument="--dereplication-ani" type="float" min="0" max="100" value="99" label="Overall ANI level to dereplicate at with FastANI" />
+                    <param argument="--dereplication-aligned-fraction" type="float" min="0" value="50" label="Minimum aligned fraction of two genomes for clustering" />
+                    <param argument="--dereplication-fragment-length" type="integer" min="0" value="3000" label="Length of fragment used in FastANI calculation (i.e. --fragLen)" />
+                    <param argument="--dereplication-quality-formula" type="select" label="Scoring function for genome quality">
+                        <option value="Parks2020_reduced" selected="true">Parks2020_reduced: A quality formula described in Parks et. al. 2020</option>
+                        <option value="completeness-4contamination">completeness-4contamination</option>
+                        <option value="completeness-5contamination">completeness-5contamination</option>
+                        <option value="dRep">dRep</option>
+                    </param>
+                    <param argument="--dereplication-prethreshold-ani" type="float" min="0" max="100" value="95" label="Dereplication preclustering threshold" 
+                        help="Require at least this dashing-derived ANI for preclustering and to avoid FastANI on distant lineages within preclusters." />
+                    <param argument="--dereplication-precluster-method" type="select" label="Method of calculating rough ANI for dereplication">
+                        <option value="dashing" selected="true">dashing: HyperLogLog</option>
+                        <option value="finch">finch: finch MinHash</option>
+                    </param>
+                </when>
+                <when value=""/>
+            </conditional>
+            <param argument="--checkm-tab-table" type="data" format="tabular" optional="true" label="checkM table for defining genome quality" 
+                help="It is used both for filtering and to rank genomes during clustering"/>
             <param argument="--genome-info" type="data" format="csv" optional="true" 
-                label="Define quality in dRep style" help="dRep stype genome info table for defining quality" />
+                label="dRep style genome info table for defining quality" />
             <param argument="--min-completeness" type="float" optional="true" min="0" max="100" 
-                label="Min completeness" help="Ignore genomes with less completeness than this percentage" />
+                label="Minimum completeness" help="Genomes with lower completeness percentage will be ignored" />
             <param argument="--max-contamination" type="float" optional="true" min="0" max="100" 
-                label="Max contamination" help="Ignore genomes with more contamination than this percentage" />
-            <param argument="--dereplication-ani" type="float" optional="true" min="0" max="100" value="99"
-                label="Overall ANI level" help="Overall ANI level to dereplicate at with FastANI. Default: 99" />
-            <param argument="--dereplication-aligned-fraction" type="float" optional="true" min="0" value="50"
-                label="Dereplication aligned fraction" help="Min aligned fraction of two genomes for clustering. Default: 50" />
-            <param argument="--dereplication-fragment-length" type="integer" optional="true" min="0" value="3000"
-                label="Length of fragment used in FastANI calculation (i.e. --fragLen). Default: 3000" />
-            <param argument="--dereplication-prethreshold-ani" type="float" optional="true" min="0" max="100" value="95"
-                label="Dereplication preclustering threshold" help="Require at least this dashing-derived ANI for 
-                    preclustering and to avoid FastANI on distant lineages within preclusters. Default: 95" />
-            <param type="select" argument="--dereplication-quality-formula" label="Scoring function for genome quality" help="Default: Parks2020_reduced">
-                <option value="Parks2020_reduced">Parks2020_reduced (default)</option>
-                <option value="completeness-4contamination">completeness-4contamination</option>
-                <option value="completeness-5contamination">completeness-5contamination</option>
-                <option value="dRep">dRep</option>
-            </param>
-            <param type="select" argument="--dereplication-precluster-method" label="Dereplication precluster method" help="Method of calculating rough ANI for dereplication. Default: dashing">
-                <option value="dashing">HyperLogLog</option>
-                <option value="finch">finch MinHash</option>
-            </param>
+                label="Maximum contamination" help="Genomes with higher contamination percentage will be ignored" />
         </section>
-        <section name="shar" title="Sharding options" expanded="false">
-            <param argument="--sharded" type="boolean" optional="true" truevalue="--sharded" falsevalue="" label="Shared" help="If -b/--bam-files was used: Input BAM files are read-sorted alignments of a set of reads mapped to multiple reference contig sets. Choose the best hit for each read pair. Otherwise if mapping was carried out: Map reads to each reference, choosing the best hit for each pair." />
-            <param argument="--exclude-genomes-from-deshard" type="boolean" optional="true" 
-                truevalue="--exclude-genomes-from-deshard" falsevalue="" label="Exclude genomes from deshard" 
-                help="Ignore genomes whose name appears in this newline-separated file when combining shards." />
+        <section name="out" title="Outputs" expanded="false">
+            <expand macro="output_format"/>
+            <param argument="--no-zeros" type="boolean" truevalue="--no-zeros" falsevalue="" label="Omit printing of genomes that have zero coverage?" />
+            <param argument="--dereplication-output-cluster-definition" type="boolean" truevalue="--dereplication-output-cluster-definition" falsevalue="" label="Output a tabular files with dereplicated representatives and member lines?" />
+            <param argument="--dereplication-output-representative-fasta-directory-copy" type="boolean" truevalue="--dereplication-output-representative-fasta-directory-copy" falsevalue="" label="Output dereplicated representative genomes?" />
         </section>
-        <expand macro="mapping"/>
-        <expand macro="coverage"/>
-        <expand macro="out"/>
     </inputs>
     <outputs>
-        <data name="output1" format="tsv" from_work_dir="./output.tsv"/>
-        <data name="cluster_definition" format="tsv" label="${tool.name} on ${on_string}: cluster definition">
-            <filter>derep['dereplicate'] and out['dereplication_output_cluster_definition']</filter>
+        <data name="output" format="tabular" label="${tool.name} on ${on_string}"/>
+        <data name="cluster_definition" format="tabular" label="${tool.name} on ${on_string}: Cluster definition">
+            <filter>derep['dereplicate']['dereplicate'] and out['dereplication_output_cluster_definition']</filter>
         </data>
-        <collection name="representative_fasta" type="list" label="${tool.name} on ${on_string}: representative fasta">
+        <collection name="representative_fasta" type="list" label="${tool.name} on ${on_string}: Dereplicated epresentative genomes">
             <discover_datasets pattern="(?P&lt;designation&gt;.*)\.fna" format="fasta" directory="representative-fasta" />
-            <filter>derep['dereplicate'] and out['dereplication_output_representative_fasta_directory_copy']</filter>
+            <filter>derep['dereplicate']['dereplicate'] and out['dereplication_output_representative_fasta_directory_copy']</filter>
         </collection>
     </outputs>
     <tests>
         <test expect_num_outputs="1">
-            <conditional name="reads">
-                <param name="read_type" value="paired_collection"/>
-                <param name="paired_reads">
-                    <collection type="list:paired">
-                        <element name="reads_for_seq1_and_seq2..fq">
-                            <collection type="paired">
-                                <element name="forward" value="reads_for_seq1_and_seq2.1.fq.gz"/>
-                                <element name="reverse" value="reads_for_seq1_and_seq2.2.fq.gz"/>
+            <conditional name="mapped">
+                <param name="mapped" value="not-mapped" />
+                <conditional name="mode">
+                    <param name="mode" value="co"/>
+                    <conditional name="read_type">
+                        <param name="type" value="paired_collection"/>
+                        <param name="paired_reads">
+                            <collection type="list:paired">
+                                <element name="reads_for_seq1_and_seq2">
+                                    <collection type="paired">
+                                        <element name="forward" value="reads_for_seq1_and_seq2.1.fq.gz" ftype="fastqsanger.gz"/>
+                                        <element name="reverse" value="reads_for_seq1_and_seq2.2.fq.gz" ftype="fastqsanger.gz"/>
+                                    </collection>
+                                </element>
                             </collection>
-                        </element>
-                    </collection>
-                </param>
-                <conditional name="genome">
-                    <param name="ref_or_genome" value="reference"/>
-                        <param name="ref_source" value="7seqs.fna"/>
+                        </param>
+                    </conditional>
+                    <repeat name="extra_reads">
+                        <conditional name="read_type">
+                            <param name="type" value="single"/>
+                            <param name="single" value="reads_for_seq1_and_seq2.fna"/>
+                        </conditional>
+                    </repeat>
+                    <conditional name="genome">
+                        <param name="ref_or_genome" value="contigs"/>
+                        <param name="reference" value="7seqs.fna" />
                         <conditional name="cond_single_genome">
-                            <param name="single_genome" value="false"/>
-                            <param name="separator" value="~"/>
+                            <param name="single_genome" value=""/>
+                            <conditional name="genome_contig_definition">
+                                <param name="choice" value="separator"/>
+                                <param name="separator" value="~"/>
+                            </conditional>
                         </conditional>
+                    </conditional>
+                    <param name="sharded" value="" />
                 </conditional>
             </conditional>
-            <section name="add_reads">
-                <conditional name="extra_read">
-                    <param name="read_type" value="single"/>
-                    <param name="single" value="reads_for_seq1_and_seq2.fna"/>
+            <param name="exclude_genomes_from_deshard" value="false"/>
+            <section name="alignment">
+                <param name="min_read_aligned_length" value="0" />
+                <param name="min_read_percent_identity" value="0" />
+                <param name="min_read_aligned_percent" value="0" />
+                <conditional name="proper_pairs_only">
+                    <param name="proper_pairs_only" value=""/>
                 </conditional>
+                <param name="exclude_supplementary" value=""/>
             </section>
             <section name="cov">
-                <param name="mean" value="true"/>
-                <param name="relative_abundance" value="true"/>
-                <param name="variance" value="true"/>
+                <param name="methods" value="mean,relative_abundance,variance"/>
+                <param name="trim_min" value="5"/>
+                <param name="trim_max" value="95"/>
+                <param name="min_covered_fraction" value="10"/>
+                <param name="contig_end_exclusion" value="75"/>
+            </section>
+            <section name="derep">
+                <conditional name="dereplicate">
+                    <param name="dereplicate" value=""/>
+                </conditional>
             </section>
             <section name="out">
                 <param name="output_format" value="sparse"/>
+                <param name="no_zeros" value=""/>
+                <param name="dereplication_output_cluster_definition" value="" />
+                <param name="dereplication_output_representative_fasta_directory_copy"  value="" />
             </section>
-            <output name="output1" file="test1.tsv" ftype="tsv" sort="true"/>
+            <output name="output" ftype="tabular">
+                <assert_contents>
+                    <has_text text="Sample"/>
+                    <has_text text="Genome"/>
+                    <has_text text="Relative Abundance (%)"/>
+                    <has_text text="Mean"/>
+                    <has_text text="Variance"/>
+                    <has_text text="7seqs.fna_0/reads_for_seq1_and_seq2_paired_collection_0"/>
+                    <has_text text="unmapped"/>
+                    <has_text text="genome6"/>
+                </assert_contents>
+            </output>
         </test>
         <test expect_num_outputs="1">
-            <conditional name="reads">
-                <param name="read_type" value="bam"/>
-                <param name="bam" value="7seqs.reads_for_seq1_and_seq2.bam"/>
-                <conditional name="genome">
-                    <param name="ref_or_genome" value="none"/>
-                    <param name="separator" value="~"/>
+            <conditional name="mapped">
+                <param name="mapped" value="mapped" />
+                <conditional name="mode">
+                    <param name="mode" value="co"/>
+                    <param name="bam_files" value="7seqs.reads_for_seq1_and_seq2.bam"/>
+                    <param name="sharded" value="" />
+                    <conditional name="genome">
+                        <param name="ref_or_genome" value="contigs"/>
+                        <conditional name="cond_single_genome">
+                            <param name="single_genome" value=""/>
+                            <conditional name="genome_contig_definition">
+                                <param name="choice" value="separator"/>
+                                <param name="separator" value="~"/>
+                            </conditional>
+                        </conditional>
+                    </conditional>
+                    <param name="sharded" value="" />
                 </conditional>
             </conditional>
-            <section name="shar">
-                <param name="sharded" value="false"/>
-                <param name="exclude_genoms_from_deshard" value="false"/>
-            </section>
-            <section name="mapping">
-                <param name="mapper" value="minimap2-sr"/>
-                <param name="minimap2_reference_is_index" value="false"/>
+            <param name="exclude_genomes_from_deshard" value="false"/>
+            <section name="alignment">
+                <param name="min_read_aligned_length" value="0" />
+                <param name="min_read_percent_identity" value="0" />
+                <param name="min_read_aligned_percent" value="0" />
+                <conditional name="proper_pairs_only">
+                    <param name="proper_pairs_only" value=""/>
+                </conditional>
+                <param name="exclude_supplementary" value=""/>
             </section>
             <section name="cov">
-                <param name="mean" value="true"/>
-                <param name="relative_abundance" value="true"/>
+                <param name="methods" value="mean,relative_abundance"/>
+                <param name="trim_min" value="5"/>
+                <param name="trim_max" value="95"/>
+                <param name="min_covered_fraction" value="10"/>
+                <param name="contig_end_exclusion" value="75"/>
+            </section>
+            <section name="derep">
+                <conditional name="dereplicate">
+                    <param name="dereplicate" value=""/>
+                </conditional>
             </section>
             <section name="out">
                 <param name="output_format" value="sparse"/>
+                <param name="no_zeros" value=""/>
+                <param name="dereplication_output_cluster_definition" value="" />
+                <param name="dereplication_output_representative_fasta_directory_copy"  value="" />
             </section>
-            <output name="output1" file="test2.tsv" ftype="tsv" sort="true"/>
+            <output name="output" ftype="tabular">
+                <assert_contents>
+                    <has_text text="Sample"/>
+                    <has_text text="Genome"/>
+                    <has_text text="Mean"/>
+                    <has_text text="7seqs.reads_for_seq1_and_seq2"/>
+                    <has_text text="genome1"/>
+                </assert_contents>
+            </output>
         </test>
         <test expect_num_outputs="1">
-            <section name="derep">
-                <param name="dereplicate" value="true"/>
-                <param name="genome_info" value="genomeInfo.csv"/>
+            <conditional name="mapped">
+                <param name="mapped" value="not-mapped" />
+                <conditional name="mode">
+                    <param name="mode" value="co"/>
+                    <conditional name="read_type">
+                        <param name="type" value="single"/>
+                        <param name="single" value="1read.actually_fasta.fq"/>
+                    </conditional>
+                    <conditional name="genome">
+                        <param name="ref_or_genome" value="genomic"/>
+                        <conditional name="genomic">
+                            <param name="source" value="history"/>
+                            <param name="genome_fasta_files" value="500kb.fna,1mbp.fna"/>
+                        </conditional>
+                    </conditional>
+                    <param name="sharded" value="" />
+                </conditional>
+            </conditional>
+            <param name="exclude_genomes_from_deshard" value="false"/>
+            <section name="alignment">
+                <param name="min_read_aligned_length" value="0" />
+                <param name="min_read_percent_identity" value="0" />
+                <param name="min_read_aligned_percent" value="0" />
+                <conditional name="proper_pairs_only">
+                    <param name="proper_pairs_only" value=""/>
+                </conditional>
+                <param name="exclude_supplementary" value=""/>
             </section>
             <section name="cov">
-                <param name="covered_fraction" value="true"/>
+                <param name="methods" value="covered_bases"/>
+                <param name="trim_min" value="5"/>
+                <param name="trim_max" value="95"/>
                 <param name="min_covered_fraction" value="0"/>
+                <param name="contig_end_exclusion" value="75"/>
             </section>
-            <conditional name="reads">
-                <param name="read_type" value="single"/>
-                <param name="single" value="1read.actually_fasta.fq"/>
-                <conditional name="genome">
-                    <param name="ref_or_genome" value="genomic"/>
-                    <conditional name="genomic">
-                        <param name="source" value="history"/>
-                        <param name="fasta_history" value="500kb.fna,1mbp.fna"/>
-                    </conditional>
+            <section name="derep">
+                <conditional name="dereplicate">
+                    <param name="dereplicate" value="--dereplicate"/>
+                    <param name="dereplication_ani" value="99" />
+                    <param name="dereplication_aligned_fraction" value="50" />
+                    <param name="dereplication_fragment_length" value="3000" />
+                    <param name="dereplication_quality_formula" value="Parks2020_reduced" />
+                    <param name="dereplication_prethreshold_ani" value="95" />
+                    <param name="dereplication_precluster_method" value="finch"/>
                 </conditional>
-            </conditional>
-            <output name="output1">
+                <param name="genome_info" value="genomeInfo.csv"/>
+            </section>
+            <section name="out">
+                <param name="output_format" value="sparse"/>
+                <param name="no_zeros" value=""/>
+                <param name="dereplication_output_cluster_definition" value="" />
+                <param name="dereplication_output_representative_fasta_directory_copy"  value="" />
+            </section>
+            <output name="output" ftype="tabular">
                 <assert_contents>
-                    <has_n_lines n="2"/>
+                    <has_text text="Sample"/>
+                    <has_text text="Genome"/>
+                    <has_text text="Covered Bases"/>
+                    <has_text text="1read.actually_fasta.fq_single_0"/>
+                    <has_text text="1mbp"/>
                 </assert_contents>
             </output>
         </test>
         <test expect_num_outputs="3">
-            <conditional name="reads">
-                <param name="read_type" value="paired_collection"/>
-                <param name="paired_reads">
-                    <collection type="list:paired">
-                        <element name="reads_for_genome2">
-                            <collection type="paired">
-                                <element name="forward" value="reads_for_genome2.1.fa"/>
-                                <element name="reverse" value="reads_for_genome2.2.fa"/>
+            <conditional name="mapped">
+                <param name="mapped" value="not-mapped" />
+                <conditional name="mode">
+                    <param name="mode" value="co"/>
+                    <conditional name="read_type">
+                        <param name="type" value="paired_collection"/>
+                        <param name="paired_reads">
+                            <collection type="list:paired">
+                                <element name="reads_for_genome2">
+                                    <collection type="paired">
+                                        <element name="forward" value="reads_for_genome2.1.fa" ftype="fasta"/>
+                                        <element name="reverse" value="reads_for_genome2.2.fa" ftype="fasta"/>
+                                    </collection>
+                                </element>
                             </collection>
-                        </element>
-                    </collection>
-                </param>
-                <conditional name="genome">
-                <param name="ref_or_genome" value="genomic"/>
-                    <conditional name="genomic">
-                        <param name="source" value="history"/>
-                        <param name="fasta_history" value="genome1.fna,genome2.fna,genome3.fna"/>
+                        </param>
                     </conditional>
+                    <conditional name="genome">
+                        <param name="ref_or_genome" value="genomic"/>
+                        <conditional name="genomic">
+                            <param name="source" value="history"/>
+                            <param name="genome_fasta_files" value="genome1.fna,genome2.fna,genome3.fna"/>
+                        </conditional>
+                    </conditional>
+                    <param name="sharded" value="" />
                 </conditional>
             </conditional>
+            <param name="exclude_genomes_from_deshard" value="false"/>
+            <section name="alignment">
+                <param name="min_read_aligned_length" value="0" />
+                <param name="min_read_percent_identity" value="0" />
+                <param name="min_read_aligned_percent" value="0" />
+                <conditional name="proper_pairs_only">
+                    <param name="proper_pairs_only" value=""/>
+                </conditional>
+                <param name="exclude_supplementary" value=""/>
+            </section>
             <section name="cov">
-                <param name="mean" value="true"/>
+                <param name="methods" value="mean"/>
+                <param name="trim_min" value="5"/>
+                <param name="trim_max" value="95"/>
+                <param name="min_covered_fraction" value="0"/>
+                <param name="contig_end_exclusion" value="75"/>
             </section>
             <section name="derep">
-                <param name="dereplicate" value="true"/>
+                <conditional name="dereplicate">
+                    <param name="dereplicate" value="--dereplicate"/>
+                    <param name="dereplication_ani" value="99" />
+                    <param name="dereplication_aligned_fraction" value="50" />
+                    <param name="dereplication_fragment_length" value="3000" />
+                    <param name="dereplication_quality_formula" value="Parks2020_reduced" />
+                    <param name="dereplication_prethreshold_ani" value="95" />
+                    <param name="dereplication_precluster_method" value="finch"/>
+                </conditional>
             </section>
             <section name="out">
-                <param name="dereplication_output_cluster_definition" value="true"/>
-                <param name="dereplication_output_representative_fasta_directory_copy" value="true"/>
+                <param name="output_format" value="sparse"/>
+                <param name="no_zeros" value=""/>
+                <param name="dereplication_output_cluster_definition" value="true" />
+                <param name="dereplication_output_representative_fasta_directory_copy" value="true" />
             </section>
-            <output name="output1" file="test3.tsv" ftype="tsv" sort="true"/>
-            <output name="cluster_definition" ftype="tsv" value="test4_cluster.tsv" sort="true"/>
+            <output name="output" ftype="tabular">
+                <assert_contents>
+                    <has_text text="Genome"/>
+                    <has_text text="Mean"/>
+                    <has_text text="Sample"/>
+                    <has_text text="reads_for_genome2_paired_collection_0"/>
+                    <has_text text="genome2"/>
+                    <has_text text="genome3"/>
+                </assert_contents>
+            </output>
+            <output name="cluster_definition" ftype="tabular">
+                <assert_contents>
+                    <has_text text="genome1"/>
+                    <has_text text="genome2"/>
+                    <has_text text="genome3"/>
+                </assert_contents>
+            </output>
             <output_collection name="representative_fasta" type="list" count="3">
-                <element name="genome1" file="test4_rep1.fa" ftype="fasta" />
-                <element name="genome2" file="test4_rep2.fa" ftype="fasta" />
-                <element name="genome3" file="test4_rep3.fa" ftype="fasta" />
+                <element name="genome1" ftype="fasta">
+                    <assert_contents>
+                        <has_text text=">random_sequence_length_500_1"/>
+                        <has_text text=">random_sequence_length_500_2"/>
+                    </assert_contents>
+                </element>
+                <element name="genome2" ftype="fasta">
+                    <assert_contents>
+                        <has_text text=">random_sequence_length_500_1"/>
+                        <has_text text=">random_sequence_length_500_2"/>
+                    </assert_contents>
+                </element>
+                <element name="genome3" ftype="fasta">
+                    <assert_contents>
+                        <has_text text=">random_sequence_length_500_1"/>
+                        <has_text text=">random_sequence_length_500_2"/>
+                    </assert_contents>
+                </element>
             </output_collection>
         </test>
         <test expect_num_outputs="1">
-            <conditional name="reads">
-                <param name="read_type" value="bam"/>
-                <param name="bam" value="2seqs.bad_read.1.with_supplementary.bam"/>
-                <conditional name="genome">
-                    <param name="ref_or_genome" value="none"/>
-                    <param name="single_genome" value="true"/>
+            <conditional name="mapped">
+                <param name="mapped" value="mapped" />
+                <conditional name="mode">
+                    <param name="mode" value="co"/>
+                    <param name="bam_files" value="2seqs.bad_read.1.with_supplementary.bam"/>
+                    <param name="sharded" value="" />
+                    <conditional name="genome">
+                        <param name="ref_or_genome" value="contigs"/>
+                        <conditional name="cond_single_genome">
+                            <param name="single_genome" value="true"/>
+                            <conditional name="genome_contig_definition">
+                                <param name="choice" value="default"/>
+                            </conditional>
+                        </conditional>
+                    </conditional>
+                    <param name="sharded" value="" />
                 </conditional>
             </conditional>
+            <param name="exclude_genomes_from_deshard" value="false"/>
+            <section name="alignment">
+                <param name="min_read_aligned_length" value="0" />
+                <param name="min_read_percent_identity" value="0" />
+                <param name="min_read_aligned_percent" value="0" />
+                <conditional name="proper_pairs_only">
+                    <param name="proper_pairs_only" value=""/>
+                </conditional>
+                <param name="exclude_supplementary" value=""/>
+            </section>
             <section name="cov">
-                <param name="count" value="true"/>
+                <param name="methods" value="count"/>
+                <param name="trim_min" value="5"/>
+                <param name="trim_max" value="95"/>
                 <param name="min_covered_fraction" value="0"/>
+                <param name="contig_end_exclusion" value="75"/>
             </section>
-            <output name="output1" file="test5.tsv" ftype="tsv" sort="true"/>
+            <section name="derep" >
+                <conditional name="dereplicate">
+                    <param name="dereplicate" value=""/>
+                </conditional>
+            </section>
+            <section name="out">
+                <param name="output_format" value="sparse"/>
+                <param name="no_zeros" value=""/>
+                <param name="dereplication_output_cluster_definition" value="" />
+                <param name="dereplication_output_representative_fasta_directory_copy"  value="" />
+            </section>
+            <output name="output" ftype="tabular">
+                <assert_contents>
+                    <has_text text="Sample"/>
+                    <has_text text="Genome"/>
+                    <has_text text="Read Count"/>
+                    <has_text text="2seqs.bad_read.1.with_supplementary"/>
+                    <has_text text="genome1"/>
+                </assert_contents>
+            </output>
         </test>
-        </tests>
+    </tests>
     <help><![CDATA[
 .. class:: infomark
     
--- a/macros.xml	Tue Mar 28 08:36:25 2023 +0000
+++ b/macros.xml	Wed Jul 26 07:35:03 2023 +0000
@@ -1,13 +1,17 @@
 <macros>
+    <token name="@TOOL_VERSION@">0.6.1</token>
+    <token name="@VERSION_SUFFIX@">1</token>
+    <token name="@PROFILE@">22.01</token>
     <xml name="requirements">
         <requirements>
             <requirement type="package" version="@TOOL_VERSION@">coverm</requirement>
         </requirements>
     </xml>
-    <token name="@INPUT_FORMATS@">fasta,fastq,fastq.gz,fasta.gz</token>
-    <token name="@TOOL_VERSION@">0.6.1</token>
-    <token name="@VERSION_SUFFIX@">0</token>
-    <token name="@PROFILE@">22.01</token>
+    <xml name="bio_tools">
+        <xrefs>
+            <xref type="bio.tools">coverm</xref>
+        </xrefs>
+    </xml>
     <xml name="citation">
         <citations>
             <citation type="bibtex">
@@ -22,275 +26,315 @@
             </citation>
         </citations>
     </xml>
-    <xml name="genome_opt">
-        <conditional name="genome">
-            <param name="ref_or_genome" type="select" label="Select if you want to specify additional genome files.">
-                <option value="genomic">yes</option>
-                <option value="none" selected="true">No (Only when BAM files are provided)</option>
-            </param>
-            <when value="none">
-                <param argument="--single-genome" type="boolean" truevalue="--single-genome" falsevalue="" checked="false" label="All contigs are from the same genome."/>
-                <param type="text" name="separator" optional="true" label="Character, that separates genome names from contig names in the reference file." >
-                    <sanitizer>
-                        <valid initial="string.punctuation">
-                        </valid>
-                    </sanitizer>
-                </param>
+    <xml name="mapped">
+        <param name="mapped" type="select" label="Have the reads already been mapped to contigs?">
+            <option value="mapped">Yes (no read mapping algorithm will be undertaken)</option>
+            <option value="not-mapped" selected="true">No</option>
+        </param>
+    </xml>
+    <xml name="assembly_mode">
+        <param name="mode" type="select" label="Assembly mode?" help="Useful to know if contigs have been generated all samples together (co-assembly) or on each sample individually (individual assembly)">
+            <option value="individual">Individual assembly (1 contig file per sample)</option>
+            <option value="co" selected="true">Co-assembly (1 contig file for several samples)</option>
+        </param>
+    </xml>
+    <xml name="mapped_params">
+        <conditional name="mode">
+            <expand macro="assembly_mode"/>
+            <when value="individual">
+                <param argument="--bam-files" type="data" format="bam" label="BAM file(s)" help="These must be reference sorted (e.g. with samtools sort) unless sharded is specified, in which case they must be read name sorted (e.g. with samtools sort -n)."/>
+            </when>
+            <when value="co">
+                <param argument="--bam-files" type="data" format="bam" multiple="true" label="BAM file(s)" help="These must be reference sorted (e.g. with samtools sort) unless sharded is specified, in which case they must be read name sorted (e.g. with samtools sort -n)."/>
             </when>
-            <when value="genomic">
-                <conditional name="genomic">
-                    <param type="select" label="Reference genome source" name="source">
-                        <option value="history" selected="true">History</option>
-                        <option value="builtin">Built-in</option>
-                    </param>
-                    <when value="history">
-                        <param type="data" name="fasta_history" multiple="true" label="FASTA files of each genome" format="fasta" />
-                    </when>
-                    <when value="builtin">
-                        <param type="select" name="fasta_builtin" multiple="true" label="Reference genome(s)">
-                            <options from_data_table="all_fasta" />
-                        </param>
-                    </when>
-                </conditional>
+        </conditional>
+        <param argument="--sharded" type="boolean" truevalue="--sharded" falsevalue="" checked="false" label="BAM file(s) read-sorted alignments of a set of reads mapped to multiple reference contig sets?" help="If set, it will choose the best hit for each read pair" />
+    </xml>
+    <token name="@BAMS@"><![CDATA[
+    #if $mapped.mode.mode == 'individual'
+        #set $fn = 'bam/' + re.sub('[^\s\w\-\\.]', '_', str($mapped.mode.bam_files.element_identifier))
+        #silent $bam_fp.append( $fn )
+ln -s '$mapped.mode.bam_files' '$fn' &&
+    #else
+        #for $i, $bam in enumerate($mapped.mode.bam_files)
+            #set $fn = 'bam/' + re.sub('[^\s\w\-\\.]', '_', str($bam.element_identifier)) + '_' + str($i)
+            #silent $bam_fp.append( $fn )
+ln -s '$bam' '$fn' &&
+        #end for
+    #end if
+]]></token>
+    <xml name="genomic">
+        <conditional name="genomic">
+            <param type="select" name="source" label="Source of FASTA files with each genome" >
+                <option value="history" selected="true">History</option>
+                <option value="builtin">Built-in</option>
+            </param>
+            <when value="history">
+                <param argument="--genome-fasta-files" type="data" format="fasta" multiple="true" label="FASTA files of each genome"/>
+            </when>
+            <when value="builtin">
+                <param argument="--genome-fasta-files" type="select" multiple="true" label="Reference genome(s)">
+                    <options from_data_table="all_fasta" />
+                </param>
             </when>
         </conditional>
     </xml>
-    <xml name="genome">
-        <conditional name="genome">
-            <param name="ref_or_genome" type="select" label="Reference sequence mode" help="Select if you want to specify genome file(s) or a FASTA reference file or both. NOTE: If genomic FASTA files are specified, then reference is not needed as a reference FASTA file can be derived by concatenating input genomes. However, while not necessary, reference can be specified if an alternate reference sequence set is desired.">
-                <option value="genomic" selected="true">Reference genome</option>
-                <option value="reference">Contigs (e.g. concatenated genomes or metagenome assembly)</option>
+    <xml name="cond_single_genome">
+        <conditional name="cond_single_genome">
+            <param argument="--single-genome" type="select" label="Are all contigs from the same genome?">
+                <option value="--single-genome">True</option>
+                <option value="">False</option>
             </param>
-            <when value="genomic">
-                <conditional name="genomic">
-                    <param type="select" label="Reference genome source" name="source">
-                        <option value="history" selected="true">History</option>
-                        <option value="builtin">Built-in</option>
+            <when value="--single-genome"/>
+            <when value="">
+                <conditional name="genome_contig_definition">
+                    <param argument="choice" type="select" label="How to get genome names and contig names?">
+                        <option value="default" selected="true">Using default behavior</option>
+                        <option value="genome-definition">Providing a file containing newline-separated list of genome name and contig</option>
+                        <option value="separator">Providing character that separates genome names from contig names in the reference file</option>
                     </param>
-                    <when value="history">
-                        <param type="data" name="fasta_history" multiple="true" label="FASTA files of each genome" format="fasta" />
+                    <when value="default"/>
+                    <when value="genome-definition">
+                        <param argument="--genome-definition" type="data" format="tabular" label="File containing newline-separated list of genome_name and contig, separated by tab, to define the genome of each contig." />
                     </when>
-                    <when value="builtin">
-                        <param type="select" name="fasta_builtin" multiple="true" label="Reference genome(s)">
-                            <options from_data_table="all_fasta" />
-                        </param>
-                    </when>
-                </conditional>
-            </when>
-            <when value="reference">
-                <param type="data" name="ref_source" multiple="true" label="Contigs file(s)" format="fasta" help="If multiple references FASTA files are provided and 'sharded' is specified, then reads will be mapped to references separately as sharded BAMs."/>
-                <conditional name="cond_single_genome">
-                    <param name="single_genome" type="select" label="All contigs are from a single genome">
-                        <option value="--single-genome">True</option>
-                        <option value="false">False</option>
-                    </param>
-                    <when value="--single-genome">
-                        <param type="data" name="genome_definition" format="tsv" optional="true" label="File containing newline-separated list of genome_name and contig, separated by tab, to define the genome of each contig." />
-                    </when>
-                    <when value="false">
-                        <param type="text" argument="--separator" optional="true" label="Character, that separates genome names from contig names in the reference file." >
+                    <when value="separator">
+                        <param argument="--separator" type="text" label="Character that separates genome names from contig names in the reference file." >
                             <sanitizer>
                                 <valid initial="string.punctuation">
                                 </valid>
                             </sanitizer>
                         </param>
                     </when>
-                </conditional>                    
-                <conditional name="add_genome">
-                    <param name="add_genome" type="select" label="Add additional Genome Files">
-                        <option value="true">Yes</option>
-                        <option value="false" selected="true">No</option>
-                    </param>
-                    <when value="true">
-                        <conditional name="add_genomic">
-                            <param type="select" label="Reference genome source" name="source">
-                                <option value="history" selected="true">History</option>
-                                <option value="builtin">Built-in</option>
-                            </param>
-                            <when value="history">
-                                <param type="data" name="fasta_history" multiple="true" label="Single FASTA file of contigs" format="fasta" />
-                            </when>
-                            <when value="builtin">
-                                <param type="select" name="fasta_builtin" multiple="true" label="Reference genome">
-                                    <options from_data_table="all_fasta" />
-                                </param>
-                            </when>
-                        </conditional>                           
-                    </when>
-                    <when value="false">
-                    </when>
                 </conditional>
             </when>
         </conditional>
     </xml>
-    <xml name="reads_for_contig">
-        <conditional name="reads">
-            <param type="select" label="Read type" name="read_type">
-                <option value="paired">Paired end</option>
-                <option value="paired_collection" selected="true">Paired collection</option>
-                <option value="single">Single ended</option>
-                <option value="interleaved">Interleaved</option>
-                <option value="bam">BAM file(s)</option>
-            </param>
+    <token name="@INPUT_FORMATS@">fasta,fastq,fastq.gz,fasta.gz</token>
+    <xml name="read_type">
+        <param name="type" type="select" label="Read type" >
+            <option value="single">Single end</option>
+            <option value="paired">Paired end</option>
+            <option value="paired_collection" selected="true">Paired collection</option>
+            <option value="interleaved">Interleaved</option>
+        </param>
+    </xml>
+    <xml name="paired_reads">
+        <param name="paired_reads" type="data_collection" collection_type="list:paired" format="@INPUT_FORMATS@" label="Collection of paired-end FASTA/Q files(s) for mapping" help="One or more pairs of forward and reverse possibly gzipped FASTA/Q files for mapping in order." />
+    </xml>
+    <xml name="individual_assembly_reads">
+        <conditional name="read_type">
+            <expand macro="read_type"/>
+            <when value="single">
+                <param argument="--single" type="data" format="@INPUT_FORMATS@" label="Single Read" />
+            </when>
             <when value="paired">
-                <param type="data" format="@INPUT_FORMATS@" name="read1" multiple="true" label="Read1" />
-                <param type="data" format="@INPUT_FORMATS@" name="read2" multiple="true" label="Read2" />
-                <param type="data" name="ref_fasta_history" multiple="true" label="FASTA file(s) of contigs" format="fasta" />
+                <param argument="-1" name="read1" type="data" format="@INPUT_FORMATS@" label="Forward FASTA/Q file for mapping" />
+                <param argument="-2" name="read2" type="data" format="@INPUT_FORMATS@" label="Reverse FASTA/Q file for mapping" />
             </when>
             <when value="paired_collection">
-                <param type="data_collection" collection_type="list:paired" format="@INPUT_FORMATS@" name="paired_reads" label="One or more pairs of forward and reverse possibly gzipped FASTA/Q files for mapping in order" />
-                <param type="data" name="ref_fasta_history" multiple="true" label="FASTA file(s) of contigs" format="fasta" />
-            </when>
-            <when value="single">
-                <param type="data" format="@INPUT_FORMATS@" multiple="true" name="single" label="Single Read" />
-                <param type="data" name="ref_fasta_history" multiple="true" label="FASTA file(s) of contigs" format="fasta" />
+                <expand macro="paired_reads"/>
             </when>
             <when value="interleaved">
-                <param type="data" format="@INPUT_FORMATS@" multiple="true" name="single" label="Interleaved" />
-                <param type="data" name="ref_fasta_history" multiple="true" label="FASTA file(s) of contigs" format="fasta" />
-            </when>
-            <when value="bam">
-                 <param type="data" format="bam" name="bam" multiple="true" label="BAM file(s)" help="BAM file(s). These must be reference sorted (e.g. with samtools sort) unless sharded is specified, in which case they must be read name sorted (e.g. with samtools sort -n). When specified, no read mapping algorithm is undertaken."/>
-                <param type="data" name="ref_fasta_history" optional="true" multiple="true" label="FASTA file(s) of contigs" format="fasta" />
+                <param argument="--interleaved" type="data" format="@INPUT_FORMATS@" label="Interleaved FASTA/Q files for mapping" />
             </when>
         </conditional>
-    </xml>     
-    <xml name="reads">
-        <conditional name="reads">
-            <param type="select" label="Read type" name="read_type">
-                <option value="single">Single ended</option>
-                <option value="paired">Paired end</option>
-                <option value="paired_collection" selected="true">Paired collection</option>
-                <option value="interleaved">Interleaved</option>
-                <option value="bam">BAM file(s)</option>
-            </param>
+    </xml>
+    <xml name="ref_or_genome">
+        <param name="ref_or_genome" type="select" label="Genome definition">
+            <option value="contigs" selected="true">From contigs (e.g. concatenated genomes or metagenome assembly)</option>
+            <option value="genomic">From FASTA files with each genome</option>
+        </param>
+    </xml>
+    <xml name="individual_assembly_reference">
+        <param argument="--reference" type="data" format="fasta" label="Contigs"/>
+    </xml>
+    <token name="@INDIVIDUAL_ASSEMBLY_READS@"><![CDATA[
+        #set $reads = $mapped.mode.read_type
+        #if $reads.type == 'single'
+            #set $fn = "single/" + re.sub('[^\s\w\-\\.]', '_', str($reads.single.element_identifier))
+            #silent $single_fp.append( $fn )
+ln -s '$reads.single' '$single_fp' &&
+        #else if $reads.type == 'paired'
+            #set $fn = "fw/" + re.sub('[^\s\w\-\\.]', '_', str($reads.read1.element_identifier))
+            #silent $fw_fp.append( $fn )
+ln -s '$reads.read1' '$fn' &&
+            #set $fn = "rv/" + re.sub('[^\s\w\-\\.]', '_', str($reads.read2.element_identifier))
+ln -s '$reads.read2' '$fn' &&
+            #silent $rv_fp.append( $fn )
+        #else if $reads.type == 'paired_collection'
+            #set $id = re.sub('[^\s\w\-\\.]', '_', str($reads.paired_reads.element_identifier))
+            #set $fn = "fw/" + $id
+            #silent $fw_fp.append( $fn )
+ln -s '$reads.paired_reads.forward' '$fn' &&
+            #set $fn = "rv/" + $id
+            #silent $rv_fp.append( $fn )
+ln -s '$mreads.paired_reads.reverse' '${fn}' &&
+        #else if $reads.type == 'interleaved'
+            #set $fn = "interl/" + re.sub('[^\s\w\-\\.]', '_', str($reads.interleaved.element_identifier))
+            #silent $interl_fp.append( $fn )
+ln -s '$reads.interleaved' '$fn' &&
+        #end if
+]]></token>
+    <token name="@INDIVIDUAL_ASSEMBLY_REF@"><![CDATA[
+        #set $fn = "ref/" + re.sub('[^\s\w\-\\.]', '_', str($ref.element_identifier))
+        #silent $ref_fp.append( $fn )
+ln -s '$ref' '${fn}' &&
+]]></token>
+    <token name="@GENOME_FOR_READS@"><![CDATA[
+            #if $mapped.mode.genome.genomic.source == 'history'
+                #for $i, $genome in enumerate($mapped.mode.genome.genomic.genome_fasta_files)
+                    #set $fn = re.sub('[^\s\w\-\\.]', '_', str($genome.element_identifier))
+                    #silent $genome_fp.append( $fn )
+ln -s '$genome' '$fn' &&
+                #end for
+            #else
+                #for $i, $genome in enumerate($mapped.mode.genome.genomic.genome_fasta_files)
+                    #set $fn = re.sub('[^\s\w\-\\.]', '_', str($genome.fields.path.element_identifier))
+                    #silent $genome_fp.append( $fn )
+ln -s '$genome' '$fn' &&
+                #end for
+            #end if
+]]></token>
+    <xml name="co_assembly_reads">
+        <conditional name="read_type">
+            <expand macro="read_type"/>
+            <when value="single">
+                <param argument="--single" type="data" format="@INPUT_FORMATS@" multiple="true" label="Single Read" />
+            </when>
             <when value="paired">
-                <param type="data" format="@INPUT_FORMATS@" name="read1" multiple="true" label="Read1" />
-                <param type="data" format="@INPUT_FORMATS@" name="read2" multiple="true" label="Read2" />
-                <expand macro="genome"/>
+                <param argument="-1" name="read1" type="data" format="@INPUT_FORMATS@" multiple="true" label="Forward FASTA/Q file(s) for mapping" />
+                <param argument="-2" name="read2" type="data" format="@INPUT_FORMATS@" multiple="true" label="Reverse FASTA/Q file(s) for mapping" />
             </when>
             <when value="paired_collection">
-                <param type="data_collection" collection_type="list:paired" format="@INPUT_FORMATS@" name="paired_reads" label="Collection of paired-reads" help="One or more pairs of forward and reverse possibly gzipped FASTA/Q files for mapping in order." />
-                <expand macro="genome"/>
-            </when>
-            <when value="single">
-                <param type="data" format="@INPUT_FORMATS@" multiple="true" name="single" label="Single Read" />
-                <expand macro="genome"/>
+                <expand macro="paired_reads"/>
             </when>
             <when value="interleaved">
-                <param type="data" format="@INPUT_FORMATS@" multiple="true" name="single" label="Interleaved" />
-                <expand macro="genome"/>
-            </when>
-            <when value="bam">
-                <param type="data" format="bam" name="bam" multiple="true" label="BAM file(s)" help="BAM file(s). These must be reference sorted (e.g. with samtools sort) unless sharded is specified, in which case they must be read name sorted (e.g. with samtools sort -n). When specified, no read mapping algorithm is undertaken."/>
-                <expand macro="genome_opt"/>
+                <param argument="--interleaved" type="data" format="@INPUT_FORMATS@" multiple="true" label="Interleaved FASTA/Q files(s) for mapping" />
             </when>
         </conditional>
     </xml>
-    <xml name="add_reads">
-        <section name="add_reads" title="Add an additional read">
-            <conditional name="extra_read">
-                <param type="select" label="Read type" name="read_type">
-                    <option value="none" selected="true">None</option>
-                    <option value="paired">Paired end</option>
-                    <option value="paired_collection">Paired collection</option>
-                    <option value="single">Single ended</option>
-                    <option value="interleaved">Interleaved</option>
-                    <option value="bam">BAM file(s)</option>
-                </param>
-                <when value="none">
-                </when>
-                <when value="paired">
-                    <param type="data" format="@INPUT_FORMATS@" name="read1" multiple="true" label="Read1" />
-                    <param type="data" format="@INPUT_FORMATS@" name="read2" multiple="true" label="Read2" />
-                </when>
-                <when value="paired_collection">
-                    <param type="data_collection" collection_type="list:paired" format="@INPUT_FORMATS@" name="paired_reads" label="One or more pairs of forward and reverse possibly gzipped FASTA/Q files for mapping in order" />
-                </when>
-                <when value="single">
-                    <param type="data" format="@INPUT_FORMATS@" name="single" multiple="true" label="Single read" />
-                </when>
-                <when value="interleaved">
-                    <param type="data" format="@INPUT_FORMATS@" multiple="true" name="single" label="Interleaved" />
-                </when>
-                <when value="bam">
-                    <param type="data" format="bam" name="bam" multiple="true" label="BAM file(s)" />
-                </when>
-            </conditional>
-        </section>
+    <xml name="co_assembly_reference">
+        <param argument="--reference" type="data" format="fasta" multiple="true" label="Contigs" />
+        <param argument="--sharded" type="boolean" truevalue="--sharded" falsevalue="" checked="false" label="Mapping reads to references separately as sharded BAMs?" />
+    </xml>
+    <token name="@CO_ASSEMBLY_READS@"><![CDATA[
+        #if $reads.type == 'single'
+            #for $i, $read in enumerate($reads.single)
+                #set $fn = "single/" + re.sub('[^\s\w\-\\.]', '_', str($read.element_identifier)) + "_single_" + str($i) + $extra
+                #silent $single_fp.append( $fn )
+ln -s '$read' '$fn' &&
+            #end for
+        #else if $reads.type == 'paired'
+            #for $i, $read in enumerate($reads.read1)
+                #set $id = re.sub('[^\s\w\-\\.]', '_', str($read.element_identifier))
+                #set $fn = "fw/" + $id + "_paired_" + str($i) + $extra
+                #silent $fw_fp.append( $fn )
+ln -s '$read' '$fn' &&
+            #end for
+            #for $i, $read in enumerate($reads.read2)
+                #set $id = re.sub('[^\s\w\-\\.]', '_', str($read.element_identifier))
+                #set $fn = "rv/" + $id + "_paired_" + str($i) + $extra
+                #silent $rv_fp.append( $fn )
+ln -s '$read' '$fn' &&
+            #end for
+        #else if $reads.type == 'paired_collection'
+            #for $i, $read in enumerate($reads.paired_reads)
+                #set $id = re.sub('[^\s\w\-\\.]', '_', str($read.element_identifier))
+                #set $fn = "fw/" + $id + "_paired_collection_" + str($i) + $extra
+                #silent $fw_fp.append( $fn )
+ln -s '$read.forward' '$fn' &&
+                #set $fn = "rv/" + $id + "_paired_collection_" + str($i) + $extra
+                #silent $rv_fp.append( $fn )
+ln -s '$read.reverse' '$fn' &&
+            #end for
+        #else if $reads.type == 'interleaved'
+            #for $i, $read in enumerate($reads.interleaved)
+                #set $id = re.sub('[^\s\w\-\\.]', '_', str($read.element_identifier))
+                #set $fn = "interl/" + $id + "_interleaved_" + str($i) + $extra
+                #silent $interl_fp.append( $fn )
+ln -s '$read' '$fn' &&
+            #end for
+        #end if
+    ]]></token>
+    <token name="@CO_ASSEMBLY_ALL_READS@"><![CDATA[
+        #set $reads = $mapped.mode.read_type
+        #set $extra = ''
+        @CO_ASSEMBLY_READS@
+        #for $j, $s in enumerate($mapped.mode.extra_reads)
+            #set $reads = $s.read_type
+            #set $extra = str($j)
+            @CO_ASSEMBLY_READS@
+        #end for
+    ]]></token>
+    <token name="@CO_ASSEMBLY_REF@"><![CDATA[
+        #for $i, $ref in enumerate($refs)
+            #set $fn = "ref/" + re.sub('[^\s\w\-\\.]', '_', str($ref.element_identifier)) + "_" + str($i)
+            #silent $ref_fp.append( $fn )
+ln -s '$ref' '${fn}' &&
+        #end for
+    ]]></token>
+    <xml name="sharded">
+        <param name="sharded" type="boolean" truevalue="--sharded" falsevalue="" checked="false" label="Input BAM files are read-sorted alignments of a set of reads mapped to multiple reference contig sets. Choose the best hit for each read pair. Otherwise if mapping was carried out: Map reads to each reference, choosing the best hit for each pair." />
     </xml>
     <xml name="mapping">
-        <section name="mapping" title="Mapping options" expanded="false">
-            <param argument="--mapper" optional="true" type="select" label="Mapper" help="Underlying mapping software used. Default: minimap2-sr" >
-                <option value="minimap2-sr">minimap2 with '-x sr' option</option>
-                <option value="minimap2-ont">minimap2 with '-x map-ont' option</option>
-                <option value="minimap2-pb">minimap2 with '-x map-pb' option</option>
-                <option value="minimap2-no-preset">minimap2 with no '-x' option</option>
-                <option value="bwa-mem">BWA-MEM using default parameters</option>
-            </param>
-            <param argument="--min_read-aligned-length" type="integer" min="0" value="0" 
-                label="Min read aligned length" help="Exclude reads with smaller numbers of aligned bases. Default: 0" />
-            <param argument="--min_read-percent-identity" type="float" min="0" max="100" value="0" 
-                label="Min read percent identity" help="Exclude reads by overall percent identity e.g. 95 for 95%. Default: 0" />
-            <param argument="--min_read-aligned-percent" type="float" min="0" max="100" value="0" 
-                label="Min read aligned percentage" help="Exclude reads by percent aligned bases e.g. 95 means 95% 
-                    of the read's bases must be aligned. Default: 0" />
-            <param argument="--min_read-aligned-length-pair" type="integer" min="0" value="0" 
-                label="Min read aligned length pair" help="Exclude pairs with smaller numbers of aligned bases. 
-                    Implies --proper-pairs-only. Default: 0" />
-            <param argument="--min_read-percent-identity-pair" type="float" min="0" max="100" value="0" 
-                label="Min read percent identity pair" help="Exclude pairs by overall percent identity e.g. 95 for 95%. 
-                    Implies --proper-pairs-only. Default: 0" />
-            <param argument="--min_read-aligned-percent-pair" type="float" min="0" max="100" value="0" 
-                label="Min read aligned percentage pair" help="Exclude reads by percent aligned bases e.g. 95 means 95% of 
-                    the read's bases must be aligned. Implies --proper-pairs-only. Default: 0" />
-            <param argument="--proper-pairs-only" type="boolean" truevalue="--proper-pairs-only" falsevalue="" 
-                label="Require reads to be mapped as proper pairs" help="Default: not set"/>
-            <param argument="--exclude-supplementary" type="boolean" truevalue="--exclude-supplementary" falsevalue="" 
-                label="Exclude supplementary alignments" help="Default: not set"/>
-        </section>
+        <param argument="--mapper" type="select" label="Underlying mapping software used">
+            <option value="minimap2-sr"  selected="true">minimap2 with '-x sr' option</option>
+            <option value="minimap2-ont">minimap2 with '-x map-ont' option</option>
+            <option value="minimap2-pb">minimap2 with '-x map-pb' option</option>
+            <option value="minimap2-no-preset">minimap2 with no '-x' option</option>
+            <option value="bwa-mem">BWA-MEM using default parameters</option>
+        </param>
     </xml>
-    <xml name="coverage">
-        <section name="cov" title="Coverage calculation options" expanded="false">
-            <param name="relative_abundance" type="boolean" falsevalue="" truevalue="relative_abundance" label="Relative abundance (default)"/>
-            <param name="mean" type="boolean" falsevalue="" truevalue="mean" label="Mean"/>
-            <conditional name="cond_methods">
-                <param name="trimmed_mean" type="select" label="Trimmed mean">
-                    <option value="trimmed_mean">Yes</option>
+    <xml name="alignment">
+        <section name="alignment" title="Alignment thresholding" expanded="false">
+            <param argument="--min-read-aligned-length" type="integer" min="0" value="0" 
+                label="Minimum number of aligned bases" help="Reads with smaller numbers of aligned bases will be excluded" />
+            <param argument="--min-read-percent-identity" type="float" min="0" max="100" value="0" 
+                label="Minimum overall percent identity" help="Reads with lower overall percent identity will be excluded." />
+            <param argument="--min-read-aligned-percent" type="float" min="0" max="100" value="0" 
+                label="Minimum aligned base percent" help="Reads with lower percent aligned bases will be excluded" />
+            <conditional name="proper_pairs_only">
+                <param argument="--proper-pairs-only" type="select" label="Require reads to be mapped as proper pairs?">
+                    <option value="--proper-pairs-only">Yes</option>
                     <option value="" selected="true">No</option>
                 </param>
-                <when value="trimmed_mean">
-                    <param name="trim_min" type="integer" min="0" value="5" label="Trim min" help="Remove this smallest fraction of positions when calculating trimmed_mean default: 5"/>
-                    <param name="trim_max" type="integer" min="0" value="95" label="Trim max" help="Maximum fraction for trimmed_mean calculations default: 95"/>
+                <when value="--proper-pairs-only">
+                    <param argument="--min_read-aligned-length-pair" type="integer" min="0" value="0" 
+                        label="Minimum number of aligned bases for pairs" help="Pairs with smaller numbers of aligned bases will be excluded." />
+                    <param argument="--min-read-percent-identity-pair" type="float" min="0" max="100" value="0" 
+                        label="Minimum overall percent identity pair for pairs" help="Pairs by lower overall percent identity will be excluded" />
+                    <param argument="--min-read-aligned-percent-pair" type="float" min="0" max="100" value="0" 
+                        label="Minimum percent of read aligned bases for pair" help="Pairs with lower reads percent aligned bases will be excluded" />
                 </when>
                 <when value=""/>
             </conditional>
-            <param name="covered_bases" type="boolean" falsevalue="" truevalue="covered_bases" label="Covered bases"/>
-            <param name="covered_fraction" type="boolean" falsevalue="" truevalue="covered_fraction" label="Covered fraction"/>
-            <param name="variance" type="boolean" falsevalue="" truevalue="variance" label="Variance"/>
-            <param name="length" type="boolean" falsevalue="" truevalue="length" label="Length"/>
-            <param name="count" type="boolean" falsevalue="" truevalue="count" label="Count"/>
-            <param name="metabat" type="boolean" falsevalue="" truevalue="metabat" label="MetaBAT"/>
-            <param name="coverage_histogram" type="boolean" falsevalue="" truevalue="coverage_histogram" label="Coverage histogram"/>
-            <param name="reads_per_base" type="boolean" falsevalue="" truevalue="reads_per_base" label="Reads per base"/>
-            <param name="rpkm" type="boolean" falsevalue="" truevalue="rpkm" label="RPKM"/>
-            <param name="tpm" type="boolean" falsevalue="" truevalue="tpm" label="TPKM"/>
-            <param name="min_covered_fraction" type="integer" min="0" optional="true"
-                label="Min covered fraction" help="Genomes with less coverage than this reported as having zero coverage. Default: 10"/>
-            <param name="contig_end_exclusion" type="integer" min="0" optional="true"
-                label="Contig end exclusion" help="Exclude bases at the ends of reference sequences from calculation. Default: 75"/>
+            <param argument="--exclude-supplementary" type="boolean" truevalue="--exclude-supplementary" falsevalue="" checked="false"
+                label="Exclude supplementary alignments"/>
         </section>
     </xml>
-    <xml name="out">
-        <section name="out" title="Output options" expanded="false">
-            <param name="output_format" type="select" label="Shape of output" help="'Sparse' for long format, 'dense' for species-by-site. Default: dense]">
-                <option value="dense" selected="true">Dense</option>
-                <option value="sparse">Sparse</option>
-            </param>
-            <param name="no_zeros" type="boolean" truevalue="--no-zeros" falsevalue="" optional="true" label="Omit printing of genomes that have zero coverage" />
-            <param argument="--dereplication-output-cluster-definition" type="boolean" truevalue="--dereplication-output-cluster-definition" falsevalue="" label="Output a file of representative TAB member lines." />
-            <param argument="--dereplication-output-representative-fasta-directory-copy" type="boolean" truevalue="--dereplication-output-representative-fasta-directory-copy" falsevalue="" label="Output representative genomes" />
-        </section>
+    <xml name="cov_method_options">
+        <option value="trimmed_mean">trimmed_mean: Average number of aligned reads overlapping each position after removing the most deeply and shallow-ly covered positions. </option>
+        <option value="coverage_histogram">coverage_histogram: Histogram of coverage depths</option>
+        <option value="covered_bases">covered_bases: Number of bases covered by 1 or more reads</option>
+        <option value="variance">variance: Variance of coverage depths</option>
+        <option value="length">length: Length of each contig in base pairs</option>
+        <option value="count">count: Number of reads aligned toq each contig. Note that a single read may be aligned to multiple contigs with supplementary alignments</option>
+        <option value="metabat">metabat: ("MetaBAT adjusted coverage") Coverage as defined in Kang et al 2015</option>
+        <option value="reads_per_base">reads_per_base: Number of reads aligned divided by the length of the contig</option>
+        <option value="rpkm">rpkm: Reads mapped per kilobase of contig, per million mapped reads</option>
+        <option value="tpm">tpm: Transcripts Per Million as described in Li et al 2010</option>
+    </xml>
+    <xml name="coverage_params">
+        <param argument="--trim-min" type="integer" min="0" value="5" label="Smallest fraction of positions to remove when calculating" help="Only used with trimmed_mean method"/>
+        <param argument="--trim-max" type="integer" min="0" value="95" label="Maximum fraction of positions to remove when calculating" help="Only used with trimmed_mean method"/>
+        <param argument="--min-covered-fraction" type="integer" min="0" value="10" label="Minimum covered fraction" help="Genomes with less coverage than this reported as having zero coverage"/>
+        <param argument="--contig-end-exclusion" type="integer" min="0" value="75" label="Base to exclude at contig ends" help="Bases at the ends of reference sequences will be excluded from calculation"/>
+    </xml>
+    <xml name="output_format">
+        <param argument="--output-format" type="select" label="Shape of output">
+            <option value="dense" selected="true">Dense for species-by-site</option>
+            <option value="sparse">Sparse for long format</option>
+        </param>
     </xml>
     <xml name="citations">
         <citations>