VCF fields¶
Applies to GraffiTE v1.1
Verified against v1.1.0.0 at commit bf51777. The
2024 paper describes v1.0, which
differs in places; see v1.0 vs v1.1.
Every table below gives the Number and Type from the header line the code writes, and the
Source column names the line that writes it. Fields are grouped by the stage that adds them.
Which files carry which group is in Output files.
Reading a GraffiTE VCF record¶
GraffiTE writes standard VCF 4.2 with sequence-resolved alleles. One record from the
pangenome.human.vcf of a three-sample PAV run, the ALT sequence shortened. Three input VCFs take
the truvari collapse path, which strips every upstream INFO field before the merge and puts only
SVLEN back, so no PAV INFO field survives. PAV's ID is in the ID column.
module/main.nf:228,279
chr1 18081 chr1-18082-INS-315_10 t tAGAAGGAATAAGACGGGCCGGGT... . PASS
SVLEN=315;NumCollapsed=4;CollapseId=5.0;
n_hits=1;fragmts=1;match_lengths=298;repeat_ids=AluY;matching_classes=SINE/Alu;
RM_hit_strands=+;RM_hit_IDs=72004;L1_5PINV=None;total_match_length=300;
total_match_span=0.949367;ULTRA_TR=37;ULTRA_TR_span=0.117089;
total_repeat_span=0.949367;polyA=TRUE
GT 1|0 0/0 1|0
| Column | What GraffiTE puts there | Source |
|---|---|---|
ID column |
The caller's ID, with _<n> appended after the truvari merge (n is the record's zero-based position in SVs.vcf, so the first record gets _0): chr1-18082-INS-315_10 above is PAV's chr1-18082-INS-315, the eleventh record in the merge. svim-asm IDs are prefixed with the assembly name (HG002_mat.svim_asm.INS.12). With --vcf the IDs pass through unchanged. An ID of 50 characters or more stops Stage 2. |
module/main.nf:188,280, bin/shorten_ids.py:21, bin/repmask_vcf.sh:42-45 |
REF and ALT columns |
Sequence-resolved. For an insertion REF is the anchor base and ALT is that base plus the inserted sequence; for a deletion REF is the anchor base plus the deleted reference interval, re-read from the reference FASTA, and ALT is the anchor base. Symbolic <INS> and <DEL> records from Sniffles2 are dropped in Stage 1. |
bin/fix_vcf.py:33-44, module/main.nf:132 |
FILTER column |
Whatever the SV caller wrote. GraffiTE defines no FILTER of its own; see Fields inherited from upstream callers. | module/main.nf:591 |
| Sample columns | In pangenome.vcf, one column per Stage 1 sample, holding the genotype its caller wrote (PAV writes phased diploid calls, as above). A genotype missing after the merge is set to 0. In GraffiTE.merged.genotypes.vcf.gz, one column per read set from --genotype_with. |
module/main.nf:278, module/main.nf:894 |
concat_repeatmask, hervk_annotate and merge_VCFs each write a ##GraffiTE_version= line,
holding the content of version.txt (1.1.0), immediately after ##fileformat. Between them they
stamp pangenome.vcf, pangenome.trusted.vcf, pangenome.human.vcf,
pangenome.human.consolidated.vcf and GraffiTE.merged.genotypes.vcf.gz; bcftools view and
hervk_classify.py copy the header whole, so GraffiTE.merged.genotypes.trusted.vcf.gz and
hervk_candidates.vcf carry the line too. The VCFs published earlier, the per-caller calls and
SVs.vcf in 1_SV_search and genotypes_repmasked_filtered.vcf in 2_Repeat_Filtering, have
none.
module/main.nf:409-411,630-633,903
An ALT allele does not mean the TE is present
For a DEL record the transposable element is in the reference and an ALT genotype means
the sample lacks it. The presence-absence TSVs in 3_TSD_search/ fold this polarity for you;
see Output files.
Repeat annotation fields¶
Added by repeatmask_VCF from the RepeatMasker and ULTRA output on each variant's inserted or
deleted sequence. A hit is one RepeatMasker element after its fragments have been grouped by
RepeatMasker's own link ID (column 15 of the .out file); a fragment is one line of that
file. Simple repeats and low-complexity fragments are removed before grouping, so they count
neither as hits nor toward the TE span.
bin/annotate_vcf.R:97-114
| Field | Number | Type | Meaning | Source |
|---|---|---|---|---|
n_hits |
1 | Integer | Hits on the variant sequence. 0 when RepeatMasker found nothing. |
bin/repmask_vcf.sh:21, bin/annotate_vcf.R:178 |
fragmts |
. | Integer | Fragments grouped into each hit, in hit order. | bin/repmask_vcf.sh:25, bin/annotate_vcf.R:166 |
match_lengths |
. | Integer | Bases of the variant covered by each hit, first to last fragment. | bin/repmask_vcf.sh:22, bin/annotate_vcf.R:160 |
repeat_ids |
. | String | Name of each hit, taken from its highest-scoring fragment. A hit whose fragments carry different names gets an (x) suffix. An SVA hit lying entirely inside the VNTR gets a (VNTR_only) suffix; see SVA VNTR polymorphisms. |
bin/repmask_vcf.sh:23, bin/annotate_vcf.R:107-111,151-153 |
matching_classes |
. | String | RepeatMasker class of each hit, as class/family from the library (SINE/Alu, LINE/L1, LTR/ERVK, ...). A (VNTR_only) SVA hit is reported as Simple_repeat here. |
bin/repmask_vcf.sh:24, bin/annotate_vcf.R:109,154-156 |
RM_hit_strands |
. | String | Strand of each hit: + or C as RepeatMasker writes them. A hit whose fragments lie on both strands reports the concatenation (C+, +C), except an L1 with the C+ twin-priming signature, whose strand is inferred; see L1 5' inversions. |
bin/repmask_vcf.sh:26, bin/annotate_vcf.R:104,120-127 |
RM_hit_IDs |
. | String | RepeatMasker link ID of each hit, so a hit can be found again in repeatmasker_dir/indels.fa.out. |
bin/repmask_vcf.sh:27, bin/annotate_vcf.R:170 |
L1_5PINV |
. | String | Link IDs of the hits flagged as an L1 with a 5' inversion, or None. |
bin/repmask_vcf.sh:30, bin/annotate_vcf.R:119,177 |
total_match_length |
1 | Integer | Bases of the variant covered by TE hits, overlaps counted once. | bin/repmask_vcf.sh:28, bin/repmask_vcf.sh:114-124 |
total_match_span |
1 | Float | total_match_length divided by the variant length. Written for continuity with v1.0, where it was the filter metric; nothing in v1.1 filters on it. |
bin/repmask_vcf.sh:29,121-124 |
ULTRA_TR |
1 | Integer | Bases of the variant that ULTRA annotates as tandem repeat, overlaps counted once. 0 when ULTRA found nothing. |
bin/repmask_vcf.sh:31,102-104 |
ULTRA_TR_span |
1 | Float | ULTRA_TR divided by the variant length, capped at 1. |
bin/repmask_vcf.sh:32,135-137 |
total_repeat_span |
1 | Float | Fraction of the variant covered by the union of TE hits and ULTRA intervals, capped at 1. This is the Stage 2 filter metric: records at or below --repeat_span_cutoff (default 0.80) are discarded. |
bin/repmask_vcf.sh:33,142-147, module/main.nf:579,661 |
A record without any hit has n_hits=0, repeat_ids=None, matching_classes=None,
RM_hit_strands=None, RM_hit_IDs=None and L1_5PINV=None; such records fail the span filter
unless ULTRA covers them.
bin/annotate_vcf.R:205-213
TSD and polyA fields¶
Added by tsd_report and concat_repeatmask to pangenome.vcf, and carried
downstream, including into the genotyped VCFs. A consolidated HERV-K record is built from scratch and
does not carry them.
| Field | Number | Type | Meaning | Source |
|---|---|---|---|---|
TSD |
2 | String | The target site duplication as its 5' copy and its 3' copy, comma-separated and upper-cased: GATTACAG,GATTACAG. The two copies are exact matches. Absent when the search found no duplication of 4 to 20 bp whose ends sit, on average, within 5 bp of the breakpoints. How the search works is in Target site duplications. In output from before commit d1dfd7b the header says Number=1 and the comma reads %2C (GATTACAG%2CGATTACAG); decode it before splitting. |
bin/tsd_annotate_vcf.sh:23,32 |
polyA |
1 | String | TRUE when a tail of at least 8 bp with at least 80% A ends within 5 bp of the variant's 3' end for a plus-strand hit, or the same with T at its 5' end for a minus-strand hit, with or without the matching TSD copy trimmed off. FALSE otherwise, including when the single hit has a mixed strand. NA when n_hits is greater than 1. Before commit d1dfd7b the pipeline trimmed no TSD copy, and from d1dfd7b to 19da5f8 it scanned only the trimmed end; see the changelog. |
bin/add_polyA.py:24-34,71-95,111-158 |
HERV-K classifier fields¶
Written only under --human, by hervk_annotate. pangenome.vcf is left untouched because it
induces the graph, so these fields appear in pangenome.human.vcf, in hervk_candidates.vcf
and in the two consolidated VCFs. What the states mean is in
HERV-K (HML-2) biology.
| Field | Number | Type | Meaning | Source |
|---|---|---|---|---|
HERVK_CLASS |
1 | String | Polymorphism class: null_solo, solo_prov, truncated_prov, null_prov, copy_number or other. |
bin/hervk_classify.py:425 |
HERVK_ALLELE_REF |
1 | String | State of the REF allele: null, solo, provirus, prov_xN (a tandem array of N proviral units sharing an LTR at each junction), partial, or . when unresolved. |
bin/hervk_classify.py:428 |
HERVK_ALLELE |
. | String | State of each ALT allele, in ALT order, same vocabulary. | bin/hervk_classify.py:432 |
HERVK_EVIDENCE |
1 | String | What resolved the states: ARCH_2LTR, ARCH_PERM, ARCH_INT_PERM, CNV_PERIOD, ARCH_SOLO, REF_ANNOT, DENOVO_LTR, UNRESOLVED or NON_HML2. |
bin/hervk_classify.py:434 |
HERVK_ARCH |
1 | String | 5' to 3' architecture of the variant allele with consensus intervals, for example LTR:575-968/INT:1-7536/LTR:1-574. |
bin/hervk_classify.py:437 |
HERVK_K |
1 | Integer | Where the aligner broke the reference solo LTR. An alignment property that varies between haplotypes and callers; do not key on its value. | bin/hervk_classify.py:440 |
HERVK_J |
1 | Integer | The same for the internal region, the ARCH_INT_PERM counterpart of HERVK_K. |
bin/hervk_classify.py:443 |
HERVK_N_UNITS_REF |
1 | Integer | Proviral units in the masked reference element, a junction LTR counted once. | bin/hervk_classify.py:446 |
HERVK_UNIT_BP |
1 | Integer | Period of the reference array in bp: one internal region plus one LTR. A copy-number change moves a whole number of these. | bin/hervk_classify.py:448 |
HERVK_REF_STATE |
1 | String | State of the masked reference window: null, solo, provirus, partial or unknown. |
bin/hervk_classify.py:451 |
HERVK_LAMBDA |
1 | Float | bp of HML-2 LTR sequence on the variant allele. | bin/hervk_classify.py:453 |
HERVK_NU |
1 | Float | bp of HML-2 internal (HERVK-int) sequence on the variant allele. |
bin/hervk_classify.py:455 |
HERVK_COV |
1 | Float | Fraction of the variant allele that is HML-2 sequence. | bin/hervk_classify.py:457 |
HERVK_PMAP |
1 | Float | Confidence in the class under the size model, used by --hervk_strict; it does not determine the class. |
bin/hervk_classify.py:459 |
HERVK_NOTE |
. | String | Diagnostics: REF_ARCH_CONFLICT (architecture and masked reference imply different REF states), CNV_UNITS:a->b (units on REF and ALT), UNIT_COUNT_ASSUMED (the count came from the architecture, since the reference did not resolve into counted units). |
bin/hervk_classify.py:462 |
HERV-K locus flags¶
Added by hervk_reconcile.py flag to pangenome.human.vcf after classification, and carried
onto the genotyped human VCF. They group records that describe the same element and say what
varies there. Records are never merged at this stage; the genotyped calls are matched to this file
by ID, so its structure has to stay.
| Field | Number | Type | Meaning | Source |
|---|---|---|---|---|
HERVK_LOCUS |
1 | String | Locus identifier shared by the records that describe one element. | bin/hervk_reconcile.py:96 |
HERVK_LOCUS_N |
1 | Integer | Records assigned to the locus. | bin/hervk_reconcile.py:98 |
HERVK_MEI |
0 | Flag | A null allele segregates: the element is absent from some haplotypes, so a transposition produced the difference. This is the flag that separates an insertion polymorphism, comparable to an Alu, L1 or SVA insertion, from structural variation in an element every haplotype carries. | bin/hervk_reconcile.py:100 |
HERVK_SOLO_PROV |
0 | Flag | A solo LTR and a provirus both segregate. Can be set beside the other two flags. | bin/hervk_reconcile.py:106 |
HERVK_CNV |
0 | Flag | Some allele carries two or more proviral units. Can be set beside the other two flags. | bin/hervk_reconcile.py:109 |
HERVK_LOCUS_TYPE |
1 | String | One label derived from the flags: null_vs_present when HERVK_MEI is set, else copy_number, else solo_vs_provirus, else unresolved. For a locus that is two things at once, this field holds only the first; the flags are the precise statement. |
bin/hervk_reconcile.py:113 |
HERVK_MERGE_FLAG |
0 | Flag | The locus holds more than one record. | bin/hervk_reconcile.py:118 |
HERVK_POLARITY_CONFLICT |
0 | Flag | Records at the locus imply different REF states. The masked reference wins, and consolidation resolves it. | bin/hervk_reconcile.py:122 |
In a cohort of 20 diploid human genomes, chr6:78,894,316 segregates a solo LTR, a provirus and a two-unit allele. It is
labeled copy_number and carries both HERVK_SOLO_PROV and HERVK_CNV.
Consolidated HERV-K records¶
GraffiTE can emit several records for one HERV-K locus: two breakpoints for the same insertion,
or a deletion and an insertion describing opposite directions of the same event. The two
.consolidated. and .human. VCFs hold each locus as one multi-allelic record, with the
fields below. A ##hervk_consolidation=source:... header line says whether the genotypes came
from discovery or from the graph.
bin/hervk_reconcile.py:1167
| Field | Number | Type | Meaning | Source |
|---|---|---|---|---|
SVTYPE |
A | String | Redefined per ALT, since one consolidated record can hold an insertion and a deletion. | bin/hervk_reconcile.py:531 |
SVLEN |
A | Integer | Redefined per ALT for the same reason. | bin/hervk_reconcile.py:532 |
HERVK_MEMBERS |
. | String | Record IDs consolidated into the locus. | bin/hervk_reconcile.py:538 |
HERVK_AC |
. | Integer | Allele count per ALT after dosage resolution across the members. | bin/hervk_reconcile.py:540 |
HERVK_AN |
1 | Integer | Alleles called at the locus. Below 2N it means members were structurally uncalled for some samples, since graph genotyping can call every carrier and still leave some non-carriers uncalled. |
bin/hervk_reconcile.py:542 |
HERVK_N_RESOLVED |
1 | Integer | Samples fully resolved by dosage. | bin/hervk_reconcile.py:545 |
HERVK_N_PARTIAL |
1 | Integer | Samples with some haplotypes unaccounted for; those haplotypes are reported missing. | bin/hervk_reconcile.py:547 |
HERVK_N_PLOIDY_EXCEEDED |
1 | Integer | Samples whose summed ALT dosage exceeds their ploidy, which happens when a third allele was lost to bcftools norm -m-. Their genotypes are set missing. |
bin/hervk_reconcile.py:549 |
HERVK_AC_DISC |
. | Integer | Allele count per ALT from the discovery (assembly) callset, an independent check on HERVK_AC. |
bin/hervk_reconcile.py:552 |
HERVK_AN_DISC |
1 | Integer | Alleles in the discovery callset. | bin/hervk_reconcile.py:554 |
HERVK_DISC_CONCORDANT |
0 | Flag | Graph and discovery agree on every ALT count. | bin/hervk_reconcile.py:556 |
HERVK_GT_MASKED |
0 | Flag | Graph genotypes were withheld at a copy-number locus (see the warning below). | bin/hervk_reconcile.py:558 |
HERVK_ALLELE_NOGT |
. | String | Alleles the graph cannot genotype, for which HERVK_AC reports 0. Their counts are in HERVK_AC_DISC. |
bin/hervk_reconcile.py:564 |
HERVK_DISC_PLOIDY_MISMATCH |
0 | Flag | Discovery and graph disagree on ploidy, so the discovery counts are withheld rather than reported on a denominator the two do not share. Expected on hemizygous chromosomes and with a haploid discovery caller such as svim-asm run per haplotype. | bin/hervk_reconcile.py:570 |
HERVK_MEMBERS_MASKED |
. | String | Members whose genotypes were withheld. | bin/hervk_reconcile.py:575 |
HERVK_ALLELE_SET |
. | String | Every allele state segregating at the locus, including states carried by members that are not in this file. | bin/hervk_reconcile.py:577 |
HERVK_MEMBERS_ABSENT |
. | String | Members the --human filter removed, whose alleles cannot be counted here. |
bin/hervk_reconcile.py:581 |
HERVK_LOCUS_INCOMPLETE |
0 | Flag | Some member is absent from this file, so the frequencies do not cover every allele. | bin/hervk_reconcile.py:584 |
HERVK_MEMBERS_UNRESOLVED |
. | String | Members with no usable allele state. | bin/hervk_reconcile.py:587 |
HERVK_POLARITY_FLIPPED |
. | String | Members whose own polarity disagreed with the locus REF state and were re-expressed against it. | bin/hervk_reconcile.py:589 |
HERVK_LOCUS, HERVK_ALLELE_REF, HERVK_ALLELE and the four locus flags are written again on
consolidated records with the same meaning.
bin/hervk_reconcile.py:509-514,533-536
A copy-number allele cannot be genotyped from short reads
Its ALT path repeats sequence the REF path already carries, so a read from the pre-existing
copy traverses it and non-carriers pick up ALT support. More depth does not remove that.
GraffiTE withholds those alleles from the graph genotypes and names them in
HERVK_ALLELE_NOGT. The other alleles at the same locus are genotyped normally, and the
withheld one takes its frequency from the assemblies. At chr6:78,894,316 the graph counts
the solo allele at AC=8, matching the assemblies, and the two-unit allele comes from
HERVK_AC_DISC.
HERVK_LOCUS_INCOMPLETE means the frequencies are partial
The --human filter is narrower than the HERV-K candidate list, so it can remove some
members of a locus and keep others. In a cohort of 20 diploid human genomes, three loci are in that state. At chr7:4,699,714 it
keeps one of three; all three describe the same 8.5 kb unit, and the two it removes carry a
third RepeatMasker fragment the HERV-K clause does not admit. The surviving record carries
the locus id and the full HERVK_ALLELE_SET, but its counts cover only the alleles still
present. hervk_candidates.vcf has all the records with their assembly genotypes.
When reading these records, quote HERVK_AC and HERVK_AN together rather than a
frequency alone, because AN below 2N deflates the denominator without touching AC. Treat
HERVK_N_PLOIDY_EXCEEDED above zero as a sign of a lost third allele. Do not key on HERVK_K.
FORMAT fields¶
| Field | Number | Type | Meaning | Source |
|---|---|---|---|---|
GT |
1 | String | Genotype. In pangenome.vcf it is the discovery genotype: 1 or 0 per haploid assembly, or the diploid call from Sniffles2 or PAV. In the genotyped VCFs it is what PanGenie or vg call wrote for each read set. |
bin/repmask_vcf.sh:34, bin/merge_vcfs.py:521 |
PanGenie and vg call add their own FORMAT fields (genotype quality, depth, likelihoods) with
their own header lines; GraffiTE passes them through unchanged. Which ones appear depends on the
version of those tools in the container, so they are not listed here.
Fields inherited from upstream callers¶
On a single-input run, SVTYPE, SVLEN and END come from the SV caller. With more than one
input VCF every upstream INFO field is stripped before the truvari merge, truvari collapse adds NumCollapsed,
NumConsolidated and CollapseId, and bcftools +fill-tags recomputes SVLEN as
strlen(ALT) - strlen(REF) after the collapse, so it is negative for a deletion; with a single
input VCF the caller's INFO fields (PAV's HAP, QRY_REGION and so on) are kept. On a
--vcf run, and on a run whose callers produce a single VCF, truvari_merge only copies or
decompresses the input into SVs.vcf, and SVLEN stays whatever the caller wrote, sign convention
included. abs(SVLEN) is what the trusted and human filters test either way.
module/main.nf:17,205-212,222-223,228,260-263,279,545
GraffiTE defines no ##FILTER line and never sets FILTER itself. pangenome.vcf retains the
value the caller wrote, and the caller's ##FILTER definitions (PAV's TRIM, COMPOUND,
QRY_FILTER and SVLEN, for instance) travel with it. The trusted and human subsets require
PASS unless --trusted_ignore_filter or --human_ignore_filter is set.
module/main.nf:25,573,591
One field is defined for the PanGenie graph and comes back in the genotyped VCFs:
| Field | Number | Type | Meaning | Source |
|---|---|---|---|---|
ID |
A | String | Graph variant IDs per ALT allele, in the multi-allelic graph VCF pangenie_index builds. PanGenie writes them into INFO/ID of <sample>_genotyping.vcf.gz; 4_Genotyping/pangenie_graph_variants.tsv maps them back to pangenome.vcf records. |
bin/merge_vcfs.py:520 |
Retired fields¶
| Field (v1.0) | What replaced it |
|---|---|
mam_filter_1 (5P_INV) |
L1_5PINV, written for every run. --mammal is accepted and ignored. |
mam_filter_2 (VNTR_ONLY:...) |
The (VNTR_only) suffix on repeat_ids and Simple_repeat in matching_classes. |
total_match_span as the filter metric |
total_repeat_span with --repeat_span_cutoff. total_match_span is still written. |
bin/repmask_vcf.sh:164-169, bin/annotate_vcf.R:151-156
Filtering GraffiTE VCFs with bcftools¶
On the multi-valued fields (repeat_ids, matching_classes, RM_hit_strands, everything with
Number=.), ~ is evaluated on each element, and ^ anchors each element, so
repeat_ids~"^LTR5_Hs" is true for a record whose value is SVA_A,LTR5_Hs. !~ does not
negate reliably on these fields: matching_classes!~"SINE" is true for every record, SINE/Alu
ones included. GraffiTE's own
--human expression is written with positive matches only for that reason. bcftools regular
expressions also have no alternation, which is why the whitelist parameters are comma-separated
lists rather than A|B.
module/main.nf:533-549
Single-hit Alu insertions with a polyA tail and a TSD:
Read HERV-K from a consolidated VCF; in the unmerged ones a locus is several records and the same allele can be counted twice. Insertion polymorphisms only, the set to use alongside Alu, L1 and SVA:
Every other HERV-K locus, where the element is in every haplotype and its structure varies:
bcftools view -i 'INFO/HERVK_LOCUS!="." && INFO/HERVK_MEI=0' \
GraffiTE.merged.genotypes.human.vcf.gz
Drop loci whose counts do not cover every allele, either because the graph could not count one or
because the --human filter removed a member:
bcftools view -e 'INFO/HERVK_ALLELE_NOGT!="." || INFO/HERVK_LOCUS_INCOMPLETE=1' \
GraffiTE.merged.genotypes.human.vcf.gz
SVA VNTR-only records, which carry Simple_repeat rather than Retroposon/SVA: