Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
39 changes: 35 additions & 4 deletions tools/iqtree/iqtree.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<expand macro="requirements"/>
<version_command><![CDATA[iqtree3 --version 2>&1 | head -1]]></version_command>
<command detect_errors="aggressive"><![CDATA[
#if $bootstrap_parameters.ultrafast_bootstrap.skip_bootstrap_for_small_alignments and $general_options.s and $general_options.s.ext == 'fasta'
n_unique=\$(awk '/^>/{if(seq!="")print seq; seq=""; next}{seq=seq \$0}END{if(seq!="")print seq}' '$general_options.s' | sort -u | wc -l) &&
#end if
iqtree3
--prefix PREF
#if $general_options.short_alignments:
Expand Down Expand Up @@ -308,7 +311,11 @@ $tree_parameters.tree_topology.test_au
#end if

#if str($bootstrap_parameters.ultrafast_bootstrap.ufboot) != ''
--ufboot '$bootstrap_parameters.ultrafast_bootstrap.ufboot'
#if $bootstrap_parameters.ultrafast_bootstrap.skip_bootstrap_for_small_alignments and $general_options.s and $general_options.s.ext == 'fasta'
\$( [ "\$n_unique" -ge 4 ] 2>/dev/null && echo "--ufboot '$bootstrap_parameters.ultrafast_bootstrap.ufboot'" )

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still wrong as I said earlier. You are just executing iqtree3 ... && echo MORE_IQTREE_OPTIONS

If you really want to implement this (but IMO it should be done in iqtree itself, we should use the sequences metadata (which exists for fasta and phylip (unfortunately not for nex,clustal,msf which are just text from Galaxy's point of view).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to chime in late. I'm infavor of this change. Iqtree is already yielding an error. From their side this seems ok. From our side this is suboptimal, as we would need to filter collections, rerun parts of a collection with different settings etc. So I thibk having an additional parameter that makes it very clear what's happening is a good way for us and more efficient

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@d-callan can you move the if out of the iqtree command? If you special conditions met in cheetah and the bash check is valid, set a env var, reuse the env var in the iqtree command later

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the limitation also affect normal bootstrap?

I would still suggest to use sequences metadata. The sequences can be made unique using other Galaxy tools, or?

#else
--ufboot '$bootstrap_parameters.ultrafast_bootstrap.ufboot'
#end if
#end if

#if str($bootstrap_parameters.ultrafast_bootstrap.ufjack) != ''
Expand Down Expand Up @@ -434,7 +441,7 @@ Note that --seqtype CODON is always necessary when using codon models and you al
<section name="modelling_parameters" title="Modelling Parameters">
<section name="automatic_model" expanded="False" title="Automatic model selection">
<conditional name="cond_model">
<param name="opt_custommodel" type="select" label="Do you want to use a custom model" help="See http://www.iqtree.org/doc/Substitution-Models">
<param name="opt_custommodel" type="select" label="Do you want to use a custom model" help="See https://iqtree.github.io/doc/Substitution-Models">
<option value="true" selected="True">Yes, I want to use a custom model</option>
<option value="false">No, a custom model is not needed</option>
</param>
Expand Down Expand Up @@ -474,7 +481,7 @@ IQ-TREE also works for codon, binary and morphological data.
<option value="MF">Extended model selection with FreeRate heterogeneity</option>
<option value="MFP">Extended model selection followed by tree inference</option>
</param>
<param name="additional_models" type="text" optional="true" label="Additional model specifications" help="See http://www.iqtree.org/doc/Substitution-Models">
<param name="additional_models" type="text" optional="true" label="Additional model specifications" help="See https://iqtree.github.io/doc/Substitution-Models">
<expand macro="sanitize_query"/>
</param>
</when>
Expand Down Expand Up @@ -672,6 +679,7 @@ IQ-TREE also works for codon, binary and morphological data.
</sanitizer>
</param>
<param argument="--bnni" type="boolean" truevalue="--bnni" falsevalue="" checked="false" label="Perform an additional step to further optimize UFBoot trees by nearest neighbor interchange (NNI) based directly on bootstrap alignments" help="This option is recommended in the presence of severe model violations. It increases computing time by 2-fold but reduces the risk of overestimating branch supports due to severe model violations. Introduced in IQ-TREE 1.6."/>
<param name="skip_bootstrap_for_small_alignments" type="boolean" truevalue="true" falsevalue="false" checked="false" label="Skip ultrafast bootstrap for small alignments" help="IQ-TREE requires at least 4 distinct sequences to run ultrafast bootstrap (--ufboot). By default, IQ-TREE will error out when this threshold is not met. Enable this option to silently skip --ufboot when the input FASTA has fewer than 4 distinct sequences, which is useful when mapping over collections of alignments that may include small ones. Only applies to FASTA inputs."/>
</section>
<section name="nonparametric_bootstrap" expanded="False" title="Nonparametric bootstrap">
<param argument="--boot" type="integer" optional="true" label="Replicates for bootstrap + ML tree + consensus tree" help="This will perform both bootstrap and analysis on original alignment and provide a consensus tree."/>
Expand Down Expand Up @@ -1070,6 +1078,29 @@ IQ-TREE also works for codon, binary and morphological data.
<has_text text="--con-tree"/>
</assert_command>
</test>
<test expect_num_outputs="6">
<!-- skip_bootstrap_for_small_alignments: 3 identical sequences, ufboot should be skipped at runtime -->
<section name="general_options">
<param name="s" value="three_seqs.fasta" ftype="fasta"/>
</section>
<section name="bootstrap_parameters">
<section name="ultrafast_bootstrap">
<param name="ufboot" value="1000"/>
<param name="skip_bootstrap_for_small_alignments" value="true"/>
</section>
</section>
<output name="iqtree">
<assert_contents>
<has_text text="IQ-TREE"/>
</assert_contents>
</output>
<output name="treefile">
<assert_contents>
<has_text text="("/>
<has_text text=";"/>
</assert_contents>
</output>
</test>
</tests>
<help><![CDATA[
IQ-TREE
Expand Down Expand Up @@ -1128,7 +1159,7 @@ From the download_ there is an example alignment called `example.phy`
in PHYLIP format. This example contains parts of the mitochondrial DNA sequences of several animals (Source: `Phylogenetic Handbook`_)

.. _`Phylogenetic Handbook` : https://doi.org/10.1017/CBO9780511819049
.. _download: http://www.iqtree.org/#download
.. _download: https://iqtree.github.io/doc/

You can now start to reconstruct a maximum-likelihood tree
from this alignment by entering (assuming that you are now in the same folder with `example.phy`):
Expand Down
2 changes: 1 addition & 1 deletion tools/iqtree/iqtree_macros.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<macros>
<token name="@TOOL_VERSION@">3.1.3</token>
<token name="@VERSION_SUFFIX@">0</token>
<token name="@VERSION_SUFFIX@">1</token>
<token name="@PROFILE@">25.0</token>
<xml name="requirements">
<requirements>
Expand Down
6 changes: 6 additions & 0 deletions tools/iqtree/test-data/three_seqs.fasta
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
>seq1
ACGTACGTAC
>seq2
ACGTACGTAC
>seq3
ACGTACGTAC
Loading