예제 #1
0
def write_jobscript(name,
                    keyword_file,
                    amoptd,
                    directory=None,
                    job_time=86400,
                    extra_options={}):
    """
    Create the script to run MrBump for this PDB.
    """
    if not directory:
        directory = os.getcwd()

    # Next the script to run mrbump
    script = Script(directory=directory,
                    prefix="",
                    stem=name,
                    suffix=ample_util.SCRIPT_EXT)
    if not sys.platform.startswith("win"):
        script.append('[[ ! -d $CCP4_SCR ]] && mkdir $CCP4_SCR\n\n')

    # Get the mrbump command-line
    jobcmd = mrbump_cmd.mrbump_cmd(name, amoptd['mtz'], amoptd['mr_sequence'],
                                   keyword_file)
    script.append(jobcmd)

    # Write script
    script.write()
    logger.debug("Wrote MRBUMP script: %s", script.path)

    return script
예제 #2
0
    def generate_script(self, dat_model):
        logger.debug(
            "Generating script to perform AMORE rotation " + "function on %s",
            dat_model.pdb_code)

        pdb_model = self.template_model.format(dat_model.pdb_code)
        table1 = self.template_table1.format(dat_model.pdb_code)
        hklpck1 = self.template_hklpck1.format(dat_model.pdb_code)
        clmn0 = self.template_clmn0.format(dat_model.pdb_code)
        clmn1 = self.template_clmn1.format(dat_model.pdb_code)
        mapout = self.template_mapout.format(dat_model.pdb_code)

        conv_py = "\"from simbad.db import convert_dat_to_pdb; convert_dat_to_pdb('{}', '{}')\""
        conv_py = conv_py.format(dat_model.dat_path, pdb_model)

        tab_cmd = [
            self.amore_exe, "xyzin1", pdb_model, "xyzout1", pdb_model,
            "table1", table1
        ]
        tab_stdin = self.tabfun_stdin_template.format(x=dat_model.x,
                                                      y=dat_model.y,
                                                      z=dat_model.z,
                                                      a=90,
                                                      b=90,
                                                      c=120)

        rot_cmd = [
            self.amore_exe, 'table1', table1, 'HKLPCK1', hklpck1, 'hklpck0',
            self.hklpck0, 'clmn1', clmn1, 'clmn0', clmn0, 'MAPOUT', mapout
        ]
        rot_stdin = self.rotfun_stdin_template.format(shres=self.shres,
                                                      intrad=dat_model.intrad,
                                                      pklim=self.pklim,
                                                      npic=self.npic,
                                                      step=self.rotastep)
        rot_log = self.template_rot_log.format(dat_model.pdb_code)

        tmp_dir = self.template_tmp_dir.format(dat_model.pdb_code)
        cmd = [
            [EXPORT, "CCP4_SCR=" + tmp_dir],
            ["mkdir", "-p", "$CCP4_SCR\n"],
            [CMD_PREFIX, "$CCP4/bin/ccp4-python", "-c", conv_py, os.linesep],
            tab_cmd + ["<< eof >", os.devnull],
            [tab_stdin],
            ["eof"],
            [os.linesep],
            rot_cmd + ["<< eof >", rot_log],
            [rot_stdin],
            ["eof"],
            [os.linesep],
            ["grep", "-m 1", "SOLUTIONRCD", rot_log, os.linesep],
            ["rm", "-rf", "$CCP4_SCR\n"],
            [EXPORT, "CCP4_SCR=" + self.ccp4_scr],
        ]
        amore_script = Script(directory=self.script_log_dir,
                              prefix="amore_",
                              stem=dat_model.pdb_code)
        for c in cmd:
            amore_script.append(' '.join(map(str, c)))
        amore_log = amore_script.path.rsplit(".", 1)[0] + '.log'
        amore_files = (amore_log, dat_model.dat_path)
        amore_script.write()
        return amore_script, amore_files
예제 #3
0
    def generate_script(self, dat_model):
        logger.debug(
            "Generating script to perform PHASER rotation " + "function on %s",
            dat_model.pdb_code)

        pdb_model = self.template_model.format(dat_model.pdb_code)
        template_rot_log = os.path.join("$CCP4_SCR", "{0}_rot.log")

        conv_py = "\"from simbad.db import convert_dat_to_pdb; convert_dat_to_pdb('{}', '{}')\""
        conv_py = conv_py.format(dat_model.dat_path, pdb_model)

        rot_log = template_rot_log.format(dat_model.pdb_code)
        tmp_dir = self.template_tmp_dir.format(dat_model.pdb_code)

        phaser_cmd = [
            "simbad.rotsearch.phaser_rotation_search",
            "-eid",
            self.eid,
            "-hklin",
            self.mtz,
            "-f",
            self.mtz_labels.f,
            "-sigf",
            self.mtz_labels.sigf,
            "-i",
            self.mtz_labels.i,
            "-sigi",
            self.mtz_labels.sigi,
            "-pdbin",
            pdb_model,
            "-logfile",
            rot_log,
            "-solvent",
            dat_model.solvent,
            "-nmol",
            dat_model.nmol,
            "-work_dir",
            tmp_dir,
        ]
        phaser_cmd = " ".join(str(e) for e in phaser_cmd)

        cmd = [
            [EXPORT, "CCP4_SCR=" + tmp_dir],
            ["mkdir", "-p", "$CCP4_SCR\n"],
            [CMD_PREFIX, "$CCP4/bin/ccp4-python", "-c", conv_py, os.linesep],
            [
                CMD_PREFIX, "$CCP4/bin/ccp4-python", "-m", phaser_cmd,
                os.linesep
            ],
            ["rm", "-rf", "$CCP4_SCR\n"],
            [EXPORT, "CCP4_SCR=" + self.ccp4_scr],
        ]

        phaser_script = Script(directory=self.script_log_dir,
                               prefix="phaser_",
                               stem=dat_model.pdb_code)
        for c in cmd:
            phaser_script.append(' '.join(map(str, c)))
        phaser_log = phaser_script.path.rsplit(".", 1)[0] + '.log'
        phaser_files = (phaser_log, dat_model.dat_path)
        phaser_script.write()
        return phaser_script, phaser_files