-
Notifications
You must be signed in to change notification settings - Fork 195
feat: add wrapper for rbt vcf_fix_iupac_alleles #1209
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
base: master
Are you sure you want to change the base?
Changes from 3 commits
e2ccf1e
d5357ed
951f0f7
ef2f74a
33b0a10
612926d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
channels: | ||
- conda-forge | ||
- bioconda | ||
- nodefaults | ||
dependencies: | ||
- rust-bio-tools =0.42.0 | ||
- bcftools =1.16 | ||
- snakemake-wrapper-utils =0.5.3 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: rbt vcf-fix-iupac-alleles | ||
description: | | ||
Convert any IUPAC codes in alleles into Ns (in order to comply with VCF 4 specs). | ||
url: https://github.com/rust-bio/rust-bio-tools | ||
authors: | ||
- Filipe G. Vieira | ||
input: | ||
- VCF | ||
output: | ||
- VCF/BCF |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
rule vcf_fix_iupac_alleles: | ||
input: | ||
"{file}.vcf.gz", | ||
output: | ||
vcf="results/{file}.vcf.gz", | ||
idx="results/{file}.vcf.gz.tbi", | ||
log: | ||
"logs/{file}.log", | ||
params: | ||
extra="", | ||
threads: 1 | ||
resources: | ||
mem_mb=1024, | ||
wrapper: | ||
"master/bio/rbt/vcf_fix_iupac_alleles" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
__author__ = "Filipe G. Vieira" | ||
__copyright__ = "Copyright 2023, Filipe G. Vieira" | ||
__license__ = "MIT" | ||
|
||
import tempfile | ||
from snakemake.shell import shell | ||
from snakemake_wrapper_utils.bcftools import get_bcftools_opts | ||
|
||
|
||
bcftools_opts = get_bcftools_opts(snakemake, parse_ref=False) | ||
log = snakemake.log_fmt_shell(stdout=True, stderr=True) | ||
extra = snakemake.params.get("extra", "") | ||
|
||
|
||
with tempfile.TemporaryDirectory() as tmpdir: | ||
shell( | ||
"(rbt vcf-fix-iupac-alleles {extra} < {snakemake.input[0]} | bcftools sort --temp-dir {tmpdir} {bcftools_opts}) {log}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the sort? rbt vcf-fix-iupac-alleles does not change the order of the records. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The main idea was to allow for automatic output on any format ( But I can also remove it (or switch to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ping @johanneskoester |
||
) | ||
|
||
if snakemake.output.get("idx"): | ||
shell("tabix -p vcf {snakemake.output.vcf}") |
Uh oh!
There was an error while loading. Please reload this page.