Exemple #1
0
def plugin(command, name):
    """
    Enable or disable plugins

    genomepy plugin list                 show plugins and status

    genomepy plugin enable  [NAME(S)]    enable plugins

    genomepy plugin disable [NAME(S)]    disable plugins
    """
    genomepy.manage_plugins(command, name)
# redirect all messages to a logfile
with open(logfile, "w") as log:
    with contextlib.redirect_stdout(log), contextlib.redirect_stderr(log):
        genomepy.logger.remove()
        genomepy.logger.add(
            logfile,
            format=
            "<green>{time:HH:mm:ss}</green> <bold>|</bold> <blue>{level}</blue> <bold>|</bold> {message}",
            level="INFO",
        )

        # list user plugins
        active_plugins = genomepy.config.config.get("plugin", [])
        if active_plugins:
            print("Deactivating user plugins")
            genomepy.manage_plugins("disable", active_plugins)

        # select user specified provider
        if provider is None:
            # select a provider with the annotation
            provider = providers[assembly]["annotation"]

        try:
            genomepy.install_genome(
                name=assembly,
                provider=provider,
                genomes_dir=genomes_dir,
                only_annotation=True,
                force=True,
            )