view comebin_bam.xml @ 0:d2dd7be65d47 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/comebin_bam/ commit ac8533700fff90dbc9cfc2af66c2a721e4b52f2c
author iuc
date Fri, 07 Nov 2025 16:14:20 +0000
parents
children
line wrap: on
line source

<tool id="comebin_bam" name="Generate BAM file for COMEBin" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
    <description>COMEBin utility script to generate BAM files using modified MetaWRAP</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/>
    <command detect_errors="exit_code">
        <![CDATA[

            mkdir 'outputs' &&

            #if $assembly.ext.endswith('.gz'):
                ln -s '$assembly' 'assembly.fasta.gz' &&
                gunzip 'assembly.fasta.gz' &&
            #else:
                ln -s '$assembly' 'assembly.fasta' &&
            #end if

            #if $read_typ.is_select == "normal":
                #if $input_typ.is_select == "paired":
                    #if $paired_reads.forward.ext.endswith('.gz'):
                        ln -s '$paired_reads.forward' 'read_1.fastq.gz' &&
                        ln -s '$paired_reads.reverse' 'read_2.fastq.gz' &&
                        gunzip 'read_1.fastq.gz' &&
                        gunzip 'read_2.fastq.gz' &&
                    #else:
                        ln -s '$paired_reads.forward' 'read_1.fastq' &&
                        ln -s '$paired_reads.reverse' 'read_2.fastq' &&
                    #end if
                #else:
                    #if $forward.ext.endswith('.gz'):
                        ln -s '$forward' 'read_1.fastq.gz' &&
                        ln -s '$reverse' 'read_2.fastq.gz' &&
                        gunzip 'read_1.fastq.gz' &&
                        gunzip 'read_2.fastq.gz' &&
                    #else:
                        ln -s '$forward' 'read_1.fastq' &&
                        ln -s '$reverse' 'read_2.fastq' &&
                    #end if
                #end if
            #else:
                #if $single_reads.ext.endswith('.gz'):
                    ln -s '$single_reads' 'read.fastq.gz' &&
                    gunzip 'read.fastq.gz' &&
                #else:
                    ln -s '$single_reads' 'read.fastq' &&
                #end if
            #end if

            gen_cov_file.sh
            -a 'assembly.fasta'
            -o 'outputs'
            -t \${GALAXY_SLOTS:-1}
            -l ${length}
            #if $read_typ.is_select == "normal":
                'read_1.fastq'
                'read_2.fastq'
            #else:
                --single-end 'read.fastq' 
            #end if
            && mv 'outputs/work_files/read.bam' '$bam_file'

        ]]>
    </command>
    <inputs>
        <param name="assembly" type="data" format="fasta,fasta.gz" label="Input assembly file"/>
        <conditional name="read_typ">
            <param name="is_select" type="select" label="Type of reads">
                <option value="normal" selected="true">Paired-end non-interleaved</option>
                <option value="single">Single-end</option>
            </param>
            <when value="normal">
                <conditional name="input_typ">
                    <param name="is_select" type="select" label="Input type">
                        <option value="paired">Paired collection</option>
                        <option value="single">No collection</option>
                    </param>
                    <when value="paired">
                        <param name="paired_reads" type="data_collection" collection_type="paired" format="fastq,fastq.gz" label="Input paired reads collection"/>
                    </when>
                    <when value="single">
                        <param name="forward" type="data" format="fastq,fastq.gz" label="Input forward reads"/>
                        <param name="reverse" type="data" format="fastq,fastq.gz" label="Input reverse reads"/>
                    </when> 
                </conditional>
            </when>
            <when value="single">
                <param name="single_reads" type="data" format="fastq,fastq.gz" label="Input single-end reads"/>
            </when>
        </conditional>
        <param name="length" type="integer" value="1000" label="Set minimum contig length"/>
    </inputs>
    <outputs>
        <data name="bam_file" format="bam" label="COMEBin bam file"/>
    </outputs>
    <tests>
       <test expect_num_outputs="1">
        <param name="assembly" value="bowtie2-ref.fasta" ftype="fasta"/>
        <conditional name="read_typ">
            <param name="is_select" value="normal"/>
            <conditional name="input_typ">
                <param name="is_select" value="paired"/>
                <param name="paired_reads">
                    <collection type="paired">
                        <element name="forward" value="bowtie2-fq_1.fastq" ftype="fastq"/>
                        <element name="reverse" value="bowtie2-fq_2.fastq" ftype="fastq"/>
                    </collection>
                </param>
            </conditional>
        </conditional>
        <output name="bam_file">
            <assert_contents>
                <has_size size="17000" delta="1000"/>
            </assert_contents>
        </output>
       </test> 
       <test expect_num_outputs="1">
        <param name="assembly" value="bowtie2-ref.fasta" ftype="fasta"/>
        <conditional name="read_typ">
            <param name="is_select" value="normal"/>
            <conditional name="input_typ">
                <param name="is_select" value="single"/>
                <param name="forward" value="bowtie2-fq_1.fastq" ftype="fastq"/>
                <param name="reverse" value="bowtie2-fq_2.fastq" ftype="fastq"/>
            </conditional>
        </conditional>
        <output name="bam_file">
            <assert_contents>
                <has_size size="17000" delta="1000"/>
            </assert_contents>
        </output>
        </test>
       <test expect_num_outputs="1">
        <param name="assembly" value="bowtie2-ref.fasta" ftype="fasta"/>
        <conditional name="read_typ">
            <param name="is_select" value="normal"/>
            <conditional name="input_typ">
                <param name="is_select" value="single"/>
                <param name="forward" value="bowtie2-fq_1.fastq.gz" ftype="fastq.gz"/>
                <param name="reverse" value="bowtie2-fq_2.fastq.gz" ftype="fastq.gz"/>
            </conditional>
        </conditional>
        <output name="bam_file">
            <assert_contents>
                <has_size size="17000" delta="1000"/>
            </assert_contents>
        </output>
        </test>
    </tests>
    <help>
        <![CDATA[
        
            **Why using this tool instead of Bowtie2**

            COMEBin used modified from the "binning.sh" of MetaWRAP which means a complete pipeline is running to generate BAM files fit for COMEBin to use. 
            
            Other BAM file tools might also work but it is recommended to use this utility script because some test showed that using Bowtie2 COMEBin always failed since certain IDs are not contain in COMEBins data.
            
            This tool only serve one use case which is when using COMEBin as binner other binner can use and it is recommended to use Bowtie2 in this case. Only use this script when the binner is COMEBin!

            **Input**

            - Single-end reads or Paired-end (non-)interleaved reads

            **Output**

            - One BAM file build for use for COMEBin (no other binner can use this file so please run Bowtie2 for other binner!)
        ]]>
    </help>
    <expand macro="citations"/>
</tool>