Skip to content

Commit

Permalink
Add Seqkit translate (#5919)
Browse files Browse the repository at this point in the history
* Add seqkit translate

* Update tools/seqkit/seqkit_translate.xml

Change name into argument

Co-authored-by: Björn Grüning <[email protected]>

* change name by argument and delete help

* Delete test file

---------

Co-authored-by: Björn Grüning <[email protected]>
  • Loading branch information
hugolefeuvre and bgruening authored Mar 29, 2024
1 parent 50ddb7e commit 235285b
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 0 deletions.
119 changes: 119 additions & 0 deletions tools/seqkit/seqkit_translate.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<tool id="seqkit_translate" name="SeqKit translate" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
<description>Translate nucleotid sequence to protein sequence</description>
<macros>
<import>macros.xml</import>
</macros>
<expand macro="bio_tools"/>
<expand macro="requirements"/>
<command detect_errors="exit_code"><![CDATA[
seqkit translate
'$input'
-o '$output'
#if $translate_or_remove_unknown.selector == 'trimming':
$translate_or_remove_unknown.trim
#elif $translate_or_remove_unknown.selector == 'translate':
$translate_or_remove_unknown.allow_unknown_codon
#end if
$append_frame
$clean
#if $frame
-f '$frame'
#end if
$init_codon_as_M
#if $transl_table
-T '$transl_table'
#end if
]]></command>
<inputs>
<param name="input" type="data" format="fasta,fasta.gz,fastqsanger,fastqsanger.gz" label="Input file"/>
<param argument="--frame" type="select" multiple="true" label="Frame(s) to translate" >
<option value="1" selected="true">1 (default)</option>
<option value="2" selected="false">2</option>
<option value="3" selected="false">3</option>
<option value="-1" selected="false">-1</option>
<option value="-2" selected="false">-2</option>
<option value="-3" selected="false">-3</option>
<option value="6" selected="false">All 6 frames</option>
</param>
<param argument="--append-frame" type="boolean" truevalue="--append-frame" falsevalue="" checked="false" label="Append frame information to sequence ID ?" />
<param argument="--transl-table" type="select" label="Translate table / genetic code to use" >
<option value="1" selected="true">1: The Standard Code (default)</option>
<option value="2" selected="false">2: The Vertebrate Mitochondrial Code</option>
<option value="3" selected="false">3: The Yeast Mitochondrial Code</option>
<option value="4" selected="false">4: The Mold, Protozoan, and Coelenterate Mitochondrial Code and the Mycoplasma/Spiroplasma Code</option>
<option value="5" selected="false">5: The Invertebrate Mitochondrial Code</option>
<option value="6" selected="false">6: The Ciliate, Dasycladacean and Hexamita Nuclear Code</option>
<option value="9" selected="false">9: The Echinoderm and Flatworm Mitochondrial Code</option>
<option value="10" selected="false">10: The Euplotid Nuclear Code</option>
<option value="11" selected="false">11: The Bacterial, Archaeal and Plant Plastid Code</option>
<option value="12" selected="false">12: The Alternative Yeast Nuclear Code</option>
<option value="13" selected="false">13: The Ascidian Mitochondrial Code</option>
<option value="14" selected="false">14: The Alternative Flatworm Mitochondrial Code</option>
<option value="16" selected="false">16: Chlorophycean Mitochondrial Code</option>
<option value="21" selected="false">21: Trematode Mitochondrial Code</option>
<option value="22" selected="false">22: Scenedesmus obliquus Mitochondrial Code</option>
<option value="23" selected="false">23: Thraustochytrium Mitochondrial Code</option>
<option value="24" selected="false">24: Pterobranchia Mitochondrial Code</option>
<option value="25" selected="false">25: Candidate Division SR1 and Gracilibacteria Code</option>
<option value="26" selected="false">26: Pachysolen tannophilus Nuclear Code</option>
<option value="27" selected="false">27: Karyorelict Nuclear</option>
<option value="28" selected="false">28: Condylostoma Nuclear</option>
<option value="29" selected="false">29: Mesodinium Nuclear</option>
<option value="30" selected="false">30: Peritrich Nuclear</option>
<option value="31" selected="false">31: Blastocrithidia Nuclear</option>
</param>
<param argument="--clean" type="boolean" truevalue="--clean" falsevalue="" checked="false" label="Change all STOP codon positions from the '*' character to 'X' (an unknown residue) ?" />
<conditional name="translate_or_remove_unknown" >
<param name="selector" type="select" label="Translate or remove unknown code ?" >
<option value="trimming">Remove all 'X' and '*' characters</option>
<option value="translate">Translate unknown code to 'X'</option>
</param>
<when value="trimming">
<param argument="--trim" type="boolean" truevalue="--trim" falsevalue="" checked="false" label="Remove all 'X' and '*' characters from the right end of the translation" />
</when>
<when value="translate">
<param argument="--allow-unknown-codon" type="boolean" truevalue="--allow-unknown-codon" falsevalue="" checked="false" label="Translate unknown code to 'X' ?" />
</when>
</conditional>
<param argument="--init-codon-as-M" type="boolean" truevalue="--init-codon-as-M" falsevalue="" checked="false" label="Translate initial codon at beginning to 'M'" />
</inputs>
<outputs>
<data name="output" format_source="input" label="${input.name} translate (${tool.name})"/>
</outputs>
<tests>
<!-- 1. fastq -->
<test expect_num_outputs="1">
<param name="input" value="input1.fastq.gz" ftype="fastqsanger.gz"/>
<output decompress="true" name="output" file="translate_output3.fastq.gz" ftype="fastqsanger.gz"/>
</test>
<!-- 2. fasta -->
<test expect_num_outputs="1">
<param name="input" value="input1.fasta.gz" ftype="fasta.gz"/>
<conditional name="translate_or_remove_unknown">
<param name="allow_unknown_codon" value="true"/>
</conditional>
<param name="append_frame" value="true"/>
<param name="clean" value="true"/>
<param name="frame" value="2,3" />
<param name="init_codon_as_M" value="true" />
<param name="transl_table" value="3" />
<output decompress="true" name="output" file="translate_output1.fasta.gz" ftype="fasta.gz"/>
</test>
<!-- 3. fastq + trim -->
<test expect_num_outputs="1">
<param name="input" value="input1.fastq.gz" ftype="fastqsanger.gz"/>
<conditional name="translate_or_remove_unknown">
<param name="trim" value="true" />
</conditional>
<output decompress="true" name="output" file="translate_output2.fastq.gz" ftype="fastqsanger.gz"/>
</test>
</tests>
<help>
**What it does**

Translate DNA/RNA to protein sequence (supporting ambiguous bases)

</help>
<expand macro="citations"/>
</tool>
Binary file modified tools/seqkit/test-data/input1.fasta.gz
Binary file not shown.
Binary file added tools/seqkit/test-data/translate_output1.fasta.gz
Binary file not shown.
Binary file added tools/seqkit/test-data/translate_output2.fastq.gz
Binary file not shown.
Binary file added tools/seqkit/test-data/translate_output3.fastq.gz
Binary file not shown.

0 comments on commit 235285b

Please sign in to comment.