-
Notifications
You must be signed in to change notification settings - Fork 186
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
feat: add wrapper for rbt vcf_fix_iupac_alleles #1209
Open
fgvieira
wants to merge
6
commits into
snakemake:master
Choose a base branch
from
fgvieira:vcf_fix_iupac_alleles
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e2ccf1e
Added wrapper
fgvieira d5357ed
Added input and output descr
fgvieira 951f0f7
Fix test
fgvieira ef2f74a
removed index and added BCF test
fgvieira 33b0a10
Bump bcftools version
fgvieira 612926d
Merge branch 'master' into vcf_fix_iupac_alleles
fgvieira File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.17 | ||
- snakemake-wrapper-utils =0.5.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
rule vcf_fix_iupac_alleles_vcf: | ||
input: | ||
"{file}.vcf.gz", | ||
output: | ||
vcf="results/{file}.vcf.gz", | ||
log: | ||
"logs/{file}.vcf.log", | ||
params: | ||
extra="", | ||
threads: 1 | ||
resources: | ||
mem_mb=1024, | ||
wrapper: | ||
"master/bio/rbt/vcf_fix_iupac_alleles" | ||
|
||
|
||
use rule vcf_fix_iupac_alleles_vcf as vcf_fix_iupac_alleles_bcf with: | ||
output: | ||
bcf="results/{file}.bcf", | ||
log: | ||
"logs/{file}.bcf.log", |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
__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}" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
The main idea was to allow for automatic output on any format (
bcf
,vcf
,vcf.gz
).Since I was using it to standardize resources (known variation from ensembl), I thought that
sort
would be a nice-to-have (just to be sure the output was sorted) and the extra runtime would be ok since it would only be run once.But I can also remove it (or switch to
view
), if you prefer to keep the wrapper more general.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ping @johanneskoester