Example Files

Small, complete examples of the file types you will work with in this course, organized by week. Every file is meant to be opened, edited, and run in Positron — download it, break it, fix it, make it your own.

The dataset, analysis scripts and notebook templates

Five files used all term. The dataset: RNA-seq counts from the gut of 80 threespine stickleback — 2 host genotypes x 2 microbiota treatments, 20 fish per group, 600 genes — as one tidy tab-separated file. Save it anywhere; the example scripts find it automatically if you keep the course repository’s folder layout, and otherwise download it from this website.

The analysis scripts run the same full analysis of the dataset — read, normalize, fit a linear model, plot — line for line in R and in Python, so open them side by side to compare. The lab notebook templates keep a dated record of an analysis — objective, methods, results, dead ends — each with a worked example entry: copy one, rename it (e.g. 2026-10-06_rnaseq-qc.qmd), and fill it in as you work.

Download Description
Stickle_RNAseq.tsv The course dataset used by all the example files below
example_analysis.R R script: read → explore → normalize → linear model → plots (uses readr, dplyr, ggplot2)
example_analysis.py Python script: the same analysis (uses pandas, numpy, seaborn, matplotlib, statsmodels)
lab_notebook_template.qmd Quarto lab notebook template (R code chunks); render to a self-contained HTML
lab_notebook_template.ipynb Jupyter lab notebook template (Python), same structure

Examples by week

Week 1 — computers and shells

Week 1 (L01) was conceptual — computer systems, operating systems, local vs. cluster vs. cloud, and a first meeting with the shell — so it produced no example files. What you needed that week was the toolkit itself: the installs are on the Software page, and the shell-command recipes from L01 reappear as real scripts from Week 2 on.

Week 2 — shell scripts

Five small, heavily commented bash scripts from Lecture 02 — everyday tools you can use on your own computer, and working examples of arguments, pipes inside scripts, and scripts chained by pipes. After downloading, make them executable once (that’s the Lecture 02 permissions lesson in action):

chmod +x *.sh
Download Description
file_inventory.sh Writes a report of every file in a folder, grouped by file type and ordered by total size (largest first), with each file’s permissions and size
make_project.sh Creates the recommended project directory structure from Lecture 01, with template README.md, .R, .py, and .qmd files
filter_rows.sh Pipeline part 1: filters rows of a tab-separated table (e.g. the course dataset) by the value of a named column
total_counts.sh Pipeline part 2: totals the gene-count columns per fish; reads the output of filter_rows.sh — e.g. ./filter_rows.sh Genotype A < Stickle_RNAseq.tsv \| ./total_counts.sh
backup_project.sh Makes a dated .tar.gz snapshot of a project folder, skipping the regenerable output/ folder

Week 3 — a first Python script

The Lecture 03 warm-up script: the same script mechanics as the Week 2 shell scripts above (shebang on line 1, chmod +x once, run with ./), but with Python inside. It reads the course dataset — one line, because the file is tidy — totals the 600 gene columns per fish, and saves a boxplot by genotype-x-microbiota group into results/.

Download Description
plot_stickleback.py Your first Python script: read Stickle_RNAseq.tsv, total the gene counts per fish, save a quick boxplot by group — a preview of L05-L06
plot_stickleback_walkthrough.ipynb The same analysis as a Jupyter notebook that explains every step — run it cell by cell in Positron to see what each line does

Week 4 — grep, sed, awk and shell tools

The two scripts built in Lecture 04, where one-liners grew into real tools: argument checks, strict mode, and an exit status, so they drop into any pipeline. Both need chmod +x once. gene_means.sh expects the cleaned table that L04 makes with sed (results/stickle_clean.tsv); fasta_stats.sh runs on any FASTA file, like the chr21 data downloaded in class.

Download Description
gene_means.sh From one-liner to tool: the group-means awk one-liner wrapped in a script that reports any gene column — ./gene_means.sh 5 for Gene1
fasta_stats.sh The L04 worked example: sequence count, lengths, N bases, GC content and ORF-like stretches for any FASTA file, built from grep, tr and wc pipelines

