Skip to content

Commit

Permalink
feat: add kGWASflow.py
Browse files Browse the repository at this point in the history
  • Loading branch information
akcorut committed Apr 16, 2023
1 parent 4914c8a commit 698dcb8
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions kGWASflow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env python3

import argparse
import os


# Parse command line arguments
parser = argparse.ArgumentParser(description='Run kGWASflow')
parser.add_argument('-c', '--config-file', default='config/config.yaml', help='Path to the config.yaml file (default: config.yaml)')
# parser.add_argument('--output', type=str, help='Path to output directory')
parser.add_argument('-t', '--threads', type=int, default=1, help='Number of threads')
parser.add_argument('--conda-frontend', type=str, default='conda', help='Conda frontend to use')
parser.add_argument('-n', '--dryrun', action='store_true', help='Dry run', required=False)
parser.add_argument('--samples', type=str, help='Path to samples.tsv file', required=False)
parser.add_argument('--phenotypes', type=str, help='Path to phenos.tsv file', required=False)
parser.add_argument('-r', '--generate-report', action='store_true', help='create an HTML report', required=False)
parser.add_argument('-v', '--verbose', action='store_true', help='Increase output verbosity', required=False)
args = parser.parse_args()

# if config file is not specified, use the default config file
if args.config_file is None:
args.config_file = 'config/config.yaml'

# Define the command to run snakemake
cmd = f'snakemake --use-conda --conda-frontend {args.conda_frontend} --cores {args.threads} --rerun-triggers mtime --rerun-incomplete --configfile {args.config_file}'

if args.dryrun:
cmd += ' --dryrun'

# Add the --report flag if specified
if args.generate_report:
if args.dryrun:
cmd += ' --report kGWASflow-report.html'
if not args.dryrun:
cmd += ' --dryrun --report kGWASflow-report.html'

if args.verbose:
cmd += ' --verbose'

if __name__ == "__main__":
# Run the command
os.system(cmd)

0 comments on commit 698dcb8

Please sign in to comment.