Lab#

The differential-expression table is precomputed and loaded for you. Use Colab’s cell-level AI with the lab prompts in this book for the remaining cells. Do not rebuild the gene-wise t-tests from scratch.

Learning objectives#

  • Draw a volcano plot from a saved DE table

  • Run Enrichr on the significant gene list

  • Plot expression for the 10 genes with largest |log2FC| in one Hallmark set

Biological framing#

You start from a finished differential-expression table for the same acute-HIV PBMC study (GSE199911): 29 infected versus 46 uninfected samples, tested gene-by-gene on log2 TPM. Your job is to see the genome-wide pattern (volcano) and then ask whether the significant genes concentrate in known Hallmark programs. Finally, check that a chosen Enrichr term’s strongest fold-change genes actually separate by infection status across people—not just as a pathway name on a list.

# Setting up the Colab environment. DO NOT EDIT!
try:
  from applied_biostats import setup_environment
except ImportError:
  !pip -q install applied-biostats-helper
  from applied_biostats import setup_environment
finally:
  grader = setup_environment('Module11_lab')

!pip -q install gseapy==1.3.2
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import gseapy

Load the saved analysis tables#

These cells stay filled in. Nothing below should rebuild the gene-wise t-tests.

samples = pd.read_csv('gse199911_samples.csv')
log2 = pd.read_csv('gse199911_log2tpm.csv.gz').set_index('gene_symbol')
results = pd.read_csv('gse199911_de_results.csv')

print('Unit of analysis: sample')
print('n samples:', len(samples))
print(samples['group'].value_counts())
print('results genes:', len(results), 'fdr<0.05:', int((results['fdr'] < 0.05).sum()))
results.head()

Q1. Volcano plot#

Q2A. Enrichr on the significant list#

Q2B. Plot the top |log2FC| genes from one Hallmark term#