Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

From VCF to Results

A complete pipeline tutorial showing a full workflow from raw VCF data to GWAS results.

Overview

This tutorial demonstrates the full Binx workflow:

  1. Convert VCF to Binx format
  2. Quality control and filtering
  3. Compute kinship matrix
  4. Run GWAS with multiple models
  5. Generate visualizations
  6. Extract and interpret QTLs

Complete Pipeline Script

#!/bin/bash
set -e

# === Configuration ===
VCF="raw_data/variants.vcf.gz"
PHENO="raw_data/phenotypes.csv"
TRAIT="yield"
PLOIDY=4
OUTDIR="results"

mkdir -p $OUTDIR

# === Step 1: Convert VCF ===
echo "Converting VCF..."
binx convert \
  --vcf $VCF \
  --format gwaspoly \
  --output $OUTDIR/genotypes.tsv

# === Step 2: Compute Kinship ===
echo "Computing kinship..."
binx kinship \
  --geno $OUTDIR/genotypes.tsv \
  --ploidy $PLOIDY \
  --output $OUTDIR/kinship.tsv

# === Step 3: Run GWAS ===
echo "Running GWAS..."
binx gwas \
  --geno $OUTDIR/genotypes.tsv \
  --pheno $PHENO \
  --trait $TRAIT \
  --kinship $OUTDIR/kinship.tsv \
  --ploidy $PLOIDY \
  --models additive,general \
  --loco \
  --threshold bonferroni \
  --out $OUTDIR/gwas_results.csv

# === Step 4: Visualize ===
echo "Creating plots..."
binx plot \
  --input $OUTDIR/gwas_results.csv \
  --plot-type manhattan \
  --model additive \
  --output $OUTDIR/manhattan.svg

binx plot \
  --input $OUTDIR/gwas_results.csv \
  --plot-type qq \
  --model additive \
  --output $OUTDIR/qq.svg

# === Step 5: Extract QTLs ===
echo "Extracting QTLs..."
binx qtl \
  --input $OUTDIR/gwas_results.csv \
  --bp-window 5000000 \
  --output $OUTDIR/qtls.csv

echo "Done! Results in $OUTDIR/"

See Also