Exemplo n.º 1
0
 def __init__(self, parent, title, opened=False):
     self._identifier = self.unique_id("tree")
     super(Tree, self).__init__(parent)
     self._title = title
     self._opened = opened
     pyrvapi.rvapi_add_tree_widget(
         self._identifier, self._title, self._parent.identifier, 
         0, 0, 1, 1
     )
Exemplo n.º 2
0
    def results_section(self, results_tab_id, mrb_results, ensemble_results,
                        section_title):
        #
        # Results Tab
        #
        if not mrb_results: return

        # Create unique identifier for this section by using the id
        # All ids will have this appended to avoid clashes
        uid = str(uuid.uuid4())

        section_id = section_title.replace(" ", "_") + uid
        self.results_tab_sections.append(
            section_id)  # Add to list so we can remove if we update

        pyrvapi.rvapi_add_panel(section_id, results_tab_id, 0, 0, 1, 1)
        pyrvapi.rvapi_add_text("<h3>{0}</h3>".format(section_title),
                               section_id, 0, 0, 1, 1)

        results_tree = "results_tree" + section_id
        pyrvapi.rvapi_add_tree_widget(results_tree, section_title, section_id,
                                      0, 0, 1, 1)

        for r in mrb_results:
            name = r['ensemble_name']
            # container_id="sec_{0}".format(name)
            # pyrvapi.rvapi_add_section(container_id,"Results for: {0}".format(name),results_tree,0,0,1,1,True)
            container_id = "sec_{0}".format(name) + uid
            pyrvapi.rvapi_add_panel(container_id, results_tree, 0, 0, 1, 1)

            header = "<h3>Results for ensemble: {0}</h3>".format(name)
            pyrvapi.rvapi_add_text(header, container_id, 0, 0, 1, 1)

            sec_table = "sec_table_{0}".format(name) + uid
            title = "Results table: {0}".format(name)
            title = "Summary"
            pyrvapi.rvapi_add_section(sec_table, title, container_id, 0, 0, 1,
                                      1, True)
            table_id = "table_{0}".format(name) + uid
            pyrvapi.rvapi_add_table(table_id, "", sec_table, 1, 0, 1, 1, False)
            tdata = mrbump_util.ResultsSummary().results_table([r])
            self.fill_table(table_id, tdata, tooltips=self._mrbump_tooltips)

            # Ensemble
            if ensemble_results:
                epdb = self.ensemble_pdb(r, ensemble_results)
                if epdb:
                    sec_ensemble = "sec_ensemble_{0}".format(name) + uid
                    pyrvapi.rvapi_add_section(sec_ensemble,
                                              "Ensemble Search Model",
                                              container_id, 0, 0, 1, 1, False)
                    data_ensemble = "data_ensemble_{0}".format(name) + uid
                    pyrvapi.rvapi_add_data(data_ensemble, "Ensemble PDB",
                                           self.fix_path(epdb), "XYZOUT",
                                           sec_ensemble, 2, 0, 1, 1, True)
            # PHASER
            if os.path.isfile(str(r['PHASER_logfile'])) or (
                    os.path.isfile(str(r['PHASER_pdbout']))
                    and os.path.isfile(str(r['PHASER_mtzout']))):
                sec_phaser = "sec_phaser_{0}".format(name) + uid
                pyrvapi.rvapi_add_section(sec_phaser, "PHASER Outputs",
                                          container_id, 0, 0, 1, 1, False)
                if os.path.isfile(str(r['PHASER_pdbout'])) and os.path.isfile(
                        str(r['PHASER_mtzout'])):
                    data_phaser = "data_phaser_out_{0}".format(name) + uid
                    pyrvapi.rvapi_add_data(
                        data_phaser, "PHASER PDB",
                        os.path.splitext(self.fix_path(r['PHASER_pdbout']))[0],
                        "xyz:map", sec_phaser, 2, 0, 1, 1, True)
                    pyrvapi.rvapi_append_to_data(
                        data_phaser, self.fix_path(r['PHASER_mtzout']),
                        "xyz:map")
                if os.path.isfile(str(r['PHASER_logfile'])):
                    pyrvapi.rvapi_add_data(
                        "data_phaser_logfile_{0}".format(name),
                        "PHASER Logfile", self.fix_path(r['PHASER_logfile']),
                        "text", sec_phaser, 2, 0, 1, 1, True)

            # REFMAC
            if os.path.isfile(str(r['REFMAC_logfile'])) or (
                    os.path.isfile(str(r['REFMAC_pdbout']))
                    and os.path.isfile(str(r['REFMAC_mtzout']))):
                sec_refmac = "sec_refmac_{0}".format(name) + uid
                pyrvapi.rvapi_add_section(sec_refmac, "REFMAC Outputs",
                                          container_id, 0, 0, 1, 1, False)
                if os.path.isfile(str(r['REFMAC_pdbout'])) and os.path.isfile(
                        str(r['REFMAC_mtzout'])):
                    data_refmac = "data_refmac_out_{0}".format(name) + uid
                    pyrvapi.rvapi_add_data(
                        data_refmac, "REFMAC PDB",
                        os.path.splitext(self.fix_path(r['REFMAC_pdbout']))[0],
                        "xyz:map", sec_refmac, 2, 0, 1, 1, True)
                    pyrvapi.rvapi_append_to_data(
                        data_refmac, self.fix_path(r['REFMAC_mtzout']),
                        "xyz:map")
                if os.path.isfile(str(r['REFMAC_logfile'])):
                    pyrvapi.rvapi_add_data(
                        "data_refmac_logfile_{0}".format(name),
                        "REFMAC Logfile", self.fix_path(r['REFMAC_logfile']),
                        "text", sec_refmac, 2, 0, 1, 1, True)

            # Buccaner
            if os.path.isfile(str(r['BUCC_logfile'])) or (
                    os.path.isfile(str(r['BUCC_pdbout']))
                    and os.path.isfile(str(r['BUCC_mtzout']))):
                sec_bucc = "sec_bucc_{0}".format(name) + uid
                pyrvapi.rvapi_add_section(sec_bucc, "BUCCANEER Outputs",
                                          container_id, 0, 0, 1, 1, False)
                if os.path.isfile(str(r['BUCC_pdbout'])) and os.path.isfile(
                        str(r['BUCC_mtzout'])):
                    data_bucc = "data_bucc_out_{0}".format(name) + uid
                    pyrvapi.rvapi_add_data(
                        data_bucc, "BUCC PDB",
                        os.path.splitext(self.fix_path(r['BUCC_pdbout']))[0],
                        "xyz:map", sec_bucc, 2, 0, 1, 1, True)
                    pyrvapi.rvapi_append_to_data(
                        data_bucc, self.fix_path(r['BUCC_mtzout']), "xyz:map")
                if os.path.isfile(str(r['BUCC_logfile'])):
                    pyrvapi.rvapi_add_data(
                        "data_bucc_logfile_{0}".format(name), "BUCC Logfile",
                        self.fix_path(r['BUCC_logfile']), "text", sec_bucc, 2,
                        0, 1, 1, True)

            # Arpwarp
            if os.path.isfile(str(r['ARP_logfile'])) or (
                    os.path.isfile(str(r['ARP_pdbout']))
                    and os.path.isfile(str(r['ARP_mtzout']))):
                sec_arp = "sec_arp_{0}".format(name) + uid
                pyrvapi.rvapi_add_section(sec_arp, "ARPWARP Outputs",
                                          container_id, 0, 0, 1, 1, False)
                if os.path.isfile(str(r['ARP_pdbout'])) and os.path.isfile(
                        str(r['ARP_mtzout'])):
                    data_arp = "data_arp_out_{0}".format(name) + uid
                    pyrvapi.rvapi_add_data(
                        data_arp, "ARP PDB",
                        os.path.splitext(self.fix_path(r['ARP_pdbout']))[0],
                        "xyz:map", sec_arp, 2, 0, 1, 1, True)
                    pyrvapi.rvapi_append_to_data(
                        data_arp, self.fix_path(r['ARP_mtzout']), "xyz:map")
                if os.path.isfile(str(r['ARP_logfile'])):
                    pyrvapi.rvapi_add_data("data_arp_logfile_{0}".format(name),
                                           "ARP Logfile",
                                           self.fix_path(r['ARP_logfile']),
                                           "text", sec_arp, 2, 0, 1, 1, True)

            # SHELXE
            if os.path.isfile(str(r['SHELXE_logfile'])) or (
                    os.path.isfile(str(r['SHELXE_pdbout']))
                    and os.path.isfile(str(r['SHELXE_mtzout']))):
                sec_shelxe = "sec_shelxe_{0}".format(name) + uid
                pyrvapi.rvapi_add_section(sec_shelxe, "SHELXE Outputs",
                                          container_id, 0, 0, 1, 1, False)
                if os.path.isfile(str(r['SHELXE_pdbout'])) and os.path.isfile(
                        str(r['SHELXE_mtzout'])):
                    data_shelxe = "data_shelxe_out_{0}".format(name) + uid
                    pyrvapi.rvapi_add_data(
                        data_shelxe, "SHELXE PDB",
                        os.path.splitext(self.fix_path(r['SHELXE_pdbout']))[0],
                        "xyz:map", sec_shelxe, 2, 0, 1, 1, True)
                    pyrvapi.rvapi_append_to_data(
                        data_shelxe, self.fix_path(r['SHELXE_mtzout']),
                        "xyz:map")
                if os.path.isfile(str(r['SHELXE_logfile'])):
                    pyrvapi.rvapi_add_data(
                        "data_shelxe_logfile_{0}".format(name),
                        "SHELXE Logfile", self.fix_path(r['SHELXE_logfile']),
                        "text", sec_shelxe, 2, 0, 1, 1, True)

            # Buccaner Rebuild
            if os.path.isfile(str(r['SXRBUCC_logfile'])) or (
                    os.path.isfile(str(r['SXRBUCC_pdbout']))
                    and os.path.isfile(str(r['SXRBUCC_mtzout']))):
                sec_sxrbucc = "sec_sxrbucc_{0}".format(name) + uid
                pyrvapi.rvapi_add_section(
                    sec_sxrbucc, "BUCCANEER SHELXE Trace Rebuild Outputs",
                    container_id, 0, 0, 1, 1, False)
                if os.path.isfile(str(r['SXRBUCC_pdbout'])) and os.path.isfile(
                        str(r['SXRBUCC_mtzout'])):
                    data_sxrbucc = "data_sxrbucc_out_{0}".format(name) + uid
                    pyrvapi.rvapi_add_data(
                        data_sxrbucc, "SXRBUCC PDB",
                        os.path.splitext(self.fix_path(
                            r['SXRBUCC_pdbout']))[0], "xyz:map", sec_sxrbucc,
                        2, 0, 1, 1, True)
                    pyrvapi.rvapi_append_to_data(
                        data_sxrbucc, self.fix_path(r['SXRBUCC_mtzout']),
                        "xyz:map")
                if os.path.isfile(str(r['SXRBUCC_logfile'])):
                    pyrvapi.rvapi_add_data(
                        "data_sxrbucc_logfile_{0}".format(name),
                        "SXRBUCC Logfile", self.fix_path(r['SXRBUCC_logfile']),
                        "text", sec_sxrbucc, 2, 0, 1, 1, True)

            # Arpwarp Rebuild
            if os.path.isfile(str(r['SXRARP_logfile'])) or (
                    os.path.isfile(str(r['SXRARP_pdbout']))
                    and os.path.isfile(str(r['SXRARP_mtzout']))):
                sec_sxrarp = "sec_sxrarp_{0}".format(name) + uid
                pyrvapi.rvapi_add_section(
                    sec_sxrarp, "ARPWARP SHELXE Trace Redbuild Outputs",
                    container_id, 0, 0, 1, 1, False)
                if os.path.isfile(str(r['SXRARP_pdbout'])) and os.path.isfile(
                        str(r['SXRARP_mtzout'])):
                    data_sxrarp = "data_sxrarp_out_{0}".format(name) + uid
                    pyrvapi.rvapi_add_data(
                        data_sxrarp, "SXRARP PDB",
                        os.path.splitext(self.fix_path(r['SXRARP_pdbout']))[0],
                        "xyz:map", sec_sxrarp, 2, 0, 1, 1, True)
                    pyrvapi.rvapi_append_to_data(
                        data_sxrarp, self.fix_path(r['SXRARP_mtzout']),
                        "xyz:map")
                if os.path.isfile(str(r['SXRARP_logfile'])):
                    pyrvapi.rvapi_add_data(
                        "data_sxrarp_logfile_{0}".format(name),
                        "SXRARP Logfile", self.fix_path(r['SXRARP_logfile']),
                        "text", sec_sxrarp, 2, 0, 1, 1, True)

            pyrvapi.rvapi_set_tree_node(results_tree, container_id,
                                        "{0}".format(name), "auto", "")
        return
