Pre-Class Assignment: Agent-based Modeling of Superbugs#

Day 8#

CMSE 202#

✅ Put your name here

#

Goals for today’s pre-class assignment#

  1. Learn a bit about Digital Evolution (MSU BEACON Lab)

  2. Learn about bacterial “Superbugs”

Assignment instructions#

This assignment is due by 11:59 p.m. the day before class and should be uploaded into the appropriate “Pre-class assignments” submission folder in the Desire2Learn website.


1. Digital Evolution#

Do this: Watch this quick video about Digital Evolution being done here at MSU and answers the questions below.

from IPython.display import YouTubeVideo
YouTubeVideo("FLaBghtu_os",width=800,height=450)

Question 1: What are the “genes” that mutate and change in the digital organism described in this video?

Do This - Erase the contents of this cell and replace it with your answer to the above question! (double-click on this text to edit this cell, and hit shift+enter to save the text)

Question 2: Briefly describe two evolution experiments described in this video.

Do This - Erase the contents of this cell and replace it with your answer to the above question! (double-click on this text to edit this cell, and hit shift+enter to save the text)

Question 3: What other experiments could you imagine performing using a digital evolution model?

Do This - Erase the contents of this cell and replace it with your answer to the above question! (double-click on this text to edit this cell, and hit shift+enter to save the text)


2. Superbugs#

Armed with our newly developed skills to build Python classes and create new objects, we’re going to think about how we might build an agent-based model to simulate the evolution of bacteria that become resistant to antibiotics. Hopefully you remember a bit about agent-based models from CMSE 201!

Do this: Watch the following video. If you find the video stressful/terrifying, you’re not alone, this is quite worrisome.

Our eventual goal is to build a simulation that reconstructs this real world experiment using your Python skills and modeling knowledge.

Here’s an article that discusses the video: http://www.the-scientist.com/?articles.view/articleNo/46993/title/Giant-Petri-Dish-Displays-Evolution-in-Space-and-Time/

from IPython.display import YouTubeVideo
YouTubeVideo("yybsSqcB7mE",width=800,height=450)

Question 4: Think about how you might build a model using Python to recreate, explore, and test this laboratory experiment. What datastructures would you need to simulate the world and track the bacteria as they evolve? What classes and corresponding methods and attributes would you want/need? Spend about 10-15 minutes outlining the code, psuedo-coding, or writing stub functions.

What do we mean by “stub functions”? Stub functions are when we go a step beyond outlining, describing, or writing pseudo and actually start to flesh out the structure that we want our code to have. We might quickly mock up a new Python class by creating the initial class and dropping in the functions we event want to have, but don’t actually go through the process of implement the code we have planned. It might look something like this:

class Dog:
    
    def __init__(self):
        pass
    
    def bark(self):
        pass
    
    def fetch(self):
        pass
    
    def chase_postal_worker(self):
        pass

The example above doesn’t do anything but it does serve as a guide for all of the code I might want to write in my new class. I can use pass so that the code will “run” and not throw any syntax errors, but it won’t actually do anything. I can then start working on my code one method at a time and build my class without forgetting about any of my plans. There’s even folks talking about the utility of stub functions on stack overflow

This sort of code development style can be really useful when you’re working as part of a collaboration as well because different people can be assigned to work on different parts when it comes time to implement your ideas!

Do This - Erase the contents of this cell and replace it with your answer to the above question! (double-click on this text to edit this cell, and hit shift+enter to save the text)

# Put any useful/necessary stub functions here

Follow-up Questions#

Copy and paste the following questions into the appropriate box in the assignment survey include below and answer them there. (Note: You’ll have to fill out the assignment number and go to the “NEXT” section of the survey to paste in these questions.)

  1. In thinking back on what you learned about agent-based models in CMSE 201, do you think this type of modeling would be useful for modeling evolution? Why or why not?

  2. Think back on code you’ve written previously and provide one example of a coding exercise you’ve completed where it might have been useful to use the “stub function” approach to planning out your solution.


Assignment wrap-up#

Please fill out the form that appears when you run the code below. You must completely fill this out in order to receive credit for the assignment!

from IPython.display import HTML
HTML(
"""
<iframe 
	src="https://cmse.msu.edu/cmse202-pc-survey" 
	width="800px" 
	height="600px" 
	frameborder="0" 
	marginheight="0" 
	marginwidth="0">
	Loading...
</iframe>
"""
)

Congratulations, you’re done with your pre-class assignment!#

Now, you just need to submit this assignment by uploading it to the course Desire2Learn web page for today’s submission folder (Don’t forget to add your name in the first cell).

© Copyright 2024, Department of Computational Mathematics, Science and Engineering at Michigan State University