๐ง NGS Fundamentals
๐ฏ What is Next-Generation Sequencing?
Next-Generation Sequencing (NGS) refers to high-throughput DNA and RNA sequencing technologies that massively parallelize the sequencing process, producing millions to billions of reads simultaneously. NGS has revolutionized genomics by making sequencing fast, affordable, and scalable compared to Sanger sequencing. It's the foundation of modern genomics, transcriptomics, and epigenomics.
Why NGS Matters
Genomes: Complete sequences. Transcriptomes: Expression. Epigenomes: Regulation. Variants: Disease. Microbiomes: Communities. Clinical: Diagnostics. Single-cell: Heterogeneity.
# Next-Generation Sequencing โ the big picture
# High-throughput DNA and RNA sequencing.
# CONCEPTUAL OVERVIEW
print("""
=== Next-Generation Sequencing (NGS) ===
What it is:
- Massively parallel sequencing
- Millions to billions of reads
- High throughput
- Cost-effective
- Scalable
Why it matters:
- Complete genomes
- Transcriptomes
- Epigenomes
- Variant discovery
- Microbiomes
- Clinical diagnostics
- Single-cell
Evolution:
1977: Sanger sequencing
2005: 454 (first NGS)
2006: Illumina/Solexa
2010: PacBio
2014: Nanopore
2019: PacBio HiFi
2020s: Single-cell, spatial
Platforms:
- Illumina (short reads)
- PacBio (long reads)
- Oxford Nanopore (long reads)
- Ion Torrent (semiconductor)
- MGI (short reads)
Read types:
- Short: 50-300 bp
- Long: 10-100 kb
- Ultra-long: > 100 kb
Workflow:
1. Sample collection
2. DNA/RNA extraction
3. Library preparation
4. Sequencing
5. QC (FastQC)
6. Trimming (fastp)
7. Alignment (BWA)
8. Downstream analysis
9. Visualization
10. Interpretation
Applications:
- Whole genome sequencing
- Whole exome sequencing
- RNA-Seq
- ChIP-Seq
- ATAC-Seq
- Metagenomics
- Single-cell
""")
# WHY IT MATTERS
print("=== Why It Matters ===")
print("""
Biological questions:
- What is the genome sequence?
- What genes are expressed?
- What variants exist?
- How is chromatin organized?
- What microbes are present?
NGS answers:
- Genome sequences
- Expression levels
- Variant calls
- Chromatin maps
- Microbial communities
""")
# HISTORICAL CONTEXT
print("=== Historical Context ===")
print("""
1977: Sanger sequencing
2001: Human Genome Project (draft)
2005: 454 (first NGS)
2006: Illumina/Solexa
2007: SOLiD
2010: PacBio
2011: Ion Torrent
2014: Oxford Nanopore
2019: PacBio HiFi (Sequel II)
2020s: Single-cell, spatial, complete genomes
""")
# CHALLENGES
print("=== Challenges ===")
print("""
1. DATA VOLUME
- Terabytes per run
- Storage
- Transfer
2. COMPUTATIONAL
- Alignment
- Assembly
- Variant calling
- Memory
3. ERRORS
- Sequencing errors
- PCR artifacts
- Mapping errors
4. REPEATS
- Short reads
- Long reads
- Assembly
5. INTERPRETATION
- Variants
- Expression
- Function
- Clinical
""")๐ฏ Why NGS Matters
๐ฏ The Value of NGS
NGS has transformed biology and medicine, enabling genome-scale analysis at unprecedented speed and cost.
Key Applications
Genomes: Complete. Exomes: Coding. RNA: Expression. ChIP: Regulation. Metagenome: Communities. Clinical: Diagnostics.
# Why NGS Matters
print("=== 1. Whole Genome Sequencing (WGS) ===")
print("""
WGS:
- Complete genome
- All variants
- Structural variants
Workflow:
1. DNA extraction
2. Library prep
3. Sequencing
4. Alignment
5. Variant calling
6. Annotation
Coverage:
- 30x for germline
- 100x for somatic
Examples:
- Human genome
- Pathogens
- Plants
- Animals
Tools:
- BWA
- GATK
- VEP
""")
print("\n=== 2. Whole Exome Sequencing (WES) ===")
print("""
WES:
- Protein-coding regions
- ~1-2% of genome
- Cost-effective
Workflow:
1. Exome capture
2. Sequencing
3. Alignment
4. Variant calling
Coverage:
- 50-100x
Examples:
- Rare disease
- Cancer
- Clinical
Tools:
- GATK
- VEP
- ClinVar
""")
print("\n=== 3. RNA-Seq ===")
print("""
RNA-Seq:
- Gene expression
- Splicing
- Fusion genes
Workflow:
1. RNA extraction
2. Library prep
3. Sequencing
4. Alignment
5. Quantification
6. DE analysis
Examples:
- Disease vs normal
- Drug response
- Development
- Single-cell
Tools:
- STAR
- Salmon
- DESeq2
""")
print("\n=== 4. ChIP-Seq ===")
print("""
ChIP-Seq:
- Protein-DNA binding
- Histone modifications
- Regulatory elements
Workflow:
1. ChIP
2. Library prep
3. Sequencing
4. Peak calling
5. Annotation
Examples:
- TF binding
- H3K27ac
- Enhancers
- Disease
Tools:
- Bowtie2
- MACS2
- HOMER
""")
print("\n=== 5. ATAC-Seq ===")
print("""
ATAC-Seq:
- Open chromatin
- Regulatory elements
- TF footprinting
Workflow:
1. Tn5 transposition
2. Library prep
3. Sequencing
4. Peak calling
5. Motif analysis
Examples:
- Cell types
- Development
- Cancer
Tools:
- Bowtie2
- MACS2
- HOMER
""")
print("\n=== 6. Metagenomics ===")
print("""
Metagenomics:
- Microbial communities
- Unculturable
- Functional potential
Workflow:
1. Sample
2. DNA extraction
3. Sequencing
4. Assembly
5. Binning
6. Annotation
Examples:
- Gut microbiome
- Soil
- Ocean
- Clinical infections
Tools:
- SPAdes
- MEGAHIT
- MetaBAT
""")
print("\n=== 7. Single-Cell ===")
print("""
Single-cell:
- Per-cell expression
- Heterogeneity
- Rare cells
Workflow:
1. Cell isolation
2. 10x Genomics
3. Sequencing
4. Cell Ranger
5. Seurat/Scanpy
Examples:
- Immune atlas
- Brain atlas
- Tumor
- Development
Tools:
- Cell Ranger
- Seurat
- Scanpy
""")
print("\n=== 8. Clinical Diagnostics ===")
print("""
Clinical:
- Rare disease
- Cancer
- Pharmacogenomics
- Prenatal
Workflow:
1. Patient sample
2. Sequencing
3. Variant calling
4. Annotation
5. Report
Examples:
- BRCA1/2
- CFTR
- CYP2D6
- HLA
Tools:
- GATK
- VEP
- ClinVar
""")๐ History & Evolution
๐ฏ From Sanger to Single-Cell
Sequencing has evolved dramatically from Sanger's chain termination to modern high-throughput platforms.
History
1977: Sanger. 2005: 454. 2006: Illumina. 2010: PacBio. 2014: Nanopore. 2019: HiFi. 2020s: Complete genomes.
# History & Evolution
print("=== Generations of Sequencing ===")
print(""
First generation (1977):
- Sanger
- Capillary
- 1 read at a time
- 1000 bp
- Accurate
Second generation (2005-):
- 454, Illumina, SOLiD
- Massively parallel
- Short reads (50-300 bp)
- High throughput
- Low cost
Third generation (2010-):
- PacBio, Nanopore
- Single molecule
- Long reads (10-100 kb)
- Real-time
- Portable
Fourth generation (2020s):
- Single-cell
- Spatial
- Multi-omics
- Complete genomes
""")
print("\n=== Timeline ===")
print(""
1977: Sanger sequencing
1986: First automated sequencer
1990: Human Genome Project starts
1995: First bacterial genome
2001: Human genome draft
2003: Human genome complete
2005: 454 (first NGS)
2006: Illumina/Solexa
2007: SOLiD
2008: First NGS human genome
2010: PacBio
2011: Ion Torrent
2012: Oxford Nanopore
2014: Nanopore MinION
2019: PacBio HiFi
2022: Telomere-to-telomere human genome
2024: 200K+ PDB structures
""")
print("\n=== Cost of Sequencing ===")
print(""
Cost per genome:
2001: $100M
2008: $10M
2010: $100K
2015: $1K
2020: $500
2024: $200
Moore's law:
- Faster than Moore's law
- Exponential decrease
- Democratization
""")
print("\n=== Key Milestones ===")
print(""
1. Sanger (1977):
- First method
- Still used
- Accurate
2. 454 (2005):
- First NGS
- Pyrosequencing
- Discontinued
3. Illumina (2006):
- Dominant
- Short reads
- High throughput
4. PacBio (2010):
- Single molecule
- Long reads
- Real-time
5. Nanopore (2014):
- Portable
- Ultra-long
- Real-time
6. HiFi (2019):
- Highly accurate
- Long reads
- Complete genomes
""")
print("\n=== Human Genome Project ===")
print(""
HGP:
- 1990-2003
- $2.7 billion
- Sanger
- Draft 2001
- Complete 2003
T2T:
- 2019-2022
- Complete
- No gaps
- Telomeres
- Centromeres
Impact:
- Reference
- Medicine
- Biology
""")
print("\n=== Current Landscape ===")
print(""
Short reads:
- Illumina (dominant)
- MGI (China)
- Ion Torrent
Long reads:
- PacBio (HiFi)
- Oxford Nanopore
Single-cell:
- 10x Genomics
- Smart-seq
Spatial:
- 10x Visium
- MERFISH
- Slide-seq
Applications:
- Clinical
- Research
- Agriculture
- Environmental
""")๐ฅ๏ธ Sequencing Platforms
๐ฏ The Major Platforms
Several sequencing platforms dominate the market, each with its own strengths and weaknesses.
Platforms
Illumina: Short reads. PacBio: Long reads. Nanopore: Ultra-long. Ion Torrent: Semiconductor. MGI: Short reads. Sanger: Classic.
# Sequencing Platforms
print("=== Illumina ===")
print(""
Illumina:
- Dominant
- Short reads
- Sequencing by synthesis
Platforms:
- NovaSeq X
- NovaSeq 6000
- NextSeq
- MiSeq
- iSeq
Read length:
- 50-300 bp
Throughput:
- Up to 20B reads
- 6 Tb per run
Accuracy:
- Q30 > 90%
- Q40 available
Applications:
- WGS
- WES
- RNA-Seq
- ChIP-Seq
- Single-cell
""")
print("\n=== PacBio ===")
print(""
PacBio:
- Long reads
- Single molecule
- SMRT sequencing
Platforms:
- Sequel II
- Sequel IIe
- Revio
Read types:
- CLR (Continuous Long Read)
- HiFi (High Fidelity)
Read length:
- CLR: 10-60 kb
- HiFi: 10-25 kb
Accuracy:
- CLR: ~85-90%
- HiFi: > 99.9%
Applications:
- Genome assembly
- SV detection
- Full-length isoforms
- Methylation
- Metagenomics
""")
print("\n=== Oxford Nanopore ===")
print(""
Oxford Nanopore:
- Ultra-long reads
- Portable
- Real-time
Platforms:
- MinION
- GridION
- PromethION
- Flongle
Read length:
- 10-100 kb
- Up to 2 Mb
Accuracy:
- Q20+ (R10.4)
- Improving
Applications:
- Genome assembly
- SV detection
- Real-time surveillance
- Portable field work
- Direct methylation
""")
print("\n=== Ion Torrent ===")
print(""
Ion Torrent:
- Semiconductor
- Short reads
- Fast
Platforms:
- Ion GeneStudio
- Ion S5
Read length:
- 200-600 bp
Accuracy:
- Q20
Applications:
- Targeted
- Clinical
- Microbial
""")
print("\n=== MGI ===")
print(""
MGI (BGI):
- Short reads
- China
- Competitive
Platforms:
- DNBSEQ-T7
- DNBSEQ-G400
- DNBSEQ-G50
Read length:
- 50-300 bp
Throughput:
- High
Applications:
- WGS
- WES
- RNA-Seq
""")
print("\n=== Sanger ===")
print(""
Sanger:
- Classic
- Capillary
- Accurate
Platforms:
- ABI 3730
- SeqStudio
Read length:
- 500-1000 bp
Accuracy:
- > 99.99%
Applications:
- Validation
- Small targets
- Clinical
""")
print("\n=== Platform Comparison ===")
print(f"{'Platform':<20} {'Read':<15} {'Accuracy':<15} {'Use':<20}")
print("-" * 70)
print(f"{'Illumina':<20} {'50-300 bp':<15} {'Q30-Q40':<15} {'WGS, RNA':<20}")
print(f"{'PacBio HiFi':<20} {'10-25 kb':<15} {'Q30+':<15} {'Assembly, SV':<20}")
print(f"{'Nanopore':<20} {'10-100 kb':<15} {'Q20+':<15} {'Real-time':<20}")
print(f"{'Ion Torrent':<20} {'200-600 bp':<15} {'Q20':<15} {'Targeted':<20}")
print(f"{'MGI':<20} {'50-300 bp':<15} {'Q30':<15} {'WGS':<20}")
print(f"{'Sanger':<20} {'500-1000 bp':<15} {'Q40+':<15} {'Validation':<20}")๐ต Illumina (Short Reads)
๐ฏ The Dominant Platform
Illumina is the dominant short-read sequencing platform, known for high accuracy and throughput.
Illumina
SBS: Sequencing by synthesis. Clusters: Bridge amplification. Reversible: Terminators. Short: 50-300 bp. Accurate: Q30+.
# Illumina (Short Reads)
print("=== Sequencing by Synthesis ===")
print(""
Steps:
1. Library prep:
- Fragmentation
- Adapters
- Amplification
2. Cluster generation:
- Bridge amplification
- Clonal clusters
3. Sequencing:
- Reversible terminators
- Fluorescent nucleotides
- Camera capture
4. Base calling:
- Images โ bases
- Quality scores
5. Output:
- FASTQ files
""")
print("\n=== Cluster Generation ===")
print(""
Bridge amplification:
- Flow cell
- Oligos on surface
- DNA binds
- Bridge forms
- Amplification
- Clusters
Clusters:
- ~1000 copies
- Clonal
- Detectable signal
""")
print("\n=== Sequencing by Synthesis ===")
print(""
SBS:
1. Add nucleotides:
- Reversible terminators
- Fluorescent labels
2. Incorporate:
- One base per cycle
- Complementary
3. Image:
- Camera
- Fluorescence
4. Cleave:
- Terminator
- Fluorophore
5. Repeat:
- Up to 300 cycles
""")
print("\n=== Read Types ===")
print(""
Single-end:
- One read per fragment
- Cheaper
- Less info
Paired-end:
- Two reads per fragment
- Known distance
- Better alignment
- SV detection
Read length:
- 50 bp: miRNA
- 75 bp: ChIP-Seq
- 100 bp: RNA-Seq
- 150 bp: WGS
- 250-300 bp: 16S, amplicon
""")
print("\n=== Instruments ===")
print(""
1. iSeq 100:
- Small
- 1.2 Gb
- 150 bp
2. MiniSeq:
- Small
- 7.5 Gb
- 150 bp
3. MiSeq:
- Benchtop
- 15 Gb
- 300 bp
- Clinical
4. NextSeq:
- Benchtop
- 120 Gb
- 150 bp
5. NovaSeq 6000:
- High throughput
- 6 Tb
- 250 bp
6. NovaSeq X:
- Ultra high
- 16 Tb
- 150 bp
""")
print("\n=== Advantages & Disadvantages ===")
print(""
ADVANTAGES:
โ High accuracy
โ High throughput
โ Low cost per base
โ Mature ecosystem
โ Many applications
โ Paired-end
DISADVANTAGES:
โ Short reads
โ Repeats
โ SVs
โ PCR bias
โ GC bias
""")
print("\n=== Applications ===")
print(""
Illumina:
- WGS
- WES
- RNA-Seq
- ChIP-Seq
- ATAC-Seq
- Single-cell
- Metagenomics
- Targeted panels
- Clinical
""")๐ฃ Long-Read (PacBio, Nanopore)
๐ฏ Resolving Complexity
Long-read sequencing (PacBio, Nanopore) produces reads of 10-100 kb, essential for resolving repeats, structural variants, and complete genomes.
Long Reads
PacBio: SMRT. Nanopore: Current. Length: 10-100 kb. HiFi: Accurate. Real-time: Nanopore. Assembly: Complete.
# Long-Read Sequencing
print("=== PacBio SMRT ===")
print(""
PacBio:
- Single Molecule Real-Time
- Zero-mode waveguide
- Fluorescent nucleotides
- Real-time
Steps:
1. DNA โ SMRTbell
2. Diffusion into ZMW
3. Polymerase
4. Fluorescence
5. Base calling
Read types:
- CLR: ~85-90% accuracy
- HiFi: > 99.9% accuracy
Platforms:
- Sequel II
- Sequel IIe
- Revio
""")
print("\n=== PacBio HiFi ===")
print(""
HiFi:
- Highly accurate
- Long reads
- Circular consensus
Steps:
1. Circular template
2. Multiple passes
3. Consensus
4. HiFi read
Read length:
- 10-25 kb
Accuracy:
- > 99.9% (Q30+)
Applications:
- Genome assembly
- SV detection
- Full-length isoforms
- Methylation
- Metagenomics
""")
print("\n=== Oxford Nanopore ===")
print(""
Nanopore:
- Current disruption
- Protein pore
- Real-time
Steps:
1. DNA in solution
2. Protein pore
3. Current changes
4. Base calling
5. Real-time output
Read length:
- 10-100 kb
- Up to 2 Mb
Accuracy:
- Q20+ (R10.4)
- Improving
Platforms:
- MinION
- GridION
- PromethION
- Flongle
""")
print("\n=== Advantages of Long Reads ===")
print(""
Advantages:
โ Resolve repeats
โ Detect SVs
โ Full-length isoforms
โ Phase variants
โ Complete genomes
โ Methylation
โ Real-time
โ Portable
Disadvantages:
โ Higher cost
โ Lower throughput
โ Higher error (CLR)
โ More DNA needed
""")
print("\n=== Applications ===")
print(""
Long reads:
- Genome assembly
- Structural variants
- Full-length RNA
- Methylation
- Metagenomics
- Clinical
- Outbreak surveillance
- T2T genomes
""")
print("\n=== Hybrid Assembly ===")
print(""
Hybrid:
- Long reads (contigs)
- Short reads (polish)
- Best of both
Steps:
1. Long reads โ assembly
2. Short reads โ polish
3. Long reads โ polish
4. Validate
Tools:
- Unicycler
- SPAdes (hybrid)
- MaSuRCA
""")
print("\n=== Comparison ===")
print(f"{'Feature':<20} {'PacBio HiFi':<20} {'Nanopore':<20}")
print("-" * 60)
print(f"{'Read length':<20} {'10-25 kb':<20} {'10-100 kb':<20}")
print(f"{'Accuracy':<20} {'> 99.9%':<20} {'Q20+':<20}")
print(f"{'Throughput':<20} {'High':<20} {'High':<20}")
print(f"{'Portable':<20} {'No':<20} {'Yes':<20}")
print(f"{'Real-time':<20} {'No':<20} {'Yes':<20}")
print(f"{'Methylation':<20} {'Yes':<20} {'Yes':<20}")
print(f"{'Cost':<20} {'High':<20} {'Medium':<20}")๐งช Library Preparation
๐ฏ Preparing DNA for Sequencing
Library preparation converts DNA or RNA into a form compatible with the sequencing platform, adding adapters and barcodes.
Library Prep
Fragmentation: Size selection. End repair: Blunt ends. Adapters: Ligation. Amplification: PCR. Barcodes: Multiplexing. QC: Validation.
# Library Preparation
print("=== General Steps ===")
print(""
1. DNA fragmentation:
- Sonication
- Enzymatic
- Size selection
2. End repair:
- Blunt ends
- 5' phosphorylation
- 3' adenylation
3. Adapter ligation:
- Platform-specific
- Index/barcode
- Sequencing primer
4. Amplification:
- PCR
- Enrichment
- Optional
5. QC:
- Bioanalyzer
- Qubit
- qPCR
""")
print("\n=== DNA Library Types ===")
print(""
1. WGS:
- Whole genome
- 350-500 bp inserts
- 30x coverage
2. WES:
- Exome capture
- 50-100x coverage
- Protein-coding
3. Targeted:
- Panel
- Specific genes
- Deep coverage
4. Amplicon:
- PCR products
- 16S, ITS
- Microbial
5. ChIP-Seq:
- Immunoprecipitation
- Protein-DNA
- 20-40M reads
6. ATAC-Seq:
- Tn5 transposase
- Open chromatin
- 20-40M reads
""")
print("\n=== RNA Library Types ===")
print(""
1. mRNA-Seq:
- Poly-A selection
- Eukaryotic
- Expression
2. Total RNA:
- rRNA depletion
- Prokaryotic
- Non-coding
3. Small RNA:
- miRNA
- Size selection
- 20-30 nt
4. Single-cell:
- 10x Genomics
- Droplet
- Cell barcodes
""")
print("\n=== Adapters ===")
print(""
Adapters:
- Platform-specific
- Sequencing primer
- Index/barcode
- Flow cell binding
Illumina:
- P5, P7
- Read 1, Read 2
- Index 1, Index 2
Indexes:
- i7 (single)
- i5 + i7 (dual)
- Unique dual (UDI)
""")
print("\n=== Multiplexing ===")
print(""
Multiplexing:
- Multiple samples
- One run
- Barcodes
Barcodes:
- 6-8 bp
- Unique per sample
- Demultiplexing
Advantages:
- Cost-effective
- Higher throughput
- Less bias
Considerations:
- Index hopping
- Balanced
- Unique dual indexes
""")
print("\n=== QC ===")
print(""
QC:
- Qubit (concentration)
- Bioanalyzer (size)
- qPCR (quantification)
- TapeStation
Metrics:
- Concentration
- Size distribution
- Adapter dimers
- Quality
""")
print("\n=== Kits ===")
print(""
Illumina:
- TruSeq
- Nextera
- NovaSeq X
PacBio:
- SMRTbell
- Express Template
Nanopore:
- Ligation
- Rapid
- Ultra-long
10x:
- Chromium
- Single-cell
""")
print("\n=== Best Practices ===")
print(""
1. High-quality DNA/RNA
2. Appropriate insert size
3. Unique dual indexes
4. QC before sequencing
5. Avoid over-amplification
6. Balance multiplexing
7. Document everything
8. Use kits appropriately
""")๐งน QC & Trimming
๐ฏ Clean Before You Analyze
Quality control and trimming are essential first steps in any NGS pipeline. Garbage in, garbage out.
QC
FastQC: Raw reads. MultiQC: Aggregate. fastp: Trim. Trimmomatic: Trim. Adapters: Remove. Quality: Filter.
# QC & Trimming
print("=== FastQC ===")
print(""
FastQC:
- Per-base quality
- GC content
- Adapter contamination
- Duplication
- Overrepresented sequences
Command:
fastqc reads_1.fastq.gz reads_2.fastq.gz -o qc/
Output:
reads_1_fastqc.html
reads_1_fastqc.zip
Metrics:
- Per base sequence quality
- Per sequence quality
- Per base GC content
- Per sequence GC content
- N content
- Sequence duplication
- Overrepresented
""")
print("\n=== MultiQC ===")
print(""
MultiQC:
- Aggregate all QC
- One report
- Compare samples
Command:
multiqc qc/ -o multiqc_report/
Output:
multiqc_report.html
Advantages:
- One report
- Compare samples
- Summary
- Publication
""")
print("\n=== fastp ===")
print(""
fastp:
- Fast
- All-in-one
- Adapter detection
- Quality filtering
Command:
fastp \
-i reads_1.fastq.gz \
-I reads_2.fastq.gz \
-o clean_1.fastq.gz \
-O clean_2.fastq.gz \
--detect_adapter_for_pe \
--qualified_quality_phred 20 \
--length_required 36 \
--json report.json \
--html report.html
Key options:
-q 20 (quality)
-l 36 (min length)
-u 40 (max uncalled)
--cut_front, --cut_tail
""")
print("\n=== Trimmomatic ===")
print(""
Trimmomatic:
- Java
- Flexible
- Popular
Command:
trimmomatic PE \
reads_1.fastq.gz reads_2.fastq.gz \
clean_1.fq.gz unpaired_1.fq.gz \
clean_2.fq.gz unpaired_2.fq.gz \
ILLUMINACLIP:adapters.fa:2:30:10 \
LEADING:3 TRAILING:3 \
SLIDINGWINDOW:4:20 MINLEN:36
Options:
- ILLUMINACLIP
- LEADING
- TRAILING
- SLIDINGWINDOW
- MINLEN
""")
print("\n=== Adapter Trimming ===")
print(""
Adapters:
- Sequencing adapters
- Index sequences
- Contamination
Tools:
- fastp
- Trimmomatic
- cutadapt
- BBDuk
cutadapt:
cutadapt -a ADAPTER -o output.fastq input.fastq
""")
print("\n=== Quality Filtering ===")
print(""
Filter:
- Phred score
- Length
- N content
- Complexity
Phred:
- Q20: 99%
- Q30: 99.9%
- Q40: 99.99%
Filtering:
- Q < 20: filter
- Length < 36: filter
- N > 10%: filter
""")
print("\n=== Long-Read QC ===")
print(""
Long reads:
- Higher error
- Different QC
Tools:
- NanoPlot
- NanoStat
- pycoQC
- LongQC
Metrics:
- Read length
- Quality
- N50
- Throughput
""")
print("\n=== Best Practices ===")
print(""
1. Always run FastQC
2. Aggregate with MultiQC
3. Trim adapters
4. Filter low quality
5. Check for contamination
6. Remove duplicates (optional)
7. Document everything
8. Keep raw data
""")๐ File Formats (FASTQ, BAM, VCF)
๐ฏ The Language of NGS
NGS data flows through standard file formats: FASTQ (raw), BAM/SAM (aligned), VCF (variants), and more.
Formats
FASTQ: Raw reads. FASTA: Sequences. SAM: Alignments. BAM: Binary SAM. CRAM: Compressed. VCF: Variants. BED: Regions.
# File Formats
print("=== FASTQ ===")
print(""
FASTQ:
- Raw reads
- Sequence + quality
- 4 lines per read
Format:
@read_id
SEQUENCE
+
QUALITY
Example:
@SRR123456.1
ACGTACGTACGTACGT
+
IIIIIIIIIIIIIIII
Quality:
- Phred+33
- ASCII characters
- Q = ord(char) - 33
""")
print("\n=== FASTA ===")
print(""
FASTA:
- Sequences
- No quality
- Reference
Format:
>sequence_id
SEQUENCE
Example:
>chr1
ACGTACGTACGTACGT
""")
print("\n=== SAM ===")
print(""
SAM:
- Sequence Alignment/Map
- Text
- Alignments
Header:
@HD, @SQ, @RG, @PG
Columns:
QNAME, FLAG, RNAME, POS, MAPQ, CIGAR,
RNEXT, PNEXT, TLEN, SEQ, QUAL
Example:
read1 0 chr1 100 60 100M * 0 0 ACGT... IIII...
""")
print("\n=== BAM ===")
print(""
BAM:
- Binary SAM
- Compressed
- Indexed
Advantages:
- Smaller
- Faster
- Standard
Tools:
- samtools
- pysam
- IGV
Commands:
samtools view -b sample.sam > sample.bam
samtools sort sample.bam -o sample.sorted.bam
samtools index sample.sorted.bam
""")
print("\n=== CRAM ===")
print(""
CRAM:
- Compressed BAM
- Reference-based
- Smaller
Advantages:
- 30-60% smaller
- Reference-based
- EBI standard
Tools:
- samtools
- Scramble
Commands:
samtools view -C -T reference.fa sample.bam > sample.cram
""")
print("\n=== VCF ===")
print(""
VCF:
- Variant Call Format
- Variants
- Standard
Header:
##fileformat=VCFv4.2
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT
Columns:
CHROM, POS, ID, REF, ALT, QUAL, FILTER,
INFO, FORMAT, SAMPLE
Example:
chr1 1000 rs123 A G 50 PASS DP=30 GT:DP 0/1:30
""")
print("\n=== BED ===")
print(""
BED:
- Browser Extensible Data
- Regions
- 0-based
Columns:
chrom, start, end, name, score, strand
Example:
chr1 999 1010 peak1 100 +
Tools:
- bedtools
- IGV
- UCSC
""")
print("\n=== GFF/GTF ===")
print(""
GFF/GTF:
- Gene annotation
- Features
- 1-based
Columns:
seqid, source, type, start, end,
score, strand, phase, attributes
Example:
chr1 ENSEMBL gene 1000 2000 . + . ID=gene1
""")
print("\n=== Format Comparison ===")
print(f"{'Format':<15} {'Type':<20} {'Use':<20}")
print("-" * 60)
print(f"{'FASTQ':<15} {'Text':<20} {'Raw reads':<20}")
print(f"{'FASTA':<15} {'Text':<20} {'Sequences':<20}")
print(f"{'SAM':<15} {'Text':<20} {'Alignments':<20}")
print(f"{'BAM':<15} {'Binary':<20} {'Alignments':<20}")
print(f"{'CRAM':<15} {'Binary':<20} {'Compressed':<20}")
print(f"{'VCF':<15} {'Text':<20} {'Variants':<20}")
print(f"{'BED':<15} {'Text':<20} {'Regions':<20}")
print(f"{'GFF/GTF':<15} {'Text':<20} {'Annotation':<20}")โ๏ธ Analysis Workflow
๐ฏ From Reads to Insight
The NGS analysis workflow has well-defined steps: QC, alignment/assembly, downstream analysis, and interpretation.
Workflow
QC: FastQC. Trim: fastp. Align: BWA. Sort: samtools. Variant: GATK. Annotate: VEP. Visualize: IGV.
# NGS Analysis Workflow
print("=== Complete Pipeline ===")
print(""
1. QUALITY CONTROL
- FastQC
- MultiQC
2. TRIMMING
- fastp
- Trimmomatic
3. ALIGNMENT
- BWA-MEM (DNA)
- STAR (RNA)
- Bowtie2 (ChIP)
- minimap2 (long)
4. POST-ALIGNMENT
- Sort (samtools)
- Mark duplicates (Picard)
- Index (samtools)
5. DOWNSTREAM
- Variant calling (GATK)
- RNA-Seq (featureCounts)
- ChIP-Seq (MACS2)
- Assembly (SPAdes)
6. ANNOTATION
- VEP
- SnpEff
- ANNOVAR
7. VISUALIZATION
- IGV
- UCSC
- Integrative
8. INTERPRETATION
- Clinical
- Biological
- Report
""")
print("\n=== Alignment ===")
print(""
DNA:
- BWA-MEM
- Bowtie2
- minimap2
RNA:
- STAR
- HISAT2
- Salmon (alignment-free)
ChIP:
- Bowtie2
- BWA
Long reads:
- minimap2
- NGMLR
- GraphMap
Example:
bwa mem -t 8 reference.fa reads_1.fq reads_2.fq | \
samtools sort -@ 8 -o sample.bam
""")
print("\n=== Post-alignment ===")
print(""
1. Sort:
samtools sort -@ 8 -o sample.sorted.bam sample.bam
2. Mark duplicates:
picard MarkDuplicates I=sample.sorted.bam \
O=sample.dedup.bam M=metrics.txt
3. Index:
samtools index sample.dedup.bam
4. QC:
samtools flagstat sample.dedup.bam
""")
print("\n=== Variant Calling ===")
print(""
Germline:
gatk HaplotypeCaller -R ref.fa -I sample.bam \
-O sample.g.vcf.gz -ERC GVCF
Joint:
gatk GenomicsDBImport ...
gatk GenotypeGVCFs ...
Somatic:
gatk Mutect2 -R ref.fa -I tumor.bam -I normal.bam \
-O somatic.vcf.gz
Filtering:
gatk VariantFiltration ...
gatk ApplyVQSR ...
""")
print("\n=== RNA-Seq ===")
print(""
Alignment:
STAR --genomeDir index --readFilesIn r1.fq r2.fq \
--outSAMtype BAM SortedByCoordinate
Quantification:
featureCounts -T 8 -a genes.gtf -o counts.txt *.bam
DE:
DESeq2
edgeR
limma-voom
""")
print("\n=== Assembly ===")
print(""
Short reads:
spades.py -1 r1.fq -2 r2.fq -o output
Long reads:
flye --pacbio-raw reads.fq --out-dir output
canu -p assembly -d output genomeSize=5m -pacbio reads.fq
Hybrid:
unicycler -1 short_1.fq -2 short_2.fq -l long.fq -o output
""")
print("\n=== Annotation ===")
print(""
VEP:
vep -i variants.vcf --cache --assembly GRCh38 \
--vcf -o annotated.vcf
SnpEff:
snpEff ann GRCh38.105 variants.vcf > annotated.vcf
ANNOVAR:
annotate_variation.pl -geneanno -buildver hg38 \
variants.vcf humandb/
""")
print("\n=== Visualization ===")
print(""
IGV:
- BAM
- VCF
- BED
- Coverage
UCSC:
- Custom tracks
- Public data
Tools:
- IGV
- UCSC
- JBrowse
- Circos
""")
print("\n=== Best Practices ===")
print(""
1. Document pipeline
2. Version control
3. Reproducible
4. QC at each step
5. Validate
6. Report parameters
7. Share data
8. Cite tools
""")๐ผ Applications
๐ฏ What NGS Can Do
NGS enables a wide range of applications, from whole-genome sequencing to single-cell transcriptomics.
Applications
WGS: Genome. WES: Exome. RNA-Seq: Expression. ChIP-Seq: Regulation. ATAC: Chromatin. Metagenome: Microbes. Single-cell: Cells.
# Applications
print("=== 1. Whole Genome Sequencing ===")
print(""
WGS:
- Complete genome
- All variants
- Structural variants
Workflow:
1. DNA extraction
2. Library prep
3. Sequencing (30x)
4. Alignment (BWA)
5. Variant calling (GATK)
6. Annotation (VEP)
Examples:
- Human
- Pathogens
- Plants
- Animals
Tools:
- BWA
- GATK
- VEP
""")
print("\n=== 2. Whole Exome Sequencing ===")
print(""
WES:
- Protein-coding
- ~1-2% genome
- Cost-effective
Workflow:
1. Exome capture
2. Sequencing (50-100x)
3. Alignment
4. Variant calling
5. Annotation
Examples:
- Rare disease
- Cancer
- Clinical
Tools:
- GATK
- VEP
- ClinVar
""")
print("\n=== 3. RNA-Seq ===")
print(""
RNA-Seq:
- Gene expression
- Splicing
- Fusion genes
Workflow:
1. RNA extraction
2. Library prep
3. Sequencing
4. Alignment (STAR)
5. Quantification
6. DE (DESeq2)
Examples:
- Disease
- Drug
- Development
- Single-cell
Tools:
- STAR
- Salmon
- DESeq2
""")
print("\n=== 4. ChIP-Seq ===")
print(""
ChIP-Seq:
- Protein-DNA
- Histone marks
- Regulatory
Workflow:
1. ChIP
2. Library
3. Sequencing
4. Peak calling (MACS2)
5. Motif (HOMER)
Examples:
- TF binding
- H3K27ac
- Enhancers
Tools:
- Bowtie2
- MACS2
- HOMER
""")
print("\n=== 5. ATAC-Seq ===")
print(""
ATAC-Seq:
- Open chromatin
- Regulatory elements
- TF footprinting
Workflow:
1. Tn5
2. Library
3. Sequencing
4. Peak calling
5. Motif
Examples:
- Cell types
- Development
- Cancer
Tools:
- Bowtie2
- MACS2
- HOMER
""")
print("\n=== 6. Metagenomics ===")
print(""
Metagenomics:
- Microbial communities
- Unculturable
- Functional
Workflow:
1. Sample
2. DNA
3. Sequencing
4. Assembly (SPAdes)
5. Binning (MetaBAT)
6. Annotation
Examples:
- Gut
- Soil
- Ocean
- Clinical
Tools:
- SPAdes
- MEGAHIT
- MetaBAT
""")
print("\n=== 7. Single-Cell ===")
print(""
Single-cell:
- Per-cell expression
- Heterogeneity
- Rare cells
Workflow:
1. Cells
2. 10x
3. Sequencing
4. Cell Ranger
5. Seurat/Scanpy
Examples:
- Immune
- Brain
- Tumor
- Development
Tools:
- Cell Ranger
- Seurat
- Scanpy
""")
print("\n=== 8. Clinical ===")
print(""
Clinical:
- Rare disease
- Cancer
- Pharmacogenomics
Workflow:
1. Patient
2. Sequencing
3. Variant calling
4. Annotation
5. Report
Examples:
- BRCA1/2
- CFTR
- CYP2D6
- HLA
Tools:
- GATK
- VEP
- ClinVar
""")
print("\n=== Comparison ===")
print(f"{'Application':<25} {'Reads':<15} {'Coverage':<15} {'Tool':<20}")
print("-" * 75)
print(f"{'WGS':<25} {'Short/long':<15} {'30x':<15} {'GATK':<20}")
print(f"{'WES':<25} {'Short':<15} {'50-100x':<15} {'GATK':<20}")
print(f"{'RNA-Seq':<25} {'Short':<15} {'20-30M':<15} {'STAR':<20}")
print(f"{'ChIP-Seq':<25} {'Short':<15} {'20-40M':<15} {'MACS2':<20}")
print(f"{'ATAC-Seq':<25} {'Short':<15} {'20-40M':<15} {'MACS2':<20}")
print(f"{'Metagenome':<25} {'Short/long':<15} {'Variable':<15} {'SPAdes':<20}")
print(f"{'Single-cell':<25} {'Short':<15} {'50K reads':<15} {'Cell Ranger':<20}")
print(f"{'Clinical':<25} {'Short':<15} {'100x':<15} {'GATK':<20}")๐ Python Integration
๐ฏ NGS from Python
You can run NGS tools from Python using subprocess and parse outputs with pysam, Biopython, and pandas.
Python
subprocess: Run CLI. pysam: BAM. Biopython: FASTQ. pandas: VCF. matplotlib: Plot. Pipeline: Automate.
# Python Integration
print("=== Parse FASTQ ===")
print(""
from Bio import SeqIO
def parse_fastq(fastq_file):
\"\"\"Parse FASTQ file.\"\"\"
for record in SeqIO.parse(fastq_file, "fastq"):
print(f"ID: {record.id}")
print(f"Sequence: {record.seq}")
print(f"Quality: {record.letter_annotations['phred_quality'][:10]}")
# Use
# parse_fastq("reads.fastq")
""")
print("\n=== Run BWA ===")
print(""
import subprocess
def run_bwa(reference, reads_1, reads_2, output_bam,
threads=8):
\"\"\"Run BWA-MEM alignment.\"\"\"
cmd = (
f"bwa mem -t {threads} {reference} "
f"{reads_1} {reads_2} | "
f"samtools sort -@ {threads} -o {output_bam} -"
)
result = subprocess.run(cmd, shell=True, capture_output=True,
text=True)
if result.returncode != 0:
raise RuntimeError(f"BWA failed: {result.stderr}")
# Index
subprocess.run(['samtools', 'index', output_bam], check=True)
return output_bam
# Use
# bam = run_bwa("ref.fa", "r1.fq", "r2.fq", "sample.bam")
""")
print("\n=== Parse BAM with pysam ===")
print(""
import pysam
def parse_bam(bam_file):
\"\"\"Parse BAM file.\"\"\"
bam = pysam.AlignmentFile(bam_file, "rb")
count = 0
for read in bam:
print(f"Read: {read.query_name}")
print(f" Flag: {read.flag}")
print(f" Ref: {read.reference_name}:{read.reference_start}")
print(f" MapQ: {read.mapping_quality}")
print(f" CIGAR: {read.cigarstring}")
count += 1
if count >= 5:
break
bam.close()
# Use
# parse_bam("sample.bam")
""")
print("\n=== Run GATK ===")
print(""
def run_gatk(reference, bam, output_vcf, threads=4):
\"\"\"Run GATK HaplotypeCaller.\"\"\"
cmd = [
'gatk', 'HaplotypeCaller',
'-R', reference,
'-I', bam,
'-O', output_vcf,
'-ERC', 'GVCF',
'--native-pair-hmm-threads', str(threads)
]
result = subprocess.run(cmd, capture_output=True, text=True)
if result.returncode != 0:
raise RuntimeError(f"GATK failed: {result.stderr}")
return output_vcf
# Use
# vcf = run_gatk("ref.fa", "sample.bam", "sample.g.vcf.gz")
""")
print("\n=== Parse VCF ===")
print(""
import pysam
from cyvcf2 import VCF
def parse_vcf(vcf_file):
\"\"\"Parse VCF with CyVCF2.\"\"\"
vcf = VCF(vcf_file)
for variant in vcf:
print(f"{variant.CHROM}:{variant.POS} "
f"{variant.REF}>{variant.ALT[0]} "
f"QUAL={variant.QUAL}")
for sample in variant.genotypes:
print(f" GT: {sample}")
# Use
# parse_vcf("variants.vcf.gz")
""")
print("\n=== FASTQ Stats ===")
print(""
from Bio import SeqIO
import numpy as np
def fastq_stats(fastq_file):
\"\"\"Compute FASTQ statistics.\"\"\"
lengths = []
qualities = []
for record in SeqIO.parse(fastq_file, "fastq"):
lengths.append(len(record.seq))
qualities.extend(
record.letter_annotations['phred_quality']
)
print(f"Reads: {len(lengths)}")
print(f"Mean length: {np.mean(lengths):.0f}")
print(f"Mean quality: {np.mean(qualities):.1f}")
print(f"Q30: {np.mean(np.array(qualities) >= 30)*100:.1f}%")
return lengths, qualities
# Use
# fastq_stats("reads.fastq")
""")
print("\n=== Complete Pipeline ===")
print(""
import subprocess
import os
def ngs_pipeline(reads_1, reads_2, reference,
output_dir="ngs_output", threads=8):
\"\"\"Complete NGS pipeline.\"\"\"
os.makedirs(output_dir, exist_ok=True)
# 1. QC
print("QC...")
subprocess.run([
'fastqc', reads_1, reads_2,
'-o', f'{output_dir}/qc'
], check=True)
# 2. Trim
print("Trimming...")
subprocess.run([
'fastp', '-i', reads_1, '-I', reads_2,
'-o', f'{output_dir}/clean_1.fq.gz',
'-O', f'{output_dir}/clean_2.fq.gz',
'--detect_adapter_for_pe'
], check=True)
# 3. Align
print("Aligning...")
bam = run_bwa(
reference,
f'{output_dir}/clean_1.fq.gz',
f'{output_dir}/clean_2.fq.gz',
f'{output_dir}/sample.bam',
threads
)
# 4. Variant calling
print("Calling variants...")
vcf = run_gatk(reference, bam, f'{output_dir}/sample.g.vcf.gz')
print("Pipeline complete!")
return vcf
# Use
# vcf = ngs_pipeline("r1.fq", "r2.fq", "ref.fa")
""")โ๏ธ Platform Comparison
๐ฏ Which Platform?
Choosing the right sequencing platform depends on your application, budget, and required read length.
Comparison
Illumina: Short. PacBio: HiFi. Nanopore: Ultra-long. Ion: Targeted. MGI: Short. Sanger: Validation.
| Platform | Read Length | Accuracy | Throughput | Best For |
|---|---|---|---|---|
| Illumina | 50-300 bp | Q30-Q40 | Very high | WGS, RNA-Seq, ChIP |
| PacBio HiFi | 10-25 kb | Q30+ | High | Assembly, SV, isoforms |
| PacBio CLR | 10-60 kb | Q20 | Medium | Assembly, SV |
| Nanopore | 10-100 kb | Q20+ | High | Ultra-long, real-time |
| Ion Torrent | 200-600 bp | Q20 | Medium | Targeted, clinical |
| MGI | 50-300 bp | Q30 | Very high | WGS, WES |
| Sanger | 500-1000 bp | Q40+ | Very low | Validation |
# Decision Guide
print("=== Choose Platform by Application ===")
print(""
WGS (germline):
โ Illumina (30x)
โ MGI
WGS (complete):
โ PacBio HiFi
โ Nanopore
WES:
โ Illumina
โ MGI
RNA-Seq:
โ Illumina
โ Nanopore (isoforms)
ChIP-Seq:
โ Illumina
ATAC-Seq:
โ Illumina
Metagenomics:
โ Illumina + Nanopore
โ PacBio HiFi
Single-cell:
โ Illumina
โ 10x Genomics
Clinical:
โ Illumina
โ Sanger (validation)
Field work:
โ Nanopore (portable)
""")
print("\n=== Speed Comparison ===")
print(f"{'Platform':<20} {'Run time':<15} {'Output':<15}")
print("-" * 50)
print(f"{'iSeq 100':<20} {'~1 day':<15} {'1.2 Gb':<15}")
print(f"{'MiSeq':<20} {'~1 day':<15} {'15 Gb':<15}")
print(f"{'NextSeq':<20} {'~1 day':<15} {'120 Gb':<15}")
print(f"{'NovaSeq 6000':<20} {'~2 days':<15} {'6 Tb':<15}")
print(f"{'NovaSeq X':<20} {'~2 days':<15} {'16 Tb':<15}")
print(f"{'PacBio Revio':<20} {'~1 day':<15} {'25M reads':<15}")
print(f"{'Nanopore PromethION':<20} {'~1 day':<15} {'100+ Gb':<15}")
print("\n=== Cost Comparison ===")
print(f"{'Platform':<20} {'Cost/Gb':<15} {'Cost/Genome':<15}")
print("-" * 50)
print(f"{'Illumina':<20} {'$5-15':<15} {'$200-500':<15}")
print(f"{'MGI':<20} {'$3-10':<15} {'$150-400':<15}")
print(f"{'PacBio HiFi':<20} {'$50-100':<15} {'$1000-2000':<15}")
print(f"{'Nanopore':<20} {'$30-80':<15} {'$500-1500':<15}")
print(f"{'Sanger':<20} {'$1000+':<15} {'N/A':<15}")
print("\n=== When to Use Which ===")
print(""
USE ILLUMINA:
โ WGS
โ WES
โ RNA-Seq
โ ChIP-Seq
โ ATAC-Seq
โ Single-cell
โ High accuracy
โ Low cost
USE PACBIO HIFI:
โ Complete genomes
โ SVs
โ Full-length isoforms
โ Methylation
โ Assembly
USE NANOPORE:
โ Ultra-long reads
โ Real-time
โ Portable
โ Field work
โ Methylation
USE SANGER:
โ Validation
โ Small targets
โ Clinical
""")๐ผ Use Cases
๐ฏ Where NGS Is Used
NGS is used in virtually every area of biology and medicine: genomics, transcriptomics, epigenomics, and more.
Use Cases
Genomics: Genomes. Transcriptomics: Expression. Epigenomics: Regulation. Microbiome: Communities. Clinical: Diagnostics. Single-cell: Heterogeneity.
# Use Cases
print("=== 1. Human Genomics ===")
print(""
Use case:
- Reference genome
- Variants
- Disease
Workflow:
1. WGS/WES
2. Alignment
3. Variant calling
4. Annotation
5. Report
Examples:
- 1000 Genomes
- UK Biobank
- gnomAD
- Clinical
Tools:
- BWA
- GATK
- VEP
""")
print("\n=== 2. Cancer Genomics ===")
print(""
Use case:
- Somatic mutations
- Driver mutations
- Treatment
Workflow:
1. Tumor + normal
2. WGS/WES
3. Somatic calling (Mutect2)
4. Annotation
5. Report
Examples:
- TCGA
- ICGC
- Clinical trials
Tools:
- Mutect2
- Strelka2
- VEP
""")
print("\n=== 3. Rare Disease ===")
print(""
Use case:
- Diagnosis
- Novel genes
- Clinical
Workflow:
1. Patient + parents
2. WES/WGS
3. Variant calling
4. Trio analysis
5. Report
Examples:
- Undiagnosed
- Mendelian
- De novo
Tools:
- GATK
- VEP
- Exomiser
""")
print("\n=== 4. Infectious Disease ===")
print(""
Use case:
- Outbreak
- Resistance
- Surveillance
Workflow:
1. Pathogen
2. Sequencing
3. Assembly
4. Phylogenetics
5. Report
Examples:
- SARS-CoV-2
- TB
- Influenza
- HIV
Tools:
- SPAdes
- IQ-TREE
- Nextstrain
""")
print("\n=== 5. Microbiome ===")
print(""
Use case:
- Gut
- Environment
- Health
Workflow:
1. Sample
2. 16S or WGS
3. Assembly
4. Binning
5. Annotation
Examples:
- Human Microbiome Project
- Earth Microbiome
- Clinical
Tools:
- QIIME2
- SPAdes
- MetaBAT
""")
print("\n=== 6. Agriculture ===")
print(""
Use case:
- Crop genomics
- Breeding
- Traits
Workflow:
1. Plant DNA
2. WGS
3. Variant calling
4. GWAS
5. Breeding
Examples:
- Rice
- Maize
- Wheat
- Tomato
Tools:
- GATK
- TASSEL
- PLINK
""")
print("\n=== 7. Single-Cell ===")
print(""
Use case:
- Heterogeneity
- Cell types
- Trajectories
Workflow:
1. Cells
2. 10x
3. Sequencing
4. Cell Ranger
5. Seurat
Examples:
- Human Cell Atlas
- Tumor
- Brain
- Immune
Tools:
- Cell Ranger
- Seurat
- Scanpy
""")
print("\n=== 8. Epigenomics ===")
print(""
Use case:
- Chromatin
- Regulation
- Disease
Workflow:
1. ChIP/ATAC
2. Sequencing
3. Peak calling
4. Motif
5. Networks
Examples:
- ENCODE
- Roadmap
- Cancer
Tools:
- MACS2
- HOMER
- deepTools
""")
print("\n=== Comparison ===")
print(f"{'Use Case':<25} {'Platform':<20} {'Output':<20}")
print("-" * 65)
print(f"{'Human genomics':<25} {'Illumina':<20} {'Variants':<20}")
print(f"{'Cancer':<25} {'Illumina':<20} {'Somatic':<20}")
print(f"{'Rare disease':<25} {'Illumina':<20} {'Diagnosis':<20}")
print(f"{'Infectious':<25} {'Nanopore':<20} {'Outbreak':<20}")
print(f"{'Microbiome':<25} {'Illumina':<20} {'Taxa':<20}")
print(f"{'Agriculture':<25} {'Illumina':<20} {'Traits':<20}")
print(f"{'Single-cell':<25} {'Illumina':<20} {'Clusters':<20}")
print(f"{'Epigenomics':<25} {'Illumina':<20} {'Peaks':<20}")โ FAQ
๐ฏ Frequently Asked Questions
Answers to common questions about Next-Generation Sequencing.
What is Next-Generation Sequencing (NGS)?
Next-Generation Sequencing (NGS) refers to high-throughput DNA and RNA sequencing technologies that massively parallelize the sequencing process, producing millions to billions of reads simultaneously. NGS has revolutionized genomics by making sequencing fast, affordable, and scalable compared to Sanger sequencing.
What is the difference between short-read and long-read sequencing?
Short-read sequencing (Illumina) produces reads of 50-300 bp with very high accuracy and throughput, ideal for variant calling, RNA-Seq, and SNP genotyping. Long-read sequencing (PacBio, Oxford Nanopore) produces reads of 10-100 kb, which are essential for resolving repeats, structural variants, full-length isoforms, and complete genome assembly.
Which sequencing platform should I use?
Use Illumina for high-accuracy short reads (variant calling, RNA-Seq, ChIP-Seq). Use PacBio HiFi for highly accurate long reads (genome assembly, SV detection, full-length isoforms). Use Oxford Nanopore for ultra-long reads, portable sequencing, real-time analysis, and direct DNA/RNA methylation detection.
What is a FASTQ file?
FASTQ is the standard text format for storing raw sequencing reads and their quality scores. Each read is represented by four lines: a header (starting with @), the sequence, a separator (+), and the quality string (Phred-scaled ASCII characters). It's the starting point for nearly all NGS analysis pipelines.
What is the typical NGS analysis workflow?
A typical NGS workflow: (1) Library preparation, (2) Sequencing, (3) Quality control (FastQC, MultiQC), (4) Trimming (fastp, Trimmomatic), (5) Alignment (BWA, Bowtie2, minimap2) or assembly (SPAdes, Flye), (6) Downstream analysis (variant calling, RNA-Seq, ChIP-Seq), (7) Visualization and interpretation.
What coverage do I need for WGS?
For germline WGS: 30x is standard. For somatic/cancer: 100x+ tumor, 30x normal. For clinical: 100x+. For long-read assembly: 20-40x HiFi or 30-50x Nanopore. Higher coverage improves sensitivity, especially for low allele fraction variants and structural variants.
What is the difference between WGS, WES, and targeted sequencing?
WGS (Whole Genome Sequencing) sequences the entire genome (~3 Gb for human). WES (Whole Exome Sequencing) captures and sequences only protein-coding regions (~1-2% of genome). Targeted sequencing focuses on specific genes or regions. WGS is comprehensive; WES and targeted are more cost-effective for specific questions.
What is the difference between PacBio and Nanopore?
PacBio uses SMRT sequencing with zero-mode waveguides and fluorescent nucleotides; HiFi reads are highly accurate (> 99.9%) but shorter (10-25 kb). Nanopore uses protein pores and current disruption; reads can be ultra-long (> 100 kb) and it's portable and real-time, with accuracy improving (Q20+). Both detect methylation.
What is multiplexing and why is it used?
Multiplexing combines multiple samples into a single sequencing run using unique barcodes (indexes) ligated to each sample's DNA. It reduces cost per sample, increases throughput utilization, and minimizes batch effects. Use unique dual indexes (UDI) to avoid index hopping.
What is the difference between BAM and CRAM?
BAM is the binary version of SAM (Sequence Alignment/Map) and stores aligned reads. CRAM is a more compressed, reference-based format that can reduce file size by 30-60%. Both are supported by samtools, pysam, and all major genomics tools. CRAM is increasingly preferred for archival storage.
# Quick Reference
print("=== Quick Answers ===")
print(""
Q: What is NGS?
A: Massively parallel sequencing.
Q: Short vs long reads?
A: Illumina (short); PacBio/Nanopore (long).
Q: Best platform?
A: Illumina (short); PacBio HiFi (long).
Q: Coverage for WGS?
A: 30x germline, 100x somatic.
Q: FASTQ?
A: Raw reads + quality.
Q: BAM?
A: Binary alignment format.
Q: VCF?
A: Variant Call Format.
Q: Multiplexing?
A: Barcodes for multiple samples.
Q: Best long-read tool?
A: Flye, Canu, hifiasm.
Q: Free tools?
A: Yes โ BWA, GATK, samtools, SPAdes.
""")๐ Future
๐ฏ Where NGS Is Going
The future is long-read first, single-cell, spatial, real-time, multi-omics, and clinical.
Future Directions
Long-read: T2T. Single-cell: Atlases. Spatial: Location. Real-time: Surveillance. Multi-omics: Integration. Clinical: Routine.
# Future of NGS
print("=== 1. Long-Read First ===")
print(""
Trend: Long reads
Current:
- Short reads standard
- Long reads specialized
Future:
- Long reads routine
- Complete genomes
- T2T
- SVs
- Isoforms
Examples:
- Human T2T
- Complete genomes
- Clinical
Tools:
- PacBio HiFi
- Nanopore
- Flye
- hifiasm
""")
print("\n=== 2. Single-Cell ===")
print(""
Trend: Single-cell
Current:
- Bulk
- Average
Future:
- Millions of cells
- All tissues
- Atlases
- Clinical
Examples:
- Human Cell Atlas
- Brain
- Tumor
- Development
Tools:
- 10x
- Seurat
- Scanpy
- CellxGene
""")
print("\n=== 3. Spatial ===")
print(""
Trend: Spatial
Current:
- Dissociated
- Lose location
Future:
- Tissue context
- Spatial multi-omics
- 3D
- Clinical
Platforms:
- 10x Visium
- MERFISH
- Slide-seq
- Stereo-seq
Tools:
- Seurat
- Squidpy
- Giotto
""")
print("\n=== 4. Real-Time ===")
print(""
Trend: Real-time
Current:
- Batch
- Slow
Future:
- Real-time
- Portable
- Field
- Surveillance
Examples:
- Nanopore
- Outbreak
- Clinical
- Environmental
Tools:
- Nanopore
- Nextstrain
- EPI2ME
""")
print("\n=== 5. Multi-Omics ===")
print(""
Trend: Integrate everything
Current:
- Single modality
- Separate
Future:
- Multi-omics
- Single-cell
- Spatial
- Integrated
Examples:
- Genomics + transcriptomics
- Proteomics + metabolomics
- Single-cell multi-omics
Tools:
- Seurat
- MOFA
- Scanpy
""")
print("\n=== 6. Clinical ===")
print(""
Trend: Clinical
Current:
- Research
- Specialized
Future:
- Clinical routine
- Rare disease
- Cancer
- Pharmacogenomics
- Newborn screening
Examples:
- BRCA1/2
- CFTR
- CYP2D6
- HLA
Tools:
- GATK
- VEP
- ClinVar
""")
# TIMELINE
print("\n=== Timeline ===")
print(""
Past:
1977: Sanger
2005: 454
2006: Illumina
2010: PacBio
2014: Nanopore
2019: HiFi
2022: T2T
Present:
2025: Long-read first
2026: Single-cell atlases
Future:
2030: Routine T2T?
2035: Spatial multi-omics?
2040: Clinical NGS?
""")
print("\n=== Final Thoughts ===")
print(""
NGS is:
- Fundamental to genomics
- Rapidly improving
- Becoming cheaper
- Democratizing biology
The future is:
- Long-read first
- Single-cell
- Spatial
- Real-time
- Multi-omics
- Clinical
"Sequencing is the microscope
of modern biology."
Keep exploring. Keep building.
""")