Skip to content

Commit

Permalink
Allow multiple arguments to diamond blastx
Browse files Browse the repository at this point in the history
  • Loading branch information
lvreynoso committed May 8, 2024
1 parent 70567a9 commit 3a3c9bd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
10 changes: 9 additions & 1 deletion lib/idseq_utils/idseq_utils/diamond_scatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

import os
import shlex
import shutil
import sys
import errno
Expand Down Expand Up @@ -71,8 +72,15 @@ def diamond_blastx(
database,
"--out",
out,
f"--{diamond_args}",
]

# backwards compatibility for function calls that expect this function
# to automatically append "--" to diamond_args
if diamond_args == "long-reads" or diamond_args == "mid-sensitive":
diamond_args = "--" + diamond_args

cmd.extend(shlex.split(diamond_args))

for query in queries:
cmd += ["--query", query]
if chunk:
Expand Down
5 changes: 2 additions & 3 deletions workflows/diamond/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ WORKDIR /tmp
RUN git clone https://github.com/chanzuckerberg/czid-workflows
WORKDIR /tmp/czid-workflows
RUN pip3 install -r requirements-dev.txt
RUN git checkout rlim-add-diamond-modification
RUN cp short-read-mngs/idseq_utils/idseq_utils/diamond_scatter.py /usr/local/bin/
COPY --from=lib idseq_utils/idseq_utils/diamond_scatter.py /usr/local/bin/

WORKDIR /workdir
WORKDIR /workdir
4 changes: 2 additions & 2 deletions workflows/diamond/diamond.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ task RunDiamond {
}

command <<<
python3 /usr/local/bin/diamond_scatter.py blastx-chunk --db ~{db_chunk} --query ~{query_0} ~{if defined(query_1) then '--query ~{query_1}' else ''} --out-dir chunks --diamond-args "~{extra_args}"
python3 /usr/local/bin/diamond_scatter.py blastx-chunk --db ~{db_chunk} --query ~{query_0} ~{if defined(query_1) then '--query ~{query_1}' else ''} --out-dir chunks --diamond-args="~{extra_args}"
>>>

output {
Expand All @@ -45,4 +45,4 @@ task RunDiamond {
runtime {
docker: docker_image_id
}
}
}

0 comments on commit 3a3c9bd

Please sign in to comment.