Mercurial > repos > arkarachai-fungtammasan > fakename
annotate changespacetounderscore_readname.py @ 1:99ec84eb0bab draft default tip
Uploaded
| author | arkarachai-fungtammasan | 
|---|---|
| date | Wed, 01 Apr 2015 17:00:21 -0400 | 
| parents | 70f8259b0b30 | 
| children | 
| rev | line source | 
|---|---|
| 0 | 1 import sys | 
| 2 fd=open(sys.argv[1]) | |
| 3 output=open(sys.argv[2],'w') | |
| 4 columntochange=int(sys.argv[3])-1 # default is 6-1=5 | |
| 5 lines=fd.xreadlines() | |
| 6 for line in lines: | |
| 7 temp=line.strip().split('\t') | |
| 8 temp=filter(None,temp) | |
| 9 temp2=temp[columntochange].replace(' ','_') | |
| 10 product=temp[:columntochange] | |
| 11 product.append(temp2) | |
| 12 product.extend(temp[columntochange+1:]) | |
| 13 output.writelines('\t'.join(product)+'\n') | |
| 14 fd.close() | |
| 15 output.close() | 
