Output Files

VCF output

Genotype changes

Twitcher rewrites the genotype of a record whenever it splits a cluster per haplotype: a multi-allelic call such as 1|2 becomes two biallelic records (1|0 and 0|1), and an unphased heterozygous record that local phasing resolved gets a phase and an invented phase set.

Every output record whose GT and/or PS differs from the input VCF carries the TSPHASE INFO flag, declared in the output header. Records that pass through with their genotype and phase set untouched are never flagged. Filter on it with, for example:

bcftools view -i 'INFO/TSPHASE=1' output.vcf

GT and PS are written by Twitcher itself, so the output header always declares both, whether or not the input VCF does. Fields the input does not declare are simply ignored when reading it; the input file and its header are never modified. If the input declares either field with an incompatible type (e.g. PS as String), the output header inherits that declaration and it cannot be corrected. Twitcher warns at startup and leaves the field unwritten.

Unknown flanks

A template switch record carries the TSUNKNOWNFLANK INFO flag when the template of one of its switches lies on the alt and overlaps or touches a nearby variant that was left as reference because its allele on this haplotype is unknown. The copied sequence may then differ on this haplotype. See Variants near a cluster.

Template switches that cannot be written

Rarely, a template switch cannot be expressed as a VCF record. The cluster’s own records are then written instead, with a warning, and counted as alignments.unwritable. Its CSV row is still written.