Skip to content

Commit

Permalink
Add seqkit sort to existing seqkit suite (#5909)
Browse files Browse the repository at this point in the history
* add seqkit sort

* tiny changes

---------

Co-authored-by: Björn Grüning <[email protected]>
  • Loading branch information
TomHarrop and bgruening authored Mar 26, 2024
1 parent 55a4f35 commit d3d2bb5
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 0 deletions.
81 changes: 81 additions & 0 deletions tools/seqkit/seqkit_sort.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<tool id="seqkit_sort" name="SeqKit sort" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
<description>FASTA or FASTQ files</description>
<macros>
<import>macros.xml</import>
</macros>
<expand macro="bio_tools"/>
<expand macro="requirements"/>
<command detect_errors="exit_code"><![CDATA[
#set $input_fn='input.' + str($input.ext)
#set $output_fn='seqkitsort_output.' + str($output.ext)
ln -s '$input' '$input_fn'
&&
seqkit sort
'$input_fn'
$reverse
$sort_by
-o '$output_fn'
--threads \${GALAXY_SLOTS:-4}
]]></command>
<inputs>
<param name="input" type="data" format="fasta,fasta.gz,fastqsanger,fastqsanger.gz" label="Input file"/>
<param name="sort_by" type="select" label="Sort by:">
<option value="" selected="true">Sequence ID</option>
<option value="--by-bases">Non-gap bases</option>
<option value="--by-length">Sequence length</option>
<option value="--by-name">Full name (instead of just ID)</option>
<option value="--by-seq">Sequence</option>
</param>
<param argument="--reverse" type="boolean" truevalue="--reverse" falsevalue="" checked="false" label="Reverse the result?"/>
</inputs>
<outputs>
<data name="output" format_source="input" from_work_dir="seqkitsort_output.*" label="${input.name} sorted (${tool.name})"/>
</outputs>
<tests>
<!-- 1. fastq.gz -->
<test expect_num_outputs="1">
<param name="input" value="input1.fastq.gz" ftype="fastqsanger.gz"/>
<output name="output" file="sort_output1.fastq.gz" ftype="fastqsanger.gz"/>
</test>
<!-- 2. fasta.gz -->
<test expect_num_outputs="1">
<param name="input" value="input1.fasta.gz" ftype="fasta.gz"/>
<output name="output" file="sort_output2.fasta.gz" ftype="fasta.gz"/>
</test>
<!-- 3. by-bases, forward, fasta -->
<test expect_num_outputs="1">
<param name="input" value="input1.fasta.gz" ftype="fasta.gz"/>
<param name="sort_by" value="--by-bases"/>
<output name="output" file="sort_output3.fasta.gz" ftype="fasta.gz"/>
</test>
<!-- 4. by-length, rev, fasta -->
<test expect_num_outputs="1">
<param name="input" value="input1.fasta.gz" ftype="fasta.gz"/>
<param name="reverse" value="true"/>
<param name="sort_by" value="--by-length"/>
<output name="output" file="sort_output4.fasta.gz" ftype="fasta.gz"/>
</test>
<!-- 5. by-name, forward, fastq -->
<test expect_num_outputs="1">
<param name="input" value="input1.fastq.gz" ftype="fastqsanger.gz"/>
<param name="sort_by" value="--by-name"/>
<output name="output" file="sort_output5.fastq.gz" ftype="fastqsanger.gz"/>
</test>
<!-- 6. by-seq, rev, fastq -->
<test expect_num_outputs="1">
<param name="input" value="input1.fastq.gz" ftype="fastqsanger.gz"/>
<param name="reverse" value="true"/>
<param name="sort_by" value="--by-seq"/>
<output name="output" file="sort_output6.fastq.gz" ftype="fastqsanger.gz"/>
</test>
</tests>
<help>
**What it does**

Sort sequences (FASTA, FASTQ) by id, name, sequence, or length.

</help>
<expand macro="citations"/>
</tool>
Binary file added tools/seqkit/test-data/sort_output1.fastq.gz
Binary file not shown.
Binary file added tools/seqkit/test-data/sort_output2.fasta.gz
Binary file not shown.
Binary file added tools/seqkit/test-data/sort_output3.fasta.gz
Binary file not shown.
Binary file added tools/seqkit/test-data/sort_output4.fasta.gz
Binary file not shown.
Binary file added tools/seqkit/test-data/sort_output5.fastq.gz
Binary file not shown.
Binary file added tools/seqkit/test-data/sort_output6.fastq.gz
Binary file not shown.

0 comments on commit d3d2bb5

Please sign in to comment.