view macros.xml @ 6:73b667038f46 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tools/coverm commit f5876e043d748c5bdb6d310396dd2b34f30ae23a
author iuc
date Sun, 25 Feb 2024 09:45:26 +0000
parents 847f274a60da
children
line wrap: on
line source

<macros>
    <token name="@TOOL_VERSION@">0.7.0</token>
    <token name="@VERSION_SUFFIX@">0</token>
    <token name="@PROFILE@">22.01</token>
    <xml name="requirements">
        <requirements>
            <requirement type="package" version="@TOOL_VERSION@">coverm</requirement>
        </requirements>
    </xml>
    <xml name="bio_tools">
        <xrefs>
            <xref type="bio.tools">coverm</xref>
        </xrefs>
    </xml>
    <xml name="citation">
        <citations>
            <citation type="bibtex">
            @misc{githubCoverm,
            author = {B J. Woodcroft},
            year = {2021},
            title = {CoverM},
            publisher = {GitHub},
            journal = {GitHub repository},
            url = {https://github.com/wwood/CoverM}
            }
            </citation>
        </citations>
    </xml>
    <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>
        </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">
                        <column name="name" index="2"/>
                        <column name="value" index="3"/>
                    </options>
                </param>
            </when>
        </conditional>
    </xml>
    <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="--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="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="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>
            </when>
        </conditional>
    </xml>
    <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="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 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 name="paired_reads" type="data_collection" collection_type="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." />
            </when>
            <when value="interleaved">
                <param argument="--interleaved" type="data" format="@INPUT_FORMATS@" label="Interleaved FASTA/Q files for mapping" />
            </when>
        </conditional>
    </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 '$reads.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[
        echo "GENOME_FOR_READS mapped.mode.genome.genomic.source=$mapped.mode.genome.genomic.source" &&
        echo "GENOME_FOR_READS mapped.mode.genome.genomic.genome_fasta_files=$mapped.mode.genome.genomic.genome_fasta_files" &&
            #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 $genome in $mapped.mode.genome.genomic.genome_fasta_files
                    #silent $genome_fp.append($genome)
                #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 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 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." />
            </when>
            <when value="interleaved">
                <param argument="--interleaved" type="data" format="@INPUT_FORMATS@" multiple="true" label="Interleaved FASTA/Q files(s) for mapping" />
            </when>
        </conditional>
    </xml>
    <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">
        <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="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="--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 argument="--exclude-supplementary" type="boolean" truevalue="--exclude-supplementary" falsevalue="" checked="false"
                label="Exclude supplementary alignments"/>
        </section>
    </xml>
    <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>
            <yield />
        </citations>
    </xml>
</macros>