Skip to content

Commit

Permalink
update download_reference to support k=63
Browse files Browse the repository at this point in the history
  • Loading branch information
Yenaled committed Oct 21, 2024
1 parent 7a985c3 commit a239c12
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion kb_python/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ def parse_ref(
args.workflow,
files,
overwrite=args.overwrite,
temp_dir=temp_dir
temp_dir=temp_dir,
k=31 if not args.k else args.k
)
elif args.workflow == 'nac':
ref_nac(
Expand Down
11 changes: 9 additions & 2 deletions kb_python/ref.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,8 @@ def download_reference(
workflow: str,
files: Dict[str, str],
temp_dir: str = 'tmp',
overwrite: bool = False
overwrite: bool = False,
k: int = 31
) -> Dict[str, str]:
"""Downloads a provided reference file from a static url.
Expand All @@ -395,6 +396,7 @@ def download_reference(
paths to download the given reference have been provided
temp_dir: Path to temporary directory, defaults to `tmp`
overwrite: Overwrite an existing index file, defaults to `False`
k: k-mer size, defaults to `31` (only `31` and `63` are supported)
Returns:
Dictionary containing paths to generated file(s)
Expand Down Expand Up @@ -424,8 +426,13 @@ def download_reference(
f'The following workflow option is not supported: {workflow}'
)

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

0 comments on commit a239c12

Please sign in to comment.