示例#1
0
 def _plot_mountain(self, mountain, moun_path,
                    tmp_paths, prefix, vienna_util):
     if mountain:
         tmp_moun_path = os.path.join(tmp_paths["main"], moun_path)
         os.mkdir(os.path.join(tmp_moun_path, prefix))
         txt_path = os.path.join(tmp_paths["tmp"], "tmp_txt")
         self.helper.check_make_folder(txt_path)
         print("Generating mountain plot of {0}....".format(prefix))
         for dot_file in os.listdir(tmp_paths["tmp"]):
             if dot_file.endswith("dp.ps"):
                 moun_txt = os.path.join(tmp_paths["tmp"], "mountain.txt")
                 out = open(moun_txt, "w")
                 moun_file = dot_file.replace("dp.ps", "mountain.pdf")
                 print("Generating {0}".format(moun_file))
                 self._run_mountain(vienna_util, tmp_paths, dot_file, out)
                 plot_mountain_plot(moun_txt, moun_file)
                 shutil.move(moun_file,
                             os.path.join(tmp_moun_path, prefix, moun_file))
                 out.close()
                 os.remove(moun_txt)
示例#2
0
 def _plot_mountain(self, mountain, moun_path, tmp_paths, prefix,
                    vienna_util):
     if mountain:
         tmp_moun_path = os.path.join(tmp_paths["main"], moun_path)
         os.mkdir(os.path.join(tmp_moun_path, prefix))
         txt_path = os.path.join(tmp_paths["tmp"], "tmp_txt")
         self.helper.check_make_folder(txt_path)
         print("Generating mountain plot of {0}....".format(prefix))
         for dot_file in os.listdir(tmp_paths["tmp"]):
             if dot_file.endswith("dp.ps"):
                 moun_txt = os.path.join(tmp_paths["tmp"], "mountain.txt")
                 out = open(moun_txt, "w")
                 moun_file = dot_file.replace("dp.ps", "mountain.pdf")
                 print("Generating {0}".format(moun_file))
                 self._run_mountain(vienna_util, tmp_paths, dot_file, out)
                 plot_mountain_plot(moun_txt, moun_file)
                 shutil.move(moun_file,
                             os.path.join(tmp_moun_path, prefix, moun_file))
                 out.close()
                 os.remove(moun_txt)
    def test_plot_mountain_plot(self):
        gen_file(os.path.join(self.test_folder, "test"), self.example.mountain)
        pm.plot_mountain_plot(os.path.join(self.test_folder, "test"),
                              os.path.join(self.test_folder, "out"))

        self.assertTrue(os.path.exists(os.path.join(self.test_folder, "out")))