view macros.xml @ 0:d2a4c2cb8779 draft default tip

planemo upload for repository https://github.com/bgruening/galaxytools/main/tools/sylph commit 6ac2834ca0a21512c9986e2fb8d0dcda1c4b0e18
author bgruening
date Fri, 23 May 2025 09:49:04 +0000
parents
children
line wrap: on
line source

<macros>
    <token name="@TOOL_VERSION@">0.8.1</token>
    <token name="@VERSION_SUFFIX@">0</token>
    <token name="@LICENSE@">MIT</token>
    <token name="@DB_SELECTOR@"><![CDATA[
        #if $database_select.select == 'cached' or $database_select.select == 'cached_and_custom':
            #set $databases = str($database_select.sylph_database.fields.path).split(',')
            #for $number, $current_db in enumerate($databases):
                #set $db_name = str($number) + "_sylph_database.syldb"
                ln -s '$current_db' '$db_name' &&
            #end for
        #end if
    
    #if $database_select.select == 'cached'
        #set $metadata = str($database_select.sylph_database.fields.sylph_tax_identifier).split(',')
        #set metadata_files = ''
        #for $number, $current_metadata in enumerate($metadata):
            #set metadata_files = str($metadata_files) + str($current_metadata) + ' '
        #end for
    #end if

    ]]></token>
    <token name="@SINGLE_INPUT_FASTQ@"><![CDATA[
        #if $sketch_reads.input.ext == 'fastqsanger'
            #set $ext = 'fastq'
        #else if $sketch_reads.input.ext == 'fastqsanger.gz':
            #set $ext = 'fastq.gz'
        #else:
            #set $ext = str($sketch_reads.input.ext)
        #end if
        #if $sketch_reads.input.element_identifier.endswith('.fastq') or $sketch_reads.input.element_identifier.endswith('.fastq.gz'):
            #set $input = re.sub(r'\s+', '_', $sketch_reads.input.element_identifier)
        #else:
            #set $input = re.sub(r'\s+', '_', $sketch_reads.input.element_identifier + '.' + str($ext))
        #end if
        ln -s '$sketch_reads.input' '$input' &&
    ]]></token>
    <token name="@SINGLE_GROUP_FASTQ@"><![CDATA[
        #set input = ''
        #for $number, $current_file in enumerate($sketch_reads.input):
            #if $current_file.ext == 'fastqsanger'
                #set $ext = 'fastq'
            #else if $current_file.ext == 'fastqsanger.gz':
                #set $ext = 'fastq.gz'
            #else:
                #set $ext = str($current_file.ext)
            #end if
            #if $current_file.element_identifier.endswith('.fastq') or $current_file.element_identifier.endswith('.fastq.gz'):
                #set $current_input = re.sub(r'\s+', '_', $current_file.element_identifier)
            #else:
                #set $current_input = re.sub(r'\s+', '_', $current_file.element_identifier + '.' + str($ext))
            #end if
            ln -s '${current_file}' '$current_input' &&
            #set input = str($input) + ' ' + str($current_input)
        #end for
    ]]></token>
    <token name="@PAIRED@"><![CDATA[
        #if $sketch_reads.input_1.ext == 'fastqsanger'
                #set $ext_1 = 'fastq'
            #else if $sketch_reads.input_1.ext == 'fastqsanger.gz':
                #set $ext_1 = 'fastq.gz'
            #else:
                #set $ext_1 = str($sketch_reads.input_1.ext)
            #end if

            #if $sketch_reads.input_2.ext == 'fastqsanger'
                #set $ext_2 = 'fastq'
            #else if $sketch_reads.input_2.ext == 'fastqsanger.gz':
                #set $ext_2 = 'fastq.gz'
            #else:
                #set $ext_2 = str($sketch_reads.input_2.ext)
            #end if

            #if $sketch_reads.input_1.element_identifier.endswith('.fastq') or $sketch_reads.input_1.element_identifier.endswith('.fastq.gz'):
                #set $read1 = re.sub(r'\s+', '_', $sketch_reads.input_1.element_identifier)
            #else:
                #set $read1 = re.sub(r'\s+', '_', str($sketch_reads.input_1.element_identifier) + '.' + str($ext_1))
            #end if
            #if $sketch_reads.input_2.element_identifier.endswith('.fastq') or $sketch_reads.input_2.element_identifier.endswith('.fastq.gz'):
                #set $read2 = re.sub(r'\s+', '_', $sketch_reads.input_2.element_identifier)
            #else:
                #set $read2 = re.sub(r'\s+', '_', str($sketch_reads.input_2.element_identifier) + '.' + str($ext_2))
            #end if
            ln -s '$sketch_reads.input_1' '$read1' &&
            ln -s '$sketch_reads.input_2' '$read2' &&
    ]]></token>
    <token name="@PAIRED_GROUP@"><![CDATA[
        #if $sketch_reads.input.forward.ext == 'fastqsanger'
            #set $ext_1 = 'fastq'
        #else if $sketch_reads.input.forward.ext == 'fastqsanger.gz':
            #set $ext_1 = 'fastq.gz'
        #else:
            #set $ext_1 = str($sketch_reads.input.forward.ext)
        #end if

        #if $sketch_reads.input.reverse.ext == 'fastqsanger'
            #set $ext_2 = 'fastq'
        #else if $sketch_reads.input.reverse.ext == 'fastqsanger.gz':
            #set $ext_2 = 'fastq.gz'
        #else:
            #set $ext_2 = str($sketch_reads.input.reverse.ext)
        #end if
        
        #set $read1 = re.sub(r'\s+', '_', str($sketch_reads.input.element_identifier) + '.' + str($ext_1))
        #set $read2 = re.sub(r'\s+', '_', str($sketch_reads.input.element_identifier) + '_r2.' + str($ext_2))
        ln -s '$sketch_reads.input.forward' '$read1' &&
        ln -s '$sketch_reads.input.reverse' '$read2' &&
    ]]></token>
    <token name="@SINGLE_INPUT_FASTA@"><![CDATA[
        #if $sketch_fasta.input.ext == 'fasta'
            #set $ext = 'fasta'
        #else if $sketch_fasta.input.ext == 'fasta.gz':
            #set $ext = 'fasta.gz'
        #else:
            #set $ext = str($sketch_fasta.input.ext)
        #end if
        #if $sketch_fasta.input.element_identifier.endswith('.fasta') or $sketch_fasta.input.element_identifier.endswith('.fasta.gz'):
            #set $input = re.sub(r'\s+', '_', $sketch_fasta.input.element_identifier)
        #else:
            #set $input = re.sub(r'\s+', '_', $sketch_fasta.input.element_identifier + '.' + str($ext))
        #end if
        ln -s '$sketch_fasta.input' '$input' &&
    ]]></token>
    <token name="@SINGLE_GROUP_FASTA@"><![CDATA[
        #set input = ''
        #for $number, $current_file in enumerate($sketch_fasta.input):
            #if $sketch_fasta.input.ext == 'fasta'
                #set $ext = 'fasta'
            #else if $sketch_fasta.input.ext == 'fasta.gz':
                #set $ext = 'fasta.gz'
            #else:
                #set $ext = str($current_file.ext)
            #end if
            #if $current_file.element_identifier.endswith('.fasta') or $current_file.element_identifier.endswith('.fasta.gz'):
                #set $current_input = re.sub(r'\s+', '_', $current_file.element_identifier)
            #else:
                #set $current_input = re.sub(r'\s+', '_', $current_file.element_identifier + '.' + str($ext))
            #end if
            ln -s '${current_file}' '$current_input' &&
            #set input = str($input) + ' ' + str($current_input)
        #end for
    ]]></token>
    <xml name="requirements">
        <requirements>
            <requirement type="package" version="@TOOL_VERSION@">sylph</requirement>
            <requirement type="package" version="3.11">python</requirement>
            <requirement type="package" version="2.2">pandas</requirement>
            <yield />
        </requirements>
    </xml>
    <xml name="citation">
        <citations>
            <citation type="doi">10.1038/s41587-024-02412-y</citation>
        </citations>
    </xml>
    <xml name="creator">
        <creator>
            <person givenName="Tyler" familyName="Collins"/>
            <person givenName="Alexander" familyName="Ostrovsky"/>
            <person givenName="Hugo" familyName="Lefeuvre"/>
        </creator>
    </xml>
    <xml name="xrefs">
        <xrefs>
            <xref type="bio.tools">sylph</xref>
        </xrefs>
    </xml>
    <xml name="input_database">
            <when value="custom">
                <conditional name="sketch_fasta">
                    <param name="type_fasta" type="select" label="Select the type of fasta used">
                        <option value="single_fasta">Individual fasta files</option>
                        <option value="single_group_fasta">Group of fasta files</option>
                    </param>
                    <when value="single_fasta">
                        <param name="input" type="data" format="fasta,fasta.gz" label="Fasta files"/>
                    </when>
                    <when value="single_group_fasta">
                        <param name="input" type="data" format="fasta,fasta.gz" label="Fasta files" multiple="true"/>
                    </when>
                </conditional>
                <param name="compression" type="integer" min="0" value="200" label="Compression" help="Memory/runtime scale like 1/c; higher c is faster but less sensitive at low coverage. The -c for genomes must be than >= the -c for reads (strict > is allowed) (-c)" />
                <param name="grouped_genomes" type="boolean" checked="false" label="Creating a database of contigs or if genomes are all in one fasta file" truevalue="Yes" falsevalue="No" help="Considers every record in a fasta (i.e. contig) as a genome (-i)" />
            </when>
            <when value="cached_and_custom">
                <param label="Select a sylph database" name="sylph_database" type="select" multiple="true" optional="false">
                    <options from_data_table="sylph_databases">
                        <filter type="static_value" value="1" column="version"/>
                        <validator message="No Sylph databases are available" type="no_options" />
                    </options>
                </param>
                <conditional name="sketch_fasta">
                    <param name="type_fasta" type="select" label="Select the type of fasta used">
                        <option value="single_fasta">Individual fasta files</option>
                        <option value="single_group_fasta">Group of fasta files</option>
                    </param>
                    <when value="single_fasta">
                        <param name="input" type="data" format="fasta,fasta.gz" label="Fasta files"/>
                    </when>
                    <when value="single_group_fasta">
                        <param name="input" type="data" format="fasta,fasta.gz" label="Fasta files" multiple="true"/>
                    </when>
                </conditional>
                <param name="compression" type="integer" min="0" value="200" label="Compression" help="Memory/runtime scale like 1/c; higher c is faster but less sensitive at low coverage. The -c for genomes must be than >= the -c for reads (strict > is allowed) (-c)" />
                <param name="grouped_genomes" type="boolean" checked="false" label="Creating a database of contigs or if genomes are all in one fasta file" truevalue="Yes" falsevalue="No" help="Considers every record in a fasta (i.e. contig) as a genome (-i)" />
            </when>
    </xml>
    <xml name="element_assert" token_name="" token_text="">
        <element name="@NAME@">
            <assert_contents>
                <has_text text="@TEXT@"/>
                <yield/>
            </assert_contents>
        </element>
    </xml>
</macros>