Bootcamp / Session 2 / 2.4

Session 2.4 · Hands-on · Bioinformatics Core

Put the six plots and the p-value to work on real data.

You get one real RNA-Seq count table and one chat with Claude, and you do everything by talking to it. You never write code, and nobody hands you a prompt. You write every request yourself, Claude writes and runs the code, and you check every answer, ask follow-up questions, and push back when something looks off. That conversation is the skill this part teaches. By the end you will have built a metadata table from sample names, made five of Tommy's six plots, and watched multiple testing correction happen to your own p-values.

Start the exercise Only a browser and a Claude account · Works the same on macOS and Windows

Recording

The introduction to the exercise and the closing. The work time itself is not in the video.

Alper Kucukural · 6 minutes · Download (18 MB)

The study behind the table

The data come from Vernia et al., 2014, Cell Metabolism, a collaboration between the Davis and Garber labs here at UMass Chan. JNK is a stress signaling kinase that switches on when mice eat a high-fat diet, and it helps drive obesity and insulin resistance. The authors removed JNK from liver cells and asked what the liver does without it. Their answer: liver JNK holds back the nuclear receptor PPARα. Without JNK, PPARα target genes that burn fatty acids and make ketone bodies go up, and so does FGF21, a hormone the liver releases into the blood. FGF21 turns out to carry much of the metabolic benefit of losing liver JNK.

The table you will use holds liver RNA-Seq counts from that work: four genotypes, each on a normal chow diet and on a high-fat diet (hfd), with three mice per group. wt is the control. ALAB, J1c, and J2c are the lab's own labels for the JNK-deficient livers, and the paper describes the exact alleles. We will come back to this same dataset in Session 4 for a proper differential expression analysis.

DietwtALABJ1cJ2c
chow3 mice3 mice3 mice3 mice
hfd3 mice3 mice3 mice3 mice

Vernia S, Cavanagh-Kyros J, Garcia-Haro L, et al. The PPARα-FGF21 hormone axis contributes to metabolic regulation by the hepatic JNK signaling pathway. Cell Metab. 2014;20(3):512–525. doi:10.1016/j.cmet.2014.06.010

Before you start

Get set up first

If you have not set up yet, do 2.0 Get set up first. It shows the places you can work (Claude in the browser, the Claude desktop app, Claude Science, ChatGPT or Codex, and VS Code) and how to set up each one. Whichever you pick, do this whole exercise in one conversation, so the assistant remembers the data and every step you have taken.

This page says “Claude” throughout. If you use ChatGPT or Codex, read it as your assistant: the tasks, hints, and checkpoints stay the same.

Tell Claude who you are and how to work

Your first message sets the ground rules for the rest of the conversation, the same way you would brief a new lab member.

Your turn: write the prompt

Write your first message. Tell Claude who you are and how you want it to work for the rest of the chat. Make sure it covers:

  • that you are a biologist learning RNA-Seq analysis and you do not write code
  • that Claude should write and run the code itself and show you the results and plots
  • that it should explain each step in plain language and skip the code unless you ask
  • that it should tell you about any assumption or choice it makes, and stop if the data looks wrong
  • that it should confirm and wait for your first task
HINT Stuck? One way to write this prompt
I am a biologist learning to analyze RNA-Seq data, and I do not write code. For this whole conversation: - write and run the code yourself (Python is fine) and show me the results and plots - explain each step in plain language in a few sentences - do not show me code unless I ask for it - if you have to make an assumption or a choice, tell me what you chose and why - if something looks wrong in the data, stop and tell me Reply with OK and wait for my first task.
Compare it with yours. Notice how it names the data, lists exactly what to do, and says what to hand back. Your wording can be completely different and still work.

Know where the data lives

The table is one tab-separated file, about 16 MB: genes_expression_expected_count.tsv. Your first task prompt gives Claude its web address. If Claude says it cannot reach the address, download the file with that link, attach it to the chat with the paperclip, and tell Claude “use the file I attached instead”.

Work the loop

Every task below has the same shape: ask (write your own prompt from the task description; open the hint only after you have tried), check (compare with the green checkpoint), then keep talking (follow up on at least one of the suggestions in the dashed box under each checkpoint, or on your own idea). If your numbers differ from the checkpoint, do not move on. Ask Claude why they differ. Getting to the bottom of that is the most useful thing you will practice today.

A good prompt names the data, says exactly what to do (including any thresholds), and says what you want back: a plot, a number, a table, or a file. Vague prompts get vague answers, and different numbers from your neighbor’s.

