Reading an RNA-seq experiment: eight samples and one steroid
Load a real experiment's count table in RBAi, check how deeply each sample was sequenced, and draw a PCA that shows what separates the samples. In our run the steroid treatment was the largest source of variation (PC1, 40.9%) and the donor came next (PC2, 26.1%).
People with asthma breathe in steroids every day. Drugs such as dexamethasone, a synthetic glucocorticoid (a steroid hormone that calms inflammation), act on the cells of the airways and switch whole sets of genes on and off. Which genes, and how many? In 2014 Himes and colleagues asked exactly that. They took smooth muscle cells (the muscle that tightens the airways in an asthma attack) from four donors, treated one dish of each donor's cells with 1 micromolar dexamethasone for 18 hours, left a second dish untreated, and measured all of the RNA in all eight samples.
This is the airway study (GEO GSE52778), the data set the DESeq2 authors use in their RNA-seq teaching workflow. In this lesson you will read it the way a researcher does before testing anything: open the count table, check how deeply each sample was sequenced, and draw a picture of how the samples relate. Lessons 3, 4 and 5 carry on in the same chat, from the table you load here, so keep it open.
Every prompt goes into the RBAi main chat, except one small change to a figure in step 5. You will not install R or download anything yourself.
What you will make

The structure of the experiment in one picture. Each point is one sample, placed by a principal component analysis (PCA) of the 500 genes that vary most between samples. Treatment separates the samples along PC1, the direction of greatest variation: every dexamethasone-treated sample (orange) lies 29 to 34 units to the right of the same donor's untreated sample (grey). PC2 separates the donors: N080611's two samples sit at the top and N061011's at the bottom. GEO GSE52778, drawn by RBAi.

