Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bug with -O being used for gap opening penalty and samtools output directory #1450

Merged
merged 16 commits into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bio/minimap2/aligner/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ notes: |
* The `extra` param allows for additional arguments for minimap2.
* The `sort` param allows to enable sorting (if output not PAF), and can be either 'none', 'queryname' or 'coordinate'.
* The `sort_extra` allows for extra arguments for samtools/picard
* The `gap_opening` allows for setting gap opening penalty for minimap2.
4 changes: 4 additions & 0 deletions bio/minimap2/aligner/test/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ rule minimap2_paf:
extra="-x map-pb", # optional
sorting="coordinate", # optional: Enable sorting. Possible values: 'none', 'queryname' or 'coordinate'
sort_extra="", # optional: extra arguments for samtools/picard
gap_opening="4" #optional: gap opening penalty for minimap2. Example usage: '4' or '4,24'
threads: 3
wrapper:
"master/bio/minimap2/aligner"
Expand All @@ -27,6 +28,7 @@ rule minimap2_sam:
extra="-x map-pb", # optional
sorting="none", # optional: Enable sorting. Possible values: 'none', 'queryname' or 'coordinate'
sort_extra="", # optional: extra arguments for samtools/picard
gap_opening="4" #optional: gap opening penalty for minimap2. Example usage: '4' or '4,24'
threads: 3
wrapper:
"master/bio/minimap2/aligner"
Expand All @@ -44,6 +46,7 @@ rule minimap2_sam_sorted:
extra="-x map-pb", # optional
sorting="queryname", # optional: Enable sorting. Possible values: 'none', 'queryname' or 'coordinate'
sort_extra="", # optional: extra arguments for samtools/picard
gap_opening="4" #optional: gap opening penalty for minimap2. Example usage: '4' or '4,24'
threads: 3
wrapper:
"master/bio/minimap2/aligner"
Expand All @@ -61,6 +64,7 @@ rule minimap2_bam_sorted:
extra="-x map-pb", # optional
sorting="coordinate", # optional: Enable sorting. Possible values: 'none', 'queryname' or 'coordinate'
sort_extra="", # optional: extra arguments for samtools/picard
gap_opening="4" #optional: gap opening penalty for minimap2. Example usage: '4' or '4,24'
threads: 3
wrapper:
"master/bio/minimap2/aligner"
5 changes: 5 additions & 0 deletions bio/minimap2/aligner/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
log = snakemake.log_fmt_shell(stdout=False, stderr=True)
sort = snakemake.params.get("sorting", "none")
sort_extra = snakemake.params.get("sort_extra", "")
gap_opening = snakemake.params.get("gap_opening", "")

out_ext = infer_out_format(snakemake.output[0])

Expand All @@ -40,11 +41,15 @@
else:
raise ValueError(f"Unexpected value for params.sort: {sort}")

#prepend -O to the command only if gap_opening is specified
huzuner marked this conversation as resolved.
Show resolved Hide resolved
if gap_opening:
gap_opening = f"-O {gap_opening}"

shell(
"(minimap2"
" -t {snakemake.threads}"
" {extra} "
" {gap_opening} "
" {snakemake.input.target}"
" {snakemake.input.query}"
" {pipe_cmd}"
Expand Down