Exemplo n.º 3
0
    def results_section(self, results_tab_id, mrb_results, ensemble_results,
                        section_title):
        """Results Tab"""
        if not mrb_results:
            return
        # Create unique identifier for this section by using the id
        # All ids will have this appended to avoid clashes
        uid = str(uuid.uuid4())
        section_id = section_title.replace(" ", "_") + uid
        self.results_tab_sections.append(
            section_id)  # Add to list so we can remove if we update
        pyrvapi.rvapi_add_panel(section_id, results_tab_id, 0, 0, 1, 1)
        pyrvapi.rvapi_add_text("<h3>{0}</h3>".format(section_title),
                               section_id, 0, 0, 1, 1)
        results_tree = "results_tree" + section_id
        pyrvapi.rvapi_add_tree_widget(results_tree, section_title, section_id,
                                      0, 0, 1, 1)
        for r in mrb_results:
            ensemble_name = r['ensemble_name']
            container_id = "sec_{0}".format(ensemble_name) + uid
            pyrvapi.rvapi_add_panel(container_id, results_tree, 0, 0, 1, 1)

            header = "<h3>Results for ensemble: {0}</h3>".format(ensemble_name)
            pyrvapi.rvapi_add_text(header, container_id, 0, 0, 1, 1)

            sec_table = "sec_table_{0}".format(ensemble_name) + uid
            title = "Results table: {0}".format(ensemble_name)
            title = "Summary"
            pyrvapi.rvapi_add_section(sec_table, title, container_id, 0, 0, 1,
                                      1, True)
            table_id = "table_{0}".format(ensemble_name) + uid
            pyrvapi.rvapi_add_table(table_id, "", sec_table, 1, 0, 1, 1, False)
            tdata = mrbump_util.ResultsSummary().results_table([r])
            self.fill_table(table_id, tdata, tooltips=self._mrbump_tooltips)
            # Ensemble
            if ensemble_results:
                epdb = self.ensemble_pdb(r, ensemble_results)
                if epdb:
                    sec_ensemble = "sec_ensemble_{0}".format(
                        ensemble_name) + uid
                    pyrvapi.rvapi_add_section(sec_ensemble,
                                              "Ensemble Search Model",
                                              container_id, 0, 0, 1, 1, False)
                    data_ensemble = "data_ensemble_{0}".format(
                        ensemble_name) + uid
                    pyrvapi.rvapi_add_data(data_ensemble, "Ensemble PDB",
                                           self.fix_path(epdb), "XYZOUT",
                                           sec_ensemble, 2, 0, 1, 1, True)
            # PHASER
            self.add_results_section(
                result_dict=r,
                ensemble_name=ensemble_name,
                program_name='PHASER',
                logfile_key='PHASER_logfile',
                pdb_key='PHASER_pdbout',
                mtz_key='PHASER_mtzout',
                uid=uid,
                container_id=container_id,
            )
            # REFMAC
            self.add_results_section(
                result_dict=r,
                ensemble_name=ensemble_name,
                program_name='Refmac',
                logfile_key='REFMAC_logfile',
                pdb_key='REFMAC_pdbout',
                mtz_key='REFMAC_mtzout',
                uid=uid,
                container_id=container_id,
            )
            # Buccaner
            self.add_results_section(
                result_dict=r,
                ensemble_name=ensemble_name,
                program_name='BUCCANEER',
                logfile_key='BUCC_logfile',
                pdb_key='BUCC_pdbout',
                mtz_key='BUCC_mtzout',
                uid=uid,
                container_id=container_id,
            )
            # Arpwarp
            self.add_results_section(
                result_dict=r,
                ensemble_name=ensemble_name,
                program_name='ArpWarp',
                logfile_key='ARP_logfile',
                pdb_key='ARP_pdbout',
                mtz_key='ARP_mtzout',
                uid=uid,
                container_id=container_id,
            )
            # SHELXE
            self.add_results_section(
                result_dict=r,
                ensemble_name=ensemble_name,
                program_name='SHELXE',
                logfile_key='SHELXE_logfile',
                pdb_key='SHELXE_pdbout',
                mtz_key='SHELXE_mtzout',
                uid=uid,
                container_id=container_id,
            )
            # Buccaner Rebuild
            self.add_results_section(
                result_dict=r,
                ensemble_name=ensemble_name,
                program_name='BUCCANEER SHELXE Trace Rebuild',
                logfile_key='SXRBUCC_logfile',
                pdb_key='SXRBUCC_pdbout',
                mtz_key='SXRBUCC_mtzout',
                uid=uid,
                container_id=container_id,
            )
            # Arpwarp Rebuild
            self.add_results_section(
                result_dict=r,
                ensemble_name=ensemble_name,
                program_name='ARPWARP SHELXE Trace Rebuild',
                logfile_key='SXRARP_logfile',
                pdb_key='SXRARP_pdbout',
                mtz_key='SXRARP_mtzout',
                uid=uid,
                container_id=container_id,
            )
            pyrvapi.rvapi_set_tree_node(results_tree, container_id,
                                        "{0}".format(ensemble_name), "auto",
                                        "")
        return
