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

Add Quicktree tool #6583

Merged
merged 12 commits into from
Nov 25, 2024
11 changes: 11 additions & 0 deletions tools/quicktree/.shed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
categories:
- Phylogenetics
description: neighbour-joining phylogenetic inference
long_description: |
QuickTree is an efficient implementation of the Neighbor-Joining
algorithm, capable of reconstructing phylogenies from huge alignments
homepage_url: https://github.com/khowe/quicktree
name: quicktree
owner: iuc
remote_repository_url: https://github.com/galaxyproject/tools-iuc/tree/master/tools/quicktree
type: unrestricted
178 changes: 178 additions & 0 deletions tools/quicktree/quicktree.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
<tool id="quicktree" name="Quicktree" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.01">
<description></description>
<macros>
<token name="@TOOL_VERSION@">2.5</token>
<token name="@VERSION_SUFFIX@">0</token>
</macros>
<edam_topics>
<edam_topic>topic_3293</edam_topic> <!-- phylogenetics -->
</edam_topics>
<edam_operations>
<edam_operation>operation_0540</edam_operation> <!-- Phylogenetic inference (from molecular sequences) -->
</edam_operations>
<requirements>
<requirement type="package" version="@TOOL_VERSION@">quicktree</requirement>
<requirement type="package" version="3.4">hmmer</requirement> <!-- for file conversion with esl-reformat-->
</requirements>
<version_command>quicktree -v</version_command>
<command detect_errors="exit_code"><![CDATA[

## convert alignment to stockholm before quicktree if needed
#if $input_type.format == "align"
Copy link
Member

Choose a reason for hiding this comment

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

You could also do this if/else dance based on the filetype $input_type.ext and avoid the conditional. But maybe explicit is better than implicit here.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, I did it this way because "phylip" format can unhelpfully refer to either a distance matrix format or an alignment format in this tool so I figured I would make it explicit for the user which they are supplying. But I will check if Galaxy has a sniffer for phylip and which format it assumes when a file is marked as phylip and see if I can streamline that part.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, looks like Galaxy's definition of phylip is the alignment version, but that still leaves the issue that distance matrices and some of the supported alignment file types will both be 'txt' in Galaxy currently so I think the conditional is still good here

Copy link
Member

Choose a reason for hiding this comment

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

Thanks. Ship it if your like I will make sure its installed on Monday.

Copy link
Contributor

Choose a reason for hiding this comment

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

Independent of this PR, esl-reformat might be cool as extra tool.

esl-reformat -o input.quicktree stockholm '$input_file' ##--informat a2m
#else
ln -s '$input_file' input.quicktree
#end if

&&

quicktree
#if $input_type.format =="align"
-in a
#else
-in m
#end if
#if $output_type == 'tree_out'
-out t
#else
-out m
#end if
$upgma
$kimura
#if $boot
-boot $boot
#end if
input.quicktree
> '$output_file'

]]></command>
<inputs>
<conditional name="input_type">
<param name="format" type="select" label="Provide an alignment file or a distance matrix?">
<option value="align">Alignment File</option>
<option value="dist">Distance Matrix</option>
</param>
<when value="align">
<param name="input_file" type="data" format="fasta,stockholm,phylip,txt" label="Alignment file" />
</when>
<when value="dist">
<param name="input_file" type="data" format="mothur.dist,mothur.lower.dist,mothur.square.dixt,txt" label="Distance Matrix" help="A distance matrix in phylip format (see help below for details). Can be a square distance matrix or a lower triangle distance matrix." />
Copy link
Contributor

Choose a reason for hiding this comment

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

  • mothur.square.dixt -> mothur.square.dist
  • txt can / should we replace this by tabular? Or at least add it?

Copy link
Contributor

Choose a reason for hiding this comment

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

should we replace this by tabular

I answer this myself: No :)