Claude can be confidently wrong, especially about biology and papers. When it tells you a fact, ask how it knows, and check anything that matters.

The exercise

Load the table and look before you touch anything

Your turn: write the prompt

Ask Claude to load the table from https://biocore.umassmed.edu/data/session2/genes_expression_expected_count.tsv and describe it, without analyzing anything yet. Ask for:

  • the number of rows and columns, and the column names
  • what one row represents, and whether the gene names are unique
  • what kind of numbers the sample columns hold
  • how many rows are zero in every sample
HINT Stuck? One way to write this prompt
Load this tab-separated RNA-Seq count table with Python and pandas: https://biocore.umassmed.edu/data/session2/genes_expression_expected_count.tsv Do not analyze anything yet. Tell me: 1. how many rows and columns it has, and the column names 2. what one row represents, and whether the gene names are unique 3. what kind of numbers the sample columns hold 4. how many rows are zero in every sample
Compare it with yours. Notice how it names the data, lists exactly what to do, and says what to hand back. Your wording can be completely different and still work.

Checkpoint 77,922 rows and 26 columns: gene, transcript, and 24 sample columns. Gene names are unique, so one row is one gene. The values are expected counts (numbers of reads, some with decimals). 40,181 genes are zero in every sample.

  • Ask what an “expected count” is, explained for someone new to RNA-Seq.
  • Ask to see the first five rows.
WHY Why look first?
Every later number depends on knowing what a row is. Counts are not normalized, and half the rows are empty. Both facts shape every plot you are about to make.

Turn sample names into a metadata table

The sample names hold the whole experimental design, for example hfd.J1c.rep2. Pull it out into a table you can group, color, and test by.

Your turn: write the prompt

The 24 sample names follow the pattern diet.genotype.replicate. Ask Claude to turn them into a metadata table. Ask for:

  • one row per sample, with the columns sample, diet, genotype, replicate, and group (diet and genotype joined, like hfd_J1c)
  • a cross-table of diet against genotype, so you can check the parsing
  • the table saved as metadata.tsv for you to download
HINT Stuck? One way to write this prompt
The 24 sample column names follow the pattern diet.genotype.replicate. Build a metadata table with one row per sample and the columns: sample, diet, genotype, replicate, and group (diet and genotype joined, like hfd_J1c). Show me the table, then a cross-tabulation of diet against genotype, and save it as metadata.tsv so I can download it.
Compare it with yours. Notice how it names the data, lists exactly what to do, and says what to hand back. Your wording can be completely different and still work.

Checkpoint 24 rows. Two diets (chow, hfd) by four genotypes (wt, ALAB, J1c, J2c), with exactly 3 samples in every cell. Eight groups.

  • Ask to see the code Claude used to split the sample names.
  • Ask how to open metadata.tsv in Excel.
WHY Why a separate metadata table?
Metadata is data. Once diet and genotype are columns, every plot and test can say “color by diet” or “compare these groups” instead of hand-picking sample names. The cross-table is the check that Claude parsed every name correctly: a 2 or a 4 in any cell means something went wrong.

Filter, normalize, and use a barplot the right way

Your turn: write the prompt

Ask Claude to clean and normalize the counts, and to show you how deeply each sample was sequenced. Your prompt should ask it to:

  • drop genes that are zero in every sample
  • draw a barplot of the total counts per sample (the library size), colored by diet
  • keep genes with at least 10 counts in at least 3 samples
  • convert to counts per million (CPM), take log2(CPM + 1), and use this log table from now on
  • report the library size range and how many genes were kept
HINT Stuck? One way to write this prompt
1. Drop genes that are zero in every sample. 2. Make a barplot of the total counts per sample (library size), colored by diet. 3. Keep genes with at least 10 counts in at least 3 samples. 4. Normalize to counts per million (CPM) using each sample's library size, then take log2(CPM + 1). Call this the log table and use it from now on. Tell me the library size range and how many genes you kept.
Compare it with yours. Notice how it names the data, lists exactly what to do, and says what to hand back. Your wording can be completely different and still work.

Checkpoint Library sizes run from about 7.4 to 24.1 million reads, so some samples were sequenced three times deeper than others. 15,974 genes pass the filter.

  • Ask why the filter is at least 10 counts in at least 3 samples, and what changes with 5.
  • Ask which sample has the smallest library, and whether that is a worry.
