Skip to content

Commit a239c12

Browse files
committed
update download_reference to support k=63
1 parent 7a985c3 commit a239c12

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

kb_python/main.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ def parse_ref(
263263
args.workflow,
264264
files,
265265
overwrite=args.overwrite,
266-
temp_dir=temp_dir
266+
temp_dir=temp_dir,
267+
k=31 if not args.k else args.k
267268
)
268269
elif args.workflow == 'nac':
269270
ref_nac(

kb_python/ref.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,8 @@ def download_reference(
383383
workflow: str,
384384
files: Dict[str, str],
385385
temp_dir: str = 'tmp',
386-
overwrite: bool = False
386+
overwrite: bool = False,
387+
k: int = 31
387388
) -> Dict[str, str]:
388389
"""Downloads a provided reference file from a static url.
389390
@@ -395,6 +396,7 @@ def download_reference(
395396
paths to download the given reference have been provided
396397
temp_dir: Path to temporary directory, defaults to `tmp`
397398
overwrite: Overwrite an existing index file, defaults to `False`
399+
k: k-mer size, defaults to `31` (only `31` and `63` are supported)
398400
399401
Returns:
400402
Dictionary containing paths to generated file(s)
@@ -424,8 +426,13 @@ def download_reference(
424426
f'The following workflow option is not supported: {workflow}'
425427
)
426428

429+
long = ""
430+
if k == 63:
431+
long = "_long"
432+
elif k != 31:
433+
logger.info("Only k-mer lengths 31 or 63 supported, defaulting to 31")
427434
url = "https://github.com/pachterlab/kallisto-transcriptome-indices/"
428-
url = url + f'releases/download/v1/{species}_index_{workflow}.tar.xz'
435+
url = url + f'releases/download/v1/{species}_index_{workflow}{long}.tar.xz'
429436
path = os.path.join(temp_dir, os.path.basename(url))
430437
logger.info(
431438
'Downloading files for {} ({} workflow) from {} to {}'.format(

0 commit comments

Comments
 (0)