changeset 6:f1eca1158f21 draft

planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/ete commit 133bb57feca9672734d664e6b34e428488cf2e73
author earlhaminst
date Wed, 10 Oct 2018 05:24:04 -0400
parents 817031b8486d
children 6a5282f71f82
files ete_genetree_splitter.xml ete_homology_classifier.py ete_lineage_generator.py ete_lineage_generator.xml ete_macros.xml ete_species_tree_generator.xml test-data/lineage-compress-lower.txt test-data/lineage-compress.txt test-data/lineage-full.txt test-data/lineage-wid.txt test-data/lineage.txt
diffstat 11 files changed, 99 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/ete_genetree_splitter.xml	Thu May 10 06:15:17 2018 -0400
+++ b/ete_genetree_splitter.xml	Wed Oct 10 05:24:04 2018 -0400
@@ -1,4 +1,4 @@
-<tool id="ete_genetree_splitter" name="ETE GeneTree splitter" version="@VERSION@.1">
+<tool id="ete_genetree_splitter" name="ETE GeneTree splitter" version="@VERSION@">
     <description>from a genetree using the ETE Toolkit</description>
     <macros>
         <import>ete_macros.xml</import>
--- a/ete_homology_classifier.py	Thu May 10 06:15:17 2018 -0400
+++ b/ete_homology_classifier.py	Wed Oct 10 05:24:04 2018 -0400
@@ -17,8 +17,13 @@
     if options.genetree is None:
         parser.error("--genetree option must be specified, GeneTree in nhx format")
 
+    with open(options.genetree, 'r') as f:
+        contents = f.read()
+
+    # Remove empty NHX features that can be produced by TreeBest but break ete3
+    contents = contents.replace('[&&NHX]', '')
     # reads single gene tree
-    genetree = PhyloTree(options.genetree)
+    genetree = PhyloTree(contents)
 
     leaves_list = genetree.get_leaf_names()
     # Genetree nodes are required to be in gene_species format
--- a/ete_lineage_generator.py	Thu May 10 06:15:17 2018 -0400
+++ b/ete_lineage_generator.py	Wed Oct 10 05:24:04 2018 -0400
@@ -69,6 +69,8 @@
                   help='Prefer lower levels when compressed')
 parser.add_option('-r', '--rank', dest='ranks', action="append",
                   help='include rank - multiple ones can be specified')
+parser.add_option('-i', '--includeid', dest="addid", action="store_true", default=False,
+                  help='add taxid column')
 
 options, args = parser.parse_args()
 # check command line options
@@ -106,8 +108,13 @@
         for ilr in range(len(LONG_RANKS)):
             if RANKS[ir] in LONG_RANKS[ilr]:
                 COMP_RANK_IDX[LONG_RANKS[ilr]] = ir
+
 # write header
-of.write("#species/taxid\t%s\n" % ("\t".join(RANKS)))
+of.write("# query")
+if options.addid:
+    of.write("\ttaxid")
+of.write("\t%s\n" % ("\t".join(RANKS)))
+
 # get and write data
 with open(options.input_species_filename) as f:
     for line in f.readlines():
@@ -128,5 +135,8 @@
         process_taxid(ncbi, taxid, ranks, RANK_IDX)
         if options.compress:
             process_taxid(ncbi, taxid, ranks, COMP_RANK_IDX, options.lower)
-        of.write("%s\t%s\n" % (line, "\t".join(ranks)))
+        of.write("%s" % line)
+        if options.addid:
+            of.write("\t%d" % taxid)
+        of.write("\t%s\n" % "\t".join(ranks))
 of.close()
--- a/ete_lineage_generator.xml	Thu May 10 06:15:17 2018 -0400
+++ b/ete_lineage_generator.xml	Wed Oct 10 05:24:04 2018 -0400
@@ -20,6 +20,7 @@
     $compresscond.compress
     $compresscond.lower
 #end if
+$includeid
     ]]></command>
     <inputs>
         <param name="speciesFile" type="data" format="txt" label="Species file" help="List with one species/taxid per line" />
@@ -68,17 +69,16 @@
         </conditional>
         <conditional name="compresscond">
             <param name="compress" type="select" label="Fill unnamed ranks" help="Fill unnamed ranks with super/sub ranks (see -l)">
