Exemplo n.º 1
0
def get_response_content(fs):
    header_sequence_pairs = beasttut.get_header_seq_pairs()
    interval_xml_data = beasttut.get_xml_string(
            fs.start_pos, fs.stop_pos, fs.nsamples, 'myjob.log',
            header_sequence_pairs)
    arr = get_loganalysis_array(interval_xml_data)
    s = '\n'.join('\t'.join(str(x) for x in row) for row in arr) + '\n'
    return s
Exemplo n.º 2
0
def get_response_content(fs):
    header_sequence_pairs = beasttut.get_header_seq_pairs()
    interval_xml_data = beasttut.get_xml_string(fs.start_pos, fs.stop_pos,
                                                fs.nsamples, 'myjob.log',
                                                header_sequence_pairs)
    arr = get_loganalysis_array(interval_xml_data)
    s = '\n'.join('\t'.join(str(x) for x in row) for row in arr) + '\n'
    return s
Exemplo n.º 3
0
def get_loganalysis_array(start_pos, stop_pos, nsamples, header_seq_pairs):
    # get the xml contents
    xml_string = beasttut.get_xml_string(
            start_pos, stop_pos, nsamples, 'myjob.log', header_seq_pairs)
    # prepare the base path for the beast analysis
    basepath = beast.prepare()
    with open(os.path.join(basepath, 'myjob.xml'), 'w') as fout:
        fout.write(xml_string + '\n')
    beast.run_beast(basepath, g_beast_jar_path)
    beast.run_loganalyser(basepath)
    # read the analysis
    with open(os.path.join(basepath, 'myjob-loganalyser.txt')) as fin:
        analysis_text = fin.read()
    # parse the analysis
    arr = beast.loganalyser_to_array(analysis_text)
    return arr
Exemplo n.º 4
0
 def preprocess(self):
     # for each (start_pos, stop_pos) pair
     # define a log filename and
     # create a beast xml and a bsub script
     self.local_log_paths = []
     for i, start_stop_pair in enumerate(self.start_stop_pairs):
         start_pos, stop_pos = start_stop_pair
         # define the log file paths
         log_name = 'primate-tut-%d-%d.log' % start_stop_pair
         local_log_path = os.path.join(
                 self.local.get_out(), log_name)
         remote_log_path = os.path.join(
                 self.remote.get_out(), log_name)
         self.local_log_paths.append(local_log_path)
         # define the xml file paths
         xml_name = 'primate-tut-%d-%d.xml' % start_stop_pair
         local_xml_path = os.path.join(
                 self.local.get_in_contents(), xml_name)
         remote_xml_path = os.path.join(
                 self.remote.get_in_contents(), xml_name)
         # define the local bsub path
         bsub_name = 'primate-tut-%d-%d.bsub' % start_stop_pair
         local_bsub_path = os.path.join(
                 self.local.get_in_bsubs(), bsub_name)
         # create the xml file
         with open(local_xml_path, 'w') as fout:
             print >> fout, beasttut.get_xml_string(
                     start_pos, stop_pos, self.nsamples, remote_log_path)
         # create the bsub file
         with open(local_bsub_path, 'w') as fout:
             stdout_path = os.path.join(self.remote.get_out(),
                     'out.tut-%d-%d' % start_stop_pair)
             stderr_path = os.path.join(self.remote.get_out(),
                     'err.tut-%d-%d' % start_stop_pair)
             # name the job
             print >> fout, '#BSUB -J tut-%d-%d' % start_stop_pair
             # suggest the brc queue
             print >> fout, '#BSUB -q brc'
             # redirect stdout
             print >> fout, '#BSUB -o', stdout_path
             # redirect stderr
             print >> fout, '#BSUB -e', stderr_path
             # run BEAST using a java path suggested by Gary Howell
             print >> fout, g_remote_java_path, '-jar'
             print >> fout, g_remote_beast_jar_path, remote_xml_path
Exemplo n.º 5
0
 def __call__(self, conn):
     # for each (start_pos, stop_pos) pair
     # define a log filename and
     # create a beast xml and a bsub script
     self.local_log_paths = []
     for i, start_stop_pair in enumerate(self.start_stop_pairs):
         start_pos, stop_pos = start_stop_pair
         # define the log file paths
         log_name = 'primate-tut-%d-%d.log' % start_stop_pair
         local_log_path = os.path.join(
                 conn.local.get_out(), log_name)
         remote_log_path = os.path.join(
                 conn.remote.get_out(), log_name)
         self.local_log_paths.append(local_log_path)
         # define the xml file paths
         xml_name = 'primate-tut-%d-%d.xml' % start_stop_pair
         local_xml_path = os.path.join(
                 conn.local.get_in_contents(), xml_name)
         remote_xml_path = os.path.join(
                 conn.remote.get_in_contents(), xml_name)
         # define the local bsub path
         bsub_name = 'primate-tut-%d-%d.bsub' % start_stop_pair
         local_bsub_path = os.path.join(
                 conn.local.get_in_bsubs(), bsub_name)
         # create the xml file
         with open(local_xml_path, 'w') as fout:
             print >> fout, beasttut.get_xml_string(
                     start_pos, stop_pos, self.nsamples, remote_log_path)
         # create the bsub file
         with open(local_bsub_path, 'w') as fout:
             stdout_path = os.path.join(conn.remote.get_out(),
                     'out.tut-%d-%d' % start_stop_pair)
             stderr_path = os.path.join(conn.remote.get_out(),
                     'err.tut-%d-%d' % start_stop_pair)
             # name the job
             print >> fout, '#BSUB -J tut-%d-%d' % start_stop_pair
             # suggest the brc queue
             print >> fout, '#BSUB -q brc'
             # redirect stdout
             print >> fout, '#BSUB -o', stdout_path
             # redirect stderr
             print >> fout, '#BSUB -e', stderr_path
             # run BEAST using a java path suggested by Gary Howell
             print >> fout, g_remote_java_path, '-jar'
             print >> fout, g_remote_beast_jar_path, remote_xml_path
Exemplo n.º 6
0
 def __call__(self, conn):
     # for each (start_pos, stop_pos) pair
     # define a log filename and
     # create a beast xml and a bsub script
     self.local_log_paths = []
     for i, start_stop_pair in enumerate(self.start_stop_pairs):
         start_pos, stop_pos = start_stop_pair
         # define the log file paths
         log_name = "primate-tut-%d-%d.log" % start_stop_pair
         local_log_path = os.path.join(conn.local.get_out(), log_name)
         remote_log_path = os.path.join(conn.remote.get_out(), log_name)
         self.local_log_paths.append(local_log_path)
         # define the xml file paths
         xml_name = "primate-tut-%d-%d.xml" % start_stop_pair
         local_xml_path = os.path.join(conn.local.get_in_contents(), xml_name)
         remote_xml_path = os.path.join(conn.remote.get_in_contents(), xml_name)
         # define the local bsub path
         bsub_name = "primate-tut-%d-%d.bsub" % start_stop_pair
         local_bsub_path = os.path.join(conn.local.get_in_bsubs(), bsub_name)
         # create the xml file
         with open(local_xml_path, "w") as fout:
             print >> fout, beasttut.get_xml_string(start_pos, stop_pos, self.nsamples, remote_log_path)
         # create the bsub file
         with open(local_bsub_path, "w") as fout:
             stdout_path = os.path.join(conn.remote.get_out(), "out.tut-%d-%d" % start_stop_pair)
             stderr_path = os.path.join(conn.remote.get_out(), "err.tut-%d-%d" % start_stop_pair)
             # name the job
             print >> fout, "#BSUB -J tut-%d-%d" % start_stop_pair
             # suggest the brc queue
             print >> fout, "#BSUB -q brc"
             # redirect stdout
             print >> fout, "#BSUB -o", stdout_path
             # redirect stderr
             print >> fout, "#BSUB -e", stderr_path
             # run BEAST using a java path suggested by Gary Howell
             print >> fout, g_remote_java_path, "-jar"
             print >> fout, g_remote_beast_jar_path, remote_xml_path
Exemplo n.º 7
0
def get_response_content(fs):
    # init the response and get the user variables
    start_pos = fs.start
    stop_pos = fs.stop
    nsamples = fs.nsamples
    out = StringIO()
    # get the xml contents
    xml_string = beasttut.get_xml_string(
            start_pos, stop_pos, nsamples, 'myjob.log',
            beasttut.get_header_seq_pairs())
    # prepare the base path for the beast analysis
    basepath = beast.prepare()
    with open(os.path.join(basepath, 'myjob.xml'), 'w') as fout:
        fout.write(xml_string + '\n')
    beast.run_beast(basepath, g_beast_jar_path)
    beast.run_loganalyser(basepath)
    # read the analysis
    with open(os.path.join(basepath, 'myjob-loganalyser.txt')) as fin:
        analysis_text = fin.read()
    # parse the analysis
    arr = beast.loganalyser_to_array(analysis_text)
    s = '\n'.join('\t'.join(str(x) for x in row) for row in arr) + '\n'
    # return the response
    return s
Exemplo n.º 8
0
def get_response_content(fs):
    # init the response and get the user variables
    start_pos = fs.start
    stop_pos = fs.stop
    nsamples = fs.nsamples
    out = StringIO()
    # get the xml contents
    xml_string = beasttut.get_xml_string(start_pos, stop_pos, nsamples,
                                         'myjob.log',
                                         beasttut.get_header_seq_pairs())
    # prepare the base path for the beast analysis
    basepath = beast.prepare()
    with open(os.path.join(basepath, 'myjob.xml'), 'w') as fout:
        fout.write(xml_string + '\n')
    beast.run_beast(basepath, g_beast_jar_path)
    beast.run_loganalyser(basepath)
    # read the analysis
    with open(os.path.join(basepath, 'myjob-loganalyser.txt')) as fin:
        analysis_text = fin.read()
    # parse the analysis
    arr = beast.loganalyser_to_array(analysis_text)
    s = '\n'.join('\t'.join(str(x) for x in row) for row in arr) + '\n'
    # return the response
    return s