Skip to content

Commit

Permalink
number of interactions parameter updated
Browse files Browse the repository at this point in the history
  • Loading branch information
mikelkou committed May 31, 2023
1 parent ea0f479 commit 1ac2f10
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = favapy
version = 0.3.9.3
version = 0.3.9.4
author = Mikaela Koutrouli
author_email = mikaela.koutrouli@cpr.ku.dk
description = Infer Functional Associations using Variational Autoencoders on -Omics data.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="favapy",
version="0.3.9.3",
version="0.3.9.4",
author="Mikaela Koutrouli",
author_email="mikaela.koutrouli@cpr.ku.dk",
description="Infer Functional Associations using Variational Autoencoders on -Omics data.",
Expand Down
15 changes: 8 additions & 7 deletions src/favapy/fava.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def pairs_after_cutoff(correlation, interaction_count=100000, PCC_cutoff=None):
logging.info(" A cut-off of " + str(PCC_cutoff) + " is applied.")
correlation_df_new = correlation.loc[(correlation['Score'] >= PCC_cutoff)]
else:
correlation_df_new = correlation.head(interaction_count+1)
correlation_df_new = correlation.iloc[:interaction_count,:]
logging.warn(" The number of interactions in the output file is " + str(interaction_count) + " in which both directions are included: proteinA - proteinB and proteinB - proteinA.")
return correlation_df_new

Expand Down Expand Up @@ -208,9 +208,9 @@ def cook(data,
vae = VAE(opt, x_train, x_test, batch_size, original_dim, hidden_layer, latent_dim, epochs)
x_test_encoded = np.array(vae.encoder.predict(x_test, batch_size=batch_size))
correlation = create_protein_pairs(x_test_encoded, row_names)
final_pairs = pairs_after_cutoff(correlation, interaction_count=interaction_count, PCC_cutoff=PCC_cutoff)
final_pairs = final_pairs[final_pairs.iloc[:,0] != final_pairs.iloc[:,1]]
final_pairs = correlation[correlation.iloc[:,0] != correlation.iloc[:,1]]
final_pairs = final_pairs.sort_values(by=['Score'], ascending=False)
final_pairs = pairs_after_cutoff(correlation=final_pairs, interaction_count=interaction_count, PCC_cutoff=PCC_cutoff)
return final_pairs


Expand Down Expand Up @@ -242,13 +242,14 @@ def main():
x_test_encoded = np.array(vae.encoder.predict(x_test, batch_size=args.batch_size))

logging.info(" Calculating Pearson correlation scores.")

correlation = create_protein_pairs(x_test_encoded, row_names)
final_pairs = pairs_after_cutoff(correlation, interaction_count=args.interaction_count, PCC_cutoff=args.PCC_cutoff)
logging.warn(" If it is not the desired cut-off, please check again the value assigned to the related parameter (-n or interaction_count | -c or PCC_cutoff).")

final_pairs = final_pairs[final_pairs.iloc[:,0] != final_pairs.iloc[:,1]]
final_pairs = correlation[correlation.iloc[:,0] != correlation.iloc[:,1]]
final_pairs = final_pairs.sort_values(by=['Score'], ascending=False)
final_pairs = pairs_after_cutoff(correlation=final_pairs, interaction_count=args.interaction_count, PCC_cutoff=args.PCC_cutoff)
final_pairs.Score = final_pairs.Score.astype(float).round(5)
logging.warn(" If it is not the desired cut-off, please check again the value assigned to the related parameter (-n or interaction_count | -c or PCC_cutoff).")

logging.info(" Saving the file with the interactions in the chosen directory ...")

# Save the file
Expand Down

0 comments on commit 1ac2f10

Please sign in to comment.