Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure correct output formats of seqtk_seq and seqtk_mergefa in all cases #6393

Merged
merged 16 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions tools/seqtk/macros.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,35 @@
This Galaxy tool relies on the seqtk toolkit from `lh3/seqtk
<https://github.com/lh3/seqtk/>`_, developed by Heng Li at the Broad Institute
]]></token>
<token name="@GENERATE_GALAXY_JSON_SEQTK_SEQ@"><![CDATA[
#import json

#try:
#silent $outputs[0]
#except
#set outputs = [("default", $default)]
#end try

#set ext = None

#if $A and $in_file.is_of_type('fasta.gz', 'fastq.gz')
#set ext = "fasta.gz"
#elif $A
#set ext = "fasta"
#elif $in_file.is_of_type('fasta.gz')
#set ext = "fasta.gz"
#elif $in_file.is_of_type('fastq.gz')
#set ext = "fastq.gz"
#elif $in_file.is_of_type('fasta')
#set ext = "fasta"
#elif $in_file.is_of_type('fastq')
#set ext = "fastq"
#end if
RZ9082 marked this conversation as resolved.
Show resolved Hide resolved

#set gxy_json = {}
#silent gxy_json["default"] = {"ext": ext}
&& echo '${json.dumps(gxy_json)}' >> galaxy.json
RZ9082 marked this conversation as resolved.
Show resolved Hide resolved
]]></token>
<xml name="citation">
<citations>
<citation type="bibtex">
Expand Down
20 changes: 16 additions & 4 deletions tools/seqtk/seqtk_seq.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<tool id="seqtk_seq" name="seqtk_seq" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="22.05">
<tool id="seqtk_seq" name="seqtk_seq" version="@TOOL_VERSION@+galaxy1" profile="22.05">
<description>common transformation of FASTA/Q</description>
<macros>
<import>macros.xml</import>
Expand Down Expand Up @@ -33,6 +33,7 @@ $x2
#end if
'$in_file'
@CONDITIONAL_GZIP_OUT@
@GENERATE_GALAXY_JSON_SEQTK_SEQ@
]]></command>
<inputs>
<expand macro="in_faq"/>
Expand All @@ -54,25 +55,36 @@ $x2
<param name="x2" argument="-2" type="boolean" truevalue="-2" falsevalue="" checked="false" label="Output the 2n reads only" />
</inputs>
<outputs>
<data name="default" format_source="in_file" label="${tool.name} on ${on_string}" />
<data name="default" format="auto" label="${tool.name} on ${on_string}" />
</outputs>

<tests>
<!-- This is a sorry excuse for a test for a tool which does way more
than it should, but upstream decided to put a TON of functionality
into a single tool rather than using the single responsibility
principle. -->
<test>
<test expect_num_outputs="1">
<param name="in_file" value="seqtk_seq.fa"/>
<param name="r" value="True"/>
<param name="n" value=""/>
<output name="default" file="seqtk_seq_revcom.fa" ftype="fasta"/>
</test>
<test>
<test expect_num_outputs="1">
<param name="in_file" value="seqtk_seq.fa.gz" ftype="fasta.gz"/>
<param name="r" value="True"/>
<param name="n" value=""/>
<output name="default" file="seqtk_seq_revcom.fa.gz" ftype="fasta.gz"/>
</test>
<test expect_num_outputs="1">
<param name="in_file" value="seqtk_trimfq.fq" ftype="fastq"/>
<param name="A" value="True" />
<output name="default" file="seqtk_seq_A.fasta" ftype="fasta"/>
</test>
<test expect_num_outputs="1">
<param name="in_file" value="seqtk_trimfq.fq.gz" ftype="fastq.gz"/>
<param name="A" value="True" />
<output name="default" file="seqtk_seq_A.fasta.gz" ftype="fasta.gz"/>
</test>
</tests>
<help><![CDATA[
**What it does**
Expand Down
2 changes: 2 additions & 0 deletions tools/seqtk/test-data/seqtk_seq_A.fasta
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
>SEQ_ID1
GATTTGGGGTTCAAAGCAGTATCGATCAAATAGTAAATCCATTTGTTCAACTCACAGTTT
Binary file added tools/seqtk/test-data/seqtk_seq_A.fasta.gz
Binary file not shown.
Loading