annotate unfold_column.py @ 0:5314e5d6f040
 draft 
Imported from capsule None
 | author | bgruening | 
 | date | Thu, 29 Jan 2015 07:53:17 -0500 | 
 | parents |  | 
 | children | 37e1eb05b1b4 | 
 | rev | line source | 
  
| 0 | 1 #!/usr/bin/env python | 
|  | 2 | 
|  | 3 import sys | 
|  | 4 | 
|  | 5 out = open(sys.argv[4], 'w+') | 
|  | 6 | 
|  | 7 with open(sys.argv[1]) as handle: | 
|  | 8     for line in handle: | 
|  | 9         cols = line.split('\t') | 
|  | 10         unfolding_column = int(sys.argv[2]) - 1 | 
|  | 11         column_content = cols[ unfolding_column ] | 
|  | 12         for elem in column_content.split( sys.argv[3] ): | 
|  | 13             out.write( '\t'.join( cols[:unfolding_column] + [elem] + cols[unfolding_column+1:]) ) | 
|  | 14 out.close() |