Latest / Talk Python To Me / #335: Gene Editing with Python
Transcript
- 0:00Gene therapy holds the promise to permanently cure diseases that have been considered
- 0:04lifelong challenges, but the complexity of rewriting DNA is truly huge and lives in its
- 0:09own special kind of big data world. On this episode, you'll meet David Born, a computational
- 0:15biologist who uses Python to help automate genetics research and helps move that work
- 0:20to production. This is Talk Python To Me, episode 335, recorded September 15th, 2021.
- 0:27Welcome to Talk Python To Me, a weekly podcast on Python. This is your host, Michael Kennedy.
- 0:44Follow me on Twitter where I'm @mkennedy and keep up with the show and listen to past episodes
- 0:49at talkpython.fm and follow the show on Twitter via at talkpython. We've started streaming most
- 0:56of our episodes live on YouTube. Subscribe to our YouTube channel over at talkpython.fm
- 1:00slash YouTube to get notified about upcoming shows and be part of that episode. This episode
- 1:07is brought to you by Shortcut, formerly known as clubhouse.io, and us over at Talk Python
- 1:12Training. And the transcripts are brought to you by Assembly AI. David, welcome to Talk Python
- 1:18to Me.
- 1:18Thanks, Michael. It's great to be here.
- 1:19Yeah, it's great to have you here. One of the things I really love to explore is the
- 1:24somewhat non-traditional use cases of Python that are not straight down the, I'm building
- 1:30an API and something that talks to a database or a startup, right? Something like that, but
- 1:35blending it with other technologies and science and whatnot and genetics plus Python, it's going
- 1:41to be interesting.
- 1:42It sure is.
- 1:43When you got into this, did you start out on the biology side or the programming side of
- 1:48the world?
- 1:48I definitely started out on the biology side. Yeah. So I went all the way through grad school
- 1:53with relatively minimal formal programming experience.
- 1:57Yeah. Okay. So you studied biology and genetics and whatnot. And then how'd you end up here
- 2:03on a Python podcast?
- 2:04Yeah. So I always thought that programming would be cool, but I didn't really have much of an
- 2:09opportunity through my undergraduate studies to really do much formal programming. I took our one
- 2:15computer science class that my college had to offer. It was in C++. I think I wrote a Boggle program,
- 2:21something with some recursion in there. It was pretty fun. Didn't really get to use Python until
- 2:26graduate school. I was in a genetics course and we were basically tasked with doing some data analysis
- 2:33on published data and then reproducing some plots in a figure, then extending it further.
- 2:38My partner and I decided to learn Python, teach it to ourselves so that we could do this. We heard that
- 2:45it was a good way to do data analysis in biology. And so we basically taught it to ourselves and we used
- 2:52NumPy, some basic string searching and things to redo this analysis. And it was really amazing what we could
- 3:00do with Python for that civil project.
- 3:02That's awesome. How'd the learning project go? Like coming from not having a ton of programming,
- 3:06what was your experience like?
- 3:08It was relatively easy. I would say I think my brain sort of fits pretty well with how
- 3:13programming languages work, but it was definitely a lot in a short amount of time to really dive into
- 3:18how to make sure your while loops don't stay open. And then someone tells you maybe you shouldn't use
- 3:24a while loop at all. I was learning a lot of things not to do right away.
- 3:28Yeah, of course. But you had to get all the analysis done, right? So you got to solve all the problems
- 3:33and power through.
- 3:34Yeah, we did. We got our analysis done there and we got some, we reproduced some plots and got some
- 3:40new analysis made. And I think we really just, I really came to appreciation of how much you can do
- 3:45in a short amount of time with just a little bit of coding knowledge or essentially none.
- 3:49Yeah. I think that's really an important takeaway that a lot of people, you know, maybe many people
- 3:54listen to podcasts already kind of know, but I think looking in from the outside, it feels like,
- 3:59oh, I've got to, you know, go get a degree in this to be productive or useful. And really what you need
- 4:06is like a couple of weeks and a small problem and you're already already there.
- 4:10Absolutely. Yeah. I've all, I've definitely found that just learning through, through doing has been
- 4:15the way I've, I've worked entirely. I have essentially no formal programming training, no,
- 4:20no coursework and I'm using Python every day.
- 4:23Yeah. That's fantastic. Yeah. I didn't take that much computer science and college either. Just
- 4:27enough to do the extra stuff from my math degree. Very cool. All right. Now how about today? You're
- 4:32working at Beam Therapeutics doing genetic stuff. Tell us about what you do day to day.
- 4:37Yeah. So I'm on the computational sciences team at Beam Therapeutics. We're a gene editing company. So
- 4:44we develop these precision genetic medicines that are, we're trying to develop them to cure genetic
- 4:50diseases that are caused by single genetic changes in the genome.
- 4:56Like a point shift mutation or something like that.
- 4:59Yep. Yep. And so if you have one of these genetic changes, you might have a disease that is lifelong
- 5:06and there aren't any cures for most of these diseases. So we're trying to create these, we call
- 5:12them hopefully lifelong cures for patients by changing the genetic code back to what it should be.
- 5:18That's incredible. It seems really out of the future. I mean, it's, I think it's one thing to
- 5:24understand genetics at play and it's even amazing to be able to read the gene sequences, but it's
- 5:31entirely another thing I think to say, and let's rewrite that.
- 5:34Yeah. We're definitely at the cutting edge of a lot of biotechnology and science that has really come
- 5:41to have had in the last decade with the, with CRISPR and technologies that use CRISPR, which ours do be able to precisely target genetic sequences. It's a really fascinating place to work and it's a privilege.
- 5:54I bet a lot of people go to work and they end up writing what you might classify as forms over data. It's like, well, I need a view into this bit of our database or I need to make, be able to run a query to just see who's got the most sales this week or, you know, something like that.
- 6:10And that's important work and it's, it's useful and there's cool design patterns and whatnot you can focus on, but it's also, it's not like what people dream of necessarily building when they wake up.
- 6:21But this kind of science, like maybe so, right? Like these are the really interesting problems that both have a positive outcome, right? You're helping cure disease, not just, you know, shave another one, one hundredth of a percent off of a transaction that you get to keep or, you know, something like that. Right. From like in finance.
- 6:39Yeah.
- 6:39You get to use really cool tech to do it too, like programming wise.
- 6:42Yeah. I mean, one of our dreams that we joke about on the computational team is that like it's conceivable one day we could, you know, say like, Hey Alexa, how do we cure sickle cell disease? And it'll tell you what parts of our technology we should put together to cure that disease. That's sort of like the pipe dream of, of where we could go if we combine all our data in the right ways. And I think all of the stuff we'll talk about today is really just laying out the framework for that.
- 7:09Yeah, absolutely. So you mentioned CRISPR. Maybe tell people a bit about that biotechnology.
- 7:14Yeah. So CRISPR is molecular machine, which a lot, which targets a very specific place in a specific genetic sequence. And so usually people are using CRISPR to target a specific place in the genome, a specific sequence. And what CRISPR does naturally is to cut at that sequence.
- 7:38So it'll cut in a very specific place in the genome. And as people were using CRISPR, we could actually decide where it's going to cut by giving it a different targeting sequence. This sort of like directed molecular machine is a basis of a whole new field of biotechnology using CRISPR and CRISPR derived technology.
- 8:00So our technology is like kind of a CRISPR 2.0 where we don't use CRISPR to cut. We use the localization machinery and we add onto it another protein, which just changes a base instead of cutting the DNA itself.
- 8:16So it's slight variation, but it's still using this same CRISPR technology.
- 8:20Okay. So let me see if my not very knowledge filled background understand here is kind of a, has a decent analogy. So does it work basically like you give it like almost like find and replace, like you give it a sequence of pairs and it says, okay, if I find a TTCAT, like enough specificity and that it's like, that's the unique one. And then it does like cut at that point. Is that kind of how it works?
- 8:46Yep. It's pretty much just like that. We give it the sequence you want to target. And then if it finds that sequence in the genome, it will cut the genetic material, the DNA at that position for normal CRISPR.
- 9:00When you're coming up with these and you say, we're going to rewrite the DNA to solve this problem. How do you do it on a large enough scale? Right. Like how do you, I mean, how much of the body has to be changed for this to be kind of, to be permanent, right?
- 9:14Right. It's definitely a tricky question. I think we are, we definitely leverage human biology, how the human body works for a lot of these problems. For example, our, some of our leading drug candidates are for sickle cell disease. And because of the way sickle cell disease manifests in red blood cells and red blood cells are created through a set of, through, there's a specific type of cell that creates red blood cells.
- 9:41And we can, if you access that type of cell and you cure, cure a sickle cell in these progenitor cells, the stem cells, then you can create all red blood cells from a cured population.
- 9:54So if you can target it to the regenerative cells, you can cure sickle cell throughout the body essentially, because the symptoms are from red blood cells. There's a lot of diseases that, which by curing a single organ, you can cure the symptoms of the disease because that's where it actually manifests.
- 10:13Right. Like, like, like diabetes or sickle cell anemia or something like that?
- 10:17Yeah. Like sickle cell diseases in the liver, like some blindnesses in the eye. By just targeting specifically where the symptoms occur, you can cure the disease.
- 10:27Yeah. That's amazing. Is it a shot? Is it a blood transfusion or like, how do you deliver this stuff?
- 10:32Yeah. Delivery is a huge place of research and it definitely depends on the type of targeting we're doing. So for something in the eye, it would probably be an injection.
- 10:41For something in the blood, it's slightly more complicated and it's not an injection. For something in the liver, it would probably be more akin to a injection or dosing regimen.
- 10:54Okay. It sounds really fascinating. Like I said, it feels like it's a little bit out of the future to be able to come up with these and just say, no, we're just going to rewrite this little bit of the genetics and I think it'll be good. But if you can make it happen, it's pretty clear how it's obviously a benefit, right? Like those progenitor cells, they eventually have to recreate new ones. And then the way they do that is they clone their, their current copy of the DNA, which is the fixed one, right? So if you can get enough of them going, it'll just sort of propagate from there.
- 11:22Yep. And we're also the benefit that sometimes you only need to cure a small fraction to remove the symptom. So lots of things going for us.
- 11:31That's awesome. So I'm sure there's a lot of people involved in this type of work. What exactly are you and your team working on?
- 11:39Yeah. So our team, we call ourselves the computational sciences team. We really sit in the, in the middle of the research and development arm of the organization, processing all of our sequencing data and some other data as well. And as you can imagine, with our technology changing DNA, changing genomes, there's a lot of sequencing data because what we're trying to do is change a genetic sequence.
- 12:07So we have to read out that genetic sequence and then figure out has it changed, how many copies are changed and things like that.
- 12:14Yeah.
- 12:14Yeah.
- 12:14The field of the techniques of next generation sequencing NGS are pretty broad. And we deal with a lot of different types of these next generation sequencing assays that are being done at the end. Our team really processes, analyzes, and collaborates with the experimental scientists on performing and developing these experiments.
- 12:36Cool. So the scientists will do some work and they'll attempt to use CRISPR-like technology to make changes. And then they measure the changes that they've made. And it's, you all sort of take that data and compare it and work with it.
- 12:50Right. Yeah. The act of measuring the changes itself is relatively computationally intensive. So we run and support pipelines for all of these standard assays as well, which is, is part of our, our job.
- 13:03How much data is in DNA? I mean, I know that human biology stores or just biology stores an insane amount of data, but also computers store an insane amount of data and processing. So I'm not sure like which, where the sort of trade-off is, but what sort of data are we talking about? How much?
- 13:20Yeah. I mean, it definitely depends on the type of assay that we're doing, like the scale of the data. I would say usually we're not looking, sometimes we're looking at things that are looking at all the bases in the genome. More often we're looking at defined regions of the genome where we're trying to make the change.
- 13:39Right. You're like, this one gene is the problem, right? And let's look at that.
- 13:42Right. Yeah. We're trying to target here. So that's where we're looking. It definitely depends on the assay, but, but I guess in terms of data scale, in terms of file sizes, perhaps that would be accessible.
- 13:52Yeah.
- 13:54For standard things, it would be on the order of a few gigabytes per experimental run. For some of our larger assays, it's 10 to 100 times that.
- 14:04Right.
- 14:04Per experiment.
- 14:05That's a lot of data, but not impossible to transmit sort of amounts of data, right? Or store.
- 14:10Right. Every little piece of it is, is pretty manageable. When you start combining them together and looking at some doubt, like your downstream results of things, the data does get pretty, pretty large.
- 14:22But I wouldn't say we're at the scale of like big data analytics at Google or anything like that.
- 14:26Yeah. Yeah. Or the LHC. If you've ever looked at the data flow layers at LHC, it's like the stuff near the collectors is just unimaginable amounts of data. Right.
- 14:36Yeah. I haven't looked, but I'm sure it's certainly.
- 14:39Yeah. They've got a lot of stuff built in, like onboard the detectors to filter it down a bunch. And then it goes for processing. Then it gets filtered down some more. And then like eventually it gets to a point where like now we have enough space.
- 14:51on hard drives to save it.
- 14:53But before that, it was like,
- 14:54it couldn't be saved on hard drives.
- 14:56It was just too much.
- 14:56Yeah, very interesting.
- 14:58But it sounds to me like
- 14:59some of the real big challenges for you all
- 15:01is the computational bits, right?
- 15:03Because if you take all these things
- 15:05and you can end up in like
- 15:06combinatorial comparison scenarios,
- 15:09I'm sure that that can really blow up
- 15:11the computing time.
- 15:12Yeah, I think definitely
- 15:13there's a lot of the challenges
- 15:16sometimes in these combinatorics.
- 15:18And there's also just a lot of,
- 15:21there's steps that have to go on
- 15:23to process a lot of this data.
- 15:24There's a lot of biology specific
- 15:27pieces of software that we use
- 15:29for various things.
- 15:30And we have to string them together
- 15:33to create a complete
- 15:35data processing pipeline.
- 15:37And a lot of that art is part of our job,
- 15:40how to get all these tools to behave together
- 15:42and act in unison
- 15:44to actually process the data effectively.
- 15:46I can just imagine
- 15:47some of these pipelines are tricky.
- 15:49It's like, well, okay,
- 15:50so it starts over here
- 15:52where the robot gets it
- 15:53and it reads this data
- 15:54and we can access that off the hard drive.
- 15:56And then it has to be sent
- 15:57to this Windows app
- 15:59that actually doesn't have an API.
- 16:00So we got to somehow like
- 16:02automate that thing
- 16:03and then get data out of it.
- 16:05And then is that what it's like?
- 16:06That's some of it for sure.
- 16:07Tell us about your life.
- 16:08Okay.
- 16:09Yeah.
- 16:09I mean, there's a couple aspects
- 16:10and I think we might touch on them,
- 16:12but for sequencing experiments,
- 16:14the pipelines are more defined
- 16:16because we usually get the data
- 16:17from a source that's already in the cloud,
- 16:19which I'm always happy about.
- 16:21If we can start in the cloud,
- 16:22we'll stay in the cloud
- 16:23and that's a nice place to be.
- 16:24For data that's coming directly
- 16:27from instruments on premises,
- 16:29there is another layer of art
- 16:32that has to do with software
- 16:34on the instrument,
- 16:34software that gets the data to the cloud
- 16:37and moves it around
- 16:38between our other database sources.
- 16:41And that is a fun project in itself there.
- 16:43Yeah.
- 16:44I can imagine.
- 16:44I've worked in some areas
- 16:46where it's like collecting data
- 16:48from all these different things
- 16:49and then, you know,
- 16:50to process it and move it along.
- 16:52And yeah, it's not always just
- 16:53send it from this Python function
- 16:56to that Python function
- 16:57to that Python function.
- 16:58There's a lot of janky stuff
- 17:00that wasn't really meant
- 17:01to be part of pipelines possibly.
- 17:03Absolutely.
- 17:04Yeah.
- 17:06This portion of Talk Python To Me
- 17:08is brought to you by Shortcut,
- 17:09formerly known as clubhouse.io.
- 17:11Happy with your project management tool?
- 17:13Most tools are either too simple
- 17:15for a growing engineering team
- 17:17to manage everything
- 17:18or way too complex
- 17:19for anyone to want to use them
- 17:20without constant prodding.
- 17:22Shortcut is different though,
- 17:24because it's worse.
- 17:25No, wait, no, I mean it's better.
- 17:26Shortcut is project management
- 17:28built specifically for software teams.
- 17:30It's fast, intuitive, flexible, powerful,
- 17:32and many other nice positive adjectives.
- 17:35Key features include
- 17:36team-based workflows.
- 17:37Individual teams can use
- 17:39default workflows
- 17:40or customize them
- 17:41to match the way they work.
- 17:42Org-wide goals and roadmaps.
- 17:44The work in these workflows
- 17:46is automatically tied
- 17:47into larger company goals.
- 17:48It takes one click
- 17:50to move from a roadmap
- 17:51to a team's work
- 17:52to individual updates and back.
- 17:54Type version control integration.
- 17:56Whether you use GitHub,
- 17:57GitLab, or Bitbucket,
- 17:58clubhouse ties directly into them
- 18:00so you can update progress
- 18:02from the command line.
- 18:03Keyboard-friendly interface.
- 18:04The rest of Shortcut
- 18:06is just as friendly
- 18:07as their power bar,
- 18:08allowing you to do
- 18:09virtually anything
- 18:10without touching your mouse.
- 18:11Throw that thing in the trash.
- 18:13Iteration planning.
- 18:14Set weekly priorities
- 18:16and let Shortcut run the schedule
- 18:18for you
- 18:18with accompanying burndown charts
- 18:20and other reporting.
- 18:20Give it a try
- 18:22over at
- 18:23talkpython.fm
- 18:24slash shortcut.
- 18:25Again,
- 18:26that's
- 18:26talkpython.fm
- 18:28slash shortcut.
- 18:29Choose shortcut
- 18:30because you shouldn't have
- 18:31to project manage
- 18:32your project management.
- 18:33with robots,
- 18:37do you have to actually
- 18:38talk to the robots
- 18:39and like any of the
- 18:41type of automated things?
- 18:42Yeah,
- 18:43for lab automation
- 18:44is what we
- 18:45call our
- 18:46team that has
- 18:47the robots
- 18:48as we like to
- 18:49call them.
- 18:50As you can imagine
- 18:51with a lot of
- 18:51these types of experiments,
- 18:53they can be
- 18:54made much more efficient
- 18:55if we can have
- 18:56robots doing
- 18:57the actual
- 18:58transfer of liquids
- 18:59and incubation
- 19:01and centrifugation,
- 19:03these scientific
- 19:03techniques that
- 19:04sometimes you need
- 19:06someone in the lab
- 19:06to do,
- 19:07but oftentimes
- 19:07you can automate them.
- 19:09So the
- 19:10lab robotics
- 19:11aspect is an
- 19:12important part
- 19:13of how we can
- 19:14efficiently generate
- 19:15data.
- 19:16A lot of the
- 19:17issues around that
- 19:18come with
- 19:18how to
- 19:19pass
- 19:20instructions
- 19:21to the instrument
- 19:22and how to get
- 19:23back
- 19:24data from the
- 19:25instrument
- 19:25when it's done.
- 19:26and then
- 19:27there's a
- 19:27whole other
- 19:27art of
- 19:28making the
- 19:29instruments
- 19:29actually
- 19:30orchestrate
- 19:30together,
- 19:31which is
- 19:31held in a
- 19:32different world
- 19:33of software.
- 19:34I don't actually
- 19:35work on that
- 19:36part myself.
- 19:36Yeah,
- 19:37that part of
- 19:38programming
- 19:38definitely seems
- 19:39a little bit
- 19:39magical,
- 19:40getting factories
- 19:41or automations
- 19:42of different
- 19:43machines to
- 19:44work together.
- 19:44It's very cool.
- 19:45There's a whole
- 19:46lot of
- 19:46proprietary software
- 19:47involved in
- 19:48actually running
- 19:49the instruments,
- 19:50but in terms of
- 19:51the problems
- 19:51in getting the
- 19:52data to them,
- 19:53I think it's
- 19:54one of those,
- 19:55it could be a
- 19:56relatively common
- 19:56software problem
- 19:57of getting
- 19:57information from
- 19:59somewhere in
- 20:00the cloud.
- 20:01We have
- 20:01electronic lab
- 20:03notebooks and
- 20:04laboratory data
- 20:05systems that
- 20:06are in the
- 20:07cloud and
- 20:08users will be
- 20:09submitting
- 20:09information about
- 20:11how they want
- 20:11their samples
- 20:12processed by
- 20:13the robots.
- 20:14There's the
- 20:14problem of
- 20:15getting that
- 20:16to the
- 20:17instruments
- 20:17themselves.
- 20:18And I think
- 20:18it actually
- 20:19sort of
- 20:20reminded me of
- 20:21the talks you
- 20:22guys had in
- 20:22episode,
- 20:22I think it was
- 20:23327, the
- 20:24small automation
- 20:25projects.
- 20:26We end up
- 20:27with quite a
- 20:28few of those
- 20:28here where we
- 20:29have these
- 20:29relatively small
- 20:31tasks of
- 20:32take data from
- 20:33an API,
- 20:33put it somewhere
- 20:35where a robot
- 20:36can access it.
- 20:37Usually we use
- 20:38AWS S3,
- 20:40and these sort
- 20:41of very small
- 20:42data handling
- 20:43tasks end up
- 20:44being these nice
- 20:44little projects
- 20:45for Python to
- 20:47come into play.
- 20:47Awesome.
- 20:48I can see that
- 20:49that definitely
- 20:50happens, right?
- 20:51if a file
- 20:51shows up
- 20:52here, grab
- 20:53it, upload
- 20:54it to that
- 20:54bucket, and
- 20:55name it
- 20:56whatever the
- 20:56active experiment
- 20:57is with the
- 20:58data or
- 20:58something like
- 20:59that, right?
- 20:59That's a very
- 21:00small program
- 21:00to write, but
- 21:01then that becomes
- 21:02a building block
- 21:03in this flow,
- 21:04putting these
- 21:05pieces and
- 21:06machines together.
- 21:06Right, yeah.
- 21:07Once it comes
- 21:08into the cloud,
- 21:08we do another
- 21:10set of data
- 21:11processing on it,
- 21:12we upload it
- 21:13to our
- 21:13current databases,
- 21:15and all of
- 21:15that we
- 21:16orchestrate on
- 21:18AWS using,
- 21:19I guess they
- 21:20call it their
- 21:21serverless design
- 21:22patterns, so we
- 21:24don't have to
- 21:24handle anything on
- 21:25our own computers.
- 21:26Yeah, that's
- 21:27really nice, and
- 21:27the serverless
- 21:28stuff probably
- 21:28helps you avoid
- 21:30running just tons
- 21:31of VMs in the
- 21:32cloud, right?
- 21:33Like, it can all
- 21:33be on demand,
- 21:34like the Lambda
- 21:35trigger is a file
- 21:36appears in this
- 21:37S3 bucket, so
- 21:38then it starts
- 21:39down the flow,
- 21:40right?
- 21:40Absolutely, yeah.
- 21:41I really don't
- 21:42like maintaining a
- 21:43lot of infrastructure,
- 21:43although we do
- 21:44have,
- 21:44a good amount
- 21:45of it that we
- 21:46do have to
- 21:46maintain, I
- 21:47find that these
- 21:48small Python
- 21:49functions are
- 21:50the perfect
- 21:51use case for
- 21:52those event-driven
- 21:54Lambda functions,
- 21:55which are running
- 21:56these very simple
- 21:57pieces of code.
- 21:58When an object
- 21:59appears in S3,
- 22:00they get a
- 22:01small event about
- 22:02when the object
- 22:03was uploaded,
- 22:03and then they
- 22:04do their thing,
- 22:05a little bit of
- 22:06data conversion,
- 22:07send it to an
- 22:08API, and now
- 22:09the data is in
- 22:10our data store.
- 22:11And those
- 22:12things just
- 22:13happen, and
- 22:14they're super
- 22:14consistent,
- 22:15they don't
- 22:15require anything
- 22:16on my end to
- 22:17maintain.
- 22:18It's a pretty
- 22:18beautiful pattern.
- 22:20That's awesome.
- 22:20They don't need
- 22:21things like,
- 22:22oh, there's a
- 22:24new kernel for
- 22:25Linux that
- 22:26patches a
- 22:26vulnerability, so
- 22:27let's go and
- 22:28patch our
- 22:29functions, right?
- 22:30Just it's all
- 22:31magic.
- 22:31It all happens
- 22:31on its own.
- 22:32Right.
- 22:32It does feel
- 22:33like magic a
- 22:34lot of the
- 22:34time, yeah.
- 22:35Setting them up
- 22:36can be a little
- 22:36bit of a challenge,
- 22:37but once they're
- 22:38there, they are
- 22:39very consistent.
- 22:40Yeah, yeah,
- 22:40cool.
- 22:40One of the
- 22:41things you
- 22:41talked about
- 22:42doing, you
- 22:43seen, was
- 22:44the AWS
- 22:44CDK, or
- 22:46Cloud
- 22:46Development
- 22:46Kit.
- 22:47I think I've
- 22:47heard of this
- 22:48before, but
- 22:49it's like, I've
- 22:50definitely not
- 22:50used this
- 22:51personally.
- 22:51Tell us, what
- 22:52is this?
- 22:53How does it
- 22:53help you?
- 22:53Right, so
- 22:54when I started
- 22:55dabbling with
- 22:56these Lambda
- 22:57functions, what
- 22:58I found pretty
- 23:00soon after I
- 23:01had four or
- 23:02five of these
- 23:03functions, which
- 23:04I had uploaded
- 23:05on the
- 23:06AWS Council,
- 23:07and if
- 23:08anyone's used
- 23:09that, know
- 23:10that it can
- 23:10be pretty
- 23:10tedious once
- 23:11you have a
- 23:12few things
- 23:12running, getting
- 23:13all your
- 23:13permissions and
- 23:14things set up.
- 23:15And I was
- 23:16looking for
- 23:17better ways to
- 23:19do this, and
- 23:19at that point,
- 23:20it was early
- 23:21days for this
- 23:22AWS Cloud
- 23:23Development,
- 23:24AWS CDK, and
- 23:25what it is, is
- 23:27a way to write
- 23:28your infrastructure
- 23:29as code in
- 23:31essentially any
- 23:32common language,
- 23:34programming language.
- 23:35write JavaScript,
- 23:36TypeScript, I
- 23:38think you can
- 23:38do Java, Go,
- 23:39and Python
- 23:40perhaps.
- 23:40And using it,
- 23:42you can define
- 23:44your cloud
- 23:45infrastructure in
- 23:46an object-oriented
- 23:47way with all the
- 23:48parameters they
- 23:49need, and you
- 23:50can deploy it to
- 23:51different AWS
- 23:52accounts, you
- 23:53can take it
- 23:53down, you can
- 23:54reconfigure it,
- 23:55you can look at
- 23:56how it's changed
- 23:57since your last
- 23:57commit, and you
- 23:59can store all
- 23:59that configuration
- 24:00in source
- 24:01control.
- 24:02And this has
- 24:03allowed us to
- 24:04scale up,
- 24:05in terms of
- 24:06number of
- 24:06Lambda functions,
- 24:07I think we
- 24:08have maybe
- 24:0860 or
- 24:09something now,
- 24:10which would
- 24:11be unmaintainable
- 24:12in the
- 24:12console, but
- 24:13they're
- 24:14essentially just
- 24:14completely maintained
- 24:15inside of
- 24:16source control
- 24:17these days using
- 24:18AWS CDK and
- 24:19Python.
- 24:20Yeah, it seems
- 24:20super neat.
- 24:21I have not used
- 24:22it, but on
- 24:23the page, which
- 24:24I'll link to in
- 24:24the show notes,
- 24:25they have
- 24:26Werner Vogels,
- 24:28the CTO of
- 24:29Amazon, AWS, and
- 24:32talks about some
- 24:33of the benefits and
- 24:34kind of how it all
- 24:35fits together.
- 24:35And like you
- 24:36said, you can
- 24:37store your cloud
- 24:38structure definition
- 24:39in source control.
- 24:40You can run unit
- 24:41tests against your
- 24:42infrastructure to
- 24:43say, if I apply
- 24:44all these commands
- 24:44to AWS, so I
- 24:45actually get what I
- 24:46was hoping to get
- 24:47out of it.
- 24:48yeah, it seems
- 24:49like a really neat
- 24:50thing for this
- 24:51infrastructure's code
- 24:52bits.
- 24:53Yeah, and I
- 24:53think it definitely
- 24:54really shines when
- 24:56you're developing
- 24:57larger pieces of
- 24:58infrastructure, but
- 25:00I would encourage
- 25:01people to check it
- 25:02out, even if they
- 25:02have a small
- 25:04automation type
- 25:05project.
- 25:05This is what I
- 25:06was thinking of
- 25:07when I was
- 25:07listening to
- 25:08episode 327 the
- 25:09other day.
- 25:10When you have
- 25:10these things you
- 25:11want to run on
- 25:12your computer with
- 25:14a cron job, you
- 25:15can actually run
- 25:16them for free on
- 25:18AWS Lambda.
- 25:19You get a bunch
- 25:19of free time on
- 25:21the free tier, and
- 25:22you try it out.
- 25:23You don't need to
- 25:24make sure your
- 25:25system D processor
- 25:26for whatever is
- 25:27running, and it's
- 25:29a pretty cool way
- 25:29to get familiar
- 25:30with how to do
- 25:32some of these
- 25:32things on AWS.
- 25:33I'm not sure if
- 25:35this also exists for
- 25:36other cloud
- 25:36providers.
- 25:37We use AWS in
- 25:39particular, so that's
- 25:40what I know, but
- 25:40it might also exist
- 25:41for things like
- 25:42Azure and Google
- 25:43Cloud.
- 25:43Sure.
- 25:44Yeah, maybe.
- 25:44I don't know if it
- 25:45does either, but it
- 25:46definitely seems
- 25:47useful for what
- 25:48you all are doing
- 25:48there.
- 25:48One of the things
- 25:50it could be useful
- 25:51for, and one of the
- 25:51challenges I suspect
- 25:52that you run into
- 25:53more than a lot of
- 25:54places, certainly more
- 25:55than like an e-commerce
- 25:56site or something like
- 25:57that, is
- 25:58reproducibility.
- 25:59If you're going to
- 26:00say, we're going to
- 26:01come up with a
- 26:02treatment that
- 26:03literally gets
- 26:04injected into people,
- 26:05you've got to go
- 26:06through FDA, you've
- 26:08got to have
- 26:09possibly peer-reviewed
- 26:11stuff.
- 26:11There's a lot of
- 26:13reproducibility and
- 26:14data stewardship
- 26:15going on, I
- 26:16imagine, right?
- 26:17Absolutely.
- 26:18That's definitely the
- 26:19case.
- 26:19We are very
- 26:20cognizant of the
- 26:21fact that we have
- 26:22to make our
- 26:23software as
- 26:24reproducible as
- 26:25possible.
- 26:25I think a lot of
- 26:27that lends itself to
- 26:28just using good
- 26:29development practices,
- 26:30containerizing everything
- 26:32that you're doing for
- 26:34data processing,
- 26:34getting all your
- 26:35versions, appropriate
- 26:37source control, all
- 26:39of these things.
- 26:40And the
- 26:40infrastructure is
- 26:41definitely a piece
- 26:43of that because if
- 26:44we can't deploy the
- 26:45pipeline in the same
- 26:46way a year from
- 26:47now, we won't be
- 26:49able to get the same
- 26:50results from the
- 26:51data.
- 26:51And that's a
- 26:52problem.
- 26:53That's a big
- 26:53challenge.
- 26:54It's tricky, right?
- 26:55Because things like
- 26:57containers and source
- 26:58control, they'll
- 26:58absolutely get you
- 27:00very far.
- 27:00But then you're also
- 27:02depending on these
- 27:03external things that
- 27:05have been very
- 27:06stable and very likely
- 27:07will be, like
- 27:08Lambda, for
- 27:08example, but what
- 27:10if Amazon went out
- 27:11of business, right?
- 27:12Which, you know, is
- 27:14kind of laughable,
- 27:14right?
- 27:15It's only like
- 27:15doubled its revenue
- 27:16this year or
- 27:17something.
- 27:17But, you know,
- 27:18theoretically, it's
- 27:20possible that AWS
- 27:21decided to shut down
- 27:22or something like
- 27:23that, right?
- 27:24Yeah, it's
- 27:25definitely true.
- 27:25So you got to
- 27:26think, these are
- 27:26trade-offs, right?
- 27:27But at the same
- 27:28time, it's so
- 27:28enabling for you to
- 27:29just scale out all
- 27:31this workload.
- 27:31Yeah, I mean, in
- 27:32terms of how we
- 27:33create data pipelines,
- 27:35I think a lot of
- 27:36the ways we do it,
- 27:37we do have to be
- 27:39aware of creating
- 27:40them in a way that
- 27:40you can run them
- 27:41outside of the cloud.
- 27:43Sometimes we need to
- 27:45allow a third party
- 27:46to run our data
- 27:47analysis in a
- 27:48regulated way.
- 27:49And that requires us
- 27:51to have essentially
- 27:52running it internally,
- 27:54we run it in the
- 27:55cloud, which is
- 27:56efficient for scaling,
- 27:57but we also need to
- 27:58be able to take that
- 27:59same piece of
- 28:00software and run it
- 28:02in a way that may
- 28:03not be on AWS,
- 28:04may not be in the
- 28:04cloud at all.
- 28:05And that creates
- 28:06some interesting
- 28:07software challenges.
- 28:08Yeah, I'm sure,
- 28:09because so many of
- 28:10the APIs are, you
- 28:11know, cloud native,
- 28:12right?
- 28:12You import Bodo,
- 28:14Bodo do this thing,
- 28:15or something like
- 28:16that, right?
- 28:17How do you deal
- 28:18with that?
- 28:18I think a lot of it
- 28:19comes down to
- 28:20structuring your
- 28:21workflows and your
- 28:24data pipelines in
- 28:25ways that are,
- 28:26they're not really
- 28:27using the cloud as
- 28:28much as they're,
- 28:29they're using the
- 28:29cloud as a, well,
- 28:30the file system
- 28:31and a way to
- 28:33gain compute,
- 28:34but they're not
- 28:35using any piece of
- 28:36the cloud to actually
- 28:37affect the data
- 28:38processing itself.
- 28:39So ideally, if you
- 28:41create the data
- 28:42pipeline in a way
- 28:43that is appropriate,
- 28:44you can both run it
- 28:45in the cloud and run
- 28:47it locally and
- 28:48achieve identical
- 28:49results because it's
- 28:50containerized.
- 28:52Primarily, that's the
- 28:53reason, I guess.
- 28:54Yeah.
- 28:54But doing that, I
- 28:55think, is a challenge
- 28:56in itself.
- 28:57It's really like the
- 28:58process of getting a
- 29:00data pipeline built is
- 29:01a big ask in our
- 29:03field.
- 29:03I think a lot of
- 29:04companies spend a lot
- 29:05of time thinking about
- 29:06this.
- 29:06Yeah.
- 29:07I'm sure they do.
- 29:08Getting it right is a
- 29:10huge enabler, right?
- 29:11So let's talk about the
- 29:12process of maybe coming
- 29:13up with a new data
- 29:14pipeline.
- 29:15What does a software
- 29:16project look like for
- 29:17you all?
- 29:17Yeah.
- 29:18So it usually begins
- 29:19with a collaborative
- 29:21meeting with some
- 29:23experimental scientists
- 29:24where we discuss
- 29:25what's the experimental
- 29:27design going to be
- 29:27like?
- 29:28What are we going to
- 29:28be looking at in the
- 29:29data?
- 29:30And then the
- 29:31experimentalists will
- 29:32go and they'll
- 29:33generate some form of
- 29:35sequencing data.
- 29:36At that point, we
- 29:37generally take the
- 29:39data, open up some
- 29:40Jupyter notebooks or
- 29:42some small Python,
- 29:43sometimes even just
- 29:44bash scripts to try
- 29:46to use some of those
- 29:47standard third-party
- 29:48tools.
- 29:49These are things like
- 29:50making sure all the
- 29:51sequences are aligned
- 29:52to each other so that
- 29:53you know when there's
- 29:54differences and making
- 29:56sure the quality is
- 29:57correct, things like
- 29:58that.
- 29:58These are pretty
- 29:59standard bioinformatics
- 30:01things.
- 30:02Right.
- 30:02Then for sequencing
- 30:04assays, there's usually
- 30:06a couple spots where
- 30:07there's some real
- 30:09experimental logic going
- 30:11into it where often
- 30:12we'll have to write
- 30:13custom code in Python
- 30:15to say, if there's this
- 30:17sequence here, it means
- 30:19we should keep the
- 30:20sequence.
- 30:20And if there's this
- 30:21sequence here, we
- 30:21should divide the
- 30:22sequence in half or
- 30:23something like that.
- 30:24And so that code gets
- 30:26written in Python, maybe
- 30:27it's in the Jupyter
- 30:28notebook or another
- 30:29script.
- 30:30And we sort of do this
- 30:31really slow testing
- 30:33depending on the size of
- 30:34the data.
- 30:34It might be locally on
- 30:36a laptop or in a small
- 30:37cloud-based HPC type
- 30:40cluster.
- 30:40Right.
- 30:40This is like where we're
- 30:41doing...
- 30:42You're not trying to
- 30:42process all the results.
- 30:44You just want to spot
- 30:45check and see if it's
- 30:46coming out right before
- 30:47you turn it loose,
- 30:48right?
- 30:48Right.
- 30:49Or we're very patient.
- 30:50It's a little bit above.
- 30:52Sometimes it's very
- 30:53difficult to take only a
- 30:55small fraction of the
- 30:56data, but we try when we
- 30:57can.
- 30:57Once we settle on
- 30:59something that we think
- 31:00is pretty locked down,
- 31:01we'll take it out of the
- 31:02Jupyter notebooks.
- 31:03We don't try to use
- 31:04Paperville or anything
- 31:05like that.
- 31:06We try to get it out of
- 31:07there as soon as
- 31:08possible into some more
- 31:10complex scripts.
- 31:11They might be a shell
- 31:12script that runs a number
- 31:14of other scripts in order,
- 31:15or we might start using
- 31:17some sort of workflow
- 31:19manager.
- 31:20workflow managers in
- 31:21bioinformatics are pretty
- 31:23common because everyone
- 31:24has the same problem of
- 31:26running all these third
- 31:26party tools together and
- 31:29custom code.
- 31:29Right.
- 31:30It's a lot of shared
- 31:30tools as well, probably.
- 31:32Right.
- 31:32They all use this library
- 31:33or that app.
- 31:34Absolutely.
- 31:34Yeah.
- 31:34There's definitely...
- 31:36Whatever it is, right?
- 31:37There's a whole bunch of
- 31:38standard bioinformatics
- 31:40tools that we run on
- 31:41almost everything.
- 31:42And so some of the
- 31:44workflow managers are
- 31:45designed to specifically
- 31:46work very well with those
- 31:47tools and others are
- 31:49pretty agnostic of what
- 31:51you're doing with them.
- 31:52Yeah.
- 31:52One of the things I find
- 31:53interesting and listening
- 31:55to you talk about this,
- 31:56it just reminded me, is
- 31:58so often we see these
- 32:00problems that people are
- 32:01solving, right?
- 32:02Like, oh, here we're
- 32:03using CRISPR to do all
- 32:05this work.
- 32:06And then you talk about
- 32:07the tools you use.
- 32:07It's like, oh, yeah,
- 32:08we're using like NumPy
- 32:09and Pandas and Jupyter
- 32:11and these kinds of
- 32:12things.
- 32:12And the thing that I find
- 32:14really interesting is for
- 32:16software development,
- 32:17there's so much of the
- 32:18stuff that is, it's just
- 32:19the same for everyone,
- 32:21right?
- 32:22They're doing the same
- 32:23thing.
- 32:23And then there's 10 or
- 32:2520% that like, yeah,
- 32:26this field does this part
- 32:28different, but there's
- 32:28like 80% of, yeah, we
- 32:30kind of, we should use
- 32:31source control.
- 32:32We're using Python.
- 32:33We're using notebooks.
- 32:34We're using Pandas and
- 32:36that kind of stuff.
- 32:37and it's the
- 32:38similarities are way
- 32:40more common than I
- 32:42think they appear from
- 32:43the outside.
- 32:44It's a great point.
- 32:45And I think we'd, we'd
- 32:46all be better off if we
- 32:47reminded ourselves of
- 32:48that more often that
- 32:49we're not just because
- 32:51we're doing biotechnology
- 32:52and things with Python
- 32:54that we're largely very
- 32:57similar to other
- 32:58software developers doing
- 32:59data science on business
- 33:01topics or finance or
- 33:03just standard web
- 33:05development.
- 33:05You could be at a hedge
- 33:06fund and you're like,
- 33:07this is that different
- 33:08than what I'm used to
- 33:09actually.
- 33:09Yeah.
- 33:09And if you think like
- 33:10that, we, you end up
- 33:11with, I think, better
- 33:12practices overall in
- 33:14software.
- 33:14Yeah.
- 33:15Oh, I totally agree.
- 33:16Also, I suspect that
- 33:18this fact is what also
- 33:21makes the data science
- 33:22tools and all the
- 33:23tooling around Python,
- 33:24the libraries and
- 33:25whatnot.
- 33:25So good because it's
- 33:27not just like, oh, the
- 33:28biologists have made this
- 33:30part of it really good.
- 33:30It's like most of the
- 33:32people are all really
- 33:33refining like the, the
- 33:35core parts.
- 33:36Right.
- 33:36Yeah.
- 33:36I think that's, that's
- 33:37definitely the case.
- 33:38And some of the biology
- 33:39specific tools are, are
- 33:40a little, a little
- 33:41walkie when you, when
- 33:43you start using them.
- 33:43I think, I mean, things
- 33:44like pandas are, are
- 33:46really amazing.
- 33:47You can tell the amount
- 33:48of attention or something
- 33:49is different.
- 33:50Cool.
- 33:51what is moving to production
- 33:52look like for you.
- 33:54So you talked about
- 33:55sometimes it's, you start
- 33:56the exploration and stuff
- 33:57in notebooks, which is
- 33:58exactly what they're built
- 33:59for.
- 33:59And then moving to maybe a
- 34:02little more composition of
- 34:03scripts and whatnot.
- 34:04And eventually somehow you
- 34:05end up with, you know,
- 34:06Lambda, cloud databases,
- 34:08things like that.
- 34:09What's that flow?
- 34:10Yeah.
- 34:11So the process of, I
- 34:12guess we say like
- 34:13productionizing a pipeline
- 34:15is we've had pretty well
- 34:17set now.
- 34:17and generally how it
- 34:19works as we say this
- 34:21pipeline is about done
- 34:22and we'll hand it off to
- 34:25myself or one of my
- 34:27colleagues to start the
- 34:28process of getting it
- 34:29fully cloud capable and
- 34:31scalable.
- 34:32And what that means for us
- 34:34is to take the software
- 34:36in whatever form we've
- 34:37gotten it from our
- 34:38colleagues and put it
- 34:40into a workflow manager.
- 34:42And we, I think every
- 34:43company has their own
- 34:44version of workflow
- 34:45manager that they, they
- 34:47choose.
- 34:47we're using Luigi, which
- 34:49is fully Python based.
- 34:51It was originally
- 34:52developed at Spotify to
- 34:55do this sort of task.
- 34:57It uses like a GNU make
- 34:59type target file dag
- 35:02creation.
- 35:02I don't know all the
- 35:04technical terms to
- 35:05describe how the tasks
- 35:06are built, but you
- 35:07essentially, you have a
- 35:08task at the end and you
- 35:10say it requires the
- 35:11output of this other
- 35:13task.
- 35:13And then that task
- 35:14requires the more.
- 35:16And as they build up,
- 35:17you create a graph of
- 35:20what tasks need to be
- 35:20done to get to our
- 35:21output.
- 35:22Right.
- 35:22A directed acyclic
- 35:24graph.
- 35:24And then the workflow
- 35:26can decide like, oh,
- 35:27these two things are
- 35:27independent.
- 35:28So let's scale them out
- 35:29separately.
- 35:30now this one has to wait for
- 35:31these two to finish and
- 35:32then get its results.
- 35:33And that coordination can
- 35:34be really tricky.
- 35:35Exactly.
- 35:36And there's a number of
- 35:37common workflow managers
- 35:38and bioinformatics.
- 35:39I think the two most
- 35:40common are snake make and
- 35:42next flow.
- 35:43Luigi is, has also been
- 35:45really good for us.
- 35:47We like it primarily
- 35:48because it is fully
- 35:49Python based and it uses
- 35:51standard Python syntax,
- 35:52which allows us to
- 35:54really, if we need to,
- 35:56get out of the hood and
- 35:57add some customization,
- 35:58extend it where we need
- 36:00to, or, or fix things
- 36:02that we don't like about
- 36:03it.
- 36:03And that was a really
- 36:04important part of our
- 36:05decision and choosing
- 36:06Luigi over some of these
- 36:07other workflow managers.
- 36:09Yeah, for sure.
- 36:10I had a nice conversation
- 36:11with the Airflow, Apache
- 36:13Airflow folks, and not
- 36:14too long ago.
- 36:15And one of the things
- 36:16that really struck me
- 36:17about this is the ability
- 36:19for people to work on
- 36:21little parts of the
- 36:22processing, a little bit
- 36:23like that, little Python
- 36:25automation tools or a
- 36:26little Python projects
- 36:28that you described
- 36:29earlier in episode 327
- 36:30in that instead of
- 36:32trying to figure out
- 36:33all this orchestration,
- 36:34you just have to figure
- 36:35out, well, this little
- 36:36task is going to do a
- 36:37thing.
- 36:37And that, like I said,
- 36:38maybe it means see the
- 36:40file and then copy it
- 36:41over there.
- 36:42And if your job was
- 36:43see a file here, copy
- 36:45it over there, like
- 36:46that's a really simple
- 36:47job.
- 36:47You can totally nail
- 36:49that.
- 36:49You know what I mean?
- 36:49Yeah.
- 36:50Whereas if your job is
- 36:51to orchestrate this,
- 36:52this graph and make sure
- 36:54that it runs on time
- 36:55and here's the failure
- 36:55case, all of a sudden
- 36:56that becomes super,
- 36:57super hard.
- 36:58So these seem really
- 36:59empowering, almost like
- 37:01the promise of
- 37:01microservices is like
- 37:03you get to focus on
- 37:03one little part and do
- 37:05that.
- 37:05Yeah, it definitely,
- 37:06it definitely helps.
- 37:08And it helps with that
- 37:09idea of having these
- 37:10small tasks.
- 37:11It really helps with how
- 37:13you can develop it and
- 37:14reuse the components
- 37:16for each task.
- 37:18Like we might, as we
- 37:19said earlier, that there
- 37:19are these third party
- 37:20tools that end up being
- 37:21used in almost all of
- 37:23our pipelines and using
- 37:24something like Luigi or
- 37:26any workflow manager.
- 37:27You can reuse the tasks
- 37:29in different contexts as
- 37:31need be and you can have
- 37:33your perfectly optimized
- 37:34way of using that task
- 37:36everywhere.
- 37:37That reuse is really nice
- 37:39and it's something I think
- 37:39a lot of software
- 37:40developers appreciate.
- 37:41Yeah, for sure.
- 37:42So if you look at some of
- 37:43the folks that are using
- 37:44Luigi, so Spotify, as you
- 37:47said, created it, but also
- 37:49Foursquare, Stripe, Asana,
- 37:51SeatGeek, a lot of companies
- 37:54that people probably heard
- 37:55of like, oh, these places
- 37:57are doing awesome stuff.
- 37:58Let's be like them.
- 37:58Yeah.
- 37:59A lot of places use it for
- 38:01like Hadoop and things like
- 38:03that.
- 38:03And one of the nice things is
- 38:05you mentioned about like how
- 38:07Airflow has the same model
- 38:08where you can create these
- 38:10contributions, which are
- 38:13different connectors for
- 38:14Luigi or for Airflow, where
- 38:16you can connect them to
- 38:17their different cloud
- 38:18providers or different data
- 38:20stores, things like that.
- 38:21And that allows you to use
- 38:24Luigi or any workflow manager
- 38:26in numerous different
- 38:27contexts, whether it's
- 38:29locally on your own
- 38:29computer running things in
- 38:31Docker containers or whether
- 38:33it's deploying out to AWS
- 38:35and scaling massively
- 38:37horizontal.
- 38:38These workflow managers
- 38:40really support that.
- 38:41And that's why they're a
- 38:42necessary component in how
- 38:44we productionize our data
- 38:45pipelines.
- 38:46Yeah.
- 38:46Again, they just seem so
- 38:48empowering for allowing
- 38:49people to focus on just
- 38:50each step independently,
- 38:51which is excellent.
- 38:53Did you consider other ones
- 38:54like did you consider
- 38:55Airflow or DAXer or any
- 38:57of these other ones or did
- 38:59you find this fit and
- 39:00you're like, we're going
- 39:00with this?
- 39:01We did look at some
- 39:02other ones.
- 39:03We were using Nextflow
- 39:05for a little bit, which is
- 39:07a bioinformatic
- 39:08flavored workflow
- 39:10manager.
- 39:10It's very focused on
- 39:12bioinformatics as its
- 39:13primary use case,
- 39:14although you could use it
- 39:15for anything.
- 39:16Syntax is similar to
- 39:18Groovy and it's based
- 39:19in Groovy.
- 39:20And that was one of the
- 39:22detractives for us is that
- 39:23it was a little hard to get
- 39:24under the hood and use
- 39:26that because of it.
- 39:27I did briefly look at DAXer
- 39:28after hearing a few
- 39:30episodes, I think.
- 39:31No, maybe a different
- 39:32podcast.
- 39:32Yeah, I did have Tobias
- 39:34Macy on to give us an
- 39:35overview of the whole data
- 39:36engineering landscape.
- 39:37So possibly, I know he
- 39:39spoke about it then, but I'm
- 39:40not sure when you heard
- 39:41about it.
- 39:41Yeah, so I heard about it
- 39:42on a podcast and probably
- 39:44this one as well.
- 39:44And I did look into it, but
- 39:46it didn't have it at that
- 39:48time.
- 39:48It was pretty early and it
- 39:49didn't have any connectors
- 39:50to AWS in the ways that we
- 39:53like to use.
- 39:54The connectors, right?
- 39:55That's such an important
- 39:56thing because otherwise
- 39:57you've got to learn the API
- 39:59of every single thing you're
- 40:00talking to.
- 40:01Yeah.
- 40:01These days, knowing how
- 40:02Luigi works, it actually
- 40:04wouldn't have been that big
- 40:05of a task to look under
- 40:07the hood.
- 40:07But yeah, so we did choose
- 40:09Luigi and particularly we
- 40:11like how it handles
- 40:13deployment to AWS and we
- 40:16use it on the service
- 40:18called AWS Batch, which
- 40:20is, I guess it might be
- 40:22similar to like
- 40:23Kubernetes pod, although I
- 40:25haven't done anything with
- 40:27K8s or anything like that.
- 40:29so I'm not speaking from
- 40:31experience, but it
- 40:32essentially scales up EC2
- 40:34instances, these elastic
- 40:36compute instances on the
- 40:39cloud as you need them.
- 40:41And it gives out jobs to
- 40:43the virtual computers as
- 40:45necessary.
- 40:46So it spins them up,
- 40:48allocates jobs in a
- 40:49Docker container.
- 40:50They run when there's no
- 40:52more jobs on the instance,
- 40:53it shuts off.
- 40:54Okay.
- 40:55So you come up with like an
- 40:57AMI, an Amazon machine
- 40:58image that's pre-configured,
- 41:00set up, ready to run.
- 41:01And then you say, I'm going
- 41:03to give you a bunch of
- 41:04data.
- 41:04Each one of these data gets
- 41:06passed to the machine and
- 41:07it runs and then maybe even
- 41:08shuts down when it's done.
- 41:09Yeah.
- 41:10There is an AMI.
- 41:11We keep the AMI pretty
- 41:12simple because it's the sort
- 41:14of the base for all of
- 41:15them.
- 41:15And then the way batch
- 41:16works is you have your top
- 41:19level AMI that's called the
- 41:20compute environment, I
- 41:22believe.
- 41:22And then inside of it, you
- 41:25run the actual job and the
- 41:27job runs inside of a
- 41:28Docker container.
- 41:29Oh, I see.
- 41:29So the Docker container is
- 41:31pre-configured with like all
- 41:32the Python dependencies and
- 41:34the settings that it needs and
- 41:35whatnot.
- 41:35Right.
- 41:36So we have each task in
- 41:38Luigi, each little piece of
- 41:41work as its own Docker
- 41:43container.
- 41:43and then we push those
- 41:46out into the cloud and they
- 41:47get allocated out onto these
- 41:49machines.
- 41:50They run their task.
- 41:51Data comes in from S3, goes
- 41:54back out to S3.
- 41:55Nothing is left on the hard
- 41:57drives and then they
- 41:58disappear.
- 41:59They're these little ephemeral
- 42:01compute instances.
- 42:02And that's all managed by a
- 42:04workflow manager such as
- 42:05Luigi or Airflow or
- 42:07Nexflow.
- 42:07Wow.
- 42:08That's pretty awesome.
- 42:09One of the things that I
- 42:11remember reading and
- 42:13thinking that's a pretty
- 42:14crazy use of the cloud was
- 42:16this Ars Technica article
- 42:18from look at that year,
- 42:202011.
- 42:21Oh, wow.
- 42:21So if you think back to
- 42:232011, like the cloud was
- 42:25really new and the idea of
- 42:27spending a ton of money on
- 42:28it and getting a bunch of
- 42:29compute out of it was still
- 42:31somewhat foreign to people.
- 42:32So there's this article I'll
- 42:34link to called the 100 or
- 42:351,279 per dollar per hour,
- 42:3930,000 core cluster built on
- 42:42Amazon EC2 cloud, which is
- 42:45this company, this
- 42:46pharmaceutical company that
- 42:47needed to do a lot of
- 42:49computing.
- 42:49And they said, instead of
- 42:51buying a supercomputer,
- 42:52basically, we're going to
- 42:54come up and just fire off an
- 42:56insane amount of cores.
- 42:57And I think if I remember
- 42:58reading this correctly, that
- 43:00they weren't allowed to make
- 43:01that many cores in a single
- 43:04data center.
- 43:05so they had to do this
- 43:06across.
- 43:07They also had to coordinate
- 43:08in like multi data center
- 43:10type of processing as well
- 43:12because, yeah, it's just the
- 43:14scale of everything.
- 43:15This seems like the type of
- 43:17work that you all might be
- 43:18doing.
- 43:18Yeah, it does look very
- 43:20familiar.
- 43:21Okay.
- 43:22You got any war stories?
- 43:24Can you tell us anything
- 43:24about this?
- 43:25Yeah, we do occasionally have
- 43:26a certain type of molecular
- 43:28modeling job that we can scale
- 43:31very wide.
- 43:33And I think these, this sort
- 43:36of 30,000 number looks pretty
- 43:38familiar.
- 43:38I think our largest jobs
- 43:40today have been about 10,000
- 43:43CPUs wide and running for a
- 43:46few days.
- 43:47So maybe like four or five
- 43:48days.
- 43:48I think the number was like
- 43:50four or five days on the 10,000
- 43:52cores.
- 43:52Yeah.
- 43:53Yeah.
- 43:53It's a, it's, it's a lot.
- 43:56And I, so I think it was like
- 43:57over a million CPU hours on AWS
- 44:01batch.
- 44:01And that was just something that
- 44:04we could really heavily
- 44:06parallelize and we needed the
- 44:08data fast and it worked.
- 44:10You pull it all back and
- 44:12aggregate it all together at the
- 44:13end that it was a really useful
- 44:16data set.
- 44:17And it's pretty amazing what you
- 44:19can do on some of these cloud
- 44:21providers by going really wide.
- 44:23Yeah.
- 44:23It's crazy.
- 44:25You know, I mean, there's some
- 44:26places where it makes sense to
- 44:27like build true supercomputers
- 44:29like Oak Ridge has this thing
- 44:31called summit, which is like
- 44:33this insane supercomputer that
- 44:35they have.
- 44:35But a lot of times there's the
- 44:38latency of getting something like
- 44:39this set up.
- 44:40There's the overhead of, guess
- 44:42what?
- 44:42Now you're an admin for like an
- 44:44insane, there's only three in
- 44:45the world supercomputer type
- 44:47system.
- 44:47It's got to be empowering to be
- 44:49able to just go hit go and then
- 44:51let all this happen and not worry
- 44:53about all those details.
- 44:54Right.
- 44:55Yeah.
- 44:55And there's definitely still
- 44:56some stress involved in, in
- 44:58starting one of these jobs.
- 44:59If you just, you know, it's not
- 45:00cheap anyway, slice it.
- 45:03We do, we do try to, you know,
- 45:04do everything we can to make it
- 45:05as, as efficient in cost as
- 45:08possible.
- 45:08But yeah, I'm sure there's,
- 45:09there's two aspects to it that
- 45:11really jump out to me.
- 45:12One is the, Oh, was that the
- 45:14wrong version of the code?
- 45:15The one that still had the bug?
- 45:17We got to throw away all the
- 45:18data.
- 45:18Whoops.
- 45:18We just ran for five days and,
- 45:20you know, thousands of dollars
- 45:22got burned up and there's a bit
- 45:24of a problem there.
- 45:25So whoops.
- 45:26And now it's five days later until
- 45:28you get the answer as well.
- 45:29Right.
- 45:29That's one.
- 45:31And then I'm losing track of my
- 45:33thought on my other one, but
- 45:34yeah, anyway, it's just got to be
- 45:36stressful to be like, to set that
- 45:38up and then press go.
- 45:39Right.
- 45:40it definitely is.
- 45:41I think one of the benefits of a
- 45:42lot of our computational team does
- 45:44have a spare metal background and
- 45:46doing experiments in the lab, these
- 45:49sort of numbers, like tens of
- 45:51thousands of dollars for an
- 45:52experiment are not really that
- 45:54uncommon.
- 45:54And those kinds of things, you get
- 45:56really careful and you check all
- 45:58the boxes and double check
- 45:59everything.
- 45:59And so I think a lot of us have
- 46:00had that, that experience.
- 46:02And so even when we're dealing
- 46:03with software, we'll be very
- 46:05careful and we'll do the tests and
- 46:08quality control before we really
- 46:09let her rip.
- 46:10Yeah.
- 46:10I, you know, I worked on some
- 46:11projects when I was in grad school
- 46:13that were on a Silicon graphics, big
- 46:16mainframe type thing.
- 46:17And obviously much lower importance
- 46:20than, you know, solving diseases and
- 46:23stuff is just solving math problems.
- 46:24But I remember coming in to work on
- 46:27the project one day and none of our
- 46:29workstations could log in to the
- 46:31Silicon graphics machine.
- 46:33And what is wrong with this thing?
- 46:34And it was so loud.
- 46:35It was in the other room.
- 46:36You could hear it roaring away.
- 46:38in there.
- 46:38It clearly was loud.
- 46:40And what happened was it wasn't
- 46:42me.
- 46:42It was someone else in the group
- 46:44had written some code.
- 46:47And these, these things would run
- 46:48all night.
- 46:48We'd come in in the morning and
- 46:49we'd check them.
- 46:49And what had happened was they had
- 46:52a bug in their code, which they
- 46:53knew they were trying to diagnose
- 46:55it.
- 46:55So they were printing out a bunch
- 46:56of log stuff or something like
- 46:58that.
- 46:58Well, they did that in a tight
- 47:00loop on a high-end computer for a
- 47:03night.
- 47:03And it filled up the hard drive
- 47:05till it had zero bytes left.
- 47:06And apparently the Silicon
- 47:07graphics machine couldn't operate
- 47:09anymore was literally zero bytes.
- 47:12And so it just stopped working.
- 47:13They couldn't get it eternal.
- 47:14I was like, it took days to get it
- 47:16back, I believe.
- 47:16Oh, oops.
- 47:18But it's like that kind of stuff,
- 47:19right?
- 47:20I mean, this, you're not going to
- 47:21break EC2, but, you know, you don't
- 47:23know until the next day that, oh, look,
- 47:25you filled up the computer and it
- 47:26doesn't work anymore, right?
- 47:27When you're doing that much
- 47:28computing, you could run out of
- 47:30different resources.
- 47:31You could run into all kinds of
- 47:32problems.
- 47:33Absolutely.
- 47:34And we are without our worst stories
- 47:37of doing this, but I think we've
- 47:40definitely learned a lot of lessons
- 47:41along the way of how to monitor your
- 47:43jobs effectively and double check
- 47:46things.
- 47:46But sometimes, yeah, you run a big
- 47:49job and it doesn't quite turn out
- 47:51right.
- 47:51But it's the cost of doing business,
- 47:53I guess.
- 47:53Yeah.
- 47:53Yeah.
- 47:54I mean, it's very computational to
- 47:56explore stuff like this kind of stuff.
- 47:57But that's also what enables it,
- 47:59right?
- 47:59Without this computing power, it would
- 48:01just not be a thing.
- 48:02Absolutely.
- 48:02A lot of the data just takes a lot of
- 48:04time to process and there's just not
- 48:06really any way around it.
- 48:07And even when you're iterating, you
- 48:08have to go through all the hoops to
- 48:11look at the data at the end.
- 48:12Yeah.
- 48:12So you talked about APIs.
- 48:14You talked about data store.
- 48:16What are you using for a database?
- 48:18Is this like a hosted RDS AWS thing or
- 48:22what is the story with that?
- 48:24Yeah.
- 48:24So we have a few different places to
- 48:26store data.
- 48:27our larger scale internal data, we
- 48:30store in Django-based web app and we
- 48:35use the Django ORM for SQL-based
- 48:37database, so MySQL database on AWS.
- 48:40And that has worked surprisingly
- 48:43effectively, actually.
- 48:44I've heard some people say that the
- 48:47Django ORM is really slow when you
- 48:49scale out and things.
- 48:50But if you design it correctly, I
- 48:53think it'll surprise you.
- 48:55I think that's so true.
- 48:57I hear so many things about ORMs are
- 48:59slow or this thing is slow in this way.
- 49:02And wow, if you have the queries
- 49:04structured well, you do the joins ahead
- 49:07of time.
- 49:07If you have indexes and you've put the
- 49:10work into finding all these things, it's
- 49:12mind-blowing.
- 49:12When I go to sites, I won't call any
- 49:15out.
- 49:15I don't know if they've been updated or whatever.
- 49:17But you go to a site and you're like, this site is taking four or five seconds to load.
- 49:20What could it possibly be doing?
- 49:22I mean, I know it has some data, but it doesn't have unimaginable amounts of data.
- 49:27Right?
- 49:27Surely somebody could just put an index in here or a worst case, a cache in something.
- 49:32And it would just transform it.
- 49:34Right?
- 49:34So yeah, I'm glad to hear you're having good experiences.
- 49:37Yeah, we definitely fairly regularly run into slow queries.
- 49:42They're usually not too bad to solve.
- 49:44I'm sure at some point we'll get to something really wonky that will be challenging.
- 49:48But I think for the most part, yeah, we've been able to solve it through better query design
- 49:54and better indexing.
- 49:56Yeah.
- 49:56Do you ever do things where you opt out of the sort of class-based query syntax and go
- 50:02straight to SQL queries here and there to make sure that that part works better?
- 50:07We have tried it for some particular sequence-based searches that we do.
- 50:13And I actually found that most of the time you can write it in the ORM.
- 50:17It's just a little more complicated.
- 50:19But I do expect that at some point we will be writing raw SQL queries because out of necessity.
- 50:25Yeah, but it's not the majority.
- 50:26Mainly you're using the ORM and then it's okay.
- 50:29Yeah.
- 50:29And I think a lot of benefits from the appropriate data model will help the queries along the way.
- 50:35Yeah, absolutely.
- 50:36The thing I found the slowest about ORMs and ODM, if you're doing document databases,
- 50:41is the deserialization, actually.
- 50:44It's not the query time, but it's like, I got to generate 100,000 Python objects
- 50:49and that just happens to be not that fast relative to other things.
- 50:53You're talking about my Monday morning pipeline.
- 50:58And in those cases, I think that's the place where it makes sense to maybe do some kind of like a projection or something.
- 51:05I don't know how to do it in Django ORM, but in say MongoEngine, you can say,
- 51:09I know what I'm going to get back is an iterable set of these objects that match to the data,
- 51:15but only actually add, just fill out these two fields.
- 51:18Most of the data, just throw it away.
- 51:20Don't try to parse it and convert it.
- 51:22Just like, I just want these two fields.
- 51:24And that usually makes it dramatically faster.
- 51:26Yeah, we've run into a number of bottlenecks at the serialization layer.
- 51:31And we have been experimenting with a variety of different ways to solve those issues.
- 51:37And sometimes it means putting fewer Python objects between you and the data.
- 51:42And that often speeds it up, even if it makes it a little bit harder to interpret in your development environment.
- 51:49Yeah, absolutely.
- 51:50Or just say, you know what?
- 51:51I just need dictionaries this time.
- 51:53I know it's going to be less fun, but that's what it takes.
- 51:56That was the fix on Monday morning.
- 51:58We do try to extensively use data classes for a lot of our interoperability.
- 52:04When data comes in and out of a pipeline, we like to have it in a data class, in a centrally stored repository.
- 52:11And then our Django web app also has access to that.
- 52:15So it knows what the structure of the data coming in is, and it knows what to serialize it to when it's coming out.
- 52:20And the Python data classes has been a really useful tool for that.
- 52:25But I think we were talking about that on another podcast a few weeks ago.
- 52:30Maybe it was the Python bytes one.
- 52:31The data classes can be slow.
- 52:33And sometimes it's better to just have a dictionary, even if it is a very highly structured dictionary.
- 52:40Yeah, and the problem is maintainability and whatnot.
- 52:43But, you know, if it's five times slower, you know what?
- 52:45This time it matters.
- 52:47So we're going to just bite the bullet and have to deal with it.
- 52:49Let's see.
- 52:50We had time for just a little bit more digging into it.
- 52:52So you talked about the Django ORM, Django REST framework, which is all great.
- 52:56What's the server deployment story?
- 53:00Like, how do you run that thing?
- 53:01Is it with GUnicorn?
- 53:03Is it Micro Whiskey?
- 53:04You know, what's your setup on that side of things?
- 53:07Ours is a little custom.
- 53:10I guess in some ways it's pretty standard.
- 53:12I think we're blanking on exactly how it's set up now.
- 53:16But there's an NGINX proxy I am blanking on.
- 53:21It might be GUnicorn.
- 53:22I feel like GUnicorn and Django go together frequently.
- 53:25I'm not sure why they got paired up specifically.
- 53:28But yeah, it's a good one.
- 53:30And we end up deploying it out to AWS Elastic Beanstalk, which is a source of some conversation in our team.
- 53:39Because there's some things we really like about it.
- 53:41And there's some things that are really annoying in terms of the deployment is much more complicated than we would like it to be.
- 53:47But we have everything wrapped up in a pretty gnarly CDK stack that does a lot of this work.
- 53:54It was messy, but you've solved it with a CDK.
- 53:57Now it's just you push the button and it's okay.
- 53:59It's exactly like that.
- 54:00We have a very automated deployment process.
- 54:03I wouldn't like to refactor it, but it's there and it works.
- 54:09So that works for us.
- 54:10But I think, yeah, it's a pretty standard Django deployment on the cloud.
- 54:14And it works well.
- 54:16Yeah, cool.
- 54:17All right.
- 54:17Well, I think that's probably about it for time to talk about the specifics of what you all are doing.
- 54:22But there's the last two questions, as always.
- 54:25So let's start with the editor.
- 54:27If you're going to write some Python code, what editor do you use?
- 54:30The yes code.
- 54:31A lot of the remote development environment on that.
- 54:34Oh, yeah.
- 54:34You use the remote aspect of it?
- 54:37Yeah.
- 54:37We're doing a lot of work on EC2 instances as our day-to-day work.
- 54:41And the yes code, the way it works with instances in the cloud is really amazing.
- 54:47So I would encourage anyone to check out that extension.
- 54:51Yeah, you get access to the file system on the remote machine.
- 54:55And basically, it's just your view into that server.
- 54:58But it's more or less standard VS Code, right?
- 55:00But when you hit run, it just runs up there.
- 55:02It feels exactly like you're on your own computer.
- 55:04Sometimes I actually get confused whether I'm on or not.
- 55:07Oh, so does it work?
- 55:08Because I'm in Virginia.
- 55:09I see.
- 55:10Yeah.
- 55:10All right.
- 55:10And then notable PyPI package?
- 55:12I'll have to shout out some of the ones that we talked about.
- 55:14I would encourage people to look at AWS CDK.
- 55:17If they're on AWS, I think it has some really interesting things there.
- 55:21And then also, Luigi as a workflow manager, if people are doing any of these types of data pipelines
- 55:28that have tasks that get reused, these sort of workflow managers are really cool.
- 55:31And Luigi is a pretty accessible one, probably one that's familiar with Python.
- 55:35Yeah.
- 55:35All right.
- 55:36Fantastic.
- 55:36Yeah.
- 55:37I'm just learning to embrace these workflow managers, but they do seem really amazing.
- 55:41All right.
- 55:42So for all the biologists and scientists out there listening, thinking you've got this really
- 55:47cool setup and all this cool computational infrastructure, what do you tell them?
- 55:50How do they get started?
- 55:51Maybe biology or wherever?
- 55:54I think biology is a good place to start.
- 55:55We're also happy to have people come from a software background that are really interested
- 55:59in learning the biology.
- 56:00And I guess as a final plug, we do have a few open positions.
- 56:04So if you're interested, check out our careers page and give us an application.
- 56:09Are you guys a remote place?
- 56:11Remote friendly?
- 56:13Or what's the story these days?
- 56:14Yep.
- 56:14We're remote friendly.
- 56:15I'm actually living in Philadelphia and our company is based in Cambridge.
- 56:19So we are.
- 56:20I mean, it's a short trip to the cloud, no matter where you come from, basically.
- 56:25Absolutely.
- 56:25Right on.
- 56:26David, thank you for being here and giving us this look inside all the gene editing Python
- 56:32stuff you're doing.
- 56:33Thank you, Michael.
- 56:33It was a pleasure.
- 56:34Yeah, you bet.
- 56:34Bye.
- 56:35Bye.
- 56:35This has been another episode of Talk Python To Me.
- 56:39Our guest on this episode was David Bourne, and it's been brought to you by Shortcut, us
- 56:44over at Talk Python Training, and the transcripts were brought to you by Assembly AI.
- 56:48Choose Shortcut, formerly Clubhouse.io, for tracking all of your project's work, because you shouldn't
- 56:54have to project manage your project management.
- 56:57Visit talkpython.fm/shortcut.
- 56:59Do you need a great automatic speech-to-text API?
- 57:03Get human-level accuracy in just a few lines of code.
- 57:05Visit talkpython.fm/assembly AI.
- 57:09Want to level up your Python?
- 57:10Want to level up your Python?
- 57:10We have one of the largest catalogs of Python video courses over at Talk Python.
- 57:14Our content ranges from true beginners to deeply advanced topics like memory and async.
- 57:19And best of all, there's not a subscription in sight.
- 57:22Check it out for yourself at training.talkpython.fm.
- 57:25Be sure to subscribe to the show.
- 57:27Open your favorite podcast app and search for Python.
- 57:29We should be right at the top.
- 57:31You can also find the iTunes feed at /itunes, the Google Play feed at /play, and the direct
- 57:37RSS feed at /rss on talkpython.fm.
- 57:41We're live streaming most of our recordings these days.
- 57:44If you want to be part of the show and have your comments featured on the air, be sure to subscribe to our YouTube channel at talkpython.fm/youtube.
- 57:51This is your host, Michael Kennedy.
- 57:53Thanks so much for listening.
- 57:55I really appreciate it.
- 57:56Now get out there and write some Python code.
- 57:58I really appreciate it.