-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmcl_cmp.py
56 lines (42 loc) · 818 Bytes
/
mcl_cmp.py
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!usr/bin/env python
import sys
qry, ref = sys.argv[1:3]
qN = 0
qry_set = set()
f = open(qry, 'r')
for i in f:
if '\t' in i:
j = i[:-1].strip().split('\t')
else:
j = i[:-1].strip().split(' ')
j.sort()
if len(j) < 2:
continue
qry_set.add(tuple(j))
qN += 1
f.close()
rN = 0
sN = 0
f = open(ref, 'r')
for i in f:
if '\t' in i:
j = i[:-1].strip().split('\t')
else:
j = i[:-1].strip().split(' ')
j.sort()
if len(j) < 2:
continue
#qry_set.add(tuple(j))
if tuple(j) in qry_set:
sN += 1
rN += 1
f.close()
#print qN, sN, rN
print '#' * 80
print qry, ref
print 'qry %f'%(sN*100. / qN) + '%', qry
print 'ref %f'%(sN*100. / rN) + '%', ref
print ''
a = sN * 1. / qN
b = sN * 1. / rN
print 'F1', 200*a*b/(a+b)