Skip to content

Commit 78f17ba

Browse files
author
BrunoG89
committed
bug fixed
1 parent d1518da commit 78f17ba

7 files changed

+9
-344
lines changed

models/ENGRO2_MCF102A.mat

-1.81 MB
Binary file not shown.

models/ENGRO2_MCF7.mat

-1.81 MB
Binary file not shown.

models/ENGRO2_MDAMB231.mat

-1.81 MB
Binary file not shown.

models/ENGRO2_MDAMB361.mat

-1.81 MB
Binary file not shown.

models/ENGRO2_SKBR3.mat

-1.81 MB
Binary file not shown.

pipeline/concordanceAnalysis.py

+3-84
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import cobra as cb
1111
import sklearn.metrics
1212
from matplotlib.colors import ListedColormap
13-
from adjustText import adjust_text
13+
#from adjustText import adjust_text
1414
from matplotlib.patches import Rectangle
1515
import genericLib as gL
1616

@@ -105,11 +105,6 @@
105105
index_commonFBAvsRAS=df_concFBA.index.intersection(df_concRAS.index)
106106
indexCommon=index_commonMETvsFBA.intersection(index_commonMETvsRAS)
107107

108-
#save all the datasets of concordances
109-
#df_concFBA.to_csv(os.path.join(OUTDIR,"df_concFFD.csv"))
110-
##df_concRAS.to_csv(os.path.join(OUTDIR,"df_concRAS.csv"))
111-
#df_met.to_csv(os.path.join(OUTDIR,"df_concRPS.csv"))
112-
113108
# Create the indexes of all the reactions in the common datasets
114109
indexUnion=df_met.index.union(df_concRAS.index).union(df_concFBA.index)
115110

@@ -169,15 +164,7 @@
169164
valori2.extend([-el for el in valori2])
170165

171166
dfConcFRD_RASvsMET.loc[reaction,str(ind)]=sklearn.metrics.cohen_kappa_score(valori1,valori2,labels=[-1,0,1],weights="linear",sample_weight=None)
172-
173-
#for reaction in index_commonFBAvsRAS:
174-
# valori1=list(df_concFBA2.loc[reaction,:].values)
175-
# valori2=list(df_concRAS3.loc[reaction,:].values)
176-
# valori1.extend([-el for el in valori1])
177-
# valori2.extend([-el for el in valori2])
178-
179-
# dfConcFRD_RASvsFBA.loc[reaction,str(ind)]=sklearn.metrics.cohen_kappa_score(valori1,valori2,labels=##[-1,0,1],weights="linear",sample_weight=None)
180-
167+
181168

182169
#######################################àà
183170
#kappa true
@@ -197,26 +184,13 @@
197184

198185
dfConcRASvsMET.loc[reaction,:]=sklearn.metrics.cohen_kappa_score(valori1,valori2,labels=[-1,0,1],weights="linear",sample_weight=None)
199186

200-
#for reaction in index_commonFBAvsRAS:
201-
# valori1=list(df_concFBA2.loc[reaction,:].values)
202-
# valori2=list(df_concRAS2.loc[reaction,:].values)
203-
# valori1.extend([-el for el in valori1])
204-
# valori2.extend([-el for el in valori2])
205-
206-
# dfConcRASvsFBA.loc[reaction,:]=sklearn.metrics.cohen_kappa_score(valori1,valori2,labels=[-1,0,1],weights="linear",sample_weight=None)
207-
208187
###############################Plot of Cohen distribution (random vs experiment)
209188
#Cumulative distribution
210189
ecdfRPSvsFBA=ECDF(dfConcFRD_FBAvsMET.values.ravel())
211190
ecdfRPSvsFBA_result=ECDF(dfConcMETvsFBA["METvsFBA"].values)
212191
ecdfRASvsMET=ECDF(dfConcFRD_RASvsMET.values.ravel())
213192
ecdfRASvsMET_result=ECDF(dfConcRASvsMET["RASvsMET"].values)
214193

215-
216-
#print(kstest(dfConcFRD_FBAvsMET.values.ravel(),dfConcMETvsFBA["METvsFBA"].values))
217-
#print(kstest(dfConcFRD_RASvsMET.values.ravel(),dfConcRASvsMET["RASvsMET"].values))
218-
#print(kstest(dfConcFRD_RASvsFBA.values.ravel(),dfConcRASvsFBA["RASvsFBA"].values))
219-
220194
#####figure of cumulative distributions
221195
#engro2
222196
fig, ax=plt.subplots(1,1,figsize=(20, 10))
@@ -238,33 +212,6 @@
238212
fig.savefig(os.path.join(FIGUREDIR, "qqplotEngro2.png"),transparent=False,format="png")
239213

240214

