Skip to content

Vg genotype

CormacKinsella edited this page Oct 7, 2025 · 2 revisions

Genotype graph variants found in sample reads

Library level GAMs are concatenated to sample level prior to processing, but users should note that currently there is no direct deduplication method for GAM files. The concatenated GAMs are deleted after read support is computed for reduced disk impact.

vg pack

Computes read support (converts alignments to compact coverage index).

Usage: vg pack [options]

Example grave command:

vg pack -t ${task.cpus} -x ${graph} -g ${meta.id}.merged.gam -o ${meta.id}.filtered.pack -Q 5

  • -Q ignore reads with MAPQ < N and positions with base quality < N [0]

Convert reference to align with VCF format

The reference FASTA used here should be in PanSN format, but the raw VCF from vg will not be. We therefore manipulate the reference to be compatible with the VCF.

sed -i 's/.*#/>/g' ${reference_fasta}
rm *.fai && samtools faidx reference.fasta

vg call

Genotypes samples against the variants found in the graph.

Usage: vg call [options] <graph> > output.vcf

Example grave command:

vg call -t ${task.cpus} ${graph} --pack ${meta.id}.filtered.pack --min-support ${params.minimumAlleleSupport},${params.minimumSiteSupport} --baseline-error ${params.baselineErrorSmallVariants},${params.baselineErrorLargeVariants} --snarls ${snarls} --sample ${meta.id} --genotype-snarls --all-snarls --gbz-translation --gbz --ploidy ${params.samplePloidy}

tabix

Indexes VCF files for fast data retrieval.

Usage: tabix [OPTIONS] [FILE] [REGION [...]]

Example grave command:

tabix -p vcf ${meta.id}.raw.vcf.gz

vcfbub

Processes the VCF, discarding nested variants over (--maxNestLevel), unless found within a popped feature. Popped features are those with reference allele length over (--maxRefLength).

Usage: vcfbub [FLAGS] [OPTIONS] --input <FILE>

vcfbub --input ${meta.id}.raw.vcf.gz --max-level ${params.maxNestLevel} --max-ref-length ${params.maxRefLength}

bcftools norm

Left-align and normalize indels.

Usage: bcftools norm [options] <in.vcf.gz>

Example grave command:

bcftools norm -f ${reference_fasta}

bcftools sort

Sorts variants to genome order.

Usage: bcftools sort [OPTIONS] <FILE.vcf>

Example grave command:

bcftools sort

Clone this wiki locally