view tools/seq_select_by_id/seq_select_by_id.xml @ 6:91f55ee8fea5 draft

v0.0.11; more tests and assorting minor changes
author peterjc
date Wed, 13 May 2015 10:56:29 -0400
parents 6842c0c7bc70
children a5602454b0ad
line wrap: on
line source

<tool id="seq_select_by_id" name="Select sequences by ID" version="0.0.11">
    <description>from a tabular file</description>
    <requirements>
        <requirement type="package" version="1.62">biopython</requirement>
        <requirement type="python-module">Bio</requirement>
    </requirements>
    <stdio>
        <!-- Anything other than zero is an error -->
        <exit_code range="1:" />
        <exit_code range=":-1" />
    </stdio>
    <version_command interpreter="python">seq_select_by_id.py --version</version_command>
    <command interpreter="python">
seq_select_by_id.py "$input_tabular" "$column" "$input_file" "$input_file.ext" "$output_file"
    </command>
    <inputs>
        <param name="input_file" type="data" format="fasta,qual,fastq,sff" label="Sequence file to select from" help="FASTA, QUAL, FASTQ, or SFF format." />
        <param name="input_tabular" type="data" format="tabular" label="Tabular file containing sequence identifiers"/>
        <param name="column" type="data_column" data_ref="input_tabular" multiple="False" numerical="False" label="Column containing sequence identifiers"/>
    </inputs>
    <outputs>
        <data name="output_file" format_source="input_file" metadata_source="input_file" label="Selected sequences from $input_file.name"/>
    </outputs>
    <tests>
        <test>
            <param name="input_file" value="k12_ten_proteins.fasta" ftype="fasta" />
            <param name="input_tabular" value="k12_hypothetical.tabular" ftype="tabular" />
            <param name="column" value="1" />
            <output name="output_file" file="k12_hypothetical.fasta" ftype="fasta" />
            <assert_stdout>
                <has_line line="Indexed 10 sequences" />
                <has_line line="Selected 1 sequences by ID" />
            </assert_stdout>
        </test>
        <!-- this version has white space in the identifier column (id and description) -->
        <test>
            <param name="input_file" value="k12_ten_proteins.fasta" ftype="fasta" />
            <param name="input_tabular" value="k12_hypothetical_alt.tabular" ftype="tabular" />
            <param name="column" value="1" />
            <output name="output_file" file="k12_hypothetical.fasta" ftype="fasta" />
            <assert_stdout>
                <has_line line="Indexed 10 sequences" />
                <has_line line="Selected 1 sequences by ID" />
            </assert_stdout>
            <assert_stderr>
                <has_line line="WARNING: Some of your identifiers had white space in them, using first word only. e.g.:" />
            </assert_stderr>
        </test>
        <test expect_failure="true" expect_exit_code="1">
            <param name="input_file" value="empty.fasta" ftype="fasta" />
            <param name="input_tabular" value="k12_hypothetical.tabular" ftype="tabular" />
            <param name="column" value="1" />
            <assert_stdout>
                <has_line line="Indexed 0 sequences" />
            </assert_stdout>
            <assert_stderr>
                <has_line line="Identifier 'gi|16127999|ref|NP_414546.1|' not found in sequence file" />
            </assert_stderr>
        </test>
    </tests>
    <help>
**What it does**

Takes a FASTA, QUAL, FASTQ or Standard Flowgram Format (SFF) file and produces a
new sequence file (of the same format) containing only the records with identifiers
in the tabular file (in the order from the tabular file).

WARNING: If you have any duplicates in the tabular file identifiers, you will get
duplicate sequences in the output.

**References**

If you use this Galaxy tool in work leading to a scientific publication please
cite the following papers:

Peter J.A. Cock, Björn A. Grüning, Konrad Paszkiewicz and Leighton Pritchard (2013).
Galaxy tools and workflows for sequence analysis with applications
in molecular plant pathology. PeerJ 1:e167
http://dx.doi.org/10.7717/peerj.167

This tool uses Biopython to read, write and index sequence files, so you may
also wish to cite the Biopython application note (and Galaxy too of course):

Cock et al (2009). Biopython: freely available Python tools for computational
molecular biology and bioinformatics. Bioinformatics 25(11) 1422-3.
http://dx.doi.org/10.1093/bioinformatics/btp163 pmid:19304878.

This tool is available to install into other Galaxy Instances via the Galaxy
Tool Shed at http://toolshed.g2.bx.psu.edu/view/peterjc/seq_select_by_id
    </help>
    <citations>
        <citation type="doi">10.7717/peerj.167</citation>
        <citation type="doi">10.1093/bioinformatics/btp163</citation>
    </citations>
</tool>