# Viromics & Viral Metagenomics: Computational Pipelines, Assembly & Annotation


## Key Takeaways

- Viromic analysis necessitates rigorous quality control and host DNA depletion using tools like FastQC, Trimmomatic, Bowtie2, or BWA-MEM to isolate viral genetic material.
- De novo assembly of viral metagenomes is achieved with specialized assemblers such as metaSPAdes or MEGAHIT, which differ in their algorithmic approaches, memory requirements, and viral recovery capabilities.
- Identification of uncultivated viral genomes (UViGs) relies on machine learning and HMM-based tools like VirSorter2, DeepVirFinder, and VIBRANT, followed by quality assessment with CheckV to categorize genomes by completeness.
- Host prediction for viral contigs is performed using methods including CRISPR spacer matching, tRNA analysis, and oligonucleotide frequency analysis, offering varying levels of resolution and computational cost.
- Critical limitations in current viromic analysis include reference bias in host depletion, assembly fragmentation, and challenges in accurately predicting hosts for novel or RNA viruses.

---

**Immediate Direct-Answer Summary:**  
Viromics computational analysis involves processing viral metagenomic data through quality control, host DNA depletion, de novo assembly, viral contig identification using machine learning tools (VirSorter2, DeepVirFinder), quality assessment with CheckV, and host prediction via CRISPR/tRNA matching. This pipeline enables discovery of uncultivated viral genomes (UViGs) from complex microbial communities.

## 1. Quality Control and Host Genome Depletion

### Read Preprocessing
```bash
# FastQC quality assessment
fastqc raw_reads_R1.fastq raw_reads_R2.fastq -o qc_reports/

# Trimmomatic adapter removal
trimmomatic PE -phred33 raw_reads_R1.fastq raw_reads_R2.fastq \
  paired_R1.fastq unpaired_R1.fastq paired_R2.fastq unpaired_R2.fastq \
  ILLUMINACLIP:adapters.fa:2:30:10 LEADING:3 TRAILING:3 SLIDINGWINDOW:4:15 MINLEN:50
```

### Host DNA Depletion (Bowtie2/BWA)
```bash
# Bowtie2 alignment to host genome
bowtie2 -x host_genome -1 paired_R1.fastq -2 paired_R2.fastq \
  --un-conc nonhost_%.fastq -S host_aligned.sam

# BWA alternative
bwa mem -t 8 host_genome.fa paired_R1.fastq paired_R2.fastq | \
  samtools view -b -f 12 -F 256 -o nonhost.bam
samtools fastq -1 nonhost_R1.fastq -2 nonhost_R2.fastq nonhost.bam
```

| Tool | Sensitivity | Speed | Memory Use | Best For |
|------|------------|-------|------------|----------|
| Bowtie2 | High | Medium | Low | Eukaryotic hosts |
| BWA-MEM | Very High | Fast | Medium | Large host genomes |
| Minimap2 | Medium | Very Fast | Low | Quick screening |

## 2. De Novo Viral Metagenome Assembly

### Assembly Pipeline Comparison

```bash
# metaSPAdes assembly
metaspades.py -1 nonhost_R1.fastq -2 nonhost_R2.fastq -o assembly_output/

# MEGAHIT assembly
megahit -1 nonhost_R1.fastq -2 nonhost_R2.fastq -o megahit_out
```

| Feature | metaSPAdes | MEGAHIT | IDBA-UD |
|---------|-----------|---------|---------|
| Algorithm | Multi-kmer | Succinct de Bruijn | Iterative |
| Memory Use | High | Medium | Medium |
| Speed | Slow | Fast | Medium |
| Viral Recovery | Excellent | Good | Fair |
| Max Input Size | <100GB | >500GB | <50GB |

## 3. Mining UViGs with ML/HMM Tools

### Viral Identification Workflow

```mermaid
flowchart TD
    A[Contigs] --> B{VirSorter2}
    A --> C{DeepVirFinder}
    A --> D{VIBRANT}
    B -->|Categories 1-3| E[High-confidence viral]
    B -->|Categories 4-6| F[Provirus/lower confidence]
    C -->|Score >0.9| E
    D -->|Complete/High-quality| E
    E --> G[CheckV quality assessment]
```

