diff options
author | Hui Lan <lanhui@zjnu.edu.cn> | 2019-12-04 19:03:19 +0800 |
---|---|---|
committer | Hui Lan <lanhui@zjnu.edu.cn> | 2019-12-04 19:03:19 +0800 |
commit | 97fdefab064f63642fa3ece05b807d29b459df31 (patch) | |
tree | a058530023224f3e35b1783996f3530c80c04bc5 /Code/make_target_tf_agris.py |
brain: add python and R code to local repository.
Diffstat (limited to 'Code/make_target_tf_agris.py')
-rw-r--r-- | Code/make_target_tf_agris.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Code/make_target_tf_agris.py b/Code/make_target_tf_agris.py new file mode 100644 index 0000000..c96c8fa --- /dev/null +++ b/Code/make_target_tf_agris.py @@ -0,0 +1,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])) + |