changeset 4:f2656e644641 draft

"planemo upload for repository https://github.com/brinkmanlab/galaxy-tools/tree/master/make_unique_id commit e3bef6bd24b0d0bf5645a5d1083c1fa886c19e4a"
author brinkmanlab
date Tue, 16 Jun 2020 12:47:07 -0400
parents a2258ce2d58c
children 85167b9e6c7a
files make_unique_id.py make_unique_id.xml
diffstat 2 files changed, 6 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/make_unique_id.py	Mon Jun 15 19:32:32 2020 -0400
+++ b/make_unique_id.py	Tue Jun 16 12:47:07 2020 -0400
@@ -29,22 +29,15 @@
     ids = defaultdict(int)
     
     def makeUnique(seq):
-        seqlenlen = len(str(len(seq)))
-        newid = seq.id[:26 - seqlenlen]  # Genbank has a max length for the id and sequence length number, truncate the sequence id if too long
-        count = ids[newid]
-        ids[newid] += 1
+        count = ids[seq.id]
+        ids[seq.id] += 1
         if count:
+            oldid = seq.id
             suffix = "_" + str(count)
-            if len(newid) + len(suffix) + 1 + seqlenlen > 26:
-               newid = newid[:25 - seqlenlen - len(suffix)]
-
-            newid += suffix
+            seq.id += suffix
             seq.name += suffix
+            print(f"{oldid}\t{seq.id}")
 
-        if seq.id != newid:
-            print(f"{seq.id}\t{newid}")
-
-        seq.id = newid
         return seq
 
 
--- a/make_unique_id.xml	Mon Jun 15 19:32:32 2020 -0400
+++ b/make_unique_id.xml	Tue Jun 16 12:47:07 2020 -0400
@@ -10,7 +10,7 @@
     </edam_operations>
     <requirements>
         <requirement type="package" version="3.7">python</requirement>
-        <requirement type="package" version="1.73">biopython</requirement>
+        <requirement type="package" version="1.76">biopython</requirement>
     </requirements>
     <version_command><![CDATA[ python $__tool_directory__/make_unique_id.py -v ]]></version_command>
     <command detect_errors="aggressive"><![CDATA[