def main(args): # set up the logger f = logging.getLogger('toplevel.logger') h = logging.StreamHandler() h.setFormatter(logging.Formatter('%(message)s %(asctime)s')) f.addHandler(h) if args.verbose: f.setLevel(logging.DEBUG) else: f.setLevel(logging.WARNING) f.info('(local) permute columns of the alignment') header_seq_pairs = beasttut.get_456_col_permuted_header_seq_pairs() f.info('(local) run BEAST serially locally and build the R stuff') table_string, scripts = get_table_string_and_scripts( g_start_stop_pairs, args.nsamples, header_seq_pairs) f.info('(local) create the composite R script') out = StringIO() print >> out, 'library(ggplot2)' print >> out, 'par(mfrow=c(3,1))' for script in scripts: print >> out, script comboscript = out.getvalue() f.info('(local) run R to create the pdf') device_name = Form.g_imageformat_to_r_function['pdf'] retcode, r_out, r_err, image_data = RUtil.run_plotter( table_string, comboscript, device_name, keep_intermediate=True) if retcode: raise RUtil.RError(r_err) f.info('(local) write the .pdf file') with open(args.outfile, 'wb') as fout: fout.write(image_data) f.info('(local) return from toplevel')
def get_response_content(fs): start_pos = 1 stop_pos = fs.ncolumns nsamples = fs.nsamples header_seq_pairs = beasttut.get_456_col_permuted_header_seq_pairs() arr = get_loganalysis_array( start_pos, stop_pos, nsamples, header_seq_pairs) s = '\n'.join('\t'.join(str(x) for x in row) for row in arr) + '\n' return s