diff --git a/src/processing_mapping_results/complete_processing_of_mapping_results.py b/src/processing_mapping_results/complete_processing_of_mapping_results.py index 2403b63f3da3bfeb92b69f587784e4939f25a9b4..30067cc1dcfdc9eccf6ccbb6a9e584bcf84c7dad 100644 --- a/src/processing_mapping_results/complete_processing_of_mapping_results.py +++ b/src/processing_mapping_results/complete_processing_of_mapping_results.py @@ -8,10 +8,9 @@ import matplotlib.pyplot as plt import seaborn as sns import numpy as np import pandas as pd -from Visualisation_des_donnes_de_mapping import up_down_path_plot, barplot +from visu_datas_mapping import up_down_path_plot, barplot from utils import column_recovery, comma_cleaning, cor_index, excel_file_writer, excel_m_file_writer -sys.path.append('C:\\Users\\mumec\\Desktop\\Dossier_gitlab_local\\traitement_des_données') LOC = "C:\\Users\\mumec\\Desktop\\fichier_mis_en_forme_programme_total\\" diff --git a/src/processing_mapping_results/Tests_unitaires/main.py b/src/processing_mapping_results/main.py similarity index 95% rename from src/processing_mapping_results/Tests_unitaires/main.py rename to src/processing_mapping_results/main.py index b38b180c5678ce918b6d6658ee59a76eab2fc5fb..d26a54e1cfa44ecdbb2cbe6575d8af06e8688dec 100644 --- a/src/processing_mapping_results/Tests_unitaires/main.py +++ b/src/processing_mapping_results/main.py @@ -7,13 +7,12 @@ from math import log from time import time import pandas as pd import py4cytoscape as p4c -sys.path.append('C:\\Users\\mumec\\Desktop\\Dossier_gitlab_local\\traitement_des_données') -sys.path.append('C:\\Users\\mumec\\Desktop\\Dossier_gitlab_local\\chebi-ids.git') +sys.path.append('.\chebi_id') from pdf_generation_toolbox import out_pdf_mapping -from Recovery_of_associated_Chebi_IDs import chebi_horizontal +from recovery_of_associated_chebi_id import chebi_horizontal from utils import excel_file_writer, pre_cut, recup_all_inf_excel from complete_processing_of_mapping_results import c_p_o_m_r -from Mapping_using_the_API import opti_multimapping +from mapping_using_api import opti_multimapping from network_visualization import paths_link_cpdb, network_visu FOLDER = "C:\\Users\\mumec\\Desktop\\fichier_mis_en_forme_programme_total\\main\\patho_oeil_06-03-2024\\" @@ -141,7 +140,7 @@ def workflow(infile, out_folder): for i_line in liste: new_line.append(str(i_line[i_col])) liste_reverse[i_liste].append(new_line) - file_path = "Modele_de_pdf_feneratio_en_anglais_rev_19-02-2024.docx" + file_path = "static\\Modele_de_pdf_feneratio_en_anglais_rev_19-02-2024.docx" out_pdf_mapping(file_path, data_input, chebi_hori, recap_pdf, result_ramp_pdf[:8], result_cpdb_pdf[:4], out_folder, l_visu) diff --git a/src/processing_mapping_results/network_visualization.py b/src/processing_mapping_results/network_visualization.py index e575f4e2d1ccf1aed2199759c4b5463c38c81908..263ef9536835732c6051294eca6896729a59dea6 100644 --- a/src/processing_mapping_results/network_visualization.py +++ b/src/processing_mapping_results/network_visualization.py @@ -5,7 +5,7 @@ import sys import pandas as pd import py4cytoscape as p4c from utils import excel_file_writer, column_recovery, cor_index -sys.path.append('C:\\Users\\mumec\\Desktop\\Dossier_gitlab_local\\traitement_des_données') + LOCAL = "C:\\Users\\mumec\\Desktop\\Mini_codes\\network_visualization\\" diff --git a/src/processing_mapping_results/pdf_generation_toolbox.py b/src/processing_mapping_results/pdf_generation_toolbox.py index d18f30e330e2f9ba8dbedafc959644f2eddf314d..cbd95926131a72134b99317c3e498983ad78ca12 100644 --- a/src/processing_mapping_results/pdf_generation_toolbox.py +++ b/src/processing_mapping_results/pdf_generation_toolbox.py @@ -3,6 +3,7 @@ this module is design to create pdf of results mapping """ from fpdf import FPDF from docx import Document +import sys class PDF(FPDF): @@ -148,8 +149,8 @@ class PDF(FPDF): displays a page with the correct format. """ self.add_page() - self.image("logo_metabohub_metex.png", 175, 4, 33) # X, Y, taille - self.image("Ensemble_des_logos_pdp.png", 20, 275, 170) + self.image("static\\logo_metabohub_metex.png", 175, 4, 33) # X, Y, taille + self.image("static\\Ensemble_des_logos_pdp.png", 20, 275, 170) self.ln(15) def guard_page(self, str_tw): @@ -192,9 +193,8 @@ class PDF(FPDF): self.ln(4) for str_end1 in cont_end[begin_2pages+1:]: self.chapter_body(str_end1) - pypdf_f = "C:\\Users\\mumec\\Desktop\\Mini_codes\\pdf_PyPDF2\\" - self.image(pypdf_f + "carte_france_fin_doc.png", 90, 100, 100) - self.image(pypdf_f + "bandeau_fin_doc.png", 15, 100, 60) + self.image("static\\carte_france_fin_doc.png", 90, 100, 100) + self.image("static\\bandeau_fin_doc.png", 15, 100, 60) def read_docx(file_path): @@ -229,9 +229,9 @@ def out_pdf_mapping(file_path, data_input, chebi_hori, recap, results_map_ramp, one PDF of global mapping results. """ result_pdf = PDF() - result_pdf.add_font('DejaVu', 'I', 'DejaVuSansCondensed.ttf') - result_pdf.add_font('DejaVu', 'B', 'DejaVuSansCondensed.ttf') - result_pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf') + result_pdf.add_font('DejaVu', 'I', 'static\\DejaVuSansCondensed.ttf') + result_pdf.add_font('DejaVu', 'B', 'static\\DejaVuSansCondensed.ttf') + result_pdf.add_font('DejaVu', '', 'static\\DejaVuSansCondensed.ttf') result_pdf.set_font('DejaVu', '', 14) content = read_docx(file_path) index_toc = content.index('Table of contents') @@ -313,7 +313,7 @@ if __name__ == "__main__": FOLD_V+"CPDBbar_plot_of_metabolites.png", FOLD_V+"CPDBmetabolites_bo_of_frequency.png", FOLD_V+"CPDBup_down_path_plot.png"] - FP = "Modele_de_pdf_feneratio_en_anglais_rev_19-02-2024.docx" + FP = "static\\Modele_de_pdf_feneratio_en_anglais_rev_19-02-2024.docx" out_pdf_mapping(FP, dinput, Chebi_optimal, reca, r_m_r, r_m_c, FOLD_V, list_visu)