-                <option value="-c">Yes</option>
+                <option value="-c" selected="True">Yes</option>
                 <option value="">No</option>
             </param>
             <when value="-c">
-                <param name="lower" type="select" label="Prefer lower ranks for filling" help="Prefer lower levels for filling">
-                    <option value="-l">Yes</option>
-                    <option value="">No</option>
-                </param>
+                <param name="lower" type="boolean" truevalue="-l" falsevalue="" checked="False" label="Prefer lower ranks" help="Take the next available lower rank (default: higher)"/> 
             </when>
             <when value="" />
         </conditional>
+        <param name="includeid" type="boolean" truevalue="--includeid" falsevalue="" label="Include taxid in the table"
+            help="For the case when the input consists of taxon names" />
     </inputs>
     <outputs>
         <data name="outputFile" format="tsv" label="${tool.name} on ${on_string}"/>
@@ -114,6 +114,12 @@
             <param name="manualranks" value="kingdom,family" />
             <output name="outputFile" file="lineage-full.txt" />
         </test>
+        <test>
+            <param name="speciesFile" ftype="txt" value="species.txt" />
+            <param name="database" ftype="sqlite" value="taxdump.sqlite" />
+            <param name="includeid" value="--includeid" />
+            <output name="outputFile" file="lineage-wid.txt" />
+        </test>
     </tests>
     <help><![CDATA[
 Generates a table with lineage information for a list of species (also taxids and arbitrary taxons are accepted) using the `ETE Toolkit`_.
--- a/ete_macros.xml	Thu May 10 06:15:17 2018 -0400
+++ b/ete_macros.xml	Wed Oct 10 05:24:04 2018 -0400
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <macros>
-    <token name="@VERSION@">3.0.0b35</token>
+    <token name="@VERSION@">3.1.1</token>
     <xml name="requirements">
         <requirements>
             <requirement type="package" version="@VERSION@">ete3</requirement>
--- a/ete_species_tree_generator.xml	Thu May 10 06:15:17 2018 -0400
+++ b/ete_species_tree_generator.xml	Wed Oct 10 05:24:04 2018 -0400
@@ -1,4 +1,4 @@
-<tool id="ete_species_tree_generator" name="ETE species tree generator" version="@VERSION@.1">
+<tool id="ete_species_tree_generator" name="ETE species tree generator" version="@VERSION@">
     <description>from a list of species using the ETE Toolkit</description>
     <macros>
         <import>ete_macros.xml</import>
--- a/test-data/lineage-compress-lower.txt	Thu May 10 06:15:17 2018 -0400
+++ b/test-data/lineage-compress-lower.txt	Wed Oct 10 05:24:04 2018 -0400
@@ -1,4 +1,4 @@
-#species/taxid	kingdom	phylum	class	order	family	genus	species
+# query	kingdom	phylum	class	order	family	genus	species
 Latimeria chalumnae	Eukaryota	Chordata	NA	Coelacanthiformes	Coelacanthidae	Latimeria	Latimeria chalumnae
 Xenopus tropicalis	Eukaryota	Chordata	Amphibia	Batrachia	Pipoidea	Xenopus	Xenopus tropicalis
 Ornithorhynchus anatinus	Eukaryota	Chordata	Mammalia	Monotremata	Ornithorhynchidae	Ornithorhynchus	Ornithorhynchus anatinus
--- a/test-data/lineage-compress.txt	Thu May 10 06:15:17 2018 -0400
+++ b/test-data/lineage-compress.txt	Wed Oct 10 05:24:04 2018 -0400
@@ -1,4 +1,4 @@
-#species/taxid	kingdom	phylum	class	order	family	genus	species
+# query	kingdom	phylum	class	order	family	genus	species
 Latimeria chalumnae	Eukaryota	Chordata	NA	Coelacanthiformes	Coelacanthidae	Latimeria	Latimeria chalumnae
 Xenopus tropicalis	Eukaryota	Chordata	Amphibia	Batrachia	Pipoidea	Xenopus	Xenopus tropicalis
 Ornithorhynchus anatinus	Eukaryota	Chordata	Mammalia	Monotremata	Ornithorhynchidae	Ornithorhynchus	Ornithorhynchus anatinus
--- a/test-data/lineage-full.txt	Thu May 10 06:15:17 2018 -0400
+++ b/test-data/lineage-full.txt	Wed Oct 10 05:24:04 2018 -0400
@@ -1,4 +1,4 @@
-#species/taxid	kingdom	family
+# query	kingdom	family
 Latimeria chalumnae	Metazoa	Coelacanthidae
 Xenopus tropicalis	Metazoa	Pipidae
 Ornithorhynchus anatinus	Metazoa	Ornithorhynchidae
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/lineage-wid.txt	Wed Oct 10 05:24:04 2018 -0400
@@ -0,0 +1,63 @@
+# query	taxid	kingdom	phylum	class	order	family	genus	species
+Latimeria chalumnae	7897	Eukaryota	Chordata	NA	Coelacanthiformes	Coelacanthidae	Latimeria	Latimeria chalumnae
+Xenopus tropicalis	8364	Eukaryota	Chordata	Amphibia	Batrachia	Pipoidea	Xenopus	Xenopus tropicalis
+Ornithorhynchus anatinus	9258	Eukaryota	Chordata	Mammalia	Monotremata	Ornithorhynchidae	Ornithorhynchus	Ornithorhynchus anatinus
+Macropus eugenii	9315	Eukaryota	Chordata	Mammalia	Diprotodontia	Macropodidae	Notamacropus	Notamacropus eugenii
+Sarcophilus harrisii	9305	Eukaryota	Chordata	Mammalia	Dasyuromorphia	Dasyuridae	Sarcophilus	Sarcophilus harrisii
+Monodelphis domestica	13616	Eukaryota	Chordata	Mammalia	Didelphimorphia	Didelphidae	Monodelphis	Monodelphis domestica
+Echinops telfairi	9371	Eukaryota	Chordata	Mammalia	Afrotheria	Tenrecidae	Echinops	Echinops telfairi
+Procavia capensis	9813	Eukaryota	Chordata	Mammalia	Afrotheria	Procaviidae	Procavia	Procavia capensis
+Loxodonta africana	9785	Eukaryota	Chordata	Mammalia	Afrotheria	Elephantidae	Loxodonta	Loxodonta africana
+Dasypus novemcinctus	9361	Eukaryota	Chordata	Mammalia	Xenarthra	Dasypodidae	Dasypus	Dasypus novemcinctus
+Choloepus hoffmanni	9358	Eukaryota	Chordata	Mammalia	Xenarthra	Megalonychidae	Choloepus	Choloepus hoffmanni
+Ochotona princeps	9978	Eukaryota	Chordata	Mammalia	Euarchontoglires	Ochotonidae	Ochotona	Ochotona princeps
+Oryctolagus cuniculus	9986	Eukaryota	Chordata	Mammalia	Euarchontoglires	Leporidae	Oryctolagus	Oryctolagus cuniculus
+Cavia porcellus	10141	Eukaryota	Chordata	Mammalia	Euarchontoglires	Caviidae	Cavia	Cavia porcellus
+Ictidomys tridecemlineatus	43179	Eukaryota	Chordata	Mammalia	Euarchontoglires	Sciuridae	Ictidomys	Ictidomys tridecemlineatus
+Dipodomys ordii	10020	Eukaryota	Chordata	Mammalia	Euarchontoglires	Heteromyidae	Dipodomys	Dipodomys ordii
+Rattus norvegicus	10116	Eukaryota	Chordata	Mammalia	Euarchontoglires	Muridae	Rattus	Rattus norvegicus
+Mus musculus	10090	Eukaryota	Chordata	Mammalia	Euarchontoglires	Muridae	Mus	Mus musculus
+Tupaia belangeri	37347	Eukaryota	Chordata	Mammalia	Euarchontoglires	Tupaiidae	Tupaia	Tupaia belangeri
+Otolemur garnettii	30611	Eukaryota	Chordata	Mammalia	Euarchontoglires	Galagidae	Otolemur	Otolemur garnettii
+Microcebus murinus	30608	Eukaryota	Chordata	Mammalia	Euarchontoglires	Cheirogaleidae	Microcebus	Microcebus murinus
+Tarsius syrichta	1868482	Eukaryota	Chordata	Mammalia	Euarchontoglires	Tarsiidae	Carlito	Carlito syrichta
+Callithrix jacchus	9483	Eukaryota	Chordata	Mammalia	Euarchontoglires	Cebidae	Callithrix	Callithrix jacchus
+Chlorocebus sabaeus	60711	Eukaryota	Chordata	Mammalia	Euarchontoglires	Cercopithecoidea	Chlorocebus	Chlorocebus sabaeus
+Papio anubis	9555	Eukaryota	Chordata	Mammalia	Euarchontoglires	Cercopithecoidea	Papio	Papio anubis
+Macaca mulatta	9544	Eukaryota	Chordata	Mammalia	Euarchontoglires	Cercopithecoidea	Macaca	Macaca mulatta
+Nomascus leucogenys	61853	Eukaryota	Chordata	Mammalia	Euarchontoglires	Hominoidea	Nomascus	Nomascus leucogenys
+Pongo abelii	9601	Eukaryota	Chordata	Mammalia	Euarchontoglires	Hominoidea	Pongo	Pongo abelii
+Gorilla gorilla gorilla	9595	Eukaryota	Chordata	Mammalia	Euarchontoglires	Hominoidea	Gorilla	Gorilla gorilla
+Pan troglodytes	9598	Eukaryota	Chordata	Mammalia	Euarchontoglires	Hominoidea	Pan	Pan troglodytes
+Homo sapiens	9606	Eukaryota	Chordata	Mammalia	Euarchontoglires	Hominoidea	Homo	Homo sapiens
+Sorex araneus	42254	Eukaryota	Chordata	Mammalia	Laurasiatheria	Soricidae	Sorex	Sorex araneus
+Erinaceus europaeus	9365	Eukaryota	Chordata	Mammalia	Laurasiatheria	Erinaceidae	Erinaceus	Erinaceus europaeus
+Pteropus vampyrus	132908	Eukaryota	Chordata	Mammalia	Laurasiatheria	Pteropodidae	Pteropus	Pteropus vampyrus
+Myotis lucifugus	59463	Eukaryota	Chordata	Mammalia	Laurasiatheria	Vespertilionidae	Myotis	Myotis lucifugus
+Felis catus	9685	Eukaryota	Chordata	Mammalia	Laurasiatheria	Felidae	Felis	Felis catus
+Canis lupus familiaris	9615	Eukaryota	Chordata	Mammalia	Laurasiatheria	Canidae	Canis	Canis lupus
+Mustela putorius furo	9669	Eukaryota	Chordata	Mammalia	Laurasiatheria	Mustelidae	Mustela	Mustela putorius
+Ailuropoda melanoleuca	9646	Eukaryota	Chordata	Mammalia	Laurasiatheria	Ursidae	Ailuropoda	Ailuropoda melanoleuca
+Equus caballus	9796	Eukaryota	Chordata	Mammalia	Laurasiatheria	Equidae	Equus	Equus caballus
+Vicugna pacos	30538	Eukaryota	Chordata	Mammalia	Laurasiatheria	Camelidae	Vicugna	Vicugna pacos
+Sus scrofa	9823	Eukaryota	Chordata	Mammalia	Laurasiatheria	Suidae	Sus	Sus scrofa
+Tursiops truncatus	9739	Eukaryota	Chordata	Mammalia	Laurasiatheria	Delphinidae	Tursiops	Tursiops truncatus
+Ovis aries	9940	Eukaryota	Chordata	Mammalia	Laurasiatheria	Bovidae	Ovis	Ovis aries
+Bos taurus	9913	Eukaryota	Chordata	Mammalia	Laurasiatheria	Bovidae	Bos	Bos taurus
+Anolis carolinensis	28377	Eukaryota	Chordata	NA	Lepidosauria	Dactyloidae	Anolis	Anolis carolinensis
+Pelodiscus sinensis	13735	Eukaryota	Chordata	NA	Testudines	Trionychidae	Pelodiscus	Pelodiscus sinensis
+Taeniopygia guttata	59729	Eukaryota	Chordata	Aves	Neognathae	Passeroidea	Taeniopygia	Taeniopygia guttata
+Ficedula albicollis	59894	Eukaryota	Chordata	Aves	Neognathae	Muscicapidae	Ficedula	Ficedula albicollis
+Anas platyrhynchos	8839	Eukaryota	Chordata	Aves	Neognathae	Anatidae	Anas	Anas platyrhynchos
+Meleagris gallopavo	9103	Eukaryota	Chordata	Aves	Neognathae	Phasianidae	Meleagris	Meleagris gallopavo
+Gallus gallus	9031	Eukaryota	Chordata	Aves	Neognathae	Phasianidae	Gallus	Gallus gallus
+Lepisosteus oculatus	7918	Eukaryota	Chordata	Actinopterygii	Semionotiformes	Lepisosteidae	Lepisosteus	Lepisosteus oculatus
+Danio rerio	7955	Eukaryota	Chordata	Actinopterygii	Cypriniphysae	Cyprinoidea	Danio	Danio rerio
+Astyanax mexicanus	7994	Eukaryota	Chordata	Actinopterygii	Characiphysae	Characidae	Astyanax	Astyanax mexicanus
+Gadus morhua	8049	Eukaryota	Chordata	Actinopterygii	Gadiformes	Gadidae	Gadus	Gadus morhua
+Oreochromis niloticus	8128	Eukaryota	Chordata	Actinopterygii	Cichlomorphae	Cichlidae	Oreochromis	Oreochromis niloticus
+Poecilia formosa	48698	Eukaryota	Chordata	Actinopterygii	Atherinomorphae	Poeciliidae	Poecilia	Poecilia formosa
+Xiphophorus maculatus	8083	Eukaryota	Chordata	Actinopterygii	Atherinomorphae	Poeciliidae	Xiphophorus	Xiphophorus maculatus
+Gasterosteus aculeatus	69293	Eukaryota	Chordata	Actinopterygii	Perciformes	Gasterosteidae	Gasterosteus	Gasterosteus aculeatus
+Tetraodon nigroviridis	99883	Eukaryota	Chordata	Actinopterygii	Tetraodontiformes	Tetradontoidea	Tetraodon	Tetraodon nigroviridis
+Takifugu rubripes	31033	Eukaryota	Chordata	Actinopterygii	Tetraodontiformes	Tetradontoidea	Takifugu	Takifugu rubripes
--- a/test-data/lineage.txt	Thu May 10 06:15:17 2018 -0400
+++ b/test-data/lineage.txt	Wed Oct 10 05:24:04 2018 -0400
@@ -1,4 +1,4 @@
-#species/taxid	superkingdom	kingdom	subkingdom	superphylum	phylum	subphylum	superclass	class	subclass	infraclass	cohort	superorder	order	suborder	infraorder	parvorder	superfamily	family	subfamily	tribe	subtribe	genus	subgenus	species group	species subgroup	species	subspecies	varietas	forma
+# query	superkingdom	kingdom	subkingdom	superphylum	phylum	subphylum	superclass	class	subclass	infraclass	cohort	superorder	order	suborder	infraorder	parvorder	superfamily	family	subfamily	tribe	subtribe	genus	subgenus	species group	species subgroup	species	subspecies	varietas	forma
 Latimeria chalumnae	Eukaryota	Metazoa	NA	NA	Chordata	Craniata	NA	NA	NA	NA	NA	NA	Coelacanthiformes	NA	NA	NA	NA	Coelacanthidae	NA	NA	NA	Latimeria	NA	NA	NA	Latimeria chalumnae	NA	NA	NA
 Xenopus tropicalis	Eukaryota	Metazoa	NA	NA	Chordata	Craniata	NA	Amphibia	NA	NA	NA	Batrachia	Anura	NA	NA	NA	Pipoidea	Pipidae	Xenopodinae	NA	NA	Xenopus	Silurana	NA	NA	Xenopus tropicalis	NA	NA	NA
 Ornithorhynchus anatinus	Eukaryota	Metazoa	NA	NA	Chordata	Craniata	NA	Mammalia	NA	NA	NA	NA	Monotremata	NA	NA	NA	NA	Ornithorhynchidae	NA	NA	NA	Ornithorhynchus	NA	NA	NA	Ornithorhynchus anatinus	NA	NA	NA