view draw_features.xml @ 6:d5a5d145cfce draft

Uploaded
author greg
date Fri, 10 Mar 2023 18:02:00 +0000
parents c318e520dca1
children
line wrap: on
line source

<tool id="draw_features" name="PIMA: draw features" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
    <description>of annotated assemblies</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/>
    <command detect_errors="exit_code"><![CDATA[
#import re

#if $contigs.is_of_type('fasta.gz'):
    gunzip -c '$contigs' > 'contigs.fasta' &&
#else:
    ln -s '$contigs' 'contigs.fasta' &&
#end if

mkdir feature_hits_dir &&
mkdir output_dir &&

#for $i in $feature_hits:
    #set identifier = re.sub('[^\s\w\-\\.]', '_', str($i.element_identifier))
    ln -s $i 'feature_hits_dir/$identifier' &&
#end for

python '$__tool_directory__/draw_features.py'
--contigs 'contigs.fasta'
--feature_hits_dir 'feature_hits_dir'
--output_dir 'output_dir'
#if str($output_process_log) == 'yes':
    && mv 'process_log' '$process_log'
#end if
]]></command>
    <inputs>
        <param name="contigs" type="data" format="fasta,fasta.gz" label="Fasta file of assembled contigs"/>
        <param name="feature_hits" format="bed" type="data_collection" collection_type="list" label="Collection of feature hits BED files"/>
        <param name="output_process_log" type="select" display="radio" label="Output process log file?">
            <option value="no" selected="true">No</option>
            <option value="yes">Yes</option>
        </param>
    </inputs>
    <outputs>
        <data name="process_log" format="txt" label="${tool.name} on ${on_string} (process log)">
            <filter>output_process_log == 'yes'</filter>
        </data>
        <collection name="features_bed" type="list" format="bed" label="${tool.name} on ${on_string} (best bed)">
            <discover_datasets pattern="__name__" directory="feature_hits_dir" format="bed"/>
        </collection>
        <collection name="features_png" type="list" format="png" label="${tool.name} on ${on_string} (png)">
            <discover_datasets pattern="(?P&lt;designation&gt;.+)\.(?P&lt;ext&gt;png)" directory="output_dir"/>
        </collection>
    </outputs>
    <tests>
        <test>
            <param name="contigs" value="PS01519_contigs.fasta.gz" ftype="fasta.gz"/>
            <param name="feature_hits">
                <collection type="list">
                    <element name="amr_cds.bed" value="amr_cds.bed"/>
                </collection>
            </param>
            <output_collection name="features_bed" type="list" count="1">
                <element name="amr_cds.bed" ftype="bed">
                    <assert_contents>
                        <has_size value="610" delta="10"/>
                    </assert_contents>
                </element>
            </output_collection>
            <output_collection name="features_png" type="list" count="1">
                <element name="contig_1" ftype="png">
                    <assert_contents>
                        <has_size value="25383" delta="100"/>
                    </assert_contents>
                </element>
            </output_collection>
        </test>
    </tests>
    <help>
**What it does**

Accepts a FASTA file of assembled contigs and a collection of 2 BED files containing the feature hits and plots
the features.
    </help>
    <expand macro="citations"/>
</tool>