forked from fjruizruano/ngs-protocols
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrm_join_out.py
More file actions
executable file
·40 lines (30 loc) · 1.27 KB
/
rm_join_out.py
File metadata and controls
executable file
·40 lines (30 loc) · 1.27 KB
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
#! /usr/bin/python
files = open("lista_out.txt")
# process RM *.out file
dict_count = {}
dict_diver = {}
header = """ SW perc perc perc query position in query matching repeat position in repeat
score div. del. ins. sequence begin end (left) repeat class/family begin end (left) ID
"""
outout = open("test.all.out", "w")
outout.write(header)
def process_out(file):
file = open(file).readlines()
for line in file[3:]:
outout.write(line)
text = line.split()
begin = int(text[5])-1
end = int(text[6])
if end - begin > 50:
diver = float(text[1])
annot = text[9]
look = annot in dict_count
if look == True:
dict_count[annot] += 1
dict_diver[annot].append(diver)
elif look == False:
dict_count[annot] = 1
dict_diver[annot] = [diver]
for file in files:
process_out(file[:-1]) #complete dictionary of counts
outout.close()