Lab#
Learning Objectives#
At the end of this learning activity you will be able to:
Practice creating statistical figures to answer biological questions.
Practice writing figure legends for statistical figures.
Practice writing descriptive reasonings about a figure.
Note: It is difficult to automatically grade figures as they are many “correct” answers. So, most questions will accept any figure or axis and then ask you to answer a question that should be obvious from a properly generated figure. For all questions, assume a 95% interval.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
cell_level_data = pd.read_csv('pHrodo_DMEM.csv')
cell_level_data.head()
How full is each cell?#
The strategy of using the number of beads in a cell as our count is that it is impacted by the size of the cell. Small cells can only eat a few beads, large cells can eat many. To address this we’ll create a new measurement, the fraction of the cell containing beads. This way, small cells that are ‘stuffed’ with beads will beat out large cells with only a few beads.
For this analysis we’ll use:
ObjectAreaCh1- The area of the entire cell.SpotTotalAreaCh2- The area of the cell containing beads.
Q1: Create an fraction_area_covered column#
Checked variables:
cell_level_data['fraction_area_covered']- The fraction of the area of each cell covered by pH responsive beadsCalculate as red_bead_area / cell_area
q1_plot- A barplot showing the mean area of each cell covered split by wellShould be a matplotlib Axes object
Hint
Create a new column by dividing the red_bead_area by cell_area for each cell. Then use groupby to calculate the mean fraction for each well and plot as a bar chart. See Module 7 walkthrough for examples.Points |
5 |
Public Checks |
2 |
Hidden Tests |
1 |
Points: 5
# What fraction of the cell's area is covered by phrodo beads
cell_level_data['fraction_area_covered'] = ...
# Create a barplot of the fraction_area_covered in each well
# Your answers should be between 0 and 1.
q1_plot = ...
grader.check("q1_area_covered")
Q2: Merge well_level_data with plate-map and visualize#
Checked variables:
plate_map- A DataFrame from reading the plate_map.csv filewell_level_data- A DataFrame where each well is an index (row) with columns:mean,sem, andcountCalculate from the
fraction_area_coveredof cells in each well using groupby
sample_level_data- A DataFrame mergingplate_mapandwell_level_dataq2a- Which experimental condition (pHrodo_conc_ug) had less noise? (string or number)q2b- Does this graph show evidence that dopamine increases bead percentage? (string: ‘yes’ or ‘no’)q2_plot- A plot justifying your answers forq2aandq2bShould be a matplotlib Axes object with error bars
Hint
Use groupby on cell_level_data by 'well' to calculate mean, sem (using .sem()), and count. Merge with plate_map on the well column. Create a grouped barplot with error bars showing dopamine conditions and pHrodo concentrations. Less noise = smaller error bars. See Module 7 walkthrough for groupby aggregation and merging examples.Points |
5 |
Public Checks |
2 |
Hidden Tests |
1 |
Points: 5
# Load in plate map
plate_map = ...
# Group the cell level data by well and for each well calculate the mean, standard-error of the mean, and the number of cells
well_level_data = ...
well_level_data.head()
# Merge well_level_data with the platemap
sample_level_data = ...
sample_level_data.head()
### Visualize merged dataset
# Create any visualization which answers the questions below.
# Feel free to explore other functions like `lineplot` & `pointplot`.
q2_plot = ...
# Which experimental condition (pHrodo_conc_ug) had less noise in the measurement?
# Answer 5.0 or 7.5
q2a = ...
# Write your reasoning in a Markdown cell after this.
# Does this graph show evidence that dopamine increases
# the percentage of the cell that contains beads?
# Anwser 'yes' or 'no'
q2b = ...
# Write your reasoning in a Markdown cell after this.
grader.check("q2_merge")
This week we explored how to summarize large datasets by sample. This aggregation is often important for downstream inferential tests like t-tests and ANOVAs. However, this technique also looses a significant amount of information; ~525 numbers are compressed to a single value. We will also explore more nuanced techniques like regression which allows us to use each of these points individually.
Submission#
Check:
That all tables and graphs are rendered properly.
Code completes without errors by using
Restart & Run All.All checks pass.
Then save the notebook and the File -> Download -> Download .ipynb. Upload this file to BBLearn.