📋 1-Column Reference Guide
VCF • BAM • BED • GFF3
Samtools • Bcftools • Bedtools • Seqkit
The Bioinformatician's Command Cookbook & Format Reference
High-yield command-line one-liners, CLI tool syntax cards, and comprehensive field-by-field specifications for core genomic formats. Arranged in a streamlined 1-column layout so commands and explanations sit cleanly on a single line.
Jump to:
🧪 In-Browser WASM Terminal
⚡ Shell One-Liners
🛠️ Samtools & Bcftools
📐 Bedtools Intervals
✂️ Seqkit Utilities
📄 Format Specifications
⚡ WebAssembly Execution Engine
Zero Server Latency • 100% Client-Side
● Ready to Launch
🧪 In-Browser Live Script Terminal & Bio-Runner
Presets:
Executes in WebAssembly
Piped directly into stdin
Click '▶ Run Script (WASM)' to initialize Pyodide WebAssembly and test live bioinformatics scripts in your browser...⚡ Streaming & Shell One-Liners
Awk, Sed, Grep & Bash Pipelines
FASTQ
Count Total Reads (Gzipped)
— Divides raw line sum by 4 in a streaming pipeline without disk decompression.zcat reads.fq.gz | awk '{s++}END{print s/4}'
FASTQ
Convert to FASTA Format
— Substitutes '@' with '>' on headers and preserves nucleotide rows while discarding qualities.zcat reads.fq.gz | paste - - - - | cut -f 1,2 | sed 's/^@/>/' | tr "\t" "\n" > out.fa
FASTQ
Filter Reads by Sequence Motif
— Isolates 4-line records bearing a specific primer or adapter oligomer.zcat reads.fq.gz | grep -B 1 -A 2 --no-group-separator "GATTACA" | gzip > matched_reads.fq.gz
BAM
Retain Mapped High-Quality Alignments
— Excludes unmapped segments (-F 4) and enforces MAPQ ≥ 30 (-q 30).samtools view -b -F 4 -q 30 in.bam > filtered.bam
BAM
Count Alignments per Chromosome
— Rapid summary retrieved from the .bai index without reading raw records.samtools idxstats in.bam | cut -f 1,3 | head -n 25
BAM
Quantify PCR & Optical Duplicates
— Leverages bitwise flag 1024 to report total redundant read pairs.samtools view -c -f 1024 in.bam
VCF
Filter for PASS & High-Frequency SNVs
— Extracts confident variants meeting all quality criteria with Allele Frequency > 5%.bcftools view -f 'PASS' -i 'TYPE="snp" && INFO/AF > 0.05' in.vcf.gz -Oz -o filtered.vcf.gz
VCF
Calculate Transition / Transversion (Ti/Tv)
— Expected human WGS baseline is ~2.0–2.1; exome targets reach ~2.8–3.0.bcftools stats in.vcf.gz | grep "^TSTV" | cut -f 5
VCF
Sort Coordinates, Bgzip & Tabix Index
— Orders raw callsets into standard genomic sequence and generates .tbi lookup.bcftools sort in.vcf -Oz -o sorted.vcf.gz && tabix -p vcf sorted.vcf.gz
🛠️ Samtools & Bcftools Syntax Cards
v1.19+ Standards
SAMTOOLS
Coordinate-Sort Alignments to BAM
— Spins 8 CPU worker threads (-@ 8) for accelerated binary compression.samtools sort -@ 8 -o out.bam in.sam
SAMTOOLS
Index Binary Alignment File
— Builds the .bai index necessary for random locus queries and IGV navigation.samtools index -@ 4 in.bam
SAMTOOLS
Flagstat Alignment Summary
— Reports total segments, primary mappings, proper pairs, and duplicate percentages.samtools flagstat in.bam > stats.txt
SAMTOOLS
Per-Base Depth across Target Regions
—-a outputs all loci including zero-coverage; -b restricts to intervals.samtools depth -a -b targets.bed in.bam > depth.tsv
SAMTOOLS
Slice Genomic Window by Coordinates
— Extracts reads overlapping a target interval directly from indexed BAM.samtools view -b in.bam "chr17:41196312-41277500" > brca1_reads.bam
BCFTOOLS
Normalize & Split Multiallelic Sites
— Left-aligns indels and partitions multi-ALT records into individual biallelic rows.bcftools norm -m -any -f ref.fa in.vcf.gz -Oz -o norm.vcf.gz
BCFTOOLS
Export Multi-Sample Genotypes to TSV
— Square brackets[...] automatically iterate across all sample columns.bcftools query -f '%CHROM\t%POS\t%REF\t%ALT[\t%GT]\n' in.vcf.gz > genotypes.tsv
BCFTOOLS
Filter Variants by Quality & Depth
— Retains PASS calls having Phred score ≥ 30 and DP ≥ 15.bcftools view -i 'FILTER="PASS" && QUAL>=30 && DP>=15' in.vcf.gz -Oz -o filtered.vcf.gz
📐 Bedtools Interval Arithmetic
Genomic Arithmetic
BEDTOOLS
Intersect Overlapping Features
— Finds shared genomic regions between feature sets A and B (e.g. ChIP peaks in Promoters).bedtools intersect -a peaks.bed -b promoters.bed -wa -wb > overlaps.bed
BEDTOOLS
Merge Contiguous Intervals
— Collapses overlapping or adjacent spans into unified genomic segments.sort -k1,1 -k2,2n in.bed | bedtools merge -i - > merged.bed
BEDTOOLS
Subtract Excluded Regions
— Strips regions in set B from features in A (e.g. removing repeats from exons).bedtools subtract -a exons.bed -b repeats.bed > non_repeat_exons.bed
BEDTOOLS
Extract Reference Sequences
— Pulls FASTA sequence corresponding to coordinate intervals from reference.bedtools getfasta -fi hg38.fa -bed peaks.bed -fo peaks.fa
BEDTOOLS
Find Nearest Feature
— Identifies non-overlapping neighbor in B for each interval in A, returning distance (-d).bedtools closest -a variants.bed -b genes.bed -d > closest_genes.bed
BEDTOOLS
Calculate Breadth & Depth
— Summarizes mapped coverage, read counts, and percentage across intervals.bedtools coverage -a targets.bed -b sample.bam > coverage_summary.bed
✂️ Seqkit Sequence Utilities
Ultra-Fast Go Binary
SEQKIT
Summary Statistics (N50, Q20, Q30)
— Generates record counts, length ranges, N50 assembly metric, and Phred distributions.seqkit stats -a -j 4 *.fastq.gz
SEQKIT
Filter Records by Header List
— Pulls matching FASTA/FASTQ records using a plain text file of accession names.seqkit grep -f id_list.txt in.fasta -o filtered.fasta
SEQKIT
Extract Coordinate Sub-Sequence
— Slices exact nucleotide windows (e.g. 1 to 5000 bp) without indexing overhead.seqkit subseq -r 1:5000 in.fasta -o promoter_window.fa
SEQKIT
Reverse Complement & Linearize
—-r -p generates reverse complements; -w 0 converts wrapped entries to single-line.seqkit seq -r -p -w 0 in.fasta -o revcomp.fasta
SEQKIT
Deduplicate Records by Content
—-s identifies duplicate sequences; -d redirects redundant entries to an audit file.seqkit rmdup -s -i in.fasta -o dedup.fasta -d duplicates.fasta
SEQKIT
Order Contigs by Length
—-l orders by size; -r sorts in descending sequence for assembly inspection.seqkit sort -l -r in.fasta -o sorted_by_length.fasta
📄 File Format Specifications
Community StandardsVCF 4.2 / 4.3 Mandatory Columns
Every VCF features 8 mandatory tab-separated fields, followed by an optional 9th column (FORMAT) and sample calls (10+).
| Col # | Field Name | Type / Convention | Description |
|---|---|---|---|
| 1 | CHROM | String | Chromosome identifier (e.g. chr17 or 17). |
| 2 | POS | Integer (1-based) | Starting coordinate of the first base in the REF allele. |
| 3 | ID | String | Accession identifier (e.g. dbSNP rsID rs121913529 or . if unassigned). |
| 4 | REF | String [A,C,G,T,N] | Nucleotide bases present in the source genome build. |
| ALT | Comma-separated | Non-reference alleles observed in the sequenced sample. | |
| 6 | QUAL | Float (Phred) | -10 * log10(P(error)) for the alternate call. Score 30 represents 99.9% confidence. |
| 7 | FILTER | String | PASS when meeting all quality criteria; otherwise lists failed metric names. |
| 8 | INFO | Key-Value (Semicolon) | Site-level annotations (e.g. DP=120;AF=0.45;AN=2;AC=1). |
Essential Sample FORMAT Sub-Tags (Col 9+):
GT
Genotype Call:
0/0 ref hom, 0/1 het, 1/1 alt hom, 0|1 phased chromosome configurationAD
Allelic Depths:
Unfiltered count of passing reads for REF and each ALT allele (e.g. 32,18)DP
Sample Read Depth:
Filtered coverage sum evaluated across this specific locus (e.g. 50)GQ
Call Confidence:
Phred metric (0–99) evaluating certainty in the assigned GTPL
Normalized Likelihoods:
Phred calculations across possible genotypes (0 indicates the most probable state, e.g. 0,45,255)SAM / BAM 11 Mandatory Columns
The Sequence Alignment/Map standard requires 11 mandatory tab-delimited columns per aligned segment.
| Col # | Field Name | Type | Description |
|---|---|---|---|
| 1 | QNAME | String | Query template / read identifier (e.g. A00123:14:H7K5MDSXX:1:1101:1000:2050). |
| 2 | FLAG | Bitwise Int | Binary indicators (e.g. 99 = read paired, proper pair, mate reverse strand, first in pair). |
| 3 | RNAME | String | Reference chromosome where segment aligns (e.g. chr1). |
| 4 | POS | 1-Based Pos | Leftmost coordinate of the first aligned base. |
| 5 | MAPQ | Integer (Phred) | Confidence metric: -10 * log10(P(mapping error)). 60 represents highest certainty. |
| CIGAR | String | Alignment operations string (e.g. 100M match or 15S85M soft-clipping). | |
| RNEXT | String | Chromosome of the mate pair (= if identical). | |
| 8 | PNEXT | Integer | 1-based position of the mate read. |
| 9 | TLEN | Integer | Observed template span / insert size between paired reads. |
| 10 | SEQ | String [A,C,G,T,N] | Nucleotide sequence represented on reference strand. |
| 11 | QUAL | String (ASCII) | Phred score ASCII characters matching 1:1 with SEQ bases. |
CIGAR String Operators (Column 6):
M
Match or Mismatch:
Bases aligned to the reference genome; denotes sequence identity or single-nucleotide variant.I
Insertion:
Novel bases present in the read that are absent from the reference assembly.D
Deletion:
Bases missing in the read segment that exist in the reference genome.N
Intron Skip:
Spliced junction spanning mRNA exons in RNA-seq alignments.S
Soft Clipping:
Terminal bases (adapter, primer, low quality) excluded from alignment but kept in SEQ.H
Hard Clipping:
Excluded bases fully discarded and omitted from the SEQ field.
Example: 15S85M1200N50M
→ 15 bp soft-clipped adapter/primer + 85 bp exon alignment + 1,200 bp spliced intron + 50 bp downstream exon alignment.
→ 15 bp soft-clipped adapter/primer + 85 bp exon alignment + 1,200 bp spliced intron + 50 bp downstream exon alignment.
BED Format Standard 3, 6 & 12 Columns
The Browser Extensible Data standard utilizes 0-based, half-open coordinates [chromStart, chromEnd).
| Col # | Field Name | Format Tier | Description |
|---|---|---|---|
| 1 | chrom | BED3+ | Chromosome name (e.g. chr7). |
| 2 | chromStart | BED3+ | 0-based starting coordinate of the feature. |
| 3 | chromEnd | BED3+ | 1-based boundary (half-open, length = end - start). |
| 4 | name | BED6+ | Feature identifier or symbol (e.g. EGFR_exon1). |
| 5 | score | BED6+ | Quality ranking integer between 0 and 1000. |
| 6 | strand | BED6+ | Directional orientation: + (forward), - (reverse), or . (unassigned). |
| 7–12 | thickStart..blockStarts | BED12 | Defines coding boundaries (thickStart/End), RGB color, exon block count, block sizes, and relative block starts. |