Skip to content

Commit 848922d

Browse files
authored
Merge pull request #7322 from veg/cawlign_truly_clean_wrapper
feat: Add cawlign Galaxy tool wrapper
2 parents 9ebed28 + 51a9428 commit 848922d

File tree

5 files changed

+303
-0
lines changed

5 files changed

+303
-0
lines changed

tools/cawlign/.shed.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: cawlign
2+
owner: iuc
3+
categories:
4+
- Sequence Analysis
5+
description: Codon-aware alignment of sequences to a reference.
6+
homepage_url: https://github.com/veg/cawlign
7+
long_description: |
8+
cawlign is a standalone C++ port of bealign, used for codon-aware alignment of sequences in a FASTA file to a reference sequence.
9+
remote_repository_url: https://github.com/galaxyproject/tools-iuc/tree/master/tools/cawlign

tools/cawlign/cawlign.xml

Lines changed: 264 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,264 @@
1+
<tool id="cawlign" name="cawlign" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="24.2">
2+
<description>Codon-aware (pairwise) alignment</description>
3+
<macros>
4+
<import>macros.xml</import>
5+
</macros>
6+
<expand macro="requirements"/>
7+
<expand macro="stdio"/>
8+
<command detect_errors="exit_code"><![CDATA[
9+
cawlign
10+
#if $reference_cond.reference_source == "history"
11+
-r '$reference_cond.reference_history'
12+
#else
13+
-r '$reference_cond.reference_builtin'
14+
#end if
15+
-s $scoring_matrix_cond.scoring_matrix_source.scoring_matrix
16+
-t $scoring_matrix_cond.datatype
17+
-l $local_alignment
18+
-f $format
19+
-R $reverse_complement
20+
$affine_gap
21+
$write_reference
22+
$fasta
23+
> '$output'
24+
]]></command>
25+
<inputs>
26+
<param name="fasta" type="data" format="fasta" label="Sequences to align" help="Input FASTA file containing sequences to align."/>
27+
<conditional name="reference_cond">
28+
<param name="reference_source" type="select" label="Reference sequence source">
29+
<option value="builtin" selected="true">Use a built-in reference</option>
30+
<option value="history">Use a custom reference from history</option>
31+
</param>
32+
<when value="builtin">
33+
<param name="reference_builtin" type="select" argument="-r" label="Select a built-in reference">
34+
<option value="CoV2-E">CoV2-E</option>
35+
<option value="CoV2-endornase">CoV2-endornase</option>
36+
<option value="CoV2-exonuclease">CoV2-exonuclease</option>
37+
<option value="CoV2-helicase">CoV2-helicase</option>
38+
<option value="CoV2-leader">CoV2-leader</option>
39+
<option value="CoV2-M">CoV2-M</option>
40+
<option value="CoV2-methyltransferase">CoV2-methyltransferase</option>
41+
<option value="CoV2-N">CoV2-N</option>
42+
<option value="CoV2-nsp10">CoV2-nsp10</option>
43+
<option value="CoV2-nsp2">CoV2-nsp2</option>
44+
<option value="CoV2-nsp3">CoV2-nsp3</option>
45+
<option value="CoV2-nsp4">CoV2-nsp4</option>
46+
<option value="CoV2-nsp6">CoV2-nsp6</option>
47+
<option value="CoV2-nsp7">CoV2-nsp7</option>
48+
<option value="CoV2-nsp8">CoV2-nsp8</option>
49+
<option value="CoV2-nsp9">CoV2-nsp9</option>
50+
<option value="CoV2-ORF10">CoV2-ORF10</option>
51+
<option value="CoV2-ORF1a">CoV2-ORF1a</option>
52+
<option value="CoV2-ORF1b">CoV2-ORF1b</option>
53+
<option value="CoV2-ORF3a">CoV2-ORF3a</option>
54+
<option value="CoV2-ORF5">CoV2-ORF5</option>
55+
<option value="CoV2-ORF6">CoV2-ORF6</option>
56+
<option value="CoV2-ORF7a">CoV2-ORF7a</option>
57+
<option value="CoV2-ORF7b">CoV2-ORF7b</option>
58+
<option value="CoV2-ORF8">CoV2-ORF8</option>
59+
<option value="CoV2-RdRp">CoV2-RdRp</option>
60+
<option value="CoV2-S">CoV2-S</option>
61+
<option value="CoV2-threeC">CoV2-threeC</option>
62+
<option value="HXB2_gag">HXB2_gag</option>
63+
<option value="HXB2_int">HXB2_int</option>
64+
<option value="HXB2_nef">HXB2_nef</option>
65+
<option value="HXB2_pol" selected="true">HXB2_pol</option>
66+
<option value="HXB2_pr">HXB2_pr</option>
67+
<option value="HXB2_prrt">HXB2_prrt</option>
68+
<option value="HXB2_rev">HXB2_rev</option>
69+
<option value="HXB2_rt">HXB2_rt</option>
70+
<option value="HXB2_tat">HXB2_tat</option>
71+
<option value="HXB2_vif">HXB2_vif</option>
72+
</param>
73+
</when>
74+
<when value="history">
75+
<param name="reference_history" type="data" argument="-r" format="fasta" label="Reference sequence" help="Reference sequence FASTA file from your history."/>
76+
</when>
77+
</conditional>
78+
<conditional name="scoring_matrix_cond">
79+
<param name="datatype" type="select" argument="-t" label="Data type" help="Choose the alignment space (nucleotide, protein, or codon).">
80+
<option value="codon" selected="true">Align sequences in codon space</option>
81+
<option value="nucleotide">Align sequences in nucleotide space</option>
82+
<option value="protein">Align sequences in protein space</option>
83+
</param>
84+
<when value="codon">
85+
<conditional name="scoring_matrix_source">
86+
<param name="matrix_source" type="select" label="Scoring matrix source">
87+
<option value="builtin" selected="true">Use a built-in scoring matrix</option>
88+
<option value="history">Use a custom scoring matrix from history</option>
89+
</param>
90+
<when value="builtin">
91+
<param name="scoring_matrix" type="select" argument="-s" label="Scoring matrix" help="Select the scoring matrix to use.">
92+
<option value="BLOSUM62" selected="true">BLOSUM62 (for protein/codon alignments)</option>
93+
<option value="HIV_BETWEEN_F">HIV_BETWEEN_F (for HIV alignments)</option>
94+
</param>
95+
</when>
96+
<when value="history">
97+
<param name="scoring_matrix" type="data" argument="-s" format="tabular" label="Scoring matrix file" help="Scoring matrix file from your history. The file should be a tabular matrix with rows and columns representing amino acids or nucleotides, and cells containing substitution scores."/>
98+
</when>
99+
</conditional>
100+
</when>
101+
<when value="nucleotide">
102+
<conditional name="scoring_matrix_source">
103+
<param name="matrix_source" type="select" label="Scoring matrix source">
104+
<option value="builtin" selected="true">Use a built-in scoring matrix</option>
105+
<option value="history">Use a custom scoring matrix from history</option>
106+
</param>
107+
<when value="builtin">
108+
<param name="scoring_matrix" type="select" argument="-s" label="Scoring matrix" help="Select the scoring matrix to use.">
109+
<option value="NUC4.4" selected="true">NUC4.4 (for nucleotide alignments)</option>
110+
</param>
111+
</when>
112+
<when value="history">
113+
<param name="scoring_matrix" type="data" argument="-s" format="tabular" label="Scoring matrix file" help="Scoring matrix file from your history. The file should be a tabular matrix with rows and columns representing amino acids or nucleotides, and cells containing substitution scores."/>
114+
</when>
115+
</conditional>
116+
</when>
117+
<when value="protein">
118+
<conditional name="scoring_matrix_source">
119+
<param name="matrix_source" type="select" label="Scoring matrix source">
120+
<option value="history" selected="true">Use a custom scoring matrix from history</option>
121+
</param>
122+
<when value="history">
123+
<param name="scoring_matrix" type="data" argument="-s" format="tabular" label="Scoring matrix file" help="Scoring matrix file from your history. The file should be a tabular matrix with rows and columns representing amino acids or nucleotides, and cells containing substitution scores."/>
124+
</when>
125+
</conditional>
126+
</when>
127+
</conditional>
128+
<param name="local_alignment" type="select" argument="-l" label="Global/local alignment" help="Select the alignment type.">
129+
<option value="trim" selected="true">Trim alignment (global to query, local to reference)</option>
130+
<option value="global">Global alignment (all gaps scored equally)</option>
131+
<option value="local">Local alignment (Smith-Waterman)</option>
132+
</param>
133+
<param name="format" type="select" argument="-f" label="Output format" help="Control the output format.">
134+
<option value="refmap" selected="true">Reference map (insertions not retained)</option>
135+
<option value="refalign">Reference align (insertions retained)</option>
136+
<option value="pairwise">Pairwise alignment (insertions retained, all pairwise alignments reported)</option>
137+
</param>
138+
<param name="reverse_complement" type="select" argument="-R" label="Reverse complementation" help="Handle reverse complementation.">
139+
<option value="none" selected="true">None</option>
140+
<option value="silent">Silent (try both strands, report best score)</option>
141+
<option value="annotated">Annotated (like silent, but annotates strand)</option>
142+
</param>
143+
<param name="affine_gap" type="boolean" argument="-a" truevalue="-a" falsevalue="" checked="false" label="Disable affine gap scoring" help="Disable affine gap scoring (enabled by default)."/>
144+
<param name="write_reference" type="boolean" argument="-I" truevalue="-I" falsevalue="" checked="false" label="Write out the reference sequence" help="Include the reference sequence in the output."/>
145+
</inputs>
146+
<outputs>
147+
<data name="output" format="fasta" label="${tool.name} on ${on_string}: ${format}"/>
148+
</outputs>
149+
<tests>
150+
<test>
151+
<param name="fasta" value="OQ948666-pr-int-indel.fa" ftype="fasta"/>
152+
<conditional name="reference_cond">
153+
<param name="reference_source" value="builtin"/>
154+
<param name="reference_builtin" value="HXB2_pol"/>
155+
</conditional>
156+
<param name="format" value="refalign"/>
157+
<conditional name="scoring_matrix_cond">
158+
<param name="datatype" value="codon"/>
159+
<conditional name="scoring_matrix_source">
160+
<param name="matrix_source" value="builtin"/>
161+
<param name="scoring_matrix" value="BLOSUM62"/>
162+
</conditional>
163+
</conditional>
164+
<output name="output" file="expected-result.fa" ftype="fasta"/>
165+
</test>
166+
</tests>
167+
<help><![CDATA[
168+
.. class:: infomark
169+
170+
**What it does**
171+
172+
`cawlign` is a codon-aware aligner that maps sequences from a FASTA file to a reference sequence. It can perform nucleotide, protein, and codon-aware alignments.
173+
174+
**Input**
175+
176+
- **Sequences to align**: A FASTA file containing the sequences to be aligned.
177+
- **Reference sequence**: You can use a built-in reference sequence or provide one from your history.
178+
- **Scoring matrix**: You can use a built-in scoring matrix or provide one from your history. The available built-in matrices depend on the selected data type.
179+
180+
**Output**
181+
182+
A FASTA file containing the alignments. The structure of the output depends on the selected output format parameter (see Output Examples below).
183+
184+
.. class:: infomark
185+
186+
**Alignment Methods**
187+
188+
`cawlign` can perform three types of alignment: nucleotide, protein, and codon-aware.
189+
190+
* **Nucleotide Alignment**: This is a standard pairwise alignment of nucleotide sequences using the Smith-Waterman-Gotoh algorithm with affine gap penalties.
191+
192+
* **Protein Alignment**: This is a standard pairwise alignment of protein sequences, also using the Smith-Waterman-Gotoh algorithm with affine gap penalties. The nucleotide sequences are translated into amino acid sequences before alignment.
193+
194+
* **Codon-aware Alignment**: This is a more complex alignment method that is aware of the codon structure of the sequences. It aligns nucleotide sequences in codon space, which allows it to handle frameshift mutations (insertions or deletions that are not a multiple of 3 nucleotides) more accurately than a simple nucleotide alignment. This is achieved by using a dynamic programming algorithm that considers various types of codon matches and mismatches, including 3-to-1, 3-to-2, 3-to-4, and 3-to-5 matches. This makes it particularly useful for aligning coding sequences where frameshift mutations may have occurred, such as in viral genomes.
195+
196+
**Options**
197+
198+
- **Data type**: The type of alignment to perform.
199+
- **Nucleotide**: Align sequences in nucleotide space.
200+
- **Protein**: Align sequences in protein space.
201+
- **Codon**: Align sequences in codon space. This requires the reference to be in-frame.
202+
203+
- **Global/local alignment**: The type of alignment strategy.
204+
- **Trim**: A trimming alignment that is global with respect to the query and local with respect to the reference.
205+
- **Global**: Full string alignment; all gaps are scored equally.
206+
- **Local**: Partial string local (Smith-Waterman type) alignment that maximizes the alignment score.
207+
208+
- **Output format**: The format of the output file.
209+
- **Reference map**: Aligns query sequences to the reference and does not retain insertions relative to the reference.
210+
- **Reference align**: Aligns query sequences to the reference and does retain insertions relative to the reference. Insertions are shown in lowercase.
211+
- **Pairwise**: Aligns query sequences to the reference and does retain insertions relative to the reference; reports all pairwise alignments.
212+
213+
- **Reverse complementation**: How to handle reverse complementation.
214+
- **None**: No reverse complementation.
215+
- **Silent**: Try both forward and reverse-complemented query sequences and report the alignment with the best score.
216+
- **Annotated**: Like "Silent", but also annotates which strand was used.
217+
218+
- **Disable affine gap scoring**: By default, `cawlign` uses affine gap scoring. Check this option to disable it.
219+
220+
- **Write out the reference sequence**: Include the reference sequence in the output.
221+
222+
.. class:: infomark
223+
224+
**Output Examples**
225+
226+
Here are examples of what the different output formats look like using an example with an insertion ('gataca') and a deletion. The sequences are truncated for clarity.
227+
228+
**refmap**
229+
230+
The `refmap` output format aligns the query sequences to the reference but does not retain insertions relative to the reference.
231+
232+
.. code-block:: text
233+
234+
>OQ948666.1-indel
235+
CCTCAAATCACTCTTTGGCAGCGACCCATTGTCACAATAAGGGTAGGGGGGCAATTAAAG...
236+
237+
**refalign**
238+
239+
The `refalign` output format also aligns the query sequences to the reference but *does* retain insertions, which are shown in lowercase.
240+
241+
.. code-block:: text
242+
243+
>OQ948666.1-indel
244+
CCTCAAATCACTCTTTGGCAGCGACCCATTGTCACgatacaAATAAGGGTAGGGGGGCAATTAAAG...
245+
246+
**pairwise**
247+
248+
The `pairwise` output format reports the full pairwise alignment, including the reference sequence, with insertions and deletions shown as gaps in the corresponding sequence.
249+
250+
.. code-block:: text
251+
252+
>HXB2_pol
253+
CCTCAGGTCACTCTTTGGCAACGACCCCTCGTCAC------AATAAAGATAGGGGGGCAACTAAAG...
254+
>OQ948666.1-indel
255+
CCTCAAATCACTCTTTGGCAGCGACCCATTGTCACGATACAAATAAGGGTAGGGGGGCAATTAAAG...
256+
257+
.. class:: infomalign
258+
259+
**References**
260+
261+
For more information, please visit the `cawlign` GitHub repository: https://github.com/veg/cawlign
262+
]]></help>
263+
<expand macro="citations"/>
264+
</tool>

