Skip to content

Commit

Permalink
Merge pull request #72 from uab-cgds-worthey/check_mount_paths_exist
Browse files Browse the repository at this point in the history
Checks mount paths exist
  • Loading branch information
ManavalanG authored May 11, 2023
2 parents 3fdc41c + 4718839 commit 7461a60
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
5 changes: 5 additions & 0 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ YYYY-MM-DD John Doe
```
---

2023-05-09 Manavalan Gajapathy

* Adds a verification step in the CLI wrapper script to check if the file/dirpaths to be mounted to singularity already exist as expected (#71)
* Resolves dirpaths of datasets in the workflow config file to obtain their full path

2023-04-10 Manavalan Gajapathy

* Refactors snakemake pipeline to fully run jobs in direct singularity containers. No more creation of conda environment using singularity containers! (#69)
Expand Down
31 changes: 27 additions & 4 deletions src/run_quac.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,26 @@ def make_dir(d):
return None


def check_mount_paths_exist(paths):
"""
Verify the paths to be mounted to Singularity exist
"""

fail_paths = []
for path in paths:
# print(path)
if not Path(path).exists():
fail_paths.append(str(path))

if fail_paths:
fail_paths = "\n".join(fail_paths)
raise SystemExit(
f"ERROR: Following directories that are part of your input were not found: \n{fail_paths}"
)

return None


def read_workflow_config(workflow_config_fpath):
"""
Read workflow config file to
Expand All @@ -41,15 +61,15 @@ def read_workflow_config(workflow_config_fpath):
mount_paths = set()
datasets = data["datasets"]
# ref genome
mount_paths.add(Path(datasets["ref"]).parent)
mount_paths.add(Path(get_full_path(datasets["ref"])).parent)

# somalier resource files
for resource in datasets["somalier"]:
mount_paths.add(Path(datasets["somalier"][resource]).parent)
mount_paths.add(Path(get_full_path(datasets["somalier"][resource])).parent)

# verifyBamID resource files
for resource in datasets["verifyBamID"]:
mount_paths.add(Path(datasets["verifyBamID"][resource]).parent)
mount_paths.add(Path(get_full_path(datasets["verifyBamID"][resource])).parent)

# get slurm partitions
slurm_partitions_dict = data["slurm_partitions"]
Expand Down Expand Up @@ -94,6 +114,9 @@ def gather_mount_paths(
paths_in_wokflow_config, _ = read_workflow_config(workflow_config)
mount_paths.update(paths_in_wokflow_config)

# checks paths to be mounted to singularity exist
check_mount_paths_exist(mount_paths)

return ",".join([str(x) for x in mount_paths])


Expand Down Expand Up @@ -160,7 +183,7 @@ def create_snakemake_command(args, repo_path, mount_paths):

def main(args):

repo_path = Path(__file__).absolute().parents[1]
repo_path = Path(get_full_path(__file__)).parents[1]

# process user's input-output config file and get singularity bind paths
mount_paths = gather_mount_paths(
Expand Down

0 comments on commit 7461a60

Please sign in to comment.