Week 5 — R and Python fundamentals

Start with the two companion notebooks: every syntax and data-type example from Lecture 05 as cells to run, change and break, with matching section numbers in the two languages. Then the four scripts, in lecture order: the warm-up pair (the Week 3 Python script grown up — now in both languages, writing a vector .svg instead of a .png), and the finale pair (Lecture 04’s fasta_stats.sh reborn — same job, same ORF regular expression, new languages). The script pairs are the finale exercises of Lecture 05: write your own first, then compare.

Download Description
Lecture05_R_fundamentals.ipynb Companion notebook: every R example from Lecture 05’s syntax and data-type sections as cells to run, change and break (needs the R kernel — see below)
Lecture05_Python_fundamentals.ipynb Companion notebook: the matching Python examples, with the same section numbers — keep both open side by side to compare languages
plot_stickleback_boxplots.R Lecture 05 warm-up in R: read Stickle_RNAseq.tsv, total the gene counts per fish, write boxplots by group to results/total_counts_by_group.svg
plot_stickleback_boxplots.py The same warm-up in Python — open the two side by side to compare
fasta_stats.R Lecture 04’s fasta_stats.sh rewritten in R: sequences, lengths, GC content and ORF-like stretches found with regular expressions — run as ./fasta_stats.R sequences.fasta
fasta_stats.py The same statistics in Python, with re.findall() and a raw-string regex

Python tutorial notebooks

A series of hands-on Jupyter notebooks for learning Python, created by Parisa Hosseinzadeh (Knight Campus Department of Bioengineering) for her course on data-driven design in engineering, offered in parallel with this one — used here with thanks, and lightly adapted to run in Positron. Each notebook opens with a small exercise, then walks you through the ideas needed to solve it.

They pair with lectures L05 and L06, where we introduce Python scripting: s1 and s5 cover L05’s material directly, s2-s4 pair with Week 6’s control-flow and functions self-study, s7-s8 go alongside L06, and s9 is there when you want more linear algebra. To run one, download it, open it in Positron, choose a Python interpreter if prompted (top right), and run cells with Shift + Enter.

Download Description
s1_variables.ipynb Getting started: print, assigning variables, types and type conversion, arithmetic and comparisons
s2_ConditionalStatements.ipynb if / elif / else, comparison and logical operators — guess the mystery number
s3_Loops.ipynb for and while loops, range, changing flow with continue and break
s4_Functions.ipynb Writing functions: arguments, docstrings, return, input checking, raising errors, importing packages
s5_Lists.ipynb Lists, indexing and slicing; find min/max/median by hand, then the easy way; tuples and sets
s6_Dictionaries.ipynb Dictionaries: key-value storage, looping over items, saving to csv/json/text/pickle
s7_PandasDataframe.ipynb Pandas data frames and data cleaning
s8_PlottingData.ipynb Plotting with matplotlib and seaborn, on a real dataset of college majors
s9_NumpyMatrices.ipynb Numpy arrays and matrix operations: indexing, dot products, transpose, rank, determinant, inverse, eigenvalues
W1L2_Overfitting.ipynb Bonus — model evaluation and overfitting: polynomial fits, AIC, and train/test splits

Week 6 — data frames, the tidyverse and figures

Lecture 06 wraps up the scripting foundations in one pass — data frames → tidy reshaping → the grammar of graphics — and hands the rest to self-study. Start with the two companion notebooks, one per language with the same 31 numbered sections in both: the lecture’s material in lecture order (files, random draws, data frames, the tidyverse, ggplot2/seaborn, the geom tour, the figure gallery), with the self-study topics woven in and reference sections on control flow, gotchas and error messages at the end. Then the two script pairs: working versions of the lecture’s Your turn exercises. Write your own first, then compare.

