mamba create -n truvari python=3.7
python3 -m pip install truvari
Truvari is a command-line toolkit for structural variant (SV) comparison. It's used for benchmarking SVs against a known reference, merging SV calls, and annotating differences.
Ensure your VCF files are bgzipped, sorted, and indexed. Here's how you can prepare your data:
# Compress VCF file
bgzip -c input.vcf > input.vcf.gz
# Sort the compressed VCF
bcftools sort input.vcf.gz -Oz -o sorted_input.vcf.gz
# Index the sorted VCF
tabix -p vcf sorted_input.vcf.gz
To benchmark SVs, use the truvari bench
command:
# Running Truvari benchmarking
truvari bench -b sorted_svim_example.vcf.gz -c sorted_pbsv.vcf.gz -o truvari_output/ --reference GRCh38.p13.genome.fa
truvari bench -b base.vcf.gz -c comp.vcf.gz -o output_directory
Replace base.vcf.gz
with your reference VCF file and comp.vcf.gz
with the VCF file you want to compare.
After running the benchmarking, Truvari will generate an output_directory
containing:
summary.txt
: A summary of the stats between the base and comparison.tp-base.vcf.gz
andtp-call.vcf.gz
: True positives from the base and call sets.fn.vcf.gz
: False negatives.fp.vcf.gz
: False positives.
To check the results, you can look into summary.json
:
cat output_directory/summary.json
Truvari has several advanced options for fine-tuning the comparison, such as adjusting size filters and match criteria. Consult the official Truvari documentation for detailed usage and examples.