9  Practice Questions and Chapter Quizzes

This chapter collects learner-focused practice that mirrors the full viromics workflow, from Linux basics to viral abundance. Work through one topic at a time, ideally right after finishing the matching chapter. Each exercise is short and self-contained, and every quiz answer is hidden behind a collapsible box so you can test yourself before checking.

Learning objectives — by the end of this chapter you will be able to:

  • reproduce small command-line tasks that reinforce each stage of the pipeline;
  • filter, count, and summarize tab-separated data with awk, cut, sort, and seqkit;
  • recall which tool solves which problem across QC, assembly, viral identification, quality control, taxonomy, and abundance; and
  • self-assess your progress with both static and interactive quizzes.
TipHow to use this chapter

Some exercises read files produced by the main pipeline (assemblies, abundance tables, BAMs). Run them only if you have run the pipeline; otherwise substitute the ready-made tables in data/example/, which have the same columns and let every command run without a full analysis.

9.1 Fundamentals practice

9.1.1 Exercise

Create a TSV file with five viral genome types and use awk to print only RNA viruses.

cat > genomes.tsv << 'EOF'
virus   genome
T4  dsDNA
Influenza   -ssRNA
Coronavirus +ssRNA
Rotavirus   dsRNA
Microvirus  ssDNA
EOF

awk -F'\t' 'NR==1 || $2 ~ /RNA/' genomes.tsv

9.1.2 Quiz

Q1. What is the best one-line definition of a virome?

A. all bacteria in a sample B. the viral community associated with a sample or environment C. only the viruses that cause disease D. only RNA viruses

Answer: B. A virome is the viral community associated with a sample or environment. In practice it is an operational measurement — you detect only the protocol-dependent subset of viruses your workflow can capture.

Q2. Viromics has no equivalent of the bacterial 16S rRNA gene. What does this imply for viral identification?

A. viruses cannot be sequenced at all B. a single universal marker gene can classify every virus C. identification must combine several imperfect signals such as hallmark genes, genome structure, and reference similarity D. only circular genomes can be identified

Answer: C. There is no universal viral barcode, so tools rely on multiple lines of evidence together: viral hallmark genes, gene density and orientation, sequence composition, genome architecture, coverage, and host-association signals.

Q3. In one sentence, what is a prophage, and what sequence signal hints at one inside a bacterial contig?

Answer: A prophage is the genome of a temperate phage persisting in or alongside a host genome, usually integrated into the host chromosome. On a contig it appears as a viral region flanked by host DNA, often with an integrase or recombinase gene and attachment (att) sites — which is why tools like CheckV trim host flanks from proviruses.

9.2 Experimental design practice

9.2.1 Exercise

Make a metadata table with two groups, three replicates per group, and one extraction blank, then count samples per control type.

cat > metadata.tsv << 'EOF'
sample_id   group   replicate   control_type
A1  A   1   biological_sample
A2  A   2   biological_sample
A3  A   3   biological_sample
B1  B   1   biological_sample
B2  B   2   biological_sample
B3  B   3   biological_sample
Blank1  none    NA  extraction_blank
EOF

awk -F'\t' 'NR>1 {count[$4]++} END {for (x in count) print x, count[x]}' metadata.tsv

The awk command tallies the fourth column and prints each control type with its count. Including an extraction blank lets you flag reagent and laboratory contaminants during analysis.

9.3 Linux setup practice

9.3.1 Exercise

Check whether the core conda environment exists before starting a run.

conda env list | grep viromics-core || echo "Environment missing"

If the environment is missing, create it before continuing. The same pattern (grep <name> || echo missing) works for virsorter2, genomad, checkv, and the other environments used across the book.

9.4 Pipeline practice

9.4.1 Exercise

Count assembled contigs longer than 5 kb. Run this if you have run the pipeline; otherwise use the example assembly in data/example/ (for instance data/example/final.contigs.fa).

seqkit seq -m 5000 assemblies/megahit_samples/final.contigs.fa \
  > assemblies/megahit_samples/contigs_gt5kb.fa

grep -c "^>" assemblies/megahit_samples/contigs_gt5kb.fa

seqkit seq -m 5000 keeps sequences of at least 5000 bp, and grep -c "^>" counts FASTA headers. Length filtering removes many short, low-evidence contigs before viral identification.

9.5 Visualization practice

9.5.1 Exercise

Print the top three vOTUs by TPM using Python. Use your own abundance table if you have run the pipeline; otherwise point the reader at data/example/samples_manual_tpm.tsv.

import pandas as pd

df = pd.read_csv("abundance/samples_manual_tpm.tsv", sep="\t")
print(df.sort_values("TPM", ascending=False).head(3))

Sorting by TPM highlights the most abundant viral operational taxonomic units. Save the resulting figures under visualization/figures to keep outputs consistent with the rest of the book.