2.2 Tommy said bars hide distributions. Why is a bar fine here?
A barplot is right when each category has exactly one value, like one total per sample. It goes wrong when a bar stands in for a mean of several points and hides their spread. The threefold range in depth is why raw counts cannot be compared between samples, and why we divide by library size first.

Histogram: raw counts against log counts

Your turn: write the prompt

Ask Claude to show you why count data needs a log. Ask for:

  • two histograms side by side for the first sample: the raw counts, and log2(count + 1)
  • using the genes left after dropping the all-zero ones, before the 10-count filter
  • the fraction of genes that are zero in that sample, and the gene with the highest count
HINT Stuck? One way to write this prompt
For the first sample, using the genes left after step 1 of the last prompt (zero-in-every-sample removed, but before the 10-count filter), draw two histograms side by side: the raw counts, and log2(count + 1). What fraction of genes are zero in that sample, and which gene has the highest count?
Compare it with yours. Notice how it names the data, lists exactly what to do, and says what to hand back. Your wording can be completely different and still work.

Checkpoint The raw histogram is one tall bar at zero and nothing else visible. The log histogram shows a real shape. About 40% of those genes are zero in this sample. The top gene is Alb (albumin), with over 800,000 counts, which is what you expect from liver.

  • Ask for both histograms in one figure with titles and labels good enough for lab meeting.
  • Ask why we add 1 before taking the log.
2.2 What did the log transform buy you?
Counts span from 0 to almost a million, so on a linear axis a handful of huge genes squash everything else into one bar. The log spreads out the range where most genes live. The +1 keeps the zeros, since log of zero is undefined.

Violin and box: are the samples comparable?

Your turn: write the prompt

Ask Claude to compare the distributions of all 24 samples in the log table. Ask for:

  • a violin plot with a boxplot inside, one per sample
  • filled by diet, with samples grouped by genotype
  • the lowest and the highest per-sample median
HINT Stuck? One way to write this prompt
Using the log table, draw a violin plot with a boxplot inside, one per sample, filled by diet, with samples grouped by genotype. Report the lowest and highest per-sample median.
Compare it with yours. Notice how it names the data, lists exactly what to do, and says what to hand back. Your wording can be completely different and still work.

Checkpoint 24 violins of nearly the same shape. Per-sample medians fall between about 3.0 and 3.5 log2(CPM + 1). No sample stands out as broken.

  • Ask for colorblind friendly colors and a PNG you can download.
  • Ask what a failed sample's violin would look like.
2.2 What would a barplot of means have hidden?
A bar of the mean per sample would look almost identical across samples and tell you nothing about shape. A violin shows the whole distribution, so a failed library (a lump of low genes, or a squashed shape) would jump out.

Scatter plots: replicates, then diet

Your turn: write the prompt

Ask Claude for three scatter plots from the log table:

  • chow.wt.rep1 against chow.wt.rep2, with a y = x line and the Pearson correlation
  • the average of each group's three replicates, chow_wt on x against hfd_wt on y, drawn first with solid points and then with transparent points
  • labels on the 10 genes farthest from the diagonal, and which of them went up or down on hfd
HINT Stuck? One way to write this prompt
Using the log table: 1. Scatter chow.wt.rep1 against chow.wt.rep2, with a y = x line. Report the Pearson correlation. 2. Average the three replicates of each group. Scatter chow_wt (x) against hfd_wt (y), with a y = x line. First draw it with solid points, then again with transparent points. 3. Label the 10 genes farthest from the diagonal, and tell me which went up on hfd and which went down.
Compare it with yours. Notice how it names the data, lists exactly what to do, and says what to hand back. Your wording can be completely different and still work.

Checkpoint Replicates hug the diagonal (r about 0.991). Diet spreads points off it (group means r about 0.983). Among the farthest genes: Cyp2b9, Lcn2, and Serpina7 go up on hfd, while Moxd1, Cyp3a11, and Cyp4a12b go down.

  • Ask which of the labeled genes are known liver or metabolism genes, and how sure Claude is about each.
  • Ask for the same diet scatter for ALAB instead of wt, and whether it looks different.
2.2 What did the transparent version show that the solid one hid?
With 16,000 solid points the middle becomes one black blob: overplotting. Transparency lets the density show, so you can see that nearly all genes sit on the diagonal and only a thin tail moves. A correlation of 0.98 sounds like “nothing changed”, yet those tails hold the biology. One summary number is not the plot.

Find the paper's gene yourself

Your turn: write the prompt

