diff unfold_column.py @ 3:37e1eb05b1b4 draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 10052765d6b712cf7d38356af4251fcc38a339b6-dirty
author bgruening
date Fri, 26 Feb 2016 12:22:19 -0500
parents 5314e5d6f040
children f46f0e4f75c4
line wrap: on
line diff
--- a/unfold_column.py	Tue Jun 30 17:47:23 2015 -0400
+++ b/unfold_column.py	Fri Feb 26 12:22:19 2016 -0500
@@ -4,11 +4,16 @@
 
 out = open(sys.argv[4], 'w+')
 
+sep = sys.argv[3]
+# un-sanitize Galaxy inputs
+if sep == 'X':
+    sep = ';'
+
 with open(sys.argv[1]) as handle:
     for line in handle:
         cols = line.split('\t')
         unfolding_column = int(sys.argv[2]) - 1
         column_content = cols[ unfolding_column ]
-        for elem in column_content.split( sys.argv[3] ):
+        for elem in column_content.split( sep ):
             out.write( '\t'.join( cols[:unfolding_column] + [elem] + cols[unfolding_column+1:]) )
 out.close()