-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathahrdResultOnSprot3.py
More file actions
89 lines (63 loc) · 3.53 KB
/
ahrdResultOnSprot3.py
File metadata and controls
89 lines (63 loc) · 3.53 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
'''
@auther: Samaneh Jozashoori
'''
import pandas as pd
import numpy as np
import matplotlib.pylab as plt
from pandas.tools.plotting import scatter_matrix
from matplotlib.backends.backend_pdf import PdfPages
#################################################
dataDfList = []
dfColnames = []
meanList = []
EvScoreList = []
### sprot3 old blacklist: index0, sprot3 new blacklist: index1, sprot4 old blacklist: index2, sprot4 new blacklist: index3
dataDfList.append(pd.read_excel(pd.ExcelFile("/home/samaneh/AHRD/outputs/xlsx/test_evaluator_output_both_3.xlsx")))
dataDfList.append(pd.read_excel(pd.ExcelFile("/home/samaneh/AHRD/outputs/xlsx/test_evaluator_output_descline_3.xlsx")))
dataDfList.append(pd.read_excel(pd.ExcelFile("/home/samaneh/AHRD/outputs/xlsx/test_evaluator_output_token_3.xlsx")))
dataDfList.append(pd.read_excel(pd.ExcelFile("/home/samaneh/AHRD/outputs/xlsx/test_evaluator_output_noBlacklist_3.xlsx")))
colnames = pd.Series(["AHRD Score","Tair Score","SwissProt Score","Trembl Score"])
####extract the columns names as they are placed in 3rd row
for i in range(0,4):
dfColnames = dataDfList[i].ix[2]
rownames = pd.Series(range(1,len(dataDfList[i])-2))
dataDfList[i] = dataDfList[i].rename(columns=dfColnames).drop(dataDfList[i].index[:3])
dataDfList[i].index = rownames
dataDfList[i] = dataDfList[i]["Evaluation-Score"] #filter columns except evaluation scores
dataDfList[i].columns = colnames
dataDfList[i] = dataDfList[i].astype(float)
################mean calculation#######################
for i in range(0,4):
meanList = []
for j in range(0,4):
meanList.append(dataDfList[i][colnames[j]].mean())
print "mean: " , meanList
#######AHRD scores histogram plot of 4 different experiments##########
result = pd.DataFrame({"Both Evaluation Score": dataDfList[0].iloc[:,0] , "Descline Evaluation Score": dataDfList[1].iloc[:,0], "Token Evaluation Score": dataDfList[2].iloc[:,0], "No Blacklist Evaluation Score": dataDfList[3].iloc[:,0]})
cols = result.columns
result.plot(alpha = 0.4, kind='hist', color=['purple','grey','green','yellow'])
plt.ylabel("Frequency")
plt.xlabel("AHRD Score")
plt.legend(cols, loc = 'best')
plt.savefig("/home/samaneh/AHRD/outputs/AHRDComparison_sprot3.jpg")
#plt.show()
plt.close()
####################################################################################################
##########AHRD scores scatter plot matrix of 4 different experiments for all proteins###############
data = {'both': dataDfList[0].iloc[:,0], 'descline': dataDfList[1].iloc[:,0], 'token': dataDfList[2].iloc[:,0], 'none': dataDfList[3].iloc[:,0]}
allAhrd = pd.DataFrame(data, columns=['both', 'descline', 'token', 'none'])
#data = {'both': bothScoreDf['AHRD Score'], 'token': tokScoreDf['AHRD Score'], 'none': noneScoreDf['AHRD Score']}
#allAhrd = pd.DataFrame(data, columns=['both', 'token', 'none'])
plt.title('Evaluation Scores Comparison')
#filtDesScore = desScoreDf.iloc[0:100,]
allCompare = scatter_matrix(allAhrd, alpha = 0.5, figsize=(15,15), diagonal = None)
#plt.legend(desScoreDf.columns)
###better reshape
[s.xaxis.label.set_rotation(45) for s in allCompare.reshape(-1)] #Change label rotation
[s.yaxis.label.set_rotation(0) for s in allCompare.reshape(-1)]
[s.get_yaxis().set_label_coords(-0.3,0.5) for s in allCompare.reshape(-1)] #May need to offset label when rotating to prevent overlap of figure
[s.set_xticks(()) for s in allCompare.reshape(-1)] #Hide all ticks
[s.set_yticks(()) for s in allCompare.reshape(-1)]
#plt.show()
plt.savefig("/home/samaneh/AHRD/outputs/AHRDComparisonScatterMatrix_sprot3_teeeeeest.jpg")
plt.close()