```bash
# VirSorter2 execution
virsorter run -w virsorter2_out -i contigs.fa -j 8 --min-length 1000 all

# DeepVirFinder prediction
python DeepVirFinder/dvf.py -i contigs.fa -o dvf_out -l 1000 -c 8

# VIBRANT analysis
VIBRANT_run.py -i contigs.fa -folder vibrant_out -virome -t 8
```

## 4. Viral Contig Quality Assessment with CheckV

```bash
checkv end_to_end contigs.fa output_directory -t 8 -d /path/to/checkv_db
```

**CheckV Quality Tiers:**
1. **Complete (>90% complete)**: Full-length genomes with terminal repeats
2. **High-quality (>90% complete, <5 contigs)**: Near-complete genomes
3. **Medium-quality (>50% complete)**: Partial genomes
4. **Low-quality (<50% complete)**: Fragments

## 5. Host Prediction Methods

### CRISPR Spacer Matching
```bash
# Extract CRISPR spacers from host genomes
crispr Recognition Tool -i host_genomes/ -o crispr_spacers.fa

# Align viral contigs to spacers
blastn -query viral_contigs.fa -subject crispr_spacers.fa \
  -outfmt "6 qseqid sseqid pident length mismatch" > spacer_matches.txt
```

### Oligonucleotide Frequency Analysis
```bash
# WIsH host prediction
WIsH -c viral_contigs.fa -g host_genomes/ -p 8 -o wish_predictions/
```

| Method | Resolution | Sensitivity | Computational Cost |
|--------|------------|-------------|--------------------|
| CRISPR | Strain-level | High | Low |
| tRNA | Genus-level | Medium | Medium |
| Oligo | Family-level | High | High |
| Alignment | Species-level | Low | Medium |

## Frequently Asked Questions

```json
{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "What is the minimum sequencing depth needed for viral metagenomics?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "For effective viral genome recovery, we recommend ≥10M read pairs (150bp) per sample. RNA viromes may require 2-3× deeper sequencing due to higher diversity."
      }
    },
    {
      "@type": "Question",
      "name": "How do VirSorter2 and DeepVirFinder differ in viral prediction?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "VirSorter2 uses curated HMM profiles and ML classifiers (precision-focused), while DeepVirFinder employs CNN models on sequence patterns (better for novel viruses). Combined use increases recall by 15-20%."
      }
    },
    {
      "@type": "Question",
      "name": "What CheckV completeness threshold should I use for downstream analysis?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "For most applications, include contigs with ≥50% completeness (medium-quality tier). Phylogenetic analyses should use ≥90% complete genomes where possible."
      }
    },
    {
      "@type": "Question",
      "name": "Can I predict hosts for RNA viruses using these methods?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Host prediction is more challenging for RNA viruses. While CRISPR matching works for prokaryotes, eukaryotic RNA virus hosts are best predicted via co-occurrence networks or serum antibody matching."
      }
    },
    {
      "@type": "Question",
      "name": "How do I handle mixed viral-bacterial contigs in assemblies?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Use VirSorter2's 'provirus' mode to detect integration sites, followed by manual inspection with gene callers (Prodigal) and BLAST against viral/bacterial marker databases."
      }
    },
    {
      "@type": "Question",
      "name": "What are the current limitations in viromics computational analysis?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Key challenges include: 1) reference bias in host depletion, 2) assembly fragmentation of high-diversity regions, 3) limited host prediction accuracy for novel viruses, and 4) incomplete viral protein databases affecting annotation."
      }
    }
  ]
}
```

## Key Citations
1. Roux et al. (2021) "VirSorter2: a multi-classifier, expert-guided approach to detect diverse DNA and RNA viruses" *Microbiome* 9:37  
2. Ren et al. (2020) "VirFinder: a novel k-mer based tool for identifying viral sequences from assembled metagenomic data" *Microbiome* 5:69  
3. Nayfach et al. (2021) "CheckV assesses the quality and completeness of metagenome-assembled viral genomes" *Nature Biotechnology* 39:578-585  
4. Paez-Espino et al. (2017) "CRISPR spacer content of gut microbiomes reveals billions of years of phage exposure" *Nature* 542:204-207  
5. Kieft et al. (2021) "VIBRANT: Automated recovery, annotation and curation of microbial viruses" *Nucleic Acids Research* 49:gkaa1121  
6. Tisza et al. (2020) "A catalog of tens of thousands of viruses from human metagenomes reveals host-associated viral diversity" *Nature Microbiology* 5:960-970