changeset 11:2db72467da51 draft

"planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/ete commit 67e136d433c0d925db362342919305b46fdffecd"
author earlhaminst
date Thu, 10 Mar 2022 14:01:44 +0000
parents 541a2ffc01ff
children dc32007a6b36
files ete_homology_classifier.xml ete_lineage_generator.py ete_lineage_generator.xml test-data/species_ids.txt
diffstat 4 files changed, 28 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ete_homology_classifier.xml	Fri Nov 20 16:56:22 2020 +0000
+++ b/ete_homology_classifier.xml	Thu Mar 10 14:01:44 2022 +0000
@@ -3,7 +3,7 @@
     <macros>
         <import>ete_macros.xml</import>
         <xml name="homologies_macro" token_label="" token_help="">
-            <param name="homologies" type="select" multiple="true" optional="false" display="checkboxes" label="@LABEL@" help="@HELP@">
+            <param name="homologies" type="select" multiple="true" optional="false" label="@LABEL@" help="@HELP@">
                 <option value="one-to-one" selected="true">one-to-one</option>
                 <option value="one-to-many" selected="true">one-to-many</option>
                 <option value="many-to-one" selected="true">many-to-one</option>
--- a/ete_lineage_generator.py	Fri Nov 20 16:56:22 2020 +0000
+++ b/ete_lineage_generator.py	Thu Mar 10 14:01:44 2022 +0000
@@ -41,7 +41,14 @@
     RANK_IDX: mapping from rank names to indices (distance to root/leaf?)
     lower: use lower taxa for filling "NA"s
     """
-    lineage_taxids = ncbi.get_lineage(taxid)
+    try:
+        lineage_taxids = ncbi.get_lineage(taxid)
+    except ValueError:
+        sys.stderr.write("[%s] could not determine lineage!\n" % taxid)
+        return
+    if lineage_taxids is None:
+        sys.stderr.write("[%s] could not determine lineage!\n" % taxid)
+        return
     lineage_ranks = ncbi.get_rank(lineage_taxids)
     lineage_names = ncbi.get_taxid_translator(lineage_taxids, try_synonyms=True)
     if lower:
@@ -121,6 +128,8 @@
 with open(options.input_species_filename) as f:
     for line in f.readlines():
         line = line.strip().replace('_', ' ')
+        if line == "":
+            continue
         try:
             taxid = int(line)
         except ValueError:
--- a/ete_lineage_generator.xml	Fri Nov 20 16:56:22 2020 +0000
+++ b/ete_lineage_generator.xml	Thu Mar 10 14:01:44 2022 +0000
@@ -1,4 +1,4 @@
-<tool id="ete_lineage_generator" name="ETE lineage generator" version="@VERSION@">
+<tool id="ete_lineage_generator" name="ETE lineage generator" version="@VERSION@+galaxy1">
     <description>from a list of species/taxids using the ETE Toolkit</description>
     <macros>
         <import>ete_macros.xml</import>
@@ -120,6 +120,19 @@
             <param name="includeid" value="--includeid" />
             <output name="outputFile" file="lineage-wid.txt" />
         </test>
+        <test>
+            <param name="speciesFile" ftype="txt" value="species_ids.txt" />
+            <param name="database" ftype="sqlite" value="taxdump.sqlite" />
+            <output name="outputFile">
+                <assert_contents>
+                    <has_line line="9606&#009;Eukaryota&#009;Chordata&#009;Mammalia&#009;Euarchontoglires&#009;Hominoidea&#009;Homo&#009;Homo sapiens"/>
+                    <has_line line="0&#009;NA&#009;NA&#009;NA&#009;NA&#009;NA&#009;NA&#009;NA"/>
+                </assert_contents>
+            </output>
+            <assert_stderr>
+                <has_line line="[0] could not determine lineage!"/>
+            </assert_stderr>
+        </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`_.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/species_ids.txt	Thu Mar 10 14:01:44 2022 +0000
@@ -0,0 +1,3 @@
+9606
+
+0
\ No newline at end of file