9.6 Final mixed quiz

Q1. Which tool estimates viral completeness and contamination? Answer: CheckV.

Q2. Which tool performs read trimming and quality filtering and creates an HTML report? Answer: fastp.

Q3. Which tool builds a maximum likelihood phylogenetic tree? Answer: IQ-TREE.

Q4. Which method can predict host association using bacterial immune memory? Answer: CRISPR spacer matching.

Q5. Which normalization can be used for viral abundance? Answer: TPM or coverage.

Estimated resources on 12 threads and 32 GB RAM: These practice tasks are lightweight and finish in seconds unless they reuse large FASTQ, BAM, or assembly files. The data/example/ tables keep every command runnable on a laptop.

9.7 Key takeaways

  • Work each exercise right after its matching chapter, then use the collapsible answers to test recall before revealing them.
  • Treat every wrong quiz answer as a signal: reread the linked section rather than memorizing the correct letter.
  • Practice mapping problems to tools — QC (fastp), quality (CheckV), taxonomy (vConTACT2), phylogenetics (IQ-TREE) — since exams often ask which tool solves which task.
  • Rebuild the small awk, cut, sort, and seqkit one-liners from memory; fluency with tab-separated data is the most transferable skill.
  • Self-assess with both the static and interactive quizzes, and only move on once you can explain each answer in your own words.

9.8 Further reading

  • Chen et al. (2018) — revisit the QC step behind many practice exercises and confirm you can read a fastp report.
  • Nayfach et al. (2021) — reread how completeness and contamination tiers are defined before self-testing on quality control.
  • Minh et al. (2020) — review maximum likelihood tree building to answer the phylogenetics questions confidently.
  • Quarto documentation on callouts and collapsible content: https://quarto.org/docs/authoring/callouts.html — useful if you want to build your own self-check boxes.
Chen, Shifu, Yanqing Zhou, Yaru Chen, and Jia Gu. 2018. “Fastp: An Ultra-Fast All-in-One FASTQ Preprocessor.” Bioinformatics 34 (17): i884–90. https://doi.org/10.1093/bioinformatics/bty560.
Nayfach, Stephen, Antonio Pedro Camargo, Frederik Schulz, Emiley Eloe-Fadrosh, Simon Roux, and Nikos C. Kyrpides. 2021. “CheckV Assesses the Quality and Completeness of Metagenome-Assembled Viral Genomes.” Nature Biotechnology 39: 578–85. https://doi.org/10.1038/s41587-020-00774-7.
Minh, Bui Quang, Heiko A. Schmidt, Olga Chernomor, Dominik Schrempf, Michael D. Woodhams, Arndt von Haeseler, and Robert Lanfear. 2020. “IQ-TREE 2: New Models and Efficient Methods for Phylogenetic Inference in the Genomic Era.” Molecular Biology and Evolution 37 (5): 1530–34. https://doi.org/10.1093/molbev/msaa015.

9.9 Chapter figure

Skills consolidation map across the viromics workflow
Figure 9.1: A skills consolidation map linking each practice topic to the stage of the viromics workflow it reinforces.

Save as: images/ch07-study-map.png · Aspect ratio: 16:9 · Style: clean flat vector infographic, Codanics palette (teal #008b8b, navy #05043b, white background), no photorealism.

Prompt: Create a clean educational infographic titled “Skills consolidation map” showing the viromics workflow as a horizontal pipeline of connected stages, left to right: Fundamentals, Experimental design, Linux setup, Assembly and pipeline, Visualization and abundance. Draw each stage as a rounded card with a small icon (DNA strand, sample tubes, terminal window, contig bars, bar chart). Above each card, place a small badge listing the skill practiced there (for example “awk filtering”, “metadata table”, “conda env check”, “seqkit length filter”, “TPM ranking”). Connect the cards with arrows to show progression, and add a circular “self-check quiz” node beneath the pipeline linking up to every stage. Use teal and navy Codanics branding, clear sans-serif labels, and a white background.

9.10 Interactive quiz: Mixed self-check

How to use this quiz: Select one option, click Check answer, and read the explanation. Use the reset button if you want to try again.

1. Which command is most suitable for counting unique values in a TSV column?

A common Linux pattern is to cut the desired column, sort it, and then apply uniq or uniq -c.

2. Which tool is best known for all-in-one FASTQ preprocessing in this book?

fastp performs trimming and quality filtering and also creates reports.

3. Which tool helps place viral genomes into gene-sharing clusters?

vConTACT2 uses gene-sharing networks to support taxonomic interpretation of uncultivated viruses.

4. What is a strong reason to keep exact software commands in a project?

Reproducible science depends on documenting the exact tools, commands, inputs, and outputs.

5. What should you do if a quiz answer is wrong?

The purpose of the quiz is formative learning. Explanations point you back to the concept that needs another look.