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 1f02c12bde8f83490595e97155384abbee207037..9cb03c332697b4bf723684eeb3f294863df6bde0 100644
--- a/src/processing_mapping_results/complete_processing_of_mapping_results.py
+++ b/src/processing_mapping_results/complete_processing_of_mapping_results.py
@@ -172,9 +172,8 @@ def recup_me_path_list(file, folder, number_of_files, index_tof_c):
 
 
 def c_p_o_m_r(file, outf, mapper, type_of_view="all", save_plot="all",
-              f_view_sav=LOC,
-              midfile=None,
-              n_path_to_filt="nothing", modul=None, f_modul=None):
+              f_view_sav=LOC, midfile=None, n_path_to_filt="nothing",
+              modul=None, f_modul=None, bdd=None):
     """
     Do the complet treatement of mapping results
     4 mappeurs are usable ConsensusPathDB, MetaboAnalyst, MetExplore and RAMP
@@ -250,6 +249,7 @@ def c_p_o_m_r(file, outf, mapper, type_of_view="all", save_plot="all",
                             actu_down += 1
                     else:
                         print(path_meta.strip())
+                        print(value_modul[metabo.index(path_meta)])
                         if float(value_modul[metabo.index(path_meta)]) >= 0:
                             actu_up += 1
                         else:
@@ -277,13 +277,42 @@ def c_p_o_m_r(file, outf, mapper, type_of_view="all", save_plot="all",
             log_p_u_p = log_p[n_m_i_p*plot+n_m_i_p:]
             list_path_u_p = list_path[n_m_i_p*plot+n_m_i_p:]
             plot_u = up_down_path_plot(list_path_u_p, up_u_p, down_u_p, log_p_u_p)
-            plt.savefig(f_view_sav+"up_down_path_plot"+str(under_plot + 1)+".png")
+            up_down_data = [list_path_u_p, up_u_p, down_u_p, log_p_u_p]
+            up_down_heads =["Pathways lists", "% metabolites up regulated",
+                            "% metabolites up regulated", "-log(p-value)"]
+            for uph_pos, uph in enumerate(up_down_heads):
+                up_down_data[uph_pos].insert(0, uph)
+            df_up_down = pd.DataFrame(up_down_data).transpose()
+            if bdd is not None:
+                plt.savefig(f_view_sav+"up_down_path_plot"+str(under_plot + 1)+bdd+".png")
+                up_down_excel_f = f_view_sav + "up_down_path_plot" +str(under_plot + 1)+ bdd+".xlsx"
+                excel_file_writer(df_up_down, up_down_excel_f, sheetname="Up_down")
+            else:
+                plt.savefig(f_view_sav+"up_down_path_plot"+str(under_plot + 1)+".png")
+                up_down_excel_f = f_view_sav + "up_down_path_plot" +str(under_plot + 1)+".xlsx"
+                excel_file_writer(df_up_down, up_down_excel_f, sheetname="Up_down")
         else:
             plot = up_down_path_plot(list_path, up, down, log_p)
             pdf_view.append(f_view_sav + mapper + "up_down_path_plot.png")
-            plt.savefig(f_view_sav + mapper + "up_down_path_plot.png")
+            up_down_data = [list_path, up, down, log_p]
+            up_down_heads =["Pathways lists", "% metabolites up regulated",
+                            "% metabolites up regulated", "-log(p-value)"]
+            for uph_pos, uph in enumerate(up_down_heads):
+                up_down_data[uph_pos].insert(0, uph)
+            df_up_down = pd.DataFrame(up_down_data).transpose()
+            if bdd is not None:
+                plt.savefig(f_view_sav + mapper + bdd+ "up_down_path_plot.png")
+                up_down_excel_f = f_view_sav + "up_down_path_plot" +bdd+".xlsx"
+                excel_file_writer(df_up_down, up_down_excel_f, sheetname="Up_down")
+            else:
+                plt.savefig(f_view_sav + mapper + "up_down_path_plot.png")
+                up_down_excel_f = f_view_sav + "up_down_path_plot" +".xlsx"
+                excel_file_writer(df_up_down, up_down_excel_f, sheetname="Up_down")
     if midfile is not None:
-        midfile_name = midfile + mapper + "_mid_file.xlsx"
+        if bdd is not None:
+            midfile_name = midfile + mapper + bdd + "_mid_file.xlsx"
+        else:
+            midfile_name = midfile + mapper + "_mid_file.xlsx"
         mid_data = pd.DataFrame(l_of_pathways_list, dtype=object)
         excel_file_writer(mid_data, midfile_name, sheetname="Resultats")
     if mapper != "RAMP":
@@ -419,7 +448,10 @@ def c_p_o_m_r(file, outf, mapper, type_of_view="all", save_plot="all",
     df_matrix_table = np.array(df_matrix_table, dtype=object)
     df_matrix_table = pd.DataFrame(data=df_matrix_table)
 
-    result_out_file = outf + mapper + "resultats_traitment_mapping.xlsx"
+    if bdd is not None:
+        result_out_file = outf + mapper + bdd + "resultats_traitment_mapping.xlsx"
+    else:
+        result_out_file = outf + mapper + "resultats_traitment_mapping.xlsx"
     excel_m_file_writer([patways_reco_order_for_export,
                          df_matrix_table, metabo_f_order_for_export,
                          meta_and_path_p],  result_out_file,
@@ -444,7 +476,10 @@ def c_p_o_m_r(file, outf, mapper, type_of_view="all", save_plot="all",
                                  dfrecovisu, title=titlen, y_lim=y_lim,
                                  figure_size=(22, 10))
                 if save_plot in ("all", "bar_plot", "bar_plot_r", "bar_r_meta_p"):
-                    plt.savefig(f_view_sav+titlen+".png")
+                    if bdd is not None:
+                        plt.savefig(f_view_sav+titlen+bdd+".png")
+                    else:
+                        plt.savefig(f_view_sav+titlen+".png")
                 plt.show()
             dfrecovisu = data_reco_view[n_m_i_p*(under_plot):]
             titlen = "Recouvrement moyen voies métaboliques "+str(under_plot)
@@ -452,7 +487,10 @@ def c_p_o_m_r(file, outf, mapper, type_of_view="all", save_plot="all",
                              dfrecovisu, title=titlen,y_lim=y_lim,
                              figure_size=(22, 10))
             if save_plot in ("all", "bar_plot", "bar_plot_r", "bar_r_meta_p"):
-                plt.savefig(f_view_sav+titlen+".png")
+                if bdd is not None:
+                    plt.savefig(f_view_sav+titlen+bdd+".png")
+                else:
+                    plt.savefig(f_view_sav+titlen+".png")
             plt.show()
         else:
             barplot(colnames_recovery[2], colnames_recovery[1],
@@ -460,8 +498,11 @@ def c_p_o_m_r(file, outf, mapper, type_of_view="all", save_plot="all",
                     title="Recouvrement moyen des différentes voies métaboliques",
                     figure_size=(22, 10),)
             if save_plot in ("all", "bar_plot", "bar_plot_r", "bar_r_meta_p"):
-                plt.savefig(f_view_sav+mapper+"bar_plot_of_recovery.png")
-                pdf_view.append(f_view_sav+mapper+"bar_plot_of_recovery.png")
+                if bdd is not None:
+                    plt.savefig(f_view_sav+mapper+bdd+"bar_plot_of_recovery.png")
+                else:
+                    plt.savefig(f_view_sav+mapper+"bar_plot_of_recovery.png")
+                    pdf_view.append(f_view_sav+mapper+"bar_plot_of_recovery.png")
             plt.show()
 
     just_frequency = []
@@ -481,8 +522,11 @@ def c_p_o_m_r(file, outf, mapper, type_of_view="all", save_plot="all",
                 figure_size=(10, 30), ax_x_label="Métabolites d'intérêt",
                 ax_y_label='Fréquence', decimal='%.0f')
         if save_plot in ("all", "bar_plot", "bar_plot_f", "bar_f_meta_p"):
-            plt.savefig(f_view_sav+mapper+"bar_plot_of_metabolites.png")
-            pdf_view.append(f_view_sav+mapper+"bar_plot_of_metabolites.png")
+            if bdd is not None:
+                plt.savefig(f_view_sav+mapper+bdd+"bar_plot_of_metabolites.png")
+            else:
+                plt.savefig(f_view_sav+mapper+"bar_plot_of_metabolites.png")
+                pdf_view.append(f_view_sav+mapper+"bar_plot_of_metabolites.png")
         plt.show()
 
     if type_of_view in ("all", "meta_box", "bar_f_meta_p", "bar_r_meta_p"):
@@ -492,8 +536,11 @@ def c_p_o_m_r(file, outf, mapper, type_of_view="all", save_plot="all",
         b1.set(title="Boîte à moustache des fréquences des métabolites")
         plt.ylabel("fréquence des métabolites")
         if save_plot in ("all", "meta_box", "bar_f_meta_p", "bar_r_meta_p"):
-            plt.savefig(f_view_sav + mapper + "metabolites_bo_of_frequency.png")
-            pdf_view.append(f_view_sav + mapper + "metabolites_bo_of_frequency.png")
+            if bdd is not None:
+                plt.savefig(f_view_sav + mapper + bdd+ "metabolites_bo_of_frequency.png")
+            else:
+                plt.savefig(f_view_sav + mapper + "metabolites_bo_of_frequency.png")
+                pdf_view.append(f_view_sav + mapper + "metabolites_bo_of_frequency.png")
         plt.show()
 
     return pdf_view
diff --git a/src/processing_mapping_results/main.py b/src/processing_mapping_results/main.py
index 21051a0ab58f30c2c5920af53326c54ee4f39b28..a60da64008787e5821b18dc6f0ad03d2eb952202 100644
--- a/src/processing_mapping_results/main.py
+++ b/src/processing_mapping_results/main.py
@@ -191,6 +191,28 @@ def workflow(infile, out_folder):
     map_monit_dir += "\\"
     vis_dir += "\\"
 
+    results_dir_bbb = results_dir + "base_par_base"
+    map_monit_dir_bbb = map_monit_dir + "base_par_base"
+    vis_dir_bbb = vis_dir + "base_par_base"
+    try:
+        os.mkdir(results_dir_bbb)
+    except:
+        print("base_par_base directory already exist")
+
+    try:
+        os.mkdir(map_monit_dir_bbb)
+    except:
+        print("map_monit_dir_bbb directory already exist")
+
+    try:
+        os.mkdir(vis_dir_bbb)
+    except:
+        print("vis_dir_bbb directory already exist")
+
+    results_dir_bbb += "\\"
+    map_monit_dir_bbb += "\\"
+    vis_dir_bbb += "\\"
+
     datas_f_map, chebi_hori, lec_id, exa_id = shapping_data(infile,
                                                             map_monit_dir)
     data_input = recup_all_inf_excel(infile)
@@ -199,7 +221,7 @@ def workflow(infile, out_folder):
             data_input[i_dat_i][j] = str(dat_i[j])
     result_cpdb, result_ramp, recap = opti_multimapping(datas_f_map, results_dir,
                                                         mapping="flow")
-
+    ### Global Treatment
     l_visu = c_p_o_m_r(result_ramp, results_dir, "RAMP", f_view_sav=vis_dir,
                        modul="flow", midfile=map_monit_dir, f_modul=recap)
     l_visu_c = c_p_o_m_r(result_cpdb, results_dir, "CPDB", f_view_sav=vis_dir,
@@ -224,6 +246,18 @@ def workflow(infile, out_folder):
     visu_para  = [100, 0, 1, 10, 1]
     l_bdd = ["Wikipathways", "KEGG", "EHMN",
              "HumanCyc", "INOH", "Reactome", "SMPDB"]
+    for bdd_nw in l_bdd:
+        dataset_bdd_cpdb  = [[result_cpdb[X][0]] for X in range(13)]
+        for pos_lin, bdd_l in enumerate(result_cpdb[3]):
+            if bdd_l == bdd_nw:
+                for count in range(len(dataset_bdd_cpdb)):
+                    dataset_bdd_cpdb[count].append(result_cpdb[count][pos_lin])
+        print(dataset_bdd_cpdb)
+        if len(dataset_bdd_cpdb[0])>3:
+            l_visu_c = c_p_o_m_r(dataset_bdd_cpdb, results_dir_bbb, "CPDB",
+                                 f_view_sav=vis_dir_bbb, modul="flow",
+                                 midfile=map_monit_dir_bbb,
+                                 f_modul=recap , bdd=bdd_nw)
     t2 = time()
     print("le temps nécessaires pour effectuer le mapping optimal a était de ",
           t2-t1, "secondes.")
@@ -277,7 +311,6 @@ def workflow(infile, out_folder):
         recap_augment.append(recap[i_rec-nbr_mapping])
     recap_augment.append(recap[1+nbr_mapping])
 
-
     df_recap = pd.DataFrame(recap_augment).transpose()
     n_o_f = results_dir + "recap_with_mapping.xlsx"
     excel_file_writer(df_recap, n_o_f,  sheetname="Resultats")
@@ -287,6 +320,7 @@ def workflow(infile, out_folder):
     print("le temps total pour faire tourner le programme est a était ",
           t3-t1, "secondes.")
 
+
 if __name__ == "__main__":
     INFILE = FOLDER + "datas_deux_col.xlsx"
     workflow(INFILE, FOLDER)