def plot_coords_quads(self):

        print ("plots dir is: " + self.plots_dir)
        if not os.path.exists(self.plots_dir):
            os.mkdir(self.plots_dir)
            # os.chdir(self.treehome)
            self.setTopNum()
            print "TopNum is: " + str(self.topNum)
            for i in range(1, self.topNum + 1):
                os.chdir(self.plots_dir)
                logplot = make_rplotscript(
                    self.coords_dir,
                    self.coords_filepref + str(i) + ".txt",
                    self.tree_name + " Topology " + str(i) + " Logmap",
                    aspect_ratio=1,
                    outdir=self.plots_dir,
                    mean=False,
                    majority=False,
                )
                logplot.rplot()
                # logplot.setNormFile(self.coords_prefix + str(i) + "_norms.txt")
                # logplot.rplotnorm()
                command = self.Rpath + " " + self.coords_dir + "/" + self.coords_filepref + str(i) + ".r"
                # command = 'C:\\Rstuff\\R-3.2.0\\bin\\Rscript.exe ' + self.coords_dir + "/" + self.coords_filepref + str(i) + '.r'
                subprocess.call(command.split())
                # normcommand =  'C:\\Rstuff\\R-3.2.0\\bin\\Rscript.exe ' + self.coords_dir +"/" + self.coords_filepref + str(i) + "_norm3D.r"
                # subprocess.call(normcommand.split())
        else:
            print "Quadrants already plotted - skipping quadrant creation"
 def plot_coords_all(self):
     os.chdir(self.treehome)
     if not os.path.exists(self.plots_all):
         allplot = make_rplotscript(
             self.treehome,
             self.all_topos_coords_centre,
             self.tree_name + " All Topologies Relative to Centre 1 Logmap",
             aspect_ratio=1,
             outdir=self.treehome,
             mean=False,
             majority=False,
         )
         allplot.rplot()
         # allplot.setNormFile(self.treehome + self.tree_name + "_" + self.model + "_norms.txt")
         # allplot.rplotnorm()
         # command = 'C:\\Rstuff\\R-3.2.0\\bin\\Rscript.exe ' + self.treehome + self.all_topos_coords_centre[0:-4] +  self.ordered + '.r'
         command = self.Rpath + " " + self.treehome + "/" + self.all_topos_coords_centre[0:-4] + self.ordered + ".r"
         print ("command is: " + command)
         subprocess.call(command.split())
         # normcommand = 'C:\\Rstuff\\R-3.2.0\\bin\\Rscript.exe ' + self.treehome + self.all_topos_coords_centre[0:-4] +  self.ordered + '_norm3D.r'
         # subprocess.call(normcommand.split())
     else:
         print "All topologies already plotted - skipping plot creation"
示例#3
0
 '''
 # Make the tree file including the mean and majority tree:
 
 if not os.path.exists(tree_file_mn_1st):
     infile1 = open(tree_file_mn_1st, 'r')
     #infile2 = open(majority_tree_file, 'r')
     infile3 = open(tree_file,'r')
     outfile = open(tree_file_mn_1st, 'w')
     outfile.write(infile1.readline() + "\n")
     infile1.close()
     #outfile.write(infile2.readline() + "\n")
     #infile2.close()
     for line in infile3:
         outfile.write(line)
     infile3.close()
     outfile.close()
 
 # Find the coordinates for mean, majority, and all trees:
 
 if not os.path.exists(all_coords_mn):
     
     command = 'java -jar ' + analysis_version + ' -u -a log_map -o ' + all_coords_mn + ' -f '  + center_tree_file + " " + tree_file_mn_1st
     subprocess.call(command.split())
 
 # Generate the R script for the trees:
 
 # This version gets all three:
 #newbase_r = make_rplotscript(all_coords_mn_maj,"Trees with Base, Mean & Majority","log",1,True,True)
 newbase_r = make_rplotscript(all_coords_mn,"Trees with Base & Mean","log",1,True,False)
 newbase_r.set_base(1,10)
 newbase_r.rplot(True)