</when>
</conditional>
<param argument="-upgma" type="boolean" truevalue="-upgma" falsevalue="" checked="false" label="Use the UPGMA method to construct the tree" help="ignored for distance matrix outputs"/>
<param argument="-kimura" type="boolean" truevalue="-kimura" falsevalue="" checked="false" label="Use the kimura translation for pairwise distances" help="ignored for distance matrix outputs"/>
<param argument="-boot" type="integer" optional="true" min="0" label="Calcuate bootstrap values with n iterations" help="ignored for distance matrix outputs"/>
<param name="output_type" type="select" multiple="false" label="Choose output format">
<option value="dist_out">Distance Matrix (Phylip format)</option>
<option value="tree_out" selected="true">Tree (Newick format)</option>
</param>
</inputs>
<outputs>
<data name="output_file" format="newick" label="${tool.name} on ${on_string}: stockholm format">
<change_format>
<when input="output_type" value="dist_out" format="mothur.dist" />
</change_format>
</data>
</outputs>
<tests>
<test expect_num_outputs="1"><!-- test 1: with fasta input (with reformat) -->
<param name="format" value="align"/>
<param name="input_file" value="example.009.AA.fasta" ftype="fasta"/>
<output name="output_file" file="example.009.AA.newick" ftype="newick"/>
</test>
<test expect_num_outputs="1"><!-- test 2: with stockholm input (no reformat)-->
<param name="format" value="align"/>
<param name="input_file" value="example.009.AA.stockholm" ftype="stockholm"/>
<output name="output_file" file="example.009.AA.newick" ftype="newick"/>
</test>
<test expect_num_outputs="1"><!-- test 3: with clustalw input -->
<param name="format" value="align"/>
<param name="input_file" value="example.011.AA.clw" ftype="txt"/>
<output name="output_file" file="example.011.AA.newick" ftype="newick"/>
</test>
<test expect_num_outputs="1"><!-- test 4: with phylip distance matrix input (lower triangle distance matrix) -->
<param name="format" value="dist"/>
<param name="input_file" value="example.001.AA.dist.lt.phy" ftype="mothur.dist"/>
<output name="output_file" file="example.001.AA.newick" ftype="newick"/>
</test>
<test expect_num_outputs="1"><!-- test 5: with phylip distance matrix input (square distance matrix) -->
<param name="format" value="dist"/>
<param name="input_file" value="example_dist_square_phylip.dist" ftype="mothur.dist"/>
<output name="output_file" file="example_dist_square_phylip.newick" ftype="newick"/>
</test>
<test expect_num_outputs="1"><!-- test 6: with phylip alignment input -->
<param name="format" value="align"/>
<param name="input_file" value="example.011.AA.phy" ftype="phylip"/>
<output name="output_file" file="example.011.AA.align.newick" ftype="newick"/>
</test>
<test expect_num_outputs="1"><!-- test 7: with distance matrix output -->
<param name="format" value="align"/>
<param name="input_file" value="example.009.AA.fasta" ftype="fasta"/>
<param name="output_type" value="dist_out"/>
<output name="output_file" file="example.009.AA.dist" ftype="mothur.dist"/>
</test>
<test expect_num_outputs="1"><!-- test 8: test with all parameters set -->
<param name="format" value="align"/>
<param name="input_file" value="example.011.AA.phy" ftype="phylip"/>
<param name="upgma" value="-upgma"/>
<param name="kimura" value="-kimura"/>
<param name="boot" value="100"/>
<output name="output_file" file="example.011.AA.align.params.newick" ftype="newick"/>
</test>
</tests>
<help><![CDATA[

.. class:: infomark

**What it does**

QuickTree is an efficient implementation of the Neighbor-Joining algorithm, capable of reconstructing phylogenies
from huge alignments in time less than the age of the universe.


**Input**

QuickTree accepts both distance matrix and multiple-sequence-aligment inputs. The former should be in PHYLIP format. The latter should be in Stockholm format, which is the native alignment format for the Pfam database.

Alignments can be supplied in various other formats (fasta, phylip, clustalw, pfam, psiblast, selex) and will be converted to Stockholm format with the esl-reformat program,
which is part of the HMMer package (hmmer.org).

**Output**

Quicktree will output either a distance matrix (in PHYLIP format, square distance matrix) or a Newick tree.


**File Formats**

The **distance matrix** input should be in phylip format, it can be a square matrix or a lower triangle matrix.
The distance matrix output by quicktree will be a square matrix.

Example square distance matrix in phylip format::

5
Alpha 0.000 1.000 2.000 3.000 3.000
Beta 1.000 0.000 2.000 3.000 3.000
Gamma 2.000 2.000 0.000 3.000 3.000
Delta 3.000 3.000 3.000 0.000 1.000
Epsilon 3.000 3.000 3.000 1.000 0.000

Example of a lower triangle matrix::

7
Mouse
Bovine 1.7043
Lemur 2.0235 1.1901
Orang 2.0593 1.2005 1.5356
Gorilla 1.6664 1.3460 1.4577 1.5935
Chimp 1.7320 1.3757 1.7803 1.7119 1.0635
Human 1.7101 1.3956 1.6661 1.7599 1.0557 0.6933


* For more details about the PHYLIP distance matrix format, see https://phylipweb.github.io/phylip/doc/distance.html
* For more details about the Newick output format, see https://phylipweb.github.io/phylip/newicktree.html

]]></help>
<citations>
<citation type="doi">10.1093/oxfordjournals.molbev.a040454</citation>
</citations>
</tool>
Loading