Пример #1
0
 def test_plot_ppi(self):
     ppi_file = os.path.join(self.test_folder, "test_ppi")
     gen_file(ppi_file, self.example.ppi_file)
     pp.plot_ppi(ppi_file, 0, self.test_folder, 1000)
     strain = "Helicobacter pylori 26695 chromosome"
     self.assertTrue(os.path.exists(
         "test_folder/" + strain + "/HP0001_nusB.png"))
Пример #2
0
 def test_plot_ppi(self):
     ppi_file = os.path.join(self.test_folder, "test_ppi")
     gen_file(ppi_file, self.example.ppi_file)
     pp.plot_ppi(ppi_file, 0, self.test_folder, 1000)
     strain = "Helicobacter pylori 26695 chromosome"
     self.assertTrue(
         os.path.exists("test_folder/" + strain + "/HP0001_nusB.png"))
Пример #3
0
 def _plot(self, args_ppi, files, log):
     log.write("Running plot_PPI.py to generate plots of PPI.\n")
     log.write("The figures of PPI networks are generated and stored in the "
               "following folders:\n")
     if args_ppi.no_specific:
         files["all_nospecific"].close()
         files["best_nospecific"].close()
     files["all_specific"].close()
     files["best_specific"].close()
     for folder in os.listdir(self.all_result):
         if folder in os.listdir(self.fig):
             print("Plotting {0}".format(folder))
             out_folder_spe = os.path.join(self.fig, folder,
                                       self.with_strain)
             plot_ppi(os.path.join(self.all_result, folder,
                      "_".join([folder, self.with_strain + ".csv"])),
                      args_ppi.score, out_folder_spe, args_ppi.size)
             for file_ in os.listdir(out_folder_spe):
                 log.write("\t" + os.path.join(
                     out_folder_spe, file_) + "\n")
             if args_ppi.no_specific:
                 out_folder_nospe = os.path.join(self.fig, folder,
                                       self.without_strain)
                 plot_ppi(os.path.join(self.all_result, folder,
                          "_".join([folder, self.without_strain + ".csv"])),
                          args_ppi.score, out_folder_nospe, args_ppi.size)
                 for file_ in os.listdir(out_folder_nospe):
                     log.write("\t" + os.path.join(
                         out_folder_nospe, file_) + "\n")
Пример #4
0
 def _plot(self, args_ppi, files):
     if args_ppi.no_specific:
         files["all_nospecific"].close()
         files["best_nospecific"].close()
     files["all_specific"].close()
     files["best_specific"].close()
     for folder in os.listdir(self.all_result):
         if folder in os.listdir(self.fig):
             print("plotting {0}".format(folder))
             plot_ppi(os.path.join(self.all_result, folder,
                      "_".join([folder, self.with_strain + ".csv"])),
                      args_ppi.score, os.path.join(self.fig, folder,
                      self.with_strain), args_ppi.size)
             if args_ppi.no_specific:
                 plot_ppi(os.path.join(self.all_result, folder,
                          "_".join([folder, self.without_strain + ".csv"])),
                          args_ppi.score,
                          os.path.join(self.fig, folder,
                          self.without_strain), args_ppi.size)