-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
755c7b4
commit 7f02efa
Showing
23 changed files
with
1,348 additions
and
1,050 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
repos: | ||
- repo: https://github.com/snakemake/snakefmt | ||
rev: v0.10.2 # Replace by any tag/version ≥0.2.4 : https://github.com/snakemake/snakefmt/releases | ||
hooks: | ||
- id: snakefmt | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.4.4 | ||
hooks: | ||
# Run the linter. | ||
- id: ruff | ||
args: [ --fix ] | ||
# Run the formatter. | ||
- id: ruff-format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,37 @@ | ||
import argparse | ||
from pathlib import Path | ||
import subprocess | ||
import tempfile | ||
|
||
|
||
def parse_args(): | ||
parser = argparse.ArgumentParser(description="set a seed and run the pipeline") | ||
parser.add_argument("--seed", type=int, help="seed") | ||
parser.add_argument("--config_template",type = str, help = "Provide path to template config file") | ||
parser = argparse.ArgumentParser(description='set a seed and run the pipeline') | ||
parser.add_argument('--seed', type=int, help='seed') | ||
parser.add_argument( | ||
'--config_template', type=str, help='Provide path to template config file' | ||
) | ||
return parser.parse_args() | ||
|
||
|
||
def main(args): | ||
with open(args.config_template, 'r') as file: | ||
config_content = file.read() | ||
|
||
config_content = config_content.replace('__seed__', str(args.seed)) | ||
|
||
config_content = config_content.replace("__seed__", str(args.seed)) | ||
|
||
|
||
with open(Path(args.config_template).parent / f"config_{args.seed}.yaml", 'w') as file: | ||
with open( | ||
Path(args.config_template).parent / f'config_{args.seed}.yaml', 'w' | ||
) as file: | ||
file.write(config_content) | ||
|
||
command = ( | ||
"source $(conda info --base)/etc/profile.d/conda.sh && conda activate snakemake; " | ||
f"sbatch --time=24:00:00 --wrap=\"snakemake --cores 10 --configfile config/config_{args.seed}.yaml " | ||
"--software-deployment-method conda --rerun-incomplete -p --keep-going --profile profiles/slurm/\"" | ||
'source $(conda info --base)/etc/profile.d/conda.sh && conda activate snakemake; ' | ||
f'sbatch --time=24:00:00 --wrap="snakemake --cores 10 --configfile config/config_{args.seed}.yaml ' | ||
'--software-deployment-method conda --rerun-incomplete -p --keep-going --profile profiles/slurm/"' | ||
) | ||
|
||
subprocess.run(command, shell=True, check=True, executable='/bin/bash') | ||
|
||
|
||
if __name__ == '__main__': | ||
args = parse_args() | ||
main(args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.