Ask Claude to show you Fgf21, the gene at the center of the paper. Ask for:

  • Fgf21 from the log table in all 24 samples, one column per group
  • every mouse drawn as a dot, with a boxplot behind the dots
  • the groups in a sensible order: the four chow groups, then the four hfd groups, wt first in each
  • which groups stand out
HINT Stuck? One way to write this prompt
Plot Fgf21 in the log table for all 24 samples: one column per group, every sample drawn as a dot, with a boxplot behind the dots. Order the groups chow_wt, chow_ALAB, chow_J1c, chow_J2c, then the same for hfd. Which groups stand out?
Compare it with yours. Notice how it names the data, lists exactly what to do, and says what to hand back. Your wording can be completely different and still work.

Checkpoint On chow every group sits near 2.5 to 3.2. On hfd, hfd_ALAB jumps to about 5.2 and hfd_J2c to about 4.3, while hfd_wt stays near 3.2.

  • Ask for Mapk8 and Mapk9 plotted the same way (they encode JNK1 and JNK2), what you should notice, and why a deleted gene can still leave reads behind.
  • Ask for Fgf21, Cyp4a14, and Ppara side by side in one figure.
2.1 Why draw the dots and not only the box?
A boxplot of three points invents a shape that three points cannot support. Showing every mouse is honest about n = 3. Tie it back to the paper: FGF21 rising only when JNK is lost and the diet is high in fat is the result the study is built on.
DETECTIVE Tried the Mapk8 and Mapk9 follow-up? Check your reading here.
Mapk8 (JNK1) is lower in ALAB and J1c. Mapk9 (JNK2) is lower in ALAB and J2c. So the data suggest ALAB lacks both, J1c lacks JNK1, and J2c lacks JNK2. The drop is partial because a conditional knockout removes a few exons in liver cells, while reads from the rest of the gene and from other cell types remain. This is an inference from the counts: confirm it against the paper's methods before you rely on it.

Heatmap and PCA: what drives the biggest differences?

Your turn: write the prompt

Ask Claude which factor drives the biggest differences between samples. Using the 500 most variable genes in the log table, ask for:

  • the sample to sample Pearson correlation, drawn as a clustered heatmap with diet and genotype as colored annotation bars
  • a PCA (genes centered, not scaled) of PC1 against PC2, colored by diet, shaped by genotype, with the percent variance on each axis
  • which factor separates the samples on PC1, and which on PC2
HINT Stuck? One way to write this prompt
Using the 500 most variable genes in the log table: 1. Compute the sample-to-sample Pearson correlation and draw it as a clustered heatmap, with diet and genotype as colored annotation bars. 2. Run PCA (center the genes, no scaling). Plot PC1 against PC2, color by diet, shape by genotype, and put the percent variance on each axis. Which factor separates the samples on PC1, and which on PC2?
Compare it with yours. Notice how it names the data, lists exactly what to do, and says what to hand back. Your wording can be completely different and still work.

Checkpoint In the heatmap, samples mostly group by diet. How cleanly depends on the clustering method: with some settings the two diets split perfectly, with others a less typical sample such as hfd.ALAB.rep3 sits on a branch of its own. PC1 explains about 29% of the variance and separates diet. PC2 (about 16.5%) pulls ALAB away from wt, with J1c and J2c in between.

Your tree looks different from your neighbor's? Ask Claude which distance and linkage it used, then try another. A dendrogram is one method's answer, not a fact about the data. PCA does not depend on that choice.

  • Ask which genes drive PC2, top ten.
  • Ask for the heatmap again with complete linkage, and whether the tree changed.
2.2 Is a heatmap one of the six?
Yes, and the PCA plot is just a scatter plot of two derived numbers per sample. This pair is the first figure to make in any RNA-Seq project: before testing a single gene, it tells you whether replicates agree and which factor dominates. Here diet outweighs genotype.

Wrap up: take the work with you

A chat is not a record. Before you close it, make sure you leave with more than a scrollback of plots. As Eric put it in 2.3: ask for the script, not the answer.

Your turn: write the prompt

Before you close the chat, ask Claude for everything you would need to redo or report this analysis:

  • one Python script, as a file to download, that redoes every step from the original data address, with a short comment above each step
  • a methods paragraph you could adapt for a paper, naming each filter and threshold
  • a list of every figure you made, with one sentence on what each shows
  • every assumption or choice Claude made on your behalf
  • all of it gathered into one report you can share: a page with the figures, the methods, and the findings
