view filter_contigs.xml @ 1:2c61adbbdbdb draft

Uploaded
author greg
date Thu, 26 Jan 2023 16:17:43 +0000
parents 222fb7dc2286
children 1442e77ee8e9
line wrap: on
line source

<tool id="filter_contigs" name="PIMA: 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>