vcf2maf

repository·main·Indexed 19 days ago

https://github.com/mskcc/vcf2maf

A toolset for converting VCF files into Mutation Annotation Format (MAF) files, standardizing the selection of a single gene transcript or isoform effect per variant. It utilizes Ensembl's Variant Effect Predictor (VEP) for high-quality annotation. The package includes vcf2maf.pl for VCF to MAF conversion and maf2maf.pl for reannotating existing MAF files.

Tokens
1.2K
Snippets
4
Records
4
Agent score
15%

What's inside vcf2maf

  1. Install vcf2maf and maf2maf

    main

    To install the latest release of vcf2maf, download the tarball from GitHub, extract it, and navigate to the directory. You can view the detailed usage manuals for the scripts using the --man flag.

    Note: This repository is in a maintenance-only phase and is scheduled for archive in Dec 2026. Consider switching to mafsmith for future projects.

    export VCF2MAF_URL=`curl -sL https://api.github.com/repos/mskcc/vcf2maf/releases | grep -m1 tarball_url | cut -d" -f4`
    curl -L -o mskcc-vcf2maf.tar.gz $VCF2MAF_URL; tar -zxf mskcc-vcf2maf.tar.gz; cd mskcc-vcf2maf-*
    perl vcf2maf.pl --man
    perl maf2maf.pl --man
  2. Reannotate MAF files using maf2maf.pl

    main

    The maf2maf.pl script is used to reannotate existing MAF or MAF-like files. It works by internally running maf2vcf followed by vcf2maf.

    Required Input Columns

    The script expects at least the following columns:

    • Chromosome
    • Start_Position
    • Reference_Allele
    • Tumor_Seq_Allele2
    • Tumor_Sample_Barcode

    Zygosity and Read Counts

    • If Tumor_Seq_Allele1 is present, it is used to determine zygosity.
    • If not present, zygosity is determined from variant allele fractions using the --tum-vad-col and --tum-depth-col arguments.
    • For matched normal data, use --nrm-vad-col and --nrm-depth-col along with Matched_Norm_Sample_Barcode.
    perl maf2maf.pl --input-maf tests/test.maf --output-maf tests/test.vep.maf
  3. Run vcf2maf using Docker

    main

    You can run the tools inside a Docker container. First, build the image from the repository source, then run the scripts using docker run.

    # Build the image
    git clone git@github.com:mskcc/vcf2maf.git
    cd vcf2maf
    docker build -t vcf2maf:main .
    docker builder prune -f
    
    # Run scripts
    docker run --rm vcf2maf:main perl vcf2maf.pl --help
    docker run --rm vcf2maf:main perl maf2maf.pl --help
  4. Convert VCF to MAF using vcf2maf.pl

    main

    The vcf2maf.pl script converts VCF files to MAF format. It relies on Ensembl's VEP (Variant Effect Predictor) for annotation.

    Basic Usage

    To perform a standard conversion: perl vcf2maf.pl --input-vcf <input.vcf> --output-maf <output.maf>

    Handling Sample IDs and Genotypes

    • Use --tumor-id and --normal-id to fill columns 16 and 17 of the output MAF with specific sample IDs and to parse genotypes/allele counts from the VCF.
    • If your VCF uses specific hardcoded names for genotype columns (e.g., TUMOR/NORMAL from VarScan), use --vcf-tumor-id and --vcf-normal-id to map them to your desired output IDs.

    VEP Configuration

    If VEP is installed in non-standard locations, specify the paths:

    • --vep-path: Path to the VEP installation.
    • --vep-data: Path to the VEP cache/data.

    Bypassing VEP

    Use --inhibit-vep to skip VEP and create a minimalist MAF-like file using only data from the input VCF. Warning: This is not recommended unless you are certain of the input VCF's annotation quality, as vcf2maf normally runs VEP with specific parameters to ensure standardization.

    # Basic conversion
    perl vcf2maf.pl --input-vcf tests/test.vcf --output-maf tests/test.vep.maf
    
    # Conversion with sample IDs
    perl vcf2maf.pl --input-vcf tests/test.vcf --output-maf tests/test.vep.maf --tumor-id WD1309 --normal-id NB1308
    
    # Handling VarScan-style VCFs
    perl vcf2maf.pl --input-vcf tests/test_varscan.vcf --output-maf tests/test_varscan.vep.maf --tumor-id WD1309 --normal-id NB1308 --vcf-tumor-id TUMOR --vcf-normal-id NORMAL
    
    # Specifying VEP paths
    perl vcf2maf.pl --input-vcf tests/test.vcf --output-maf tests/test.vep.maf --vep-path /opt/vep --vep-data /srv/vep