How deeply each sample was sequenced. The library size is the total number of reads counted in genes. The largest sample (30.82 million, donor N080611, treated) has about twice the reads of the smallest (15.16 million, donor N052611, treated), so raw counts from different samples cannot be compared directly.
1. Load the experiment Main chat
Start a new chat in RBAi and paste:
Load the airway RNA-seq experiment (GEO GSE52778, Himes et al. 2014): human airway smooth muscle cells from four donors, each left untreated or treated with the steroid dexamethasone. Use the gene count table from the Bioconductor airway package. Tell me how many genes and samples there are, list each sample with its donor and treatment, and show the first five rows of the counts table. Keep the table in this chat for the next steps.
In RNA-seq (RNA sequencing), a sample's RNA is broken into fragments and millions of them are read. Each fragment read is a read, and the count of a gene in a sample is the number of reads that came from that gene. A counts table holds those numbers, with one row per gene and one column per sample. Genes are named by Ensembl IDs, stable codes such as ENSG00000000003 (the gene TSPAN6). Bioconductor is the open-source collection of R software for genomics, and its airway package holds this experiment's counts. RBAi downloads the package and reads the table in its own sandbox, where R and DESeq2 are already installed.
What you should see: 63,677 genes × 8 samples, one untreated and one treated sample from each donor. The sample names, such as SRR1039508, are the runs' IDs in the Sequence Read Archive, the public store of raw sequencing data.
| Donor | Untreated | Dexamethasone |
|---|---|---|
| N61311 | SRR1039508 | SRR1039509 |
| N052611 | SRR1039512 | SRR1039513 |
| N080611 | SRR1039516 | SRR1039517 |
| N061011 | SRR1039520 | SRR1039521 |
The first five rows of the counts table:
| Gene | SRR1039508 | SRR1039509 | SRR1039512 | SRR1039513 | SRR1039516 | SRR1039517 | SRR1039520 | SRR1039521 |
|---|---|---|---|---|---|---|---|---|
| ENSG00000000003 | 679 | 448 | 873 | 408 | 1138 | 1047 | 770 | 572 |
| ENSG00000000005 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| ENSG00000000419 | 467 | 515 | 621 | 365 | 587 | 799 | 417 | 508 |
| ENSG00000000457 | 260 | 211 | 263 | 164 | 245 | 331 | 233 | 229 |
| ENSG00000000460 | 60 | 55 | 40 | 35 | 78 | 63 | 76 | 60 |
Already there is something to notice. ENSG00000000005 is TNMD, a gene used mainly in tendons, and airway muscle cells never read it. The table lists every gene in the genome's annotation, used or not.
Our first try of this prompt stopped with an error after a few steps. The same prompt in a new chat worked in under two minutes. If an answer fails, send it again.
2. How deeply was each sample read? Main chat
For each of the eight samples, add up its counts to get its library size: the total number of reads counted in genes. Plot the library sizes as a bar chart in millions of reads, with the two samples of each donor side by side, untreated in grey and dexamethasone-treated in orange, on a white background with clear axis labels. Then tell me the smallest and largest library size, and how many of the 63,677 genes have zero counts in all eight samples.
The library size of a sample (also called its sequencing depth) is the total number of reads counted for it. A sample sequenced twice as deeply gives about twice the count for every gene, without any change in biology.
What you should see: the bar chart above. The smallest library is 15,163,415 reads (SRR1039513, donor N052611, treated) and the largest 30,818,215 (SRR1039517, donor N080611, treated), about twice as many. 30,208 of the 63,677 genes, nearly half, have no reads in any of the eight samples.
3. Draw a PCA of the samples Main chat
Now make a PCA plot of the eight samples. Keep the genes with at least 10 counts in total, apply DESeq2's variance-stabilising transformation, and use the 500 most variable genes, as DESeq2's plotPCA does. Colour the points by treatment (untreated grey, dexamethasone orange), give each donor its own marker shape, and put the percentage of variance explained on each axis, on a white background without grid lines. Then tell me what separates the samples along PC1 and along PC2.
PCA (principal component analysis) turns many measurements into a picture. Each sample is a point in a space with one axis per gene, 500 axes here. PCA finds the direction in which the samples differ most, the first principal component (PC1), then the direction that captures the most of what is left at right angles to it (PC2). The variance explained by a component is its share of all the differences between the samples. The variance-stabilising transformation (VST) puts counts on a log-like scale that also takes library size into account. On raw counts, a gene with 100,000 reads varies far more in absolute terms than one with 100, and the busiest genes would dominate the picture.
What you should see: RBAi keeps 22,369 genes with at least 10 counts in total and computes the VST in DESeq2's blind mode, which ignores which group each sample belongs to, so the picture is not shaped by what we expect to see. PC1 explains 40.9% of the variance and separates treatment: untreated samples on the left, treated on the right, for all four donors. PC2 explains 26.1% and separates donors: N080611 high, N061011 low, the other two in between. RBAi adds that this is a description of eight samples, not a statistical test.
Its first figure, drawn with R's ggplot2, put each sample's name on top of its point and cut two names off at the right edge.
4. Redraw it so it can be edited Main chat
The sample labels sit on top of the points and two are cut off at the right edge. Redraw the PCA in Python with matplotlib from the same PCA coordinates: same colours and marker shapes, every marker the same size, equal units on both axes, each point labelled with its donor beside the marker without overlapping, every label inside the frame, and a light dashed line at zero on both axes.
Why ask for Python? Edit with AI, the button you met in Lesson 1, rewrites the Python code behind a figure. RBAi drew the first PCA in R and only displayed it as a picture through Python, so Edit with AI could only have moved that picture around. Redrawn with matplotlib (Python's plotting library), every part of the figure can be changed by request.
What you should see: the same eight points from the same coordinates, now labelled by donor, with equal units on both axes and dashed lines through zero. The plot uses the same variance figures, 40.9% and 26.1%. One detail still looks off: the triangles of donor N052611 look smaller than the other shapes.
5. Even out the markers Edit with AI
Click Edit with AI on the new figure and type:
Make the triangles look as large as the circles, squares and diamonds, and remove the top and right borders.
What you should see: "I enlarged the triangle markers for better visual parity and removed the top and right plot borders." This is the first figure of this lesson. A triangle fills less of its marker box than a circle does, so at the same nominal size it looks smaller. Small details like this decide whether a reader trusts a figure.
The ideas behind the picture
- Raw counts are not comparable between samples. A count depends on how active the gene is and on how deeply the sample was sequenced. Here the depth differs two-fold, so every analysis first puts the samples on a common scale. This is normalisation. DESeq2 does it with a size factor per sample, estimated from the genes all samples share. A simple total would be thrown off by a handful of very busy genes.
- Filter out genes with almost no reads. A gene with fewer than 10 reads across eight samples carries almost no information and adds noise. 22,369 of 63,677 genes pass.
- Look before you test. PCA shows the main structure of an experiment in one picture. Here the biggest difference between samples is the one the experiment was designed to create, and that is what you hope to see.
- Donors are biological replicates. The four donors are independent repeats of the experiment, and each has its own genetic background. That is why PC2 groups the samples by donor. Lesson 3 compares each donor's treated sample with its own untreated one, so this donor-to-donor difference does not hide the effect of the steroid. A batch effect looks the same on a PCA: a systematic difference that comes from how samples were handled, such as being sequenced on different days, instead of from the biology you are studying.
- Outliers stand alone. A sample with a failed library, or one that was mislabelled, would sit far from every other point. That lone sample is an outlier. Here every sample sits where the design says it should, next to its own donor and on its own treatment's side.
What the result shows, and what it doesn't
- What it shows: dexamethasone is the largest source of variation among the 500 most variable genes, consistently in all four donors. The donor is the second largest, and no sample is an outlier. The libraries differ two-fold in depth.
- What it doesn't show: which genes change, by how much, or whether a change is more than chance. PCA describes the samples; it tests nothing. That is Lesson 3.
- What the percentages mean: 40.9% is PC1's share of the variation among those 500 genes after the VST. It is not the share of all genes, and not "40.9% of genes respond to the steroid".
Your turn
Before trusting a PCA, a careful researcher asks whether something technical, such as sequencing depth, could have produced the pattern. Write down your prediction: if library size were driving PC1, how would the points be arranged? Then, in the same chat:
Colour the same PCA by each sample's library size instead of treatment, and plot PC1 against library size.
Write two sentences: does depth explain PC1 or PC2, and what would it mean for the experiment if it did? Bonus: ask RBAi to repeat the PCA with the 2,000 most variable genes instead of 500, and compare the percentages on the two axes.
Try it
Open RBAi, start a new chat and paste the first prompt. Keep the chat: Lesson 3 starts from the counts you load here and tests every gene for a change.
Start a new chat in RBAi, then paste the lesson’s first prompt:
Load the airway RNA-seq experiment (GEO GSE52778, Himes et al. 2014): human airway smooth muscle cells from four donors, each left untreated or treated with the steroid dexamethasone. Use the gene count table from the Bioconductor airway package. Tell me how many genes and samples there are, list each sample with its donor and treatment, and show the first five rows of the counts table. Keep the table in this chat for the next steps.