diff unfold_column.py @ 17:f46f0e4f75c4 draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 5f5d5802a961a77ceb092cbdef90d93e29717029-dirty"
author bgruening
date Tue, 22 Jun 2021 16:06:48 +0000
parents 37e1eb05b1b4
children
line wrap: on
line diff
--- a/unfold_column.py	Tue Oct 06 09:47:04 2020 +0000
+++ b/unfold_column.py	Tue Jun 22 16:06:48 2021 +0000
@@ -2,18 +2,22 @@
 
 import sys
 
-out = open(sys.argv[4], 'w+')
+out = open(sys.argv[4], "w+")
 
 sep = sys.argv[3]
 # un-sanitize Galaxy inputs
-if sep == 'X':
-    sep = ';'
+if sep == "X":
+    sep = ";"
 
 with open(sys.argv[1]) as handle:
     for line in handle:
-        cols = line.split('\t')
+        cols = line.split("\t")
         unfolding_column = int(sys.argv[2]) - 1
-        column_content = cols[ unfolding_column ]
-        for elem in column_content.split( sep ):
-            out.write( '\t'.join( cols[:unfolding_column] + [elem] + cols[unfolding_column+1:]) )
+        column_content = cols[unfolding_column]
+        for elem in column_content.split(sep):
+            out.write(
+                "\t".join(
+                    cols[:unfolding_column] + [elem] + cols[unfolding_column + 1:]
+                )
+            )
 out.close()