Download Description
Lecture06_R_companion.ipynb Companion notebook, R: every Lecture 06 example plus the week’s self-study, 31 numbered sections in lecture order — needs only the tidyverse (R kernel setup below)
Lecture06_Python_companion.ipynb Companion notebook, Python: the matching examples with the same section numbers — keep the pair open side by side to compare languages
summarize_stickleback.R Your turn task 1 as a working R script: per-group medians for any gene (./summarize_stickleback.R Gene42) plus the distribution gallery, saved as SVG and 300-dpi PNG
summarize_stickleback.py The same tool in Python — open the two side by side to compare
plot_gene_panel.R Your turn task 2 as a working R script: the destination figure for any genes — ./plot_gene_panel.R Gene10 Gene20 Gene30 Gene40 — saved as SVG and 300-dpi PNG
plot_gene_panel.py The same tool in Python (seaborn catplot)

Week 7 — reproducible documents with Quarto

The three in-class demos from Lecture 07 — one Quarto source per kind of output: slides, a manuscript PDF, and a website. Each demo downloads as a zip, so the files keep their exact names and extensions in every browser (a bare .qmd or .csl link gets renamed to .txt or .xml by some browsers). Unzip it, open the .qmd in Positron, and read the source next to the rendered result — every section demonstrates one thing.

Render the slides and the manuscript in Positron (Cmd/Ctrl+Shift+K). The manuscript’s PDF goes through LaTeX, so install TinyTeX once first (quarto install tinytex in a terminal); if you don’t have it yet, render it to HTML instead (quarto render example_manuscript.qmd --to html) — same source. The manuscript unzips as a folder that keeps its three companion files — the BibTeX reference database, the citation style, and the title-block partial — next to the .qmd, which is where they must stay. The website is a whole project, not a single file: unzip it, then run quarto preview in the unzipped folder — and hold on to it, because in Week 8 we put it on the real web with GitHub Pages.

Download Description
example_slides.zip RevealJS slide deck (example_slides.qmd) showing the main slide ingredients: incremental reveals, two-column layouts, executed R chunks, stepwise code highlighting, tabsets, fragments, speaker notes
example_manuscript.zip Science/Nature-style manuscript (example_manuscript.qmd): title page with authors and affiliations, abstract, lorem-ipsum sections, inline and display LaTeX, numbered equations, cross-references, superscript citations — plus its companions example_manuscript.bib (the reference database), nature.csl (the citation style; swap in any journal’s), and title.tex (restores affiliations on the PDF title page)
example_website.zip Four-page personal academic site (home/about, research, publications, CV) as a Quarto website project — pre-configured for GitHub Pages in Week 8

Week 8 — Git, GitHub and sharing your work

More to come after Lecture 08 (Nov 16) — and bring back Week 7’s example_website.zip, which becomes a live GitHub Pages site this week. Already here: an example of the top-level README.md of a GitHub repository for a genomics study — project overview, a data-availability table pointing to the NCBI databases where the data were deposited (SRA/BioProject, GEO, BioSample, and the reference genome assembly), repository structure, environment, and reproduction steps. Look at it both ways: rendered, and as plain-text source in Positron.

Download Description
example_README.md Example repository README for a genomic-data analysis project (accession numbers are placeholders)

Week 9 — software environments

Coming after Lecture 09 (Nov 23).

Week 10 — high-performance computing on Talapas

Coming after Lecture 10 (Nov 30).

Before you run them

  • R packages: install once with install.packages(c("readr", "dplyr", "ggplot2")).
  • R in Jupyter notebooks: to run the R companion notebooks (Lecture05_R_fundamentals.ipynb, Lecture06_R_companion.ipynb), install the R kernel once: install.packages("IRkernel") then IRkernel::installspec() – after that Positron offers R next to Python when you pick a notebook kernel.
  • Python packages: the course environment already has pandas, numpy, matplotlib, and seaborn; add the linear-model package once with pip install statsmodels, and the PCA package (Week 6’s gallery) with pip install scikit-learn.
  • In Positron, run scripts line by line with Cmd/Ctrl + Enter, render .qmd files with Cmd/Ctrl + Shift + K, and run notebook cells with Shift + Enter.