tools/cawlign/macros.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<macros>
2+
<token name="@TOOL_VERSION@">0.1.14</token>
3+
<token name="@VERSION_SUFFIX@">0</token>
4+
<xml name="requirements">
5+
<requirements>
6+
<requirement type="package" version="@TOOL_VERSION@">cawlign</requirement>
7+
</requirements>
8+
</xml>
9+
<xml name="stdio">
10+
<stdio>
11+
<exit_code range="1:"/>
12+
</stdio>
13+
</xml>
14+
<xml name="citations">
15+
<citations>
16+
<citation type="bibtex">@misc{githubcawlign,
17+
author = {Pond, Sergei and Weaver, Steven and Moshiri, Niema and Hepler, Lance},
18+
year = {2025},
19+
title = {cawlign: a C++ port of bealign},
20+
publisher = {GitHub},
21+
journal = {GitHub repository},
22+
url = {https://github.com/veg/cawlign}
23+
}</citation>
24+
</citations>
25+
</xml>
26+
</macros>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
>OQ948666.1-indel
2+
CCTCAAATCACTCTTTGGCAGCGACCCATTGTCACgatacaAATAAGGGTAGGGGGGCAATTAAAGGAAGCCCTATTAGATACAGGAGCAGATGATACAGTGTTAGAAGAAATGGATTTGCCAGGAAGATGGAAGCCAAAAATGATAGGGGGAATTGGAGGTTTTATCAAAGTAAGACAGTATGAGCAGATAACCATAGAAATCTGTGGACATAAAGCTATAGGTACAGTATTAGTAGGACCTACACCTGTCAACATAATTGGAAGAAATCTGTTAACTCAGCTTGGTTGCACTTTAAATTTTATGTAGATGGGGCAGCCAACAGGGAGACTAAATTGGGAAAAGCAGGATATGTTACTAACAGAGGAAGACAAAGGGTTGTCACCTTAACTGACACAACAAATCAGAAGACTGAGTTACAAGCAATTCATCTAGCTTTGCAGGATTCAGGATCAGAAGTAAACATAGTAACAGACTCACAGTATGCACTTGGAATCATCCAAGCACACCCAGATAGAAGTGAATCAGGGATAGTCAATCAAATCATAGAGCAGCTAATAAAAAAGGAAAAGGTCTACCTGGCATGGGTACCAGCACACAAAGGAATTGGAGGAAATGAACAAGTAGATAAATTAGTTAGTGCTGGAATCAGGAAAGTACTATTTTTAGATGGAATAGAAAAGGCACAGGAAGAACATGAGAAATATCACAATAATTGGAGAGCAATGGCTAGTGATTTTAACCTGCCAGCTGTAGTAGCAAAAGAAATAGTAGCCTGCTGTGATAAATGCCAGATAAAGGGAGAAGCTATACATGGACAAGTAGACTGTAGTCCAGGAATATGGCAACTAGATTGTACACATTTAGAAGGAAAAGTTATCCTGGTAGCAGTTCATGTAGCCAGTGGATATATAGAAGCAGAAGTTATTTCAGCAGAGACAGGGCAGGAAACAGCCTACTTCATCTTAAAATTAGCAGGAAGATGGCCAGTAAAAACAATACATACAGACAATGGCAGCAATTTCACCAGTGCTACAGTTAAGGCCGCCTGTTGGTGGGCAGGGATCAAGCAGGAATTTGGCATTCCCTACAATCCCCAAAGTCAAGGAGTAGTAGAATCTATGAATAATGCATTAAAGAAAATTATAGGACAGGTAAGAGAGCAGGCTGAACATCTTAAGACAGCAGTACAAATGGCAGTATTCATTCACAATTTTAAAAGAAAAGGGGGGATTGGGGGGTACAGTGCAGGGGAAAGAATAATAGACATAATAGCATCAGACATACAAACTAAAGAATTACAAAAACAAATTACAAAACTTCAAAATTTTCGGGTTTATTACAGGGACAGCAGAGACCCACTTTGGAAAGGACCAGCAAAGCTCCTCTGGAAAGGTGAAGGGGCAGTAGTAATACAAGATAATCAGGACATAAAAGTAGTGCCAAGAAGGAAAGCAAAGATTATCAGGGATTATGGAAAACAGATGGCAGGTGATGATTGTGTGGCAGGTAGACAGGATGAGGA

0 commit comments

Comments
 (0)