- 论坛徽章:
- 10
|
1.10号的不知道你还能看到不,先上代码
root@lp:~/jw/python/data# cat gene_deal.py
import pandas as pd
#### file name gene.txt
filename = 'gene.txt'
a = pd.read_csv(filename,sep='\s+',engine='python')
a.sort_values('pvalue',inplace=True)
a.to_csv('gene.csv',header=None,index=None)
x = []
with open('gene.csv') as f:
for i in f:
i = i.strip()
x.append(i.split(','))
already_exist = []
result = []
for i in x:
start = int(i[1])
stop = int(i[2])
if start not in already_exist and stop not in already_exist:
already_exist.extend(range(start,stop+1))
result.append(i)
###print
for i in result:
print('\t'.join(i)) |
|