Repository 'lotus2'
hg clone https://toolshed.g2.bx.psu.edu/repos/earlhaminst/lotus2

Changeset 12:3f3ee496acec (2021-06-09)
Previous changeset 11:8f732780e0f3 (2021-06-08) Next changeset 13:f2bb89058e99 (2021-06-10)
Commit message:
"planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/lotus2 commit e49cb599d171a596ba6a04f73f651e46ac2e4e8a"
modified:
lotus2.xml
b
diff -r 8f732780e0f3 -r 3f3ee496acec lotus2.xml
--- a/lotus2.xml Tue Jun 08 19:53:13 2021 +0000
+++ b/lotus2.xml Wed Jun 09 15:55:53 2021 +0000
[
@@ -41,8 +41,24 @@
     <command detect_errors="exit_code"><![CDATA[
 #import os.path
 #import re
-#def symlink_basename($f):
+#def symlink_basename($f, strip_ext=False):
     #set $fn = re.sub('[^\w\-_.]', '_', $f.name)
+    #if strip_ext:
+        #if $fn.endswith('.gz'):
+            #set $fn = $fn[:-3]
+        #end if
+        #if $f.ext.startswith('fasta'):
+            #set $exts_to_drop = ('.fa', '.fasta', '.fna')
+        #else:
+            #set $exts_to_drop = []
+        #end if
+        #for $ext in $exts_to_drop:
+            #if $fn.endswith($ext):
+                #set $fn = $fn[:-len($ext)]
+                #break
+            #end if
+        #end for
+    #end if
 ${fn}#slurp
 #end def
 
@@ -61,7 +77,7 @@
 
 #if $tax_args.aligner_cond.taxAligner not in ('0', '3') and $tax_args.aligner_cond.refDB_cond.refDB == 'history':
     #set $ext = $tax_args.aligner_cond.refDB_cond.ref_fasta.ext
-    #set $ref_fasta_symlink = $symlink_basename($tax_args.aligner_cond.refDB_cond.ref_fasta, $ext) + '.' + $ext
+    #set $ref_fasta_symlink = $symlink_basename($tax_args.aligner_cond.refDB_cond.ref_fasta, strip_ext=True) + '.' + $ext
     ln -s '$tax_args.aligner_cond.refDB_cond.ref_fasta' '$ref_fasta_symlink' &&
 #end if