<tool id="merquryfk_asmplot" name="MerquryFK ASMplot" version="@VERSION@+galaxy@VERSION_SUFFIX@" profile="24.2">
    <description>Analyzes k-mer spectra for unique, shared, and missing k-mers</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/>
    <command detect_errors="exit_code"><![CDATA[
        #set ASSEMBLY1="assembly."+$assembly_1.ext
        ln -s '$reads' assembly.ktab &&
        ln -s '$assembly_1' $ASSEMBLY1 &&
        #if $assembly_2:
            #set ASSEMBLY2="assembly2."+$assembly_2.ext
            ln -s '$assembly_2' $ASSEMBLY2 &&
        #end if
        ln -s '$fastk_ktab_files' ktab_files.tar.gz &&
        tar -xf ktab_files.tar.gz -C '.' &&
        ASMplot
        @PLOTS@
        @MEASURE@
        @GRAPHS@
        $pdf
        -T\${GALAXY_SLOTS:-1}
        assembly.ktab
        '$ASSEMBLY1'
        #if $assembly_2:
            $ASSEMBLY2
        #end if
        asmplot 
    ]]></command>
    <inputs>
        <param name="reads" type="data" format="fastk_ktab" label="K-mer table (ktab) obtained from FastK tool"/>
        <param name="fastk_ktab_files" type="data" format="fastk_ktab_tar" label="Select the TAR file consisting of all intermediate Ktab file from FastK"/>
        <param name="assembly_1" type="data" format="fasta,fasta.gz" label="Assembly of genome" help="Must be same genome as the K-mer table was generated from"/>
        <param name="assembly_2" type="data" format="fasta,fasta.gz" label="Additional assembly file" optional="true" help="Additional genome against which to compare"/>
        <expand macro="plots"/>
        <expand macro="sizes"/>
        <expand macro="graphs"/>
        <expand macro="pdf"/>
    </inputs>
    <outputs>
        <collection name="outputs_png" type="list" label="${tool.name} on ${on_string}: PNG figures">
            <filter>pdf is not True</filter>
            <discover_datasets pattern="(?P&lt;designation&gt;.*).png" format="png"/>
        </collection>
        <collection name="outputs_pdf" type="list" label="${tool.name} on ${on_string}: PDF figures">
            <filter>pdf is True</filter>
            <discover_datasets pattern="(?P&lt;designation&gt;.*).pdf" format="pdf"/>
        </collection>
    </outputs>
    <tests>
        <test expect_num_outputs="1">
            <param name="reads" value="assembly.ktab"/>
            <param name="fastk_ktab_files" ftype="fastk_ktab_tar" location="https://zenodo.org/records/14905247/files/asmplot_ktab.tar.gz"/>
            <param name="assembly_1" value="assembly.fasta.gz"/>
            <param name="width" value="6.0"/>
            <param name="height" value="4.5"/>
            <param name="graphs" value="-l,-f,-s"/>
            <param name="pdf" value="False"/>
            <conditional name="measure">
                <param name="measurement" value="absolute"/>
                <param name="max_x" value="2"/>
                <param name="max_y" value="1"/>
            </conditional>
            <output_collection name="outputs_png" type="list" count="3"/>
        </test>
        <test expect_num_outputs="1">
            <param name="reads" value="assembly.ktab"/>
            <param name="fastk_ktab_files" ftype="fastk_ktab_tar" location="https://zenodo.org/records/14905247/files/asmplot_ktab.tar.gz"/>
            <param name="assembly_1" value="assembly.fasta.gz"/>
            <param name="assembly_2" value="assembly_2.fasta.gz"/>
            <param name="width" value="6.0"/>
            <param name="height" value="4.5"/>
            <param name="graphs" value="-l,-f,-s"/>
            <param name="pdf" value="False"/>
            <conditional name="measure">
                <param name="measurement" value="absolute"/>
                <param name="max_x" value="2"/>
                <param name="max_y" value="1"/>
            </conditional>
            <output_collection name="outputs_png" type="list" count="3"/>
        </test>
        <test expect_num_outputs="1">
            <param name="reads" value="assembly.ktab"/>
            <param name="fastk_ktab_files" ftype="tar" location="https://zenodo.org/records/14905247/files/asmplot_ktab.tar.gz"/>
            <param name="assembly_1" value="assembly.fasta.gz"/>
            <param name="assembly_2" value="assembly_2.fasta.gz"/>
            <param name="width" value="6.0"/>
            <param name="height" value="4.5"/>
            <param name="graphs" value="-l,-f,-s"/>
            <param name="pdf" value="True"/>
            <conditional name="measure">
                <param name="measurement" value="absolute"/>
                <param name="max_x" value="2"/>
                <param name="max_y" value="1"/>
            </conditional>
            <output_collection name="outputs_pdf" type="list" count="3"/>
        </test>
    </tests>
    <help><![CDATA[
        ASMplot looks at the spectra of the k-mers that:
        (a) are in neither genome assembly file or the additional assembly file, 
        (b) in genome assembly file but not the additional assembly file, 
        (c) in the additional assembly file but not genome assembly file, and 
        (d) in both genome assembly file and the additional assembly file. 
        If the second assembly file is missing, then it looks at the spectra of the read k-mers that are and are not in the first assembly file.
    ]]></help>
    <expand macro="citation"/>
</tool>