Last modified: 2026-04-18 11:50
Status: RELEASED.
Due date: Wed Apr 22, 2026 by end of day (11:59 pm ET) in Medford, MA
Jump to: Background Starter Code Problem 1 Problem 2 Problem 3
Turn-in links:
- PDF report turned in to: https://www.gradescope.com/courses/1220989/assignments/8000096
- Notebook turned in to: https://www.gradescope.com/courses/1220989/assignments/8000116/
- Finally, complete your reflection here: https://www.gradescope.com/courses/1220989/assignments/8000128
Overview
In this HW, you'll perform a PCA and clustering analysis on a biological dataset.
- Problem 1: Perform PCA.
- Problem 2: Perform hierarchical clustering.
- Problem 3: Analyze the results to determine the presence of a label swap.
Evaluation Rubric
The worth of each problem is
- 90% PDF report
- 5% Notebook submission
- 5% Reflection
See the PDF submission portal on Gradescope for the point values of each PDF subproblem. Generally, tasks with more coding/effort will earn more potential points.
Files to Turn In:
PDF report:
- Prepare a short PDF report (no more than 5 pages).
- This document will be manually graded.
- Can use your favorite report writing tool (Word or G Docs or LaTeX or ....)
- Should be human-readable. Do not include code. Do NOT just export a jupyter notebook to PDF.
- Should have each subproblem marked via the in-browser Gradescope annotation tool)
Submit to the notebook assignment just the file:
- hw9.ipynb (just for completeness, will not be autograded but will be manually assessed if necessary.)
Background
To complete this HW, you'll need some knowledge from the following sessions of class:
- PCA (day23)
- Clustering (day24)
Starter Code
The starter notebook and dataset can be found in:
https://github.com/tufts-ml-courses/cs135-26s-assignments/tree/main/hw9
Use the provided hw9.ipynb as the primary notebook to guide you throughout this Problem.
Dataset: HIV Phosphoproteomic Data
We are collaborating with scientists who are studying HIV infection in humans. They are studying how HIV infection works over time under different conditions. Specifically, they infect human cells under different conditions with HIV (in a petri dish), and take measurements over time of how active different proteins are. The three conditions were: a control sample (called wild-type or WT), a sample called RAB7A, and a sample called NPC1. Each of these three samples had protein measurements taken at 0, 5, and 60 minutes post-infection.
Unfortunately, the protein measurements performed only allow 10 samples to be measured at a time on what is called a 10-plex, and in biological experiments it is often important to have replicates, or samples under identical conditions to make sure what we're measuring isn't due to random chance. The scientists decided to have 2 replicates for each condition, which makes a total of 3 timepoints by 3 samples by 2 replicates or \(3 \times 3 \times 2 = 18\) different samples to measure. The scientists decided to replicate wild type at 0 minutes in each 10-plex for the total 20 wells across the 2 10-plexes. This would allow the scientists to calibrate each 10-plex to the 0 minute control sample to help account for the randomness between 10-plexes (referred to as batch effects).
Experimental design showing the 2 10-plexes and which conditions are in each 10-plex.
After receiving the data from your collaborators, they inform you of a potential issue: they suspect there may have been a label swap in 10-plex 2. Two of the researchers when reviewing their lab notebooks discovered an inconsistency in how the samples were physically labeled which they suspect could have caused two of the samples to be incorrectly labeled as each other at some point in the experiment. However, they're not sure which two samples if any were swapped. They ask you to perform a quality control analysis to check if the natural grouping of the data matches experimental expectations.
Additional Details for the Curious (not needed to complete the assignment)
This data is from a gene knockout study on cultured human T-cells. Researchers created T-cells where two genes of interest, RAB7A and NPC1, are deactivated or knocked out, meaning the cells cannot use these genes. By comparing the behavior of baseline cells that have both of these genes (called wildtype or WT) to these knockout cells, we can detect what role the genes play.
The measurements taken are of protein phosphorlyation during HIV infection. Phosphorlyation is a chemical change that acts as an "on-off" switch on proteins for many cellular process. We can perform a phosphoproteomic tandem mass spectroscopy to measure the amount of different proteins that are switched on and off during infection, giving information about what cellular process are at play.
Problem 1: PCA
Implementation Step : Run PCA
Using the starter code provided in hw9.ipynb, perform PCA on each of the two 10-plexes separately. Use sklearn.decomposition.PCA.
Figures 1 and 2 in Report
Create two plots in your report, a PCA plot for 10-plex 1 and a PCA plot for 10-plex 2. Plot PC1 on the x axis and PC2 on the y axis for both. Note in the axis labels the percent of variance explained by each PC. Color the points by their sample and time point. Note that of this has already been done for you in hw9.ipynb.
Short Answer 1 in Report
Describe the PCA plots. What groups of samples appear? We expect replicates to be closest to each other as they should represent identical conditions, is that the case here? Does time point or condition (sample) appear to be better represented by one PC than the other?
Problem 2: Clustering
Figures 3 and 4 in Report
Perform and plot agglomerative clustering on each of the 10plexes using pearson correlation as a similarity metric. Pairwise correlation between all pairs of samples can be calculated using Pandas by simply calling corr_mat = plex2[plex2_names].corr(). Hierarchical clustering can then be simultaneously performed and plotted using the seaborn function sns.clustermap. Be sure to set annot=True so that the samples are labeled in your plots.
Short Answer 2 in Report
Describe the cluster plots. How are samples generally clustered, by timepoint or by sample? Do replicates always cluster together, or are there any exceptions?
Problem 3: Analysis
Short Answer 3A in Report
Do you think there was a label swap in 10-plex 2? If so, which two samples do you think were swapped? Explain your reasoning based on your plots and analysis from questions 1 and 2. Consider that we know no label swap occurred in 10-plex 1, and thus can use that as a baseline for what we expect the affects of cell condition and timepoint to be.
Short Answer 3B in Report
What appears to have the largest effect on cellular state in this experiment: time since infection or cell condition? Justify your answer. Note that in reality we'd want to run other tests to answer this question directly, but discuss what you can infer from the analyses you have performed.