annotate test-data/changespacetounderscore_readname.py @ 5:b27006b0a953

update to latest version
author devteam@galaxyproject.org
date Wed, 22 Apr 2015 12:19:28 -0400
parents ecfc9041bcc5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
ecfc9041bcc5 Deleted selected files
arkarachai-fungtammasan
parents:
diff changeset
1 import sys
ecfc9041bcc5 Deleted selected files
arkarachai-fungtammasan
parents:
diff changeset
2 fd=open(sys.argv[1])
ecfc9041bcc5 Deleted selected files
arkarachai-fungtammasan
parents:
diff changeset
3 output=open(sys.argv[2],'w')
ecfc9041bcc5 Deleted selected files
arkarachai-fungtammasan
parents:
diff changeset
4 columntochange=int(sys.argv[3])-1 # default is 6-1=5
ecfc9041bcc5 Deleted selected files
arkarachai-fungtammasan
parents:
diff changeset
5 lines=fd.xreadlines()
ecfc9041bcc5 Deleted selected files
arkarachai-fungtammasan
parents:
diff changeset
6 for line in lines:
ecfc9041bcc5 Deleted selected files
arkarachai-fungtammasan
parents:
diff changeset
7 temp=line.strip().split('\t')
ecfc9041bcc5 Deleted selected files
arkarachai-fungtammasan
parents:
diff changeset
8 temp=filter(None,temp)
ecfc9041bcc5 Deleted selected files
arkarachai-fungtammasan
parents:
diff changeset
9 temp2=temp[columntochange].replace(' ','_')
ecfc9041bcc5 Deleted selected files
arkarachai-fungtammasan
parents:
diff changeset
10 product=temp[:columntochange]
ecfc9041bcc5 Deleted selected files
arkarachai-fungtammasan
parents:
diff changeset
11 product.append(temp2)
ecfc9041bcc5 Deleted selected files
arkarachai-fungtammasan
parents:
diff changeset
12 product.extend(temp[columntochange+1:])
ecfc9041bcc5 Deleted selected files
arkarachai-fungtammasan
parents:
diff changeset
13 output.writelines('\t'.join(product)+'\n')
ecfc9041bcc5 Deleted selected files
arkarachai-fungtammasan
parents:
diff changeset
14 fd.close()
ecfc9041bcc5 Deleted selected files
arkarachai-fungtammasan
parents:
diff changeset
15 output.close()