blob: c96c8fa85d317a665cc5f80a23d624966ea4bfa6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# Make target_tf from AtRegNet.txt
# Usage: python make_target_tf_agris.py > ../Data/information/target_tf_agris.txt
fname = '../Data/information/AtRegNet.txt'
sample_id = 'C0000000000001'
f = open(fname)
lines = f.readlines()
f.close()
d = {}
count = 2
duplicate = 0
for line in lines[1:]:
line = line.strip()
lst = line.split('\t')
if len(lst) >= 5:
tf0 = lst[1].upper().strip()
target0 = lst[4].upper().strip()
tf_lst = tf0.split('/')
target_lst = target0.split('/')
for tf in tf_lst:
for target in target_lst:
if tf.startswith('AT') and target.startswith('AT'):
k = target + '.' + tf
if k in d:
#print('Warning at line %d ' % (count))
duplicate += 1
else:
d[k] = [target, tf, sample_id]
count += 1
print('pairs %d' % len(d))
print('duplicate %d' % (duplicate))
for k in sorted(d.keys()):
print('\t'.join(d[k]))
|