Skip to content

Commit

Permalink
using root_dir prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
Tianhao-Gu committed Oct 24, 2023
1 parent 9e75885 commit bd5c129
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/loaders/compute_tools/checkm2/versions.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# reference_db_path: DIAMOND database CheckM2 relies on
# reference_db_path: directory, relative to the ROOT_DIR/libraries/checkm2, containing the DIAMOND database CheckM2 relies on
# download data following the instructions provided on https://github.com/chklovski/CheckM2#database

versions:
- version: 0.1.0
date: 2023-07-19
reference_db_path: /global/cfs/cdirs/kbase/collections/libraries/CheckM2_database
reference_db_path: CheckM2_database
- version: 0.1.1
date: 2023-08-04
notes: |
- install jsonlines, pandas to support parsing of CheckM2 output
reference_db_path: /global/cfs/cdirs/kbase/collections/libraries/CheckM2_database
reference_db_path: CheckM2_database
9 changes: 5 additions & 4 deletions src/loaders/compute_tools/gtdb_tk/versions.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# reference_db_path: directory containing the unarchived GTDB-Tk reference data
# reference_db_path: directory, relative to the ROOT_DIR/libraries/gtdb_tk, containing the unarchived GTDB-Tk reference data
# download data following the instructions provided on
# https://ecogenomics.github.io/GTDBTk/installing/index.html#gtdb-tk-reference-data

# NOTE: Note that different versions of the GTDB release data may not run on all versions of GTDB-Tk
# Please check gtdb_tk/Dockerfile for the version of GTDB-Tk
versions:
- version: 0.1.0
date: 2023-07-19
reference_db_path: /global/cfs/cdirs/kbase/collections/libraries/gtdb_tk/release207_v2
reference_db_path: release207_v2
- version: 0.1.1
date: 2023-08-03
notes: |
- install jsonlines, pandas to support parsing of GTDB-Tk output
reference_db_path: /global/cfs/cdirs/kbase/collections/libraries/gtdb_tk/release207_v2
reference_db_path: release207_v2
9 changes: 5 additions & 4 deletions src/loaders/jobs/taskfarmer/task_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@
# volume name for the Docker containers
TOOL_IMG_VOLUME_NAME = {'checkm2': '/CheckM2_database',
'gtdb_tk': '/gtdbtk_reference_data'}
LIBRARY_DIR = 'libraries' # subdirectory for the library files


def _retrieve_tool_volume(tool):
def _retrieve_tool_volume(tool, root_dir):
# Retrieve the volume mapping for the specified tool.

current_dir = os.path.dirname(os.path.abspath(__file__))
Expand All @@ -80,8 +81,8 @@ def _retrieve_tool_volume(tool):
if tool in TOOL_IMG_VOLUME_NAME.keys():
if not ref_db_path:
raise ValueError(f'No reference database path found for tool {tool}.')

return {ref_db_path: TOOL_IMG_VOLUME_NAME[tool]}
ref_db_path_abs = os.path.join(root_dir, LIBRARY_DIR, tool, ref_db_path)
return {ref_db_path_abs: TOOL_IMG_VOLUME_NAME[tool]}

Check warning on line 85 in src/loaders/jobs/taskfarmer/task_generator.py

View check run for this annotation

Codecov / codecov/patch

src/loaders/jobs/taskfarmer/task_generator.py#L81-L85

Added lines #L81 - L85 were not covered by tests
else:
# No reference database path needed for the tool (microtrait, mash).
return dict()

Check warning on line 88 in src/loaders/jobs/taskfarmer/task_generator.py

View check run for this annotation

Codecov / codecov/patch

src/loaders/jobs/taskfarmer/task_generator.py#L88

Added line #L88 was not covered by tests
Expand Down Expand Up @@ -218,7 +219,7 @@ def _create_task_list(
chunk_size = TASK_META.get(tool, TASK_META['default'])['chunk_size']
genome_ids_chunks = [genome_ids[i: i + chunk_size] for i in range(0, len(genome_ids), chunk_size)]

vol_mounts = _retrieve_tool_volume(tool)
vol_mounts = _retrieve_tool_volume(tool, root_dir)

Check warning on line 222 in src/loaders/jobs/taskfarmer/task_generator.py

View check run for this annotation

Codecov / codecov/patch

src/loaders/jobs/taskfarmer/task_generator.py#L222

Added line #L222 was not covered by tests

task_list = '#!/usr/bin/env bash\n'
for idx, genome_ids_chunk in enumerate(genome_ids_chunks):
Expand Down

0 comments on commit bd5c129

Please sign in to comment.