How to use the snakemake.main function in snakemake

To help you get started, we’ve selected a few snakemake examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github merenlab / anvio / anvio / workflows / __init__.py View on Github external
# that, and at places continues to read from sys.argv in a hardcoded manner. so we have to
        # overwrite our argv here.
        original_sys_argv = copy.deepcopy(sys.argv)

        sys.argv = ['snakemake',
                    '--snakefile',
                    get_workflow_snake_file_path(self.args.workflow),
                    '--configfile',
                    self.args.config_file]

        if self.additional_params:
            sys.argv.extend(self.additional_params)

        if self.list_dependencies:
            sys.argv.extend(['--dryrun', '--printshellcmds'])
            snakemake.main()
            sys.exit(0)
        else:
            sys.argv.extend(['-p'])
            snakemake.main()

        # restore the `sys.argv` to the original for the sake of sakity (totally made up word,
        # but you already know what it means. you're welcome.)
        sys.argv = original_sys_argv
github hyeshik / tailseeker / tailseeker / tskcommand.py View on Github external
def proxy_to_snakemake(tailseeker_dir):
    from snakemake import main

    tailseeker_main_file = os.path.join(tailseeker_dir, 'tailseeker', 'main.py')

    if '-s' not in sys.argv and '--snakefile' not in sys.argv:
        sys.argv.insert(1, '-s')
        sys.argv.insert(2, tailseeker_main_file)

    sys.exit(main())
github merenlab / anvio / anvio / workflows / __init__.py View on Github external
sys.argv = ['snakemake',
                    '--snakefile',
                    get_workflow_snake_file_path(self.args.workflow),
                    '--configfile',
                    self.args.config_file]

        if self.additional_params:
            sys.argv.extend(self.additional_params)

        if self.list_dependencies:
            sys.argv.extend(['--dryrun', '--printshellcmds'])
            snakemake.main()
            sys.exit(0)
        else:
            sys.argv.extend(['-p'])
            snakemake.main()

        # restore the `sys.argv` to the original for the sake of sakity (totally made up word,
        # but you already know what it means. you're welcome.)
        sys.argv = original_sys_argv