VARSCAN SOMATIC
Varscan Somatic calls variants and identifies their somatic status (Germline/LOH/Somatic) using pileup files from a matched tumor-normal pair.
Example
This wrapper can be used in the following way:
rule varscan_somatic_single_mpileup:
input:
"mpileup/{sample}.mpileup.gz",
output:
snp="single_mpileup/vcf/{sample}.snp.vcf",
indel="single_mpileup/vcf/{sample}.indel.vcf",
log:
"logs/single_mpileup/{sample}.log",
message:
"Calling somatic variants from sample {wildcards.sample} using a normal-tumor file"
threads: 1
resources:
mem_mb=1024,
params:
extra="",
wrapper:
"v9.1.0/bio/varscan/somatic"
rule varscan_somatic_dual_mpileup:
input:
"mpileup/{sample}.mpileup.gz",
"mpileup/{sample}.tumor.mpileup.gz",
output:
snp="dual_mpileup/vcf/{sample}.snp.vcf",
indel="dual_mpileup/vcf/{sample}.indel.vcf",
log:
"logs/dual_mpileup/{sample}.log",
message:
"Calling somatic variants from sample {wildcards.sample} using both normal and tumor files."
threads: 1
resources:
mem_mb=1024,
params:
extra="",
wrapper:
"v9.1.0/bio/varscan/somatic"
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.
Software dependencies
varscan=2.4.6snakemake-wrapper-utils=0.8.0
Input/Output
Input:
A pair of pileup files (Normal/Tumor)
Output:
A VCF file
Code
"""Snakemake wrapper for varscan somatic"""
__author__ = "Thibault Dayris"
__copyright__ = "Copyright 2019, Dayris Thibault"
__email__ = "thibault.dayris@gustaveroussy.fr"
__license__ = "MIT"
import os
from snakemake.shell import shell
from snakemake_wrapper_utils.java import get_java_opts
# Defining logging and gathering extra parameters
log = snakemake.log_fmt_shell(stdout=True, stderr=True)
extra = snakemake.params.get("extra", "")
java_opts = get_java_opts(snakemake)
# Output prefix
prefix = os.path.splitext(snakemake.output.snp)[0]
# Case there is a mpileup with both normal and tumor
mpileup = "--mpileup 1" if len(snakemake.input) == 1 else ""
shell(
"varscan somatic" # Tool and its subcommand
" {snakemake.input}" # Path to input file(s)
" {prefix}" # Path to output
" {java_opts}" # Java options
" {extra}" # Extra parameters
" {mpileup}"
" --output-snp {snakemake.output.snp}" # Path to snp output file
" --output-indel {snakemake.output.indel}" # Path to indel output file
" {log}"
)