Mercurial > repos > bgruening > text_processing
diff unfold_column.py @ 10:c78b1767db2b 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:54 -0500 |
parents | 56e80527c482 |
children | 5fef6d08de83 |
line wrap: on
line diff
--- a/unfold_column.py Tue Jun 30 17:47:36 2015 -0400 +++ b/unfold_column.py Fri Feb 26 12:22:54 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()