241-
######## Cumulative distribution
242-
#fig, ax=plt.subplots(1, 1, figsize=(30, 15))
243-
244-
#ax.plot(ecdfRPSvsFBA.x, ecdfRPSvsFBA.y,"black",label="Random")
245-
#ax.plot(ecdfRPSvsFBA_result.x, ecdfRPSvsFBA_result.y,"red",label="ENGRO2")
246-
#ax.legend()
247-
#ax.grid()
248-
249-
#ax[1].plot(ecdfRASvsMET.x, ecdfRASvsMET.y,"black",label="Random")
250-
#ax[1].plot(ecdfRASvsMET_result.x, ecdfRASvsMET_result.y,"red",label="ENGRO2")
251-
252-
#ax.set_xlim([-1,1])
253-
#ax.set_xlim([-1,1])
254-
#ax.set_ylim([0,1])
255-
#ax[1].set_ylim([0,1])
256-
#ax[0].grid()
257-
#ax[1].grid()
258-
#ax.set_xlabel("RPS vs FFD",fontsize=40)
259-
#ax[1].set_xlabel("Cohen",fontsize=25)
260-
#ax[0].set_title("Distribution RPS vs FBA",fontsize=25)
261-
#ax[1].set_title("Distribution RPS vs MET",fontsize=25)
262-
263-
#ax.tick_params(axis="x", labelsize=30)
264-
#ax.tick_params(axis="y", labelsize=30)
265-
#ax.legend(loc=2, prop={'size': 40})
266-
267-
#fig.savefig(os.path.join(FIGUREDIR, "prova.png"),transparent=False,format="png")
268215
##########################################fdr correction
269216
############pvalues MET vs FBA
270217
dfConcMETvsFBA=dfConcMETvsFBA.sort_values(by=dfConcMETvsFBA.columns[0],ascending=True)
@@ -298,27 +245,6 @@
298245
for el in dfConcRASvsMET.index:
299246
dict_pvaluesRASvsMET[el]=res[i]
300247
i=i+1
301-
#print(dict_pvaluesRASvsMET)
302-
303-
#print("RASvsMET")
304-
#k=0
305-
#for el,reaction in zip(res,dfConcRASvsMET.index):
306-
# if el==True:
307-
# print(reaction,dfConcRASvsMET.loc[reaction,"RASvsMET"])
308-
309-
##############pvalues MET vs FBA
310-
#dfConcRASvsFBA=dfConcRASvsFBA.sort_values(by=dfConcRASvsFBA.columns[0],ascending=True)
311-
#valori=dfConcRASvsFBA.values
312-
#pvaluesRASvsFBA=[1-ecdfRASvsFBA(el[0]) for el in valori]
313-
314-
#resultsRASvsFBA_correction=fdrcorrection(pvaluesRASvsFBA,0.05)
315-
#res=resultsRASvsFBA_correction[0]
316-
317-
#print("RASvsFBA")
318-
#k=0
319-
#for el,reaction in zip(res,dfConcRASvsFBA.index):
320-
# if el==True:
321-
# print(reaction,dfConcRASvsFBA.loc[reaction,"RASvsFBA"])
322248

323249
###################################
324250

@@ -374,11 +300,6 @@
374300
if kappa_values.loc[r,'RPSvsRAS cohen']>=-1:
375301
kappa_values.loc[r,'RPSvsRAS pvalue']=1-ecdfRASvsMET(kappa_values.loc[r,'RPSvsRAS cohen'])
376302
kappa_values.loc[r,'RPSvsRAS adj-pvalue']=dict_pvaluesRASvsMET[r]
377-
378-
#if r in df_met2.index and r not in df_concRAS2.index:
379-
# kappa_values.loc[r,'RPSvsRAS cohen']=0
380-
# kappa_values.loc[r,'RPSvsRAS spearman']=0
381-
# kappa_values.loc[r,'RPSvsRAS pvalue']=0
382303

383304
if r in df_concFBA2.index and r in df_concRAS2.index:
384305
list1=list(df_concFBA2.loc[r])
@@ -399,7 +320,6 @@
399320

400321
####
401322
kappa_values["Formula2"]=[str(el)+':'+str(dict_formule[el]) for el in kappa_values.index]
402-
#kappa_values.index=[str(el)+':'+str(dict_formule[el]) for el in kappa_values.index]
403323
kappa_values.fillna(-3,inplace=True) ## just the create a mask map for the next figure
404324

405325
##############################################################################
@@ -559,7 +479,7 @@
559479
for x,y,z in zip(df_cohen["RPSvsFBA "+name],df_cohen["RPSvsRAS "+name],df_cohen.index):
560480
if (x>=val1 and y>=-1) or (x<=-val1 and y<=-val2 and y>=-1):
561481
Texts.append(plt.text(x,y,z.split(':')[0],fontsize=15))
562-
adjust_text(Texts)#,arrowprops=dict(arrowstyle="->", color='r', lw=0.5))
482+
#adjust_text(Texts)#,arrowprops=dict(arrowstyle="->", color='r', lw=0.5))
563483
f.colorbar(im, ax=ax,orientation="horizontal")
564484
im.set_clim(-1,1)
565485

@@ -580,7 +500,6 @@
580500
df_mean_RPS=df_met_mean2.loc[index]
581501
df_FBA=pd.DataFrame()
582502

583-
for datasetFBA,datasetRAS,test in zip(datasetsFBA,datasetsRAS,tests):
584503
df_FBA[str(test[0])]=datasetFBA["median_"+test[0]]
585504
df_FBA[str(test[1])]=datasetFBA["median_"+test[1]]
586505

0 commit comments

Comments
 (0)