Exemplo n.º 4
0
    def __init__(self, args=None):
        #   args = optional replacement for sys.argv to allow this class to be
        #     called from within other Python programs (such as tests)

        rvapi_v = "...................."
        pyrvapi.rvapi_version(rvapi_v)
        rvapi_v = rvapi_v.split(".")
        self.rvapi_version[0] = int(rvapi_v[0])
        self.rvapi_version[1] = int(rvapi_v[1])
        self.rvapi_version[2] = int(rvapi_v[2].replace("\x00", ""))

        self.workdir = os.getcwd()
        self.output_meta["retcode"] = ""
        self.output_meta["report_row"] = 0
        self.output_meta["results"] = {}
        self.output_meta["resorder"] = []

        self.file_stdout = sys.stdout
        self.file_stderr = sys.stderr

        # first parse command-line parameters

        if args is None:
            args = sys.argv[1:]

        narg = 0
        while narg < len(args):
            key = args[narg]
            narg += 1
            if key == "--sge" or key == "--mp": self.exeType = key
            elif key == "--no-simbad12": self.trySimbad12 = False
            elif key == "--no-morda": self.tryMoRDa = False
            elif key == "--no-crank2": self.tryCrank2 = False
            elif key == "--no-fitligands": self.tryFitLigands = False
            elif narg < len(args):
                value = args[narg]
                if key == "--wkdir": self.workdir = value
                elif key == "--rdir": self.reportdir = value
                elif key == "--outdir": self.outputdir = value
                elif key == "--rvapi-prefix": self.rvapi_prefix = value
                elif key == "--rvapi-document": self.rvapi_doc_path = value
                elif key == "--jobid": self.jobId = value
                elif key == "--qname": self.queueName = value
                elif key == "--njobs": self.nSubJobs = int(value)
                else:
                    self.output_meta[
                        "retcode"] = "[01-001] unknown command line parameter"
                    self.stderr(" *** unrecognised command line parameter " +
                                key)
                narg += 1

        # read data from standard input

        self.stdout("\n INPUT DATA:" +
                    "\n -----------------------------------------------")
        ilist = sys.stdin.read().splitlines()
        for i in range(len(ilist)):
            s = ilist[i].strip()
            if s.startswith("HKLIN"):
                self.hklpath = s.replace("HKLIN", "", 1).strip()
                self.stdout("\n HKLIN " + self.hklpath)
            elif s.startswith("SEQIN"):
                self.seqpath = s.replace("SEQIN", "", 1).strip()
                self.stdout("\n SEQIN " + self.seqpath)
            elif s.startswith("XYZIN"):
                self.xyzpath = s.replace("XYZIN", "", 1).strip()
                self.stdout("\n XYZIN " + self.xyzpath)
            elif s.startswith("HATOMS"):
                self.ha_type = s.replace("HATOMS", "", 1).strip()
                self.stdout("\n HATOMS " + self.ha_type)
            elif s.startswith("LIGAND"):
                lst = filter(None, s.replace("LIGAND", "", 1).split(" "))
                self.ligands.append(lst)
                self.stdout("\n LIGAND " + lst[0])
                if len(lst) > 1:
                    self.stdout(" " + lst[1])
            elif s:
                self.output_meta[
                    "retcode"] = "[01-002] unrecognised input line"
                self.stderr(" *** unrecognised input line " + s + "\n")
        self.stdout("\n -----------------------------------------------\n")

        # initialise work directory structure

        self.scriptsdir = os.path.join(self.workdir, "scripts")
        if not os.path.isdir(self.scriptsdir):
            os.mkdir(self.scriptsdir)

        outdir = os.path.join(self.workdir, self.outputdir)
        if not os.path.isdir(outdir):
            os.mkdir(outdir)

        # initialise RVAPI report

        self.layout = 4
        if self.compare_rvapi_version([1, 0, 15]) <= 0:
            self.layout = 0

        self.page_cursor = [self.summaryTabId, 0]
        if not self.rvapi_doc_path:  # initialise rvapi report document

            report_type = 1  # report with tabs
            if not self.rvapi_prefix or not self.reportdir:
                report_type = 0x00100000  # report will not be created

            rdir = self.reportdir
            if not rdir:
                rdir = "report"
            rdir = os.path.join(self.workdir,
                                rdir)  # has to be full path because of Crank-2

            if not os.path.isdir(rdir):
                os.mkdir(rdir)

            # initialise HTML report document; note that we use absolute path for
            # the report directory, which is necessary for passing RVAPI document
            # to applications via creation of the rvapi_document file with
            # pyrvapi.rvapi_store_document2(..)

            pyrvapi.rvapi_init_document(
                "jscofe_report",  # document Id
                rdir,  # report directory
                "Title",  # title (immaterial)
                report_type,  # HTML report to be produced
                self.layout,  # Report will start with plain page
                self.rvapi_prefix,  # where to look for js support
                None,
                None,
                "task.tsk",
                "i2.xml")

            if self.layout == 0:
                # Add tree widget
                pyrvapi.rvapi_add_tree_widget(
                    self.navTreeId,  # tree widget reference (Id)
                    "Workflow",  # tree widget title
                    "body",  # reference to widget holder (grid)
                    0,  # holder row
                    0,  # holder column
                    1,  # row span
                    1  # column span
                )
                pyrvapi.rvapi_set_tab_proxy(self.navTreeId, "")

            self.page_cursor = self.addTab(self.summaryTabId, "Summary", True)
            self.putMessage(
                "<h2>CCP4go (Combined Automated Structure Solution)</h2>")

        else:  # continue rvapi document given
            pyrvapi.rvapi_restore_document2(self.rvapi_doc_path)
            meta = pyrvapi.rvapi_get_meta()
            #self.stdout ( "\n META = " + meta )
            if meta:
                d = json.loads(meta)
                if "jobId" in d: self.jobId = d["jobId"]
                if "stageNo" in d: self.stage_no = d["stageNo"]
                if "sge_q" in d: self.SGE = True
                if "sge_tc" in d: self.nSubJobs = d["sge_tc"]
                if "summaryTabId" in d:
                    self.summaryTabId = d["summaryTabId"]
                    self.page_cursor[0] = self.summaryTabId
                if "summaryTabRow" in d:
                    self.summaryTabRow = d["summaryTabRow"]
                    self.page_cursor[1] = self.summaryTabRow
                if "navTreeId" in d:
                    self.navTreeId = d["navTreeId"]
                    pyrvapi.rvapi_set_tab_proxy(self.navTreeId, "")
                if "outputDir" in d: self.outputdir = d["outputDir"]
                if "outputName" in d: self.outputname = d["outputName"]
            #self.stdout ( "\n summaryTabId = " + self.summaryTabId )
            #self.stdout ( "\n summaryTabRow = " + str(self.summaryTabRow) )
            #self.stdout ( "\n layout = " + str(self.layout) )
            #self.stdout ( "\n navTreeId = " + self.navTreeId + "\n" )
            #self.putMessage ( "<h2>YYYYYYYYYYYYYYY</h2>" )
            #self.page_cursor = self.addTab ( "new","New",True )
            #self.putMessage ( "<h2>ZZZZZZZZZZZZZZZZ</h2>" )
            #self.file_stdout.write ( "nSubJobs=" + str(self.nSubJobs) + "\n" )

        return
