stoat vcf - Pa-Tou/stoat GitHub Wiki
This subcommand retrieves the genotypes of each sample across all snarls from a VCF file.
Currently, only VCFs generated by vg call or our branch of PanGenie are compatible.
See wiki page on how to convert and index the graph.
- A pangenome graph file in
.gbzformat. - An r-index (
.rifile) - A distance index (
.distfile), generated from the pangenome graph with the command:vg index -j.
The graph can be pre-processed to produce a file storing information about the snarls. When using this file as input, the graph and indexes are not required.
-
snarl_info.tsv: TSV output fromstoat vcf -g GRAPH -G RI -d DIST(see Preprocessing snarls below).
*The pangenomic VCF is a VCF merged from a pangenomic genotyping pipeline, we recommend using the vg snakemake pipeline.
Details on running this pipeline for stoat vcf can be found here
Note: Sorting the VCF using bcftools sort before running stoat vcf can improve runtime and reduce memory usage.
For example, a VCF might look like:
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT samp1 samp2 samp_g0_11
Chr1 411 >1>9 CGATTATGGA C,CGATTA,CGATT,CGA 396.121 PASS LV=0;DP=1241;AT=>1>2>4>5>6>8>9,>1>9,>1>2>3>5>6>8>9,>1>2>3>5>7>8>9,>1>2>4>5>7>8>9 GT ./1 0/2
Note: The two essential INFO fields used by STOAT are: LV (to find the top-level snarl), and AT (to extract the allele traversals).
A text file listing which reference chromosomes to use. For example, a file with:
Chr1
Chr2
Chr3
Note: use vg paths -x <pg.full.pg> -L to list the names of all paths in the pangenome that you can then filter to keep those to use as reference.
If no chromosome file is provided, STOAT will look for reference paths (those can be listed with vg paths -R -Lx <pg.full.pg>).
Snarls can be listed and prepared in advance.
This is done once per pangenome.
To prepare this TSV file, run stoat vcf providing only the pangenome and distance index files:
stoat vcf -g <graph.gbz> -G <graph.ri> -d <graph.dist> -R <ref_paths.txt> -o <output_directory>This will produce a snarl_info.tsv.gz file in the specified output directory listing all the snarls that should be tested.
See more information about the output below.
If the snarls were preprocessed (recommended, see above), run:
stoat vcf -s <snarl_info.tsv.gz> -v <genotypes.vcf.gz> -R <ref_paths.txt> -o <output directory>Otherwise, just provide the pangenome and indexes:
stoat vcf -g <graph.pg> -d <graph.dist> -v <genotypes.vcf.gz> -R <ref_paths.txt> -o <output directory>This will produce a snarl_genotypes.tsv.gz file in the specified output directory.
It has the same information as the snarl_info.tsv.gz plus the genotypes for each sample/haplotype.
See more information about the output below.
Stoat v0.0.4
Usage: stoat vcf [options]
There are three ways to launch stoat vcf:
Case 1 (snarl path decomposition): -g graph_path -G r-index_path -d dist_path
Case 2 (snarl path decomposition and genotyping): -g graph_path -G r-index_path -d dist_path -v vcf_path
Case 3 (snarl genotyping): -s snarl_path -v vcf_path
Output: snarl_info.tsv.gz and/or snarl_genotypes.tsv.gz written to given output directory
-g, --graph FILE Path to the graph file (must be .gbz format)
-G, --r-index FILE Use this r-index
-d, --dist FILE Path to the distance index file
-s, --snarl FILE Path to the snarl file (use this intermediate file instead of loading the graph, snarl_info.tsv.gz)
-v, --vcf FILE Path to the VCF file
-R, --reference-file FILE Path to the chromosome reference file, one path name per line (optional)
-r, --reference-prefix NAME The prefix of paths to be used as references. (optional)
-f, --resolve-vcf Resolve conflicting calls in the VCF that may arise in nested snarls. This may be slow (pangenie vcf not supported)
-t, --threads INT Number of threads to use [1]
-V, --verbose INT Verbosity level (0=error, 1=warn, 2=info, 3=debug, 4=trace) [2]
-o, --output FILE Output directory name [stoat_output]
-u, --no-bgzip Don't compress the output file with bgzip
-a, --ascii Print the STOAT ascii art b
Files are written in the output directory specified with -o.
A log will also be saved in this directory.
This directory will be created if necessary.
If only given pangenome indexes (-g, -r, and -d), stoat vcf will prepare a set of snarls to genotype/test later (see Preprocessing snarls above).
The selected snarl and the relevant info will be written in snarl_info.tsv.gz.
The snarl_genotypes.tsv.gz is created using the VCF file with either the snarl_info.tsv file or the graph and indexes.
The snarl_genotypes.tsv.gz file contains the same information as the snarl_info file plus the genotypes for each sample/haplotype.
The format of the two files is described here.