VCF2VCF.PL
Reformat unconventional VCF
URL: https://github.com/mskcc/vcf2maf/tree/main?tab=readme-ov-file#vcfvcf
Example
This wrapper can be used in the following way:
rule test_vcf2vcf:
input:
vcf="small.vcf",
fasta="small.fa",
# Optional input files
# chain="small.chain",
# normal_bam="normal.bam",
tumor_bam="tumor.bam",
output:
"corrected.vcf",
threads: 1
log:
"test_vcf2vcf.log",
params:
extra=" --new-tumor-id ind2 ",
wrapper:
"v7.4.0/bio/vcf2maf/vcf2vcf"
Note that input, output and log file paths can be chosen freely.
When running with
snakemake --use-conda
the software dependencies will be automatically deployed into an isolated environment before execution.
Notes
This tool has no threading option.
Software dependencies
vcf2maf=1.6.22
Input/Output
Input:
vcf: Path to the VCF to reformatfasta: Path to a reference genomechain: Optional chain file to remap variants to a different assemblynormal_bam: Optional path to normal bam file to overwrite DP:AD:ADF:ADRtumor_bam: Optional path to tumor bam file to overwrite DP:AD:ADF:ADR
Output:
Path to corrected VCF file
Params
extra: Optional parameters besides IO
Code
# coding: utf-8
"""This wrapper handles vcf2vcf.pl"""
__author__ = "Thibault Dayris"
__copyright__ = "Copyright 2020, Thibault Dayris"
__email__ = "thibault.dayris@gustaveroussy.fr"
__license__ = "MIT"
from snakemake.shell import shell
from shlex import quote
extra = snakemake.params.get("extra", "")
log = snakemake.log_fmt_shell(stdout=True, stderr=True)
# Optional input files
chain = snakemake.input.get("chain")
if chain:
extra += f" --remap-chain={quote(chain)}"
normal_bam = snakemake.input.get("normal_bam")
if normal_bam:
extra += f" --normal-bam={quote(normal_bam)}"
tumor_bam = snakemake.input.get("tumor_bam")
if tumor_bam:
extra += f" --tumor-bam={quote(tumor_bam)}"
shell(
"vcf2vcf.pl"
" --input-vcf={snakemake.input.vcf:q}"
" --ref-fasta={snakemake.input.fasta:q}"
" {extra}"
" --output-vcf={snakemake.output:q}"
" {log}"
)