Skip to content

Commit 1862249

Browse files
author
Nalini Ganapati
committed
Check if workspace is in the cloud for locating cached json files
1 parent e039001 commit 1862249

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

genomicsdb/scripts/genomicsdb_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def get_arrays(interval, contigs_map, partitions):
4848
def main():
4949
parser = argparse.ArgumentParser(
5050
prog="cache",
51-
description="Cache GenomicsDB metadata and generated callset/vidmap/loader json artifacts for workspace cloud URLs", # noqa
51+
description="Cache GenomicsDB metadata and generated callset/vidmap/loader json artifacts for workspace cloud URLs. The metadata is copied to TMPDIR and the json files to the current working directory", # noqa
5252
formatter_class=argparse.RawTextHelpFormatter,
5353
usage="%(prog)s [options]",
5454
)

genomicsdb/scripts/genomicsdb_query.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,17 +407,18 @@ def setup():
407407
args = parser.parse_args()
408408

409409
workspace = genomicsdb_common.normalize_path(args.workspace)
410+
is_cloud_workspace = True if "://" in workspace else False
410411
if not genomicsdb.workspace_exists(workspace):
411412
raise RuntimeError(f"workspace({workspace}) not found")
412413
callset_file = args.callset
413414
if not callset_file:
414-
if not args.no_cache and genomicsdb.is_file("callset.json"):
415+
if is_cloud_workspace and not args.no_cache and genomicsdb.is_file("callset.json"):
415416
callset_file = "callset.json"
416417
else:
417418
callset_file = genomicsdb_common.join_paths(workspace, "callset.json")
418419
vidmap_file = args.vidmap
419420
if not vidmap_file:
420-
if not args.no_cache and genomicsdb.is_file("vidmap.json"):
421+
if is_cloud_workspace and not args.no_cache and genomicsdb.is_file("vidmap.json"):
421422
vidmap_file = "vidmap.json"
422423
else:
423424
vidmap_file = genomicsdb_common.join_paths(workspace, "vidmap.json")

test/scripts/test.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ run_command "genomicsdb_query -w $WORKSPACE -i 4 --chunk-size=4 -b -o $OUTPUT -d
232232
# Duplicates
233233
check_command_with_duplicates "genomicsdb_query -w $WORKSPACE -i 1 -i 1 --chunk-size=2 -o $OUTPUT" 2 "1 1_1"
234234
check_command_with_duplicates "genomicsdb_query -w $WORKSPACE -i 1 -i 1 --chunk-size=2 -s HG00141 -s HG00141 -o $OUTPUT" 1 "1"
235-
235+
run_command "genomicsdb_query -w $WORKSPACE -i 4 --chunk-size=4 -b -o $OUTPUT --no-cache"
236236

237237
OLDSTYLE_JSONS="-l $OLDSTYLE_DIR/loader.json -c $OLDSTYLE_DIR/callset_t0_1_2.json -v $OLDSTYLE_DIR/vid.json"
238238
run_command "genomicsdb_cache -w $WORKSPACE $OLDSTYLE_JSONS $INTERVAL_ARGS"
@@ -247,4 +247,5 @@ run_command "genomicsdb_query -w $WORKSPACE $OLDSTYLE_JSONS $INTERVAL_ARGS -S $T
247247
rm $WORKSPACE/vcfheader.vcf
248248
run_command "genomicsdb_query -w $WORKSPACE $OLDSTYLE_JSONS --list-fields"
249249

250+
250251
cleanup

0 commit comments

Comments
 (0)