HINT Stuck? One way to write this prompt
We are done for today. Please give me: 1. one Python script, as a downloadable file, that redoes every step we did from the original data address, with a short comment above each step 2. a methods paragraph I could adapt for a paper, naming each filter and threshold we used 3. a list of every figure we made, with one sentence on what each one shows 4. anything you assumed or chose on my behalf during this conversation 5. a one-page report as an artifact, with the key figures, the methods paragraph, and three findings in plain language, so I can publish it and share the link
Compare it with yours. Notice how it names the data, lists exactly what to do, and says what to hand back. Your wording can be completely different and still work.

On claude.ai: ask for the report “as an artifact”. It opens in a panel next to the chat. Use its Publish button to get a link you can send to your PI or paste into your lab notes. Anyone with the link can see it, so publish only what you are allowed to share.

On Codex: ask it to write the report as an HTML or Markdown file in your project and tell you the file name. If your Codex is connected to GitHub, ask it to open a pull request instead, and share that link.

Checkpoint You can download a script, and the methods paragraph names the filter (at least 10 counts in at least 3 samples), log2(CPM + 1), and the 500 most variable genes for the heatmap and PCA. If a number in it disagrees with what you saw earlier, ask Claude which one is right.

  • Ask for the same script in R using ggplot2.
  • Ask which of today’s results Claude would not trust yet, and why.

Stretch: your own multiple testing problem

Done early? This one ties straight back to 2.1. It uses a plain t-test on purpose, to show why RNA-Seq needs better tools. Afterwards, ask for the step 9 wrap-up again so your script and methods include it.

Test every gene, then correct

Your turn: write the prompt

Ask Claude to test every gene in the log table with a Welch t-test of hfd_wt against chow_wt (3 against 3). Then ask it to:

  • count the genes with p < 0.05, and say how many to expect by chance alone
  • draw a histogram of all the p-values with bins 0.05 wide
  • adjust the p-values with Benjamini-Hochberg and count the genes with adjusted p < 0.05
  • shuffle each gene's six values at random between the two groups, so no real difference is left, and repeat the three steps above
  • finish with a volcano plot of the real test: log2 fold change against -log10(p)
HINT Stuck? One way to write this prompt
For every gene in the log table, run a Welch t-test of hfd_wt against chow_wt (3 against 3). 1. How many genes have p < 0.05? How many would you expect by chance alone? 2. Draw a histogram of all the p-values with bins 0.05 wide. 3. Adjust with Benjamini-Hochberg. How many genes have adjusted p < 0.05? 4. Now shuffle each gene's six values at random between the two groups, so there is no real difference left, and repeat steps 1 to 3 on the shuffled data. 5. Finish with a volcano plot of the real test: log2 fold change against -log10(p).
Compare it with yours. Notice how it names the data, lists exactly what to do, and says what to hand back. Your wording can be completely different and still work.

Checkpoint About 16,000 genes tested and 2,722 with p < 0.05, far more than the roughly 800 chance alone would give. The histogram has a spike near zero. After Benjamini-Hochberg: zero genes. The shuffled data give about 600 genes with p < 0.05 (about 4%), a flat histogram, and zero after correction.

  • Ask for a two-sentence explanation, for lab meeting, of why no gene survived correction.
  • Ask for the real and shuffled p-value histograms side by side on the same y axis.
2.1 There is a spike near zero, so why does nothing survive?
The spike says real differences exist somewhere. But with three mice per group, a t-test has so little power that no single gene's p-value is small enough to beat correction across 16,000 tests. The shuffle shows the other side: hundreds of “hits” appear from pure noise, and correction removes them all. Tools like DESeq2 share information across genes to get more power from few samples. That is Session 4.

What you practiced

  1. Metadata is data: build it, then check it with a cross-table.Step 2
  2. A barplot for one value per category, never for a hidden distribution.2.2, step 3
  3. Log transform before you look at count data.2.2, step 4
  4. Violins and dots over bars when n is small.2.2, steps 5 and 7
  5. Fix overplotting before you read a scatter plot.2.2, step 6
  6. Heatmap and PCA first, to see what drives the data.2.2, step 8
  7. Thousands of tests make noise look significant; correct for it.2.1, stretch
  8. Brief Claude first, then ask, check, and keep talking.Every step
  9. When your number differs from the checkpoint, ask why before moving on.Every step
  10. Leave with the code, the methods, and the assumptions, not just the plots.Step 9

Tell us how it went

Two minutes: whether you made it, how far you got in the hands-on, and what to change. We ask this after every session.

Session 2 feedback

Materials