view tools/seq_select_by_id/seq_select_by_id.xml @ 9:3b0a14722175 draft default tip

v0.0.14 - Script works on Python 2 and 3 (fixed output file mode)
author peterjc
date Wed, 23 May 2018 09:15:13 -0400
parents 8e1a90917fa7
children
line wrap: on
line source

<tool id="seq_select_by_id" name="Select sequences by ID" version="0.0.14">
    <description>from a tabular file</description>
    <requirements>
        <requirement type="package" version="1.67">biopython</requirement>
    </requirements>
    <version_command>
python $__tool_directory__/seq_select_by_id.py --version
    </version_command>
    <command detect_errors="aggressive">
python $__tool_directory__/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>