# Convert VCF Variants to TSV

Flatten Variant Call Format (VCF) records into tidy TSV, exploding INFO fields and optional sample genotype columns. Runs locally in your browser.

## Run it

- **CLI:** `gizza tool genomic-vcf-to-tsv "##fileformat=VCFv4.2
#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NA001
chr1	100	rs1	A	G	50	PASS	DP=30;AF=0.5	GT:DP	0/1:20"`
- **Web:** https://gizza.ai/tools/genomic-vcf-to-tsv/
- **Agents:** machine-readable descriptor (parameters JSON Schema) at https://gizza.ai/tools/genomic-vcf-to-tsv/tool.json

## Inputs

- `input` — VCF text _(field)_
- `layout` — Sample layout _(field)_
- `include_info` — Explode INFO fields _(field)_
- `include_samples` — Include sample FORMAT fields _(field)_
- `info_fields` — INFO keys to keep _(field)_
- `pass_only` — Keep only PASS / unfiltered records _(field)_
- `prefix_info` — Prefix INFO columns with INFO_ _(field)_
- `missing` — Missing-value placeholder _(field)_
- `header` — Emit header row _(field)_

## Output

- TSV output (text)

## Query parameters

Open the tool pre-filled and auto-run via URL:

- `input` — VCF text
- `layout` — Sample layout
- `include_info` — Explode INFO fields
- `include_samples` — Include sample FORMAT fields
- `info_fields` — INFO keys to keep
- `pass_only` — Keep only PASS / unfiltered records
- `prefix_info` — Prefix INFO columns with INFO_
- `missing` — Missing-value placeholder
- `header` — Emit header row

Example: `https://gizza.ai/tools/genomic-vcf-to-tsv/?input=%23%23fileformat%3DVCFv4.2%0A%23CHROM%09POS%09ID%09REF%09ALT%09QUAL%09FILTER%09INFO%09FORMAT%09NA001%0Achr1%09100%09rs1%09A%09G%0950%09PASS%09DP%3D30%3BAF%3D0.5%09GT%3ADP%090%2F1%3A20&layout=long&include_info=true&include_samples=true&info_fields=DP%2CAF&pass_only=true&prefix_info=true&missing=.&header=true`

---

## About this tool

VCF files are compact for variant callers, but awkward in spreadsheets: the fixed columns are followed by semicolon-delimited INFO annotations and, often, colon-delimited FORMAT values for each sample. This tool turns those records into tidy TSV so you can inspect, filter, or join variants with ordinary table tools.

The output always starts with `CHROM`, `POS`, `ID`, `REF`, `ALT`, `QUAL`, and `FILTER`. When enabled, INFO fields are expanded into one column per key. Sample FORMAT values can be written in **long** layout (one row per variant × sample with a `SAMPLE` column) or **wide** layout (one row per variant with columns such as `NA001_GT` and `NA001_DP`).

### Worked example

Paste this VCF:

```text
##fileformat=VCFv4.2
#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NA001	NA002
chr1	100	rs1	A	G	50	PASS	DP=30;AF=0.5	GT:DP	0/1:20	1/1:10
```

With the default long layout, the TSV contains two data rows, one for `NA001` and one for `NA002`, with INFO columns `DP` and `AF` plus FORMAT columns `GT` and `DP`.

### Controls

- **Sample layout** chooses long rows for sample-centric analysis or wide rows for variant-centric spreadsheets.
- **Explode INFO fields** adds one column per INFO key; use **INFO keys to keep** such as `DP,AF,AC` when you only need selected annotations.
- **Include sample FORMAT fields** emits genotype/sample values when the VCF has sample columns.
- **PASS-only** drops filtered calls and keeps records whose `FILTER` is `PASS` or `.`.
- **Prefix INFO columns** writes `INFO_DP` instead of `DP`, useful when INFO and FORMAT have the same key.
- **Missing value** controls the placeholder for absent INFO/FORMAT/sample values.

### Limits and edge cases

This is a table flattener, not a genomic normalizer. It does not split multi-allelic ALT values, left-align variants, query reference FASTA files, parse compressed `.vcf.gz`, or validate VEP/ANN subfield semantics. Convert compressed files to text first and paste a representative VCF section. Values are made TSV-safe by replacing embedded tabs/newlines with spaces.

## FAQ

<details>
<summary>Does this support multi-sample VCF files?</summary>

Yes. If the `#CHROM` header has sample names after `FORMAT`, long layout emits one row per sample per variant, while wide layout creates `<sample>_<FORMATKEY>` columns for each discovered FORMAT key.

</details>

<details>
<summary>What happens to INFO flags such as DB?</summary>

A bare INFO flag with no equals sign is emitted as `true` when present. If it is absent on another record, the configured missing-value placeholder is used.

</details>

<details>
<summary>Can I keep only a few INFO fields?</summary>

Yes. Put a comma-separated list such as `DP,AF,AC` in **INFO keys to keep**. The output columns follow that order and missing keys get the configured placeholder.

</details>

<details>
<summary>Does this replace bcftools or VCF normalization?</summary>

No. Use specialized bioinformatics tools for normalization, reference lookups, compressed VCF indexing, and annotation interpretation. This tool focuses on deterministic text flattening into TSV inside the browser.

</details>

## Related tools

- [FASTQ to FASTA Converter](https://gizza.ai/tools/fastq-to-fasta/): Convert FASTQ sequencing reads to clean FASTA in your browser — strip quality lines, filter by length and mean quality, wrap, rename, discard N reads. No upload.
- [CSV ⇄ JSON Converter](https://gizza.ai/tools/csv-json-convert/): Convert CSV to JSON or JSON to CSV in your browser — auto-detects direction, infers types, handles quoted fields and custom delimiters. Free, no upload.
- [Markdown Table to CSV](https://gizza.ai/tools/markdown-table-to-csv/): Convert Markdown or pipe-delimited tables into clean CSV. Strip alignment rows and padding; choose delimiter, quoting, line endings, header, and BOM.
- [Adjacency Matrix Converter](https://gizza.ai/tools/adjacency-matrix-converter/): Convert a graph between edge list, adjacency matrix, and incidence matrix — directed or undirected, weighted or not. Free, private, runs in your browser.
- [Amazon Order Analyzer](https://gizza.ai/tools/amazon-order-analyzer/): Paste an Amazon order-history CSV export to summarize total spend by month, top items, and category breakdowns. Browser-only, private, with Markdown or JSON output.