Exemplo n.º 5
0
    def results_section(self, results_tab_id, mrb_results, ensemble_results, section_title):
        #
        # Results Tab
        #
        if not mrb_results:
            return
        # Create unique identifier for this section by using the id
        # All ids will have this appended to avoid clashes
        uid = str(uuid.uuid4())
        section_id = section_title.replace(" ", "_") + uid
        self.results_tab_sections.append(section_id) # Add to list so we can remove if we update
        pyrvapi.rvapi_add_panel(section_id, results_tab_id, 0, 0, 1, 1)
        pyrvapi.rvapi_add_text("<h3>{0}</h3>".format(section_title), section_id, 0, 0, 1, 1)
        results_tree = "results_tree" + section_id
        pyrvapi.rvapi_add_tree_widget(results_tree, section_title, section_id, 0, 0, 1, 1)
        for r in mrb_results:
            name = r['ensemble_name']
            container_id = "sec_{0}".format(name) + uid
            pyrvapi.rvapi_add_panel(container_id, results_tree, 0, 0, 1, 1)

            header = "<h3>Results for ensemble: {0}</h3>".format(name)
            pyrvapi.rvapi_add_text(header, container_id, 0, 0, 1, 1)

            sec_table = "sec_table_{0}".format(name) + uid
            title = "Results table: {0}".format(name)
            title = "Summary"
            pyrvapi.rvapi_add_section(sec_table, title, container_id, 0, 0, 1, 1, True)
            table_id = "table_{0}".format(name) + uid
            pyrvapi.rvapi_add_table(table_id, "", sec_table, 1, 0, 1, 1, False)
            tdata = mrbump_util.ResultsSummary().results_table([r])
            self.fill_table(table_id, tdata, tooltips=self._mrbump_tooltips)

            # Ensemble
            if ensemble_results:
                epdb = self.ensemble_pdb(r, ensemble_results)
                if epdb:
                    sec_ensemble = "sec_ensemble_{0}".format(name) + uid
                    pyrvapi.rvapi_add_section(sec_ensemble, "Ensemble Search Model", container_id, 0, 0, 1, 1, False)
                    data_ensemble = "data_ensemble_{0}".format(name) + uid
                    pyrvapi.rvapi_add_data(data_ensemble,
                                           "Ensemble PDB",
                                           self.fix_path(epdb),
                                           "XYZOUT",
                                           sec_ensemble,
                                           2, 0, 1, 1, True)
            # PHASER
            if os.path.isfile(str(r['PHASER_logfile'])) or (os.path.isfile(str(r['PHASER_pdbout'])) and os.path.isfile(str(r['PHASER_mtzout']))):
                sec_phaser = "sec_phaser_{0}".format(name) + uid
                pyrvapi.rvapi_add_section(sec_phaser, "PHASER Outputs", container_id, 0, 0, 1, 1, False)
                if os.path.isfile(str(r['PHASER_pdbout'])) and os.path.isfile(str(r['PHASER_mtzout'])):
                    data_phaser = "data_phaser_out_{0}".format(name) + uid
                    pyrvapi.rvapi_add_data(data_phaser,
                                            "PHASER PDB",
                                            os.path.splitext(self.fix_path(r['PHASER_pdbout']))[0],
                                            "xyz:map",
                                            sec_phaser,
                                            2, 0, 1, 1, True)
                    pyrvapi.rvapi_append_to_data(data_phaser, self.fix_path(r['PHASER_mtzout']), "xyz:map")
                if os.path.isfile(str(r['PHASER_logfile'])):
                    pyrvapi.rvapi_add_data("data_phaser_logfile_{0}".format(name),
                                            "PHASER Logfile",
                                            self.fix_path(r['PHASER_logfile']),
                                            "text",
                                            sec_phaser,
                                            2, 0, 1, 1, True)

            # REFMAC
            if os.path.isfile(str(r['REFMAC_logfile'])) or (os.path.isfile(str(r['REFMAC_pdbout'])) and os.path.isfile(str(r['REFMAC_mtzout']))):
                sec_refmac = "sec_refmac_{0}".format(name) + uid
                pyrvapi.rvapi_add_section(sec_refmac, "REFMAC Outputs", container_id, 0, 0, 1, 1, False)
                if os.path.isfile(str(r['REFMAC_pdbout'])) and os.path.isfile(str(r['REFMAC_mtzout'])):
                    data_refmac = "data_refmac_out_{0}".format(name) + uid
                    pyrvapi.rvapi_add_data(data_refmac,
                                            "REFMAC PDB",
                                            os.path.splitext(self.fix_path(r['REFMAC_pdbout']))[0],
                                            "xyz:map",
                                            sec_refmac,
                                            2, 0, 1, 1, True)
                    pyrvapi.rvapi_append_to_data(data_refmac, self.fix_path(r['REFMAC_mtzout']), "xyz:map")
                if os.path.isfile(str(r['REFMAC_logfile'])):
                    pyrvapi.rvapi_add_data("data_refmac_logfile_{0}".format(name),
                                            "REFMAC Logfile",
                                            self.fix_path(r['REFMAC_logfile']),
                                            "text",
                                            sec_refmac,
                                            2, 0, 1, 1, True)

            # Buccaner
            if os.path.isfile(str(r['BUCC_logfile'])) or (os.path.isfile(str(r['BUCC_pdbout'])) and os.path.isfile(str(r['BUCC_mtzout']))):
                sec_bucc = "sec_bucc_{0}".format(name) + uid
                pyrvapi.rvapi_add_section(sec_bucc, "BUCCANEER Outputs", container_id, 0, 0, 1, 1, False)
                if os.path.isfile(str(r['BUCC_pdbout'])) and os.path.isfile(str(r['BUCC_mtzout'])):
                    data_bucc = "data_bucc_out_{0}".format(name) + uid
                    pyrvapi.rvapi_add_data(data_bucc,
                                            "BUCC PDB",
                                            os.path.splitext(self.fix_path(r['BUCC_pdbout']))[0],
                                            "xyz:map",
                                            sec_bucc,
                                            2, 0, 1, 1, True)
                    pyrvapi.rvapi_append_to_data(data_bucc, self.fix_path(r['BUCC_mtzout']), "xyz:map")
                if os.path.isfile(str(r['BUCC_logfile'])):
                    pyrvapi.rvapi_add_data("data_bucc_logfile_{0}".format(name),
                                            "BUCC Logfile",
                                            self.fix_path(r['BUCC_logfile']),
                                            "text",
                                            sec_bucc,
                                            2, 0, 1, 1, True)

            # Arpwarp
            if os.path.isfile(str(r['ARP_logfile'])) or (os.path.isfile(str(r['ARP_pdbout'])) and os.path.isfile(str(r['ARP_mtzout']))):
                sec_arp = "sec_arp_{0}".format(name) + uid
                pyrvapi.rvapi_add_section(sec_arp, "ARPWARP Outputs", container_id, 0, 0, 1, 1, False)
                if os.path.isfile(str(r['ARP_pdbout'])) and os.path.isfile(str(r['ARP_mtzout'])):
                    data_arp = "data_arp_out_{0}".format(name) + uid
                    pyrvapi.rvapi_add_data(data_arp,
                                            "ARP PDB",
                                            os.path.splitext(self.fix_path(r['ARP_pdbout']))[0],
                                            "xyz:map",
                                            sec_arp,
                                            2, 0, 1, 1, True)
                    pyrvapi.rvapi_append_to_data(data_arp, self.fix_path(r['ARP_mtzout']), "xyz:map")
                if os.path.isfile(str(r['ARP_logfile'])):
                    pyrvapi.rvapi_add_data("data_arp_logfile_{0}".format(name),
                                            "ARP Logfile",
                                            self.fix_path(r['ARP_logfile']),
                                            "text",
                                            sec_arp,
                                            2, 0, 1, 1, True)


            # SHELXE
            if os.path.isfile(str(r['SHELXE_logfile'])) or (os.path.isfile(str(r['SHELXE_pdbout'])) and os.path.isfile(str(r['SHELXE_mtzout']))):
                sec_shelxe = "sec_shelxe_{0}".format(name) + uid
                pyrvapi.rvapi_add_section(sec_shelxe, "SHELXE Outputs", container_id, 0, 0, 1, 1, False)
                if os.path.isfile(str(r['SHELXE_pdbout'])) and os.path.isfile(str(r['SHELXE_mtzout'])):
                    data_shelxe = "data_shelxe_out_{0}".format(name) + uid
                    pyrvapi.rvapi_add_data(data_shelxe,
                                            "SHELXE PDB",
                                            os.path.splitext(self.fix_path(r['SHELXE_pdbout']))[0],
                                            "xyz:map",
                                            sec_shelxe,
                                            2, 0, 1, 1, True)
                    pyrvapi.rvapi_append_to_data(data_shelxe, self.fix_path(r['SHELXE_mtzout']), "xyz:map")
                if os.path.isfile(str(r['SHELXE_logfile'])):
                    pyrvapi.rvapi_add_data("data_shelxe_logfile_{0}".format(name),
                                            "SHELXE Logfile",
                                            self.fix_path(r['SHELXE_logfile']),
                                            "text",
                                            sec_shelxe,
                                            2, 0, 1, 1, True)

            # Buccaner Rebuild
            if os.path.isfile(str(r['SXRBUCC_logfile'])) or (os.path.isfile(str(r['SXRBUCC_pdbout'])) and os.path.isfile(str(r['SXRBUCC_mtzout']))):
                sec_sxrbucc = "sec_sxrbucc_{0}".format(name) + uid
                pyrvapi.rvapi_add_section(sec_sxrbucc, "BUCCANEER SHELXE Trace Rebuild Outputs", container_id, 0, 0, 1, 1, False)
                if os.path.isfile(str(r['SXRBUCC_pdbout'])) and os.path.isfile(str(r['SXRBUCC_mtzout'])):
                    data_sxrbucc = "data_sxrbucc_out_{0}".format(name) + uid
                    pyrvapi.rvapi_add_data(data_sxrbucc,
                                            "SXRBUCC PDB",
                                            os.path.splitext(self.fix_path(r['SXRBUCC_pdbout']))[0],
                                            "xyz:map",
                                            sec_sxrbucc,
                                            2, 0, 1, 1, True)
                    pyrvapi.rvapi_append_to_data(data_sxrbucc, self.fix_path(r['SXRBUCC_mtzout']), "xyz:map")
                if os.path.isfile(str(r['SXRBUCC_logfile'])):
                    pyrvapi.rvapi_add_data("data_sxrbucc_logfile_{0}".format(name),
                                            "SXRBUCC Logfile",
                                            self.fix_path(r['SXRBUCC_logfile']),
                                            "text",
                                            sec_sxrbucc,
                                            2, 0, 1, 1, True)

            # Arpwarp Rebuild
            if os.path.isfile(str(r['SXRARP_logfile'])) or (os.path.isfile(str(r['SXRARP_pdbout'])) and os.path.isfile(str(r['SXRARP_mtzout']))):
                sec_sxrarp = "sec_sxrarp_{0}".format(name) + uid
                pyrvapi.rvapi_add_section(sec_sxrarp, "ARPWARP SHELXE Trace Redbuild Outputs", container_id, 0, 0, 1, 1, False)
                if os.path.isfile(str(r['SXRARP_pdbout'])) and os.path.isfile(str(r['SXRARP_mtzout'])):
                    data_sxrarp = "data_sxrarp_out_{0}".format(name) + uid
                    pyrvapi.rvapi_add_data(data_sxrarp,
                                           "SXRARP PDB",
                                           os.path.splitext(self.fix_path(r['SXRARP_pdbout']))[0],
                                           "xyz:map",
                                           sec_sxrarp,
                                           2, 0, 1, 1, True)
                    pyrvapi.rvapi_append_to_data(data_sxrarp, self.fix_path(r['SXRARP_mtzout']), "xyz:map")
                if os.path.isfile(str(r['SXRARP_logfile'])):
                    pyrvapi.rvapi_add_data("data_sxrarp_logfile_{0}".format(name),
                                           "SXRARP Logfile",
                                           self.fix_path(r['SXRARP_logfile']),
                                           "text",
                                           sec_sxrarp,
                                           2, 0, 1, 1, True)

            pyrvapi.rvapi_set_tree_node(results_tree, container_id, "{0}".format(name), "auto", "")
        return