Skip to content

Snarl data file format

Xian Chang edited this page Oct 9, 2026 · 2 revisions

The snarl_info.tsv and snarl_genotypes.tsv files both store per-snarl information using the same format, with the genotypes file containing additional information about genotypes of samples. stoat graph and stoat vcf both output a snarl_genotypes.tsv file, while stoat vcf can produce an intermediate snarl_info.tsv file that is used to produce the snarl_genotypes.tsv file. The snarl_genotypes.tsv file is used as input to stoat test

Header

The output file starts with a header with lines starting with #. It contains:

  • The format version, e.g. #SNARL_DATA_v1.0
  • Parameters that were used to filter snarls
  • A section enumerating the reference paths and starting with #REFS
  • The section with the snarl information, starting with #SNARLS

A header might look like:

#SNARL_DATA_v1.0
#allele_size_limit:0
#REFS
#chr1
#chr2
#SNARLS
#START_NODE END_NODE REF_INDEX START_OFFSET END_OFFSET DEPTH ALLELE_LENGTHS WALKS SEQUENCES sample1 sample2 ...
...

Snarl information and genotypes

The rest of the file lists information about each snarl (one snarl per line). Missing information is stored as .. It contains the following columns:

Column name Content
START_NODE/END_NODE Oriented boundary nodes of the snarl, both pointing into the snarl.
REF_INDEX Index of the chromosome/reference path (matching the order in the REFS section of the header, i.e. 0 for first chromosome listed in REFs).
START_OFFSET/END_OFFSET Start/end position of the snarl on the reference path. If it's a nested snarl not on the reference, this will be the coordinates of the first parent snarl on the reference.
DEPTH How deeply nested is the variant? 1 for top-level variant, 2 for nested within a top-level variant, etc.
ALLELE_LENGTHS Comma separated list of the lengths of each allele. For complex variants (i.e. containing nested variants), there could be multiple possible lengths so they are represented as a range (min/max). A SNP will appear as 1,1[,1...]. A simple INDEL will have one zero-length allele and the other non-zero.
WALKS comma separated list of the allele traversals in the snarls simplified netgraph representation. Note: we use >0 to represent a generic nested chain and <0 to represent an out-of-snarl walk.
SEQUENCES Nucleotide sequences for each allele.
[sample/hap name] Genotype (as allele assignments) for each haplotype. Note: a diploid sample will be represented by two columns, for example samp1#0 and samp1#1. . means that the haplotype didn't traverse the snarl.

Note that all per-allele information shares the same order. That is, the first allele in WALKS corresponds to the first allele in SEQUENCES, which corresponds to allele 0 in the genotype.

Example

simple_nested_chain

For this graph, which has path0 as the reference, the following is the output snarl_genotypes.tsv file from stoat graph

#SNARL_DATA_v1.1
#allele_size_limit:0
#REFS
#path0#0#path0
#SNARLS
#START_NODE	END_NODE	REF_INDEX	START_OFFSET	END_OFFSET	DEPTH	ALLELE_LENGTHS	WALKS	SEQUENCES	path2#	path1#0#path1#0	path3#	path0#0#path0
>1	<4	0	1	2	1	1,1	>1>3>4,>1>2>4	.	0	1	0	1
>4	<8	0	3	6	1	0,2/3	>4>8,>4>5>0>7>8	.	0	1	1	1
>8	<10	0	7	7	1	.	.	.	.	.	.	.
>5	<7	0	4	5	2	0,1	>5>7,>5>6>7	.	.	0	0	1

This example contains four haploid samples and four snarls. The snarl >4 <8, which is bounded by the right side of node 4 and the left side of node 8, contains two alleles: allele 0 is the deletion with length 0 which takes the walk >4>8, and allele 1 is the insertion which has a minimum length of 2 and a maximum length of 3 and takes the walk >4>5>0>7>8. Since the insertion allele contains a nested snarl >5 <7, the corresponding walk contains the step >0 to indicate that the walk includes a nested snarl with an arbitrary walk between >5 and >7. path2 takes allele 0 and the other three sample/haplotypes take allele 1.

Clone this wiki locally