示例#1
0
    def triggered():
        proc, out, err = pip(["install", "--upgrade", "drugpy"])
        if out:
            print(out)
        if err:
            print(err)

        if pref_get("LABIMM_RSCRIPT"):
            out, success = rscript("library(bio3d)")
            if "there is no packaged called" in out:
                out, success = rscript("install.packages('bio3d')")
                print(out)
示例#2
0
def __init_plugin__(app=None):
    # Load the plugin in three steps: 1) import PyVOL 2) find msms if necessary 3) try to add gui

    # Import PyVOL
    try:
        from pymol import cmd
        from pyvol import pymol_interface
        cmd.extend('pocket', pymol_interface.pymol_pocket_cmdline)
        cmd.extend('load_pocket', pymol_interface.load_calculation_cmdline)
        # cmd.extend('pose_report', pymol_interface.pose_report)
        logger.debug("PyVOL successfully imported")
    except:
        logger.info("PyVOL not imported; installing from local cache or PyPI to use")

    # add MSMS path to PyMOL preferences
    import distutils
    import distutils.util

    msms_exe = distutils.spawn.find_executable("msms")
    if msms_exe is None:
        try:
            from pymol import plugins
            msms_exe = plugins.pref_get("pyvol_msms_exe", default=None)

            if msms_exe is not None:
                sys.path.append(msms_exe)
        except:
            logger.warning("Cannot load PyMOL plugins module")

    # Try to link the GUI

    try:
        from pymol.plugins import addmenuitemqt
        addmenuitemqt('PyVOL', pyvol_window)
    except:
        logger.warning("PyVOL GUI not able to be loaded. This is most often seen when using older PyMOL distributions that use tkinter for GUIs rather thean QT. Update PyMOL to enable the GUI")

    try:
        cmd.extend("install_pyvol", install_pypi_pyvol)
        cmd.extend("install_cached_pyvol", install_cached_pyvol)
        cmd.extend("update_pyvol", update_pypi_pyvol)
    except:
        logger.warning("PyVOL installation commands not able to be added to command-line interface")
示例#3
0
def rscript(script):
    tmp_fd, tmp_path = tempfile.mkstemp(".R")
    with open(tmp_fd, "w") as tmp_file:
        tmp_file.write(script)
    return run([pref_get("LABIMM_RSCRIPT"), tmp_path])