-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheval.py
executable file
·47 lines (41 loc) · 918 Bytes
/
eval.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
#!/usr/bin/env python3
# coding: utf-8
#//Autors : Quentin Clayssen, Antoine Laine (Master2 Bioinformatics, University of Nantes)
#//First evalution of Naive result
#//Created :09/11/18
#//Modified :11/02/2019
import re
import os
import random
import math
import sys
import warnings
entFolder=sys.argv[1]
entFile=sys.argv[2]
sorFolder=sys.argv[3]
patternSize=int(sys.argv[4])
causID=sys.argv[5]
TP=0
FN=0
FP=0
countTP=0
countFP=0
with open(os.path.join(entFolder,entFile), 'r') as results:
ligne=results.readline()
while ligne:
if len(re.findall(str(causID),ligne))>=patternSize:
countTP+=1
else:
countFP+=1
ligne=results.readline()
eval=open(os.path.join(sorFolder, "results_"+entFile),'a')
if countTP!=0:
TP+=1
eval.write("TP"+'\n')
elif countFP!=0:
countFP+=1
eval.write("FP"+'\n')
else:
FN+=1
eval.write("FN"+'\n')
eval.close()