view filter_contigs.xml @ 0:222fb7dc2286 draft

Uploaded
author greg
date Fri, 06 Jan 2023 15:52:31 +0000
parents
children 2c61adbbdbdb
line wrap: on
line source

<tool id="filter_contigs" name="Filter contigs" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
  <description>from an assembled FASTA file</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/>
    <command detect_errors="exit_code"><![CDATA[
#if $input.is_of_type('fasta.gz'):
    gunzip -c '$input' > 'input.fasta' &&
#else:
    ln -s '$input' 'input.fasta' &&
#end if
faidx -i chromsizes 'input.fasta' | awk '($2 <= $max_len) {print $1}' | parallel -n1 -n1 \$(which faidx) 'input.fasta' > '$output'
    ]]></command>
    <inputs>
        <param name="input" type="data" format="fasta,fasta.gz" label="Assembled FASTA file"/>
        <param name="max_len" type="integer" value="1500000" min="0" label="Maximum contig length"/>
    </inputs>
    <outputs>
        <data name="output" format="fasta"/>
    </outputs>
    <tests>
        <test>
            <param name="input" value="input.fasta.gz" ftype="fasta.gz"/>
            <param name="max_len" value="30000"/>
            <output name="output" ftype="fasta">
                <assert_contents>
                    <has_size value="51690"/>
                    <has_text text=">contig_10"/>
                    <has_text text=">contig_7"/>
                </assert_contents>
            </output>
        </test>
        <test>
            <param name="input" value="input2.fasta" ftype="fasta"/>
            <param name="max_len" value="30000"/>
            <output name="output" ftype="fasta">
                <assert_contents>
                    <has_size value="28492"/>
                    <has_text text=">contig_7"/>
                </assert_contents>
            </output>
        </test>
    </tests>
    <help>
**What it does**

Filters contigs from an assembled fasta file that are longer than the specified length.
    </help>
    <expand macro="citations"/>
</tool>