changeset 1:a4ba317fc713 draft

planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/ete commit df73a2add6dba8550867034e157ed0699b3b2f53
author earlhaminst
date Fri, 17 Mar 2017 16:23:39 -0400
parents 276e3ee68c37
children 03c10736e497
files ete_species_tree_generator.py ete_species_tree_generator.xml ete_tree_generator.py ete_tree_generator.xml
diffstat 4 files changed, 146 insertions(+), 146 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ete_species_tree_generator.py	Fri Mar 17 16:23:39 2017 -0400
@@ -0,0 +1,56 @@
+import optparse
+
+from ete3 import NCBITaxa
+
+ncbi = NCBITaxa()
+
+parser = optparse.OptionParser()
+parser.add_option('-s', '--species', dest="input_species_filename",
+                  help='Species list in text format one species in each line')
+
+parser.add_option('-f', '--format', type='choice', choices=['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '100'], dest="format",
+                  default='8', help='outpur format for tree')
+
+parser.add_option('-t', '--treebest', type='choice', choices=['yes', 'no'], dest="treebest",
+                  default='no', help='To be used in TreeBest')
+
+parser.add_option('-d', '--database', type='choice', choices=['yes', 'no'], dest="database",
+                  default='no', help='Update database')
+
+options, args = parser.parse_args()
+
+if options.database == "yes":
+    try:
+        ncbi.update_taxonomy_database()
+    except:
+        pass
+
+if options.input_species_filename is None:
+    raise Exception('-s option must be specified, Species list in text format one species in each line')
+
+with open(options.input_species_filename) as f:
+    species_name = [_.strip().replace('_', ' ') for _ in f.readlines()]
+
+name2taxid = ncbi.get_name_translator(species_name)
+
+taxid = [name2taxid[_][0] for _ in species_name]
+
+tree = ncbi.get_topology(taxid)
+
+if options.treebest == "yes":
+    inv_map = {str(v[0]): k.replace(" ", "") + "*" for k, v in name2taxid.items()}
+else:
+    inv_map = {str(v[0]): k for k, v in name2taxid.items()}
+
+
+for leaf in tree:
+    leaf.name = inv_map[leaf.name]
+
+newickTree = tree.write(format=int(options.format))
+
+if options.treebest == "yes":
+    newickTree = newickTree.rstrip(';')
+    newickTree = newickTree + "root;"
+
+with open('newickTree.nhx', 'w') as newickFile:
+    newickFile.write(newickTree)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ete_species_tree_generator.xml	Fri Mar 17 16:23:39 2017 -0400
@@ -0,0 +1,90 @@
+<tool id="ete_species_tree_generator" name="ETE species tree generator" version="3.0.0b35">
+    <description>from a list of species using the ETE Toolkit</description>
+     <requirements>
+        <requirement type="package" version="3.0.0b35">ete3</requirement>
+    </requirements>
+    <stdio>
+        <!-- Anything other than zero is an error -->
+        <exit_code range="1:" />
+    </stdio>
+    <command>
+    <![CDATA[
+python $__tool_directory__/ete_species_tree_generator.py
+-s '$speciesFile'
+#if $output_format.treebest == 'yes'
+    -f 8
+#else
+    -f ${output_format.format_selector}
+#end if
+-t $output_format.treebest
+-d $database
+    ]]>
+    </command>
+    <inputs>
+        <param name="speciesFile" type="data" format="txt" label="Species file" help="List with one species per line" />        
+        <conditional name="output_format">
+            <param name="treebest" type="select" label="Use in TreeBest" help="Select yes if specie tree to be used in TreeBest">
+                <option value="yes">Yes</option>
+                <option value="no" selected="true">No</option>
+            </param>
+            <when value="yes" />
+            <when value="no">
+                <param name="format_selector" type="select" label="Output format" help="See table below">
+                    <option value="0" selected="true">Flexible with support values (0)</option>
+                    <option value="1">Flexible with internal node names (1)</option>
+                    <option value="2">All branches + leaf names + internal supports (2)</option>
+                    <option value="3">All branches + all names (3)</option>
+                    <option value="4">Leaf branches + leaf names (4)</option>
+                    <option value="5">Internal and leaf branches + leaf names (5)</option>
+                    <option value="6">Internal branches + leaf names (6)</option>
+                    <option value="7">Leaf branches + all names (7)</option>
+                    <option value="8">All names (8)</option>
+                    <option value="9">Leaf names (9)</option>
+                    <option value="100">Topology only (100)</option>
+                </param>
+            </when>
+        </conditional>
+        <param name="database" type="select" label="Update database" help="Update database from NCBI (slower)">
+            <option value="no" selected="true">No</option>
+            <option value="yes">Yes</option>
+        </param>
+    </inputs>
+    <outputs>
+        <data format="nhx" name="outputFile" label="${tool.name} on ${on_string}" from_work_dir="newickTree.nhx"/>
+    </outputs>
+    <tests>
+        <test>
+            <param name="speciesFile" ftype="txt" value="species.txt" />
+            <param name="treebest" value="yes" />
+            <output name="outputFile" file="out.nhx" />
+        </test>
+    </tests>
+    <help>
+    <![CDATA[
+Generate a species tree from a list of species using the `ETE Toolkit`_.
+
+.. _ETE Toolkit: http://etetoolkit.org/
+
+**Output format:**
+
+======= ============================================= ========================================================================================
+FORMAT  DESCRIPTION                                     SAMPLE
+------- --------------------------------------------- ----------------------------------------------------------------------------------------
+0       flexible with support values                    ((D:0.723274,F:0.567784)1.000000:0.067192,(B:0.279326,H:0.756049)1.000000:0.807788);
+1       flexible with internal node names               ((D:0.723274,F:0.567784)E:0.067192,(B:0.279326,H:0.756049)B:0.807788);
+2       all branches + leaf names + internal supports   ((D:0.723274,F:0.567784)1.000000:0.067192,(B:0.279326,H:0.756049)1.000000:0.807788);
+3       all branches + all names                        ((D:0.723274,F:0.567784)E:0.067192,(B:0.279326,H:0.756049)B:0.807788);
+4       leaf branches + leaf names                      ((D:0.723274,F:0.567784),(B:0.279326,H:0.756049));
+5       internal and leaf branches + leaf names         ((D:0.723274,F:0.567784):0.067192,(B:0.279326,H:0.756049):0.807788);
+6       internal branches + leaf names                  ((D,F):0.067192,(B,H):0.807788);
+7       leaf branches + all names                       ((D:0.723274,F:0.567784)E,(B:0.279326,H:0.756049)B);
+8       all names                                       ((D,F)E,(B,H)B);
+9       leaf names                                      ((D,F),(B,H));
+100     topology only                                   ((,),(,));
+======= ============================================= ========================================================================================
+    ]]>
+    </help>
+    <citations>
+        <citation type="doi">10.1093/molbev/msw046</citation>
+    </citations>
+</tool>
--- a/ete_tree_generator.py	Thu Dec 15 12:55:02 2016 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-import optparse
-
-from ete3 import NCBITaxa
-
-ncbi = NCBITaxa()
-
-parser = optparse.OptionParser()
-parser.add_option('-s', '--species', dest="input_species_filename",
-                  help='Species list in text format one species in each line')
-
-parser.add_option('-f', '--format', type='choice', choices=['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '100'], dest="format",
-                  default='8', help='outpur format for tree')
-
-parser.add_option('-t', '--treebest', type='choice', choices=['yes', 'no'], dest="treebest",
-                  default='no', help='To be used in TreeBest')
-
-parser.add_option('-d', '--database', type='choice', choices=['yes', 'no'], dest="database",
-                  default='no', help='Update database')
-
-options, args = parser.parse_args()
-
-if options.database == "yes":
-    try:
-        ncbi.update_taxonomy_database()
-    except:
-        pass
-
-if options.input_species_filename is None:
-    raise Exception('-s option must be specified, Species list in text format one species in each line')
-
-with open(options.input_species_filename) as f:
-    species_name = [_.strip().replace('_', ' ') for _ in f.readlines()]
-
-name2taxid = ncbi.get_name_translator(species_name)
-
-taxid = [name2taxid[_][0] for _ in species_name]
-
-tree = ncbi.get_topology(taxid)
-
-if options.treebest == "yes":
-    inv_map = {str(v[0]): k.replace(" ", "") + "*" for k, v in name2taxid.items()}
-else:
-    inv_map = {str(v[0]): k for k, v in name2taxid.items()}
-
-
-for leaf in tree:
-    leaf.name = inv_map[leaf.name]
-
-newickTree = tree.write(format=int(options.format))
-
-if options.treebest == "yes":
-    newickTree = newickTree.rstrip(';')
-    newickTree = newickTree + "root;"
-
-with open('newickTree.nhx', 'w') as newickFile:
-    newickFile.write(newickTree)
--- a/ete_tree_generator.xml	Thu Dec 15 12:55:02 2016 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-<tool id="species_tree_generator" name="Species tree generator" version="3.0.0b35">
-    <description>from a list of species using the ETE Toolkit</description>
-     <requirements>
-        <requirement type="package" version="3.0.0b35">ete3</requirement>
-    </requirements>
-    <stdio>
-        <!-- Anything other than zero is an error -->
-        <exit_code range="1:" />
-    </stdio>
-    <command>
-    <![CDATA[
-python $__tool_directory__/ete_tree_generator.py 
--s '$speciesFile'
-#if $output_format.treebest == 'yes'
-    -f 8
-#else
-    -f ${output_format.format_selector}
-#end if
--t $output_format.treebest
--d $database
-    ]]>
-    </command>
-    <inputs>
-        <param name="speciesFile" type="data" format="txt" label="Species file" help="List with one species per line" />        
-        <conditional name="output_format">
-            <param name="treebest" type="select" label="Use in TreeBest" help="Select yes if specie tree to be used in TreeBest">
-                <option value="yes">Yes</option>
-                <option value="no" selected="true">No</option>
-            </param>
-            <when value="yes" />
-            <when value="no">
-                <param name="format_selector" type="select" label="Output format" help="See table below">
-                    <option value="0" selected="true">Flexible with support values (0)</option>
-                    <option value="1">Flexible with internal node names (1)</option>
-                    <option value="2">All branches + leaf names + internal supports (2)</option>
-                    <option value="3">All branches + all names (3)</option>
-                    <option value="4">Leaf branches + leaf names (4)</option>
-                    <option value="5">Internal and leaf branches + leaf names (5)</option>
-                    <option value="6">Internal branches + leaf names (6)</option>
-                    <option value="7">Leaf branches + all names (7)</option>
-                    <option value="8">All names (8)</option>
-                    <option value="9">Leaf names (9)</option>
-                    <option value="100">Topology only (100)</option>
-                </param>
-            </when>
-        </conditional>
-        <param name="database" type="select" label="Update database" help="Update database from NCBI (slower)">
-            <option value="no" selected="true">No</option>
-            <option value="yes">Yes</option>
-        </param>
-    </inputs>
-    <outputs>
-        <data format="nhx" name="outputFile" label="${tool.name} on ${on_string}" from_work_dir="newickTree.nhx"/>
-    </outputs>
-    <tests>
-        <test>
-            <param name="speciesFile" ftype="txt" value="species.txt" />
-            <param name="treebest" value="yes" />
-            <output name="outputFile" file="out.nhx" />
-        </test>
-    </tests>
-    <help>
-    <![CDATA[
-Generate a species tree from a list of species using the `ETE Toolkit`_.
-
-.. _ETE Toolkit: http://etetoolkit.org/
-
-**Output format:**
-
-======= ============================================= ========================================================================================
-FORMAT  DESCRIPTION                                     SAMPLE
-------- --------------------------------------------- ----------------------------------------------------------------------------------------
-0       flexible with support values                    ((D:0.723274,F:0.567784)1.000000:0.067192,(B:0.279326,H:0.756049)1.000000:0.807788);
-1       flexible with internal node names               ((D:0.723274,F:0.567784)E:0.067192,(B:0.279326,H:0.756049)B:0.807788);
-2       all branches + leaf names + internal supports   ((D:0.723274,F:0.567784)1.000000:0.067192,(B:0.279326,H:0.756049)1.000000:0.807788);
-3       all branches + all names                        ((D:0.723274,F:0.567784)E:0.067192,(B:0.279326,H:0.756049)B:0.807788);
-4       leaf branches + leaf names                      ((D:0.723274,F:0.567784),(B:0.279326,H:0.756049));
-5       internal and leaf branches + leaf names         ((D:0.723274,F:0.567784):0.067192,(B:0.279326,H:0.756049):0.807788);
-6       internal branches + leaf names                  ((D,F):0.067192,(B,H):0.807788);
-7       leaf branches + all names                       ((D:0.723274,F:0.567784)E,(B:0.279326,H:0.756049)B);
-8       all names                                       ((D,F)E,(B,H)B);
-9       leaf names                                      ((D,F),(B,H));
-100     topology only                                   ((,),(,));
-======= ============================================= ========================================================================================
-    ]]>
-    </help>
-    <citations>
-        <citation type="doi">10.1093/molbev/msw046</citation>
-    </citations>
-</tool>