13 lessons, in order.
Text you can search, real genomics files, and a Run button on every command that runs it in your browser. Self-paced. Open a lesson to see what it covers.
Free preview Lesson 3, Reading genomic files, is open to everyone, commands and all. Try it now
Lesson 1 · Your first commands
- Two ways to type along
- The terminal, the shell and the prompt
- Your first command
- Look around with ls
- Options and arguments
- Where am I? pwd and paths
- Peek inside a human chromosome
- Let the keyboard do the work
- Getting help
- Read the error message
Lesson 2 · Files and folders
- A home for your project: mkdir and touch
- Copy with cp
- Move and rename with mv
- Delete with rm (there is no trash can)
- How big is it? du and df
- Link, don't copy: ln -s
- Name files so future you can find them
- Permissions: read, write, execute
- What is this file? file
Lesson 3 · Reading genomic files Free preview
- Look before you analyze
- Compressed files: zcat, gzip and friends
- See the invisible: tabs and line endings
- FASTA: genomes and proteins
- FASTQ: sequencing reads
- BED and narrowPeak: genomic intervals
- GTF and GFF3: gene annotation
- VCF: variants
- SAM and BAM: aligned reads
- The formats at a glance
Lesson 4 · Wildcards and grep
- Wildcards: let the shell pick the files
- Brace expansion: let the shell write the names
- Quotes: tell the shell to keep its hands off
- grep: print the lines that match
- Whole words, exact strings and lists of patterns
- Context: grep -A, -B and -C on FASTQ records
- Regular expressions with grep -E
- Find a motif in a genome (and three traps)
- Searching many files: -l, -L, -r and find
Lesson 5 · Cut, sort and count
- cut: pull out columns
- sort: text or numbers?
- Sorting by columns: the genomics sort
- Sort a file but keep the header on top
- uniq: collapse repeated lines
- Frequency tables: sort | uniq -c | sort -k1,1nr
- Random samples with shuf
- Quick summaries: datamash and csvtk
Lesson 6 · Pipes, redirection and combining files
- Three streams: stdin, stdout and stderr
- Save output: > and >>
- Errors go elsewhere: 2>, 2>&1, &> and /dev/null
- Pipes: build a pipeline one stage at a time
- Process substitution: a command that acts like a file
- paste: glue lines side by side
- join: combine two tables by a shared ID
- comm and diff: what is shared, what is different
- xargs and split
Lesson 7 · awk for genomics
- What awk is
- Fields: $1, $2 … $NF
- Tabs, spaces and the field separator
- Patterns: choose the lines you want
- Math, variables, BEGIN and END
- Decisions: if, else, next and -v
- Text functions: length, substr, split, gsub, match
- Arrays: count, sum and group
- Two files at once: NR, FNR and the lookup trick
- Recipes for genomics files
Lesson 8 · sed and tr
- How sed works
- Choose lines by pattern, and every 4th line
- Delete lines: d
- Substitute: s/old/new/
- Add or remove "chr"
- Delimiters, & and groups
- Insert, append, several commands, and editing in place
- tr: translate characters
- Clean a sample sheet saved from Excel
Lesson 9 · Shell scripting
- Variables
- String tricks for file names
- Exit codes and decisions
- Loops
- Functions
- Your first script
- Strict mode:
set -euo pipefail - Let shellcheck find your bugs
- The real script: count_variants.sh
Lesson 10 · Genomics power tools
- samtools: look inside a BAM
- bgzip and tabix: random access for any sorted text file
- bcftools: VCFs the right way
- bedtools intersect: do these intervals overlap?
- The 22 vs chr22 trap
- More genome arithmetic
- seqkit: FASTA and FASTQ at a glance
Lesson 11 · Many samples, many cores
- One sample first
- Twenty samples with a loop
- Hand a list to a command: find -exec and xargs
- CPUs, cores and threads
- How long did it take? time
- GNU parallel
- Is parallel faster?
- Background jobs
- Find and stop processes
- A sample-sheet-driven run
Lesson 12 · Working on remote machines
- What an HPC cluster is
- Logging in with ssh
- SSH keys and ~/.ssh/config
- Moving files: scp and rsync
- Downloading public data: wget and curl
- Did it arrive intact? Checksums
- Keep your session alive: tmux and screen
- Slurm: submit, watch, cancel
- Software on a cluster: modules, conda and containers
- Your shell, your way: dotfiles, PATH and aliases
Lesson 13 · Capstone: from raw files to a results table
- The question
- Step 1: Set up the project
- Step 2: Make the reference files
- Step 3: Answer it for one person
- Step 4: Write the script
- Step 5: Run it on one, then on all 20
- Step 6: Combine and summarize
- Step 7: Sanity checks
- Step 8: What you'd change for real data
- What's next
Then · Practice: the one-liner challenge
- Bite-size one-liner puzzles on the course data, one a day, with solutions