Let's start this episode with a philosophical question.
Are you human? Are you sure?
We could begin to answer that question physically.
Are you made up of cells that would typically be considered as belonging to the human body?
It turns out the answer is, maybe.
We have many ecosystems within us.
Understanding them is essential to our own well-being.
In this episode, you'll meet Sebastian Proust,
who is using Python to study the bacteria in our world.
This is Talk Python to Me, episode 237, recorded September 27th, 2019.
Welcome to Talk Python to Me, a weekly podcast on Python,
the language, the libraries, the ecosystem, and the personalities.
This is your host, Michael Kennedy.
Follow me on Twitter, where I'm @mkennedy.
Keep up with the show and listen to past episodes at talkpython.fm,
and follow the show on Twitter via at Talk Python.
This episode is brought to you by Linode and Tidelift.
Please check out what they're offering during their segments.
It really helps support the show.
Hey, folks, I want to tell you about a new course that we just launched over at Talk Python Training.
This course lets you create web apps with pure Python.
Now, you may be thinking, sure, I can use Flask and create web apps with pure Python now.
No, I mean on the browser as well as on the back end.
This course is about the Anvil platform, and the course is called Anvil Web Apps with nothing but Python.
What's really cool is, yes, you have a back end.
You can write Python code there, and that's cool.
They manage the database.
But also, they've set it up so you can write Python code and use a visual designer with events on the front end to create a single page app or a spa and write it entirely in Python.
So if all the different technologies involved in building web apps are overwhelming to you, but you still need to build a web app, check out this course.
It's a five-hour course, and it's even free.
Just visit talkpython.fm/Anvil dash course, and it'll take you right there.
Log in, click join this course, and you got it.
Now let's get to that interview.
Sebastian, welcome to Talk Python to Me.
Hi, Michael.
Thanks for having me.
It's great to have you here.
It's an honor.
We're going to have so much fun talking about some very small things that have maybe a big impact on our world.
Exactly, yeah.
So we're going to talk about studying bacteria and communities of bacteria using Python, which is going to be fascinating.
But before we get to that, let's start with your story.
How did you get into programming in Python?
So I actually got into programming about 20-something years ago.
I was 12, and my favorite game was Quake at the time.
And apart from the actual game, I also had a disk with all kinds of modifications.
And on there was the source code for the game logic that you need to make your own modification and the QuakeC compiler.
Now, the cool thing with QuakeC is that you can actually decompile the code from other modifications to readable code.
So I was just like decompiling stuff I liked, trying to figure out how it worked, and then trying to basically come up with my own stuff.
And I never really succeeded into making like the decisive version of Quake, but I did get a pretty good understanding of what's a function, what's a for loop, what's an if statement.
So I really learned programming through that medium.
I used to play Quake and Doom, and those were fun games.
And I remember the mods.
I think it was not Quake, but Doom, which was by the same software.
It was the predecessor, right?
Yeah.
And you could change things up.
I remember one we had was a Barney mod.
Do you know Barney, the weird purple dinosaur?
Yeah.
It would replace all the characters with this dinosaur thing and different dinosaurs, and they made weird noises, and it was amazing.
There was another one where it had these super scary creatures, and a friend of mine was playing it, and it was dark.
And I spooked him from behind, right?
As this creature from this mod came out, he got so scared, he ripped the keyboard drawer off of my desk.
I thought, oh my gosh, I should have.
It was just totally frightening.
It was so, so funny.
I really enjoyed those mods.
Those are great.
It's a really cool way to learn programming.
Yeah.
I had like a whole bunch of them, and some were like tiny.
They were just like a secondary fire for one of the guns.
Yeah.
I was just looking for a way to combine them, because you could only load one at a time,
and I wanted to have multiple running at the same time.
And so after I played around with QuakeC for a while, I did pick up some proper programming languages through high school.
But then ultimately, I went on and studied biology.
I always was a bit in doubt whether it was the right choice or not.
At the end of my biology degree, I noticed that there's something like bioinformatics.
I was like, oh, that's great.
It allows me to kind of combine the best of both worlds.
And I started a PhD in bioinformatics.
Now, at the time, we were using like a combination of Perl with some Java applets for our web stuff.
There was also PHP in there.
So it was kind of like...
Early days.
Yeah.
It was kind of like a whole bunch of things glued together.
So a couple of years later, when I had the opportunity to start like a new platform, I thought like, okay, I want to stick with like one language for the backend, one for the frontend.
And that's how I basically discovered Python and Flask.
Okay.
And you haven't looked back ever since.
It's just such a convenient way to develop things.
Yeah.
I got to think that the relevance of Python to biology is even more significant now than it was back then with all the data science developments and the other extra packages getting developed and all.
Sure.
So in the beginning, bioinformatics was really fueled by Perl.
And just over the course of a couple of years, this has been completely taken over by Python.
Yeah.
I can imagine.
Is it a lot?
What kind of data files and stuff are you working with?
Is it, you know, I imagine like a lot of, you know, genetic sequence character strings or like what kind of stuff are you working with when you're doing bioinformatics?
Right.
So this really is dependent on what field you're in.
In my case, it's mostly sequence information.
So that can be either raw sequences that come from a machine.
So those are very, very short reads, about 20 to a couple hundred nucleotides and the quality scores for each of them, like how reliable they have been sequenced.
Or it can also be like a full genome sequence, which is just a string of several millions of characters.
Right.
A lot of ACT and G in there.
But they're like bioinformatics is a very, very broad field.
So there are people that are doing completely different things with other types of data.
If you look at metabolite data, those are like the chemical compounds that appear in a certain sample.
That's a very different type of data entirely.
Okay.
It's super interesting.
It sounds like a fun place to be working for sure.
Biology is super cool.
Now let's talk a little bit just at large about communities of bacteria.
Because as humans, a lot of people are kind of creeped out by bacteria.
The thought of like there's something on my finger or worse, if I go to like a school and I touch the handle to the door, you know, what other stuff came off of other people, you know, sniffly kids or whatever.
Now I have this bacteria on me and probably it's actually viruses you care about, but whatever, right?
People are freaked out about it.
But it's a much more common and actually important part of life for all creatures, including humans, right?
Like there's a really interesting TED talk, which I'll link to from your boss.
And he starts the TED talk with something like, so you think you're a human, huh?
Yes.
So I might have to creep those people that are afraid of bacteria out a little bit more because basically for every cell that makes up your body, there is a bacteria somewhere on or in your body.
And if you look at your genetic information, the number of genes that you have compared to the total number of genes those bacteria have, that's like almost a hundred fold higher for bacteria.
Wow.
So there's a hundred times more genetic information of bacteria on us.
And we're about 50-50 in, maybe not in mass, but in terms of number of cells.
Just half bacteria, half human cells.
Exactly.
That's going to take a moment to sink in.
Now, I kind of knew that, but there's another stat that you threw out there that just numbers, I think this is an interesting topic partly because these numbers are so big and the things are so small that it's hard to have a concept around it.
It's hard to conceptualize it.
So you said that if you get, say, a gram of soil, that a gram, I mean, that's like tiny, right?
Like a little sugar cube size bit of soil that has up to a billion bacteria in it.
Just that little square, right?
Yes.
So it's like a very, very minute amount of material.
And there's like a ton of bacteria in there.
And if you look at the complexity or the number of different species in that sample, that's stellar.
Like in that single gram of soil, you could easily have like 10,000 different kinds of bacteria.
So it's a very, very complex environment.
And that interacts really with, in case of soil, the roots of plants, right?
On our body, there are so many different bacteria on our skin, but also on the inside in our gut.
And they actually affect us.
And it could be bad, but a lot of times it could be good, right?
Like the bacteria in your gut has a lot to do with your health.
You know, you hear about people taking antibiotics and it like killing out some of that stuff in their stomach.
And they're not as healthy necessarily because of that, right?
So yeah, it's crazy.
We actually tend to think of bacteria as something that causes disease, that causes inflammation and infections, right?
But a lot of bacteria can do exactly the opposite thing.
A lot of the bacteria that are living kind of like as our symbionts, really,
they're essential for our health.
So they can really improve our quality of life.
Right.
Maybe they help you with digestion, like certain types of proteins or things can be broken down because they're there, right?
Yeah, I can imagine so.
So I'm mostly on like the computational part.
So I'm not like microbiologist.
So that's a bit farther off what I'm doing.
Yeah, yeah, sure.
But yeah, so there are tons of bacteria that are actually beneficial for us as well.
So we really need them as much as they need us.
Yeah, I think at least in the US, there's been a trend against things like antibacterial soap and stuff like that that tries to completely kill off bacteria.
I think as much as it might creep people out, I think there's a realization that bacteria are important.
Yeah, I think that's true, right?
Like if you take antibiotics, you're killing off the bad guys.
But if it's a broad spectrum of antibiotics, you're also killing some of like the healthy bacteria, the ones that you do need.
And that actually has a long lasting effect on your microbiomes.
It takes a while to recover from that.
So people are really looking into like kind of like better ways to treat these infections.
Yeah, for sure.
So we had this quote or this number that there's a billion bacteria in a gram of soil and there's 10,000 different kinds of bacteria.
So how do you come up with that?
Do you like train grad students to recognize bacteria and they take notes?
And they spin around.
How do you come up with that number?
It can't be counting it, right?
Yeah.
Usually when I tell people, like we look at the amount of bacteria and which bacteria are in like different samples,
they think of me hunched over a microscope and just counting what I see.
It doesn't quite work like that.
So all bacteria in their DNA have like a small part.
And it's kind of like similar enough that we can pick it up and copy it from all those different species of bacteria.
But it's different enough that we can actually identify them to some extent.
So there are like tiny differences in that sequence.
And that allow us to kind of like see like, okay, this read is different from that.
So what we do is we basically take the DNA, copy over that one part a bunch of times, and then sequence all the DNA in those copies.
And it allows us to kind of like look in databases, like which part matches which bacteria.
And we get more reads from one specific bacteria, then we know, okay, there's probably more of them in the sample than from another one where we see fewer reads.
Right.
You just basically count the number of matches of that species' DNA.
And you say, well, that must be roughly representative of its ratio in the general population.
Exactly right.
But this is kind of like a fingerprint, if you want.
So it tells us that certain bacteria with that sequence is in the sample, but it doesn't tell us all that much about the sequence, about the bacteria that we're looking at.
There's also like a more modern version, if you want, where we really try to go in and sequence everything, all the genetic information in the sample.
And that gives us much more detail about what those bacteria can do, because we get the full genome information for at least some of them.
But for now, our research is mostly based on the fingerprint sequencing.
Sure.
So something I've always wondered about, just sequencing DNA in general, is you've got so many cells mixed in there.
And especially in this case, you've got different species mixed in there.
Like, how do you know that this part is all one species?
How do you separate that?
How does it not just look like a giant scramble of, you know, if everyone in a room took their name and put them into letters and just threw that into a bucket?
Like, how do you know which goes right back to which, right?
How does that happen?
In case for the sequencing, the omplicon sequencing, it's kind of like built in the design that's designed to deal with that kind of information.
If you really take like everything, then you need to sequence pretty deep.
There's like some overlapping parts in there, and it allows you to assemble different genomes.
But there are like other techniques that people use as well, looking at the number of times you see a certain copy, because that means that it needs to be from a bacteria that's equally abundant, give or take.
Right?
So that allows people to link certain parts together.
But that's not something I've actively done myself yet.
Sure.
So I might actually be giving wrong information here to be a bit careful.
Yeah, no worries.
It just seems super interesting to me that we're able to do that with such certainty and accuracy, given like how messy that it seems, you know?
So it's, I don't know, there's a lot about science.
It's pretty amazing.
Yes, absolutely.
For sure.
Let's go with the fingerprint side of things that you've been working on most recently.
You've got some soil or some other area that you've gotten this bacteria from.
You've done the sequencing.
You have these ratios of different fingerprints.
This is probably where you start using some Python to answer some questions, right?
Exactly, right.
So at that point, let's say you have about like a thousand different samples and you get like the relative abundance of 10,000, 20,000 different bacteria across all those samples.
Then you need to start using Python or some other framework to make sense out of it.
So normally, you should collect metadata for all your samples.
So that describes how a sample was collected, right?
So for soil, you might want to get the parameters of that soil, like the pH, nutrients that are in there, the place where you sample it, how much water is in there, right?
If it's from a human, you might want to ask them some medical questions.
You might want to get some information about their age, their body mass index, stuff like that, right?
And you need to really pull all those things together to get some new insights in biology, microbiology.
And to do that, Python is a great platform.
Sure it is.
That's awesome.
So are there like packages or libraries specifically built to address those types of questions?
There are some packages specifically for microbiology.
I think Chime is one that's called.
Also, Pandas, NumPy, like your traditional data science packages work really well for these kinds of questions.
So yeah, if I need to do some very specific analysis, I like to fire up Jupyter notebook and just load everything in a data frame and start working with that.
Yeah.
The problem is that's like your farther you are in your analysis, the more and more in-depth knowledge you need to have about microbiology or the specific environment you're looking at.
And very often the biologists that have that knowledge, they don't have the computer skills to kind of like make sense of the ginormous matrix of abundances combined with metadata.
And so what I try to do is actually develop a platform where we can upload those matrices with all the abundances.
And then there's an interface hooked up to it that allows people without like the bioinformatic skills to just to also make sense from that data.
How do they do it?
Is that visually with like graphs and pictures or like heat maps or is that like CSVs and drop down into Excel or what do you end up giving them?
So it's kind of like a combination of all of those things, right?
So on the front page, there will be like a search button, very similar to what you will find on Google, right?
So where you can just type the name of their favorite bacteria and just see how abundant it is across the different samples.
And you can group samples based on different things in the metadata.
There are also different tools that allow you to visualize bacteria that are very often found together in samples as a network.
So that's an interactive people can drag and drop things, color code the nodes or the edges based on the properties that they want.
And this is all a combination of basically Flask and Python in the backend and then some JavaScript on the front end.
So it's all like online that they can basically use their browser as an interface to the data.
This portion of Talk Python to me is brought to you by Linode.
Are you looking for hosting that's fast, simple, and incredibly affordable?
Well, look past that bookstore and check out Linode at talkpython.fm/Linode.
That's L-I-N-O-D-E.
Plans start at just $5 a month for a dedicated server with a gig of RAM.
They have 10 data centers across the globe.
So no matter where you are or where your users are, there's a data center for you.
Whether you want to run a Python web app, host a private Git server, or just a file server, you'll get native SSDs on all the machines, a newly upgraded 200 gigabit network, 24-7 friendly support, even on holidays, and a seven-day money-back guarantee.
Need a little help with your infrastructure?
They even offer professional services to help you with architecture, migrations, and more.
Do you want a dedicated server for free for the next four months?
Just visit talkpython.fm/Linode.
Is this the thing called MetaConnect that you built?
Exactly, yes.
So it's not published yet, so it's not out there for people to look at, but I hope to get that done soon.
Nice.
So this is a website that you just described, written in Python and Flask.
Is it tied to your university work or a company you work with?
Or is this something that's open source and that's going to be coming out?
Or what's its status?
Initially, I created the website as a way to communicate results back to one of the companies for whom I'm analyzing data.
So I quickly realized, like, okay, I can process all the data, but I'm not an expert in the field that they're active in.
So I'm going to need some way to get the data to them in a way that's useful for them, right?
So that's how it started, but we have lots and lots of different projects, also academic ones in the group.
And one of them is the Flemish gut flora project, where we're trying to get, like, an impression of the bacteria that are resident in the gut of humans, mostly within the Flemish population.
So Flanders is like the north part of Belgium.
Yeah. So would you say that that is the most important or the most influential bacterial community that humans interact with or affect humans?
Like, I mean, there's bacteria in our skin, it's in our hair, all over, and so on.
But our stomach probably has a bigger effect than others.
Well, there are quite a lot of bacteria in there, right?
So if you take a stool sample, there's somewhere between a billion and a trillion bacteria in there, so even more than soil.
And there are already some associations that we know of of those bacteria with our well-being.
So a colleague of mine recently published an article where she could demonstrate that there's a link between some of the bacteria in your gut and your mental well-being.
So we could see that some bacteria are less frequent in people that are actually struggling with mental problems.
And there are associations with all kinds of diseases.
Think about, like, irritable bowel syndrome and stuff like that.
Wow. So this Flemish gut flora project is just collecting all of this data.
And then do you guys use a similar analysis project and similar tools to study it, or is it different?
A lot of the methods between studying something like soil samples and human samples are similar, right?
So basically, you identify what's in there through sequencing.
And then once you have sequences, the pipelines are very, very similar.
We use, so there's not really a big difference between the methods that we use.
Just the microbiology and the conclusions and all that, totally different, possibly, but not the way you get the frequency diagram or whatever it is.
The biggest differences are in how the things are sampled and how the samples are processed, right?
So once it's turned into sequences, then it kind of all becomes bytes.
And then we start using some very similar workflows for different kinds of samples, yeah.
Yeah. What's that workflow look like?
It sounds like, you know, if you have 10,000 samples, that's a lot of work.
It sounds like that needs some kind of automation.
To some extent, yes, right?
But of course, the work in the lab that precedes the analysis, that's something that has to happen to some extent manual.
That's just a lot of hard work, right?
Exactly, right.
So there's like a whole logistics part before what I actually do.
That's just a ton of work.
And fortunately, we have some very talented lab technicians that take care of this process.
Yeah, for sure.
So another thing around this Gut Flora project that you were talking about is you have to do an online questionnaire because it's one thing to just go collect the samples from thousands of people.
And the people who eat meat more often have this outcome or people who are vegan and don't have any dairy.
They have that other outcome, right?
So you actually had to set up a way to collect all that information as well, right?
Yes.
So we try to recruit volunteers to participate in this project through different channels.
And the first thing I need to do is to kind of like fill in like a registration form where they say like, okay, I understand what's going on.
There's a privacy statement in there.
Also, they need to give informed consent that they know what they're volunteering to and that they can opt out at any point of the study.
And then there's an intake questionnaire where people give us some information about their health, their lifestyle, and their diet.
Now, this is done with commercial software, but it doesn't quite get us all the way there, right?
So it does about 90% of the things we wanted to do.
But then there are a few very specific things where we wanted to do something else.
For instance, we sent sampling kits to all the participants.
So we want to know that the address that they entered in the questionnaire actually exists.
So when they're filling in their address, it will quickly use a Python web service that I created to check this against the vPost, so the Belgian post office website, to make sure that that address exists.
And in case they might have made a typo, we will tell them like, oh, there's something wrong.
Are you sure this is your address?
Maybe like there's something off with it.
Maybe you made a typo somewhere.
Can you correct it?
Also, as part of this process, people need to schedule a visit with their general practitioner.
So to make it very easy for our participants, we made another web service that can kind of suggest the details for a general practitioner based on what they entered.
So it's a little bit like this type of hat form.
Once they start typing the last name of their doctor, it will immediately suggest like, okay, is it this doctor that you mean?
Here's this address.
And if they click it, it automatically completes the form.
You know, I wish more sites were like that.
It would be so nice to be so friendly and say, yeah, you've given us enough.
Here's just click here.
We got you.
It's actually extremely important in this type of research because we're asking these people to basically give up some of their free time to help us out with our research.
So we really are very grateful that people actually do this.
Also, they need to take a stool sample, freeze it, and then bring it to like a drop-off point,
which is usually a local pharmacy.
But again, that's actually quite a lot of effort that you're asking of someone.
So at least the parts that we can make easy for participants, we try to make as easy as possible.
Yes.
Yeah, yeah.
This is an easy one.
But definitely, I mean, there's so many places that could adopt that philosophy and just don't.
One of the things that's interesting about this that I think is worth pointing out is you said this is a pre-packaged commercial questionnaire site company.
Yeah, they take care of it, but they let you customize the page by putting in a little bit of JavaScript, right?
Essentially, when they filled in their address and they click the next button, that's the point where we can fire a little bit of JavaScript.
So mostly using jQuery to call the web service with the data they entered and then send a response back.
Yes, this is valid or no, this is not valid.
And then have the website respond appropriately according on that.
I think that's a really interesting way to bring in the capabilities that you have using Python and Flask to something that is not really extensible, but it has this little tiny hook where it lets you just do just enough to get into the space.
And, you know, it lets you not have to say, well, we either can use this the way it is or we can from scratch build our own questionnaire site, but we can just lay on top of it.
It definitely feels a little bit like cheating, right?
But yeah, especially because we're working with medical data, it's so important to get everything right in terms of security.
You have to comply to GDPR and some other like regulations as well.
So building our own platform would just be like a tremendous amount of work.
So that's why we opted to go with this commercial platform.
But indeed, we do need to use some tricks here and there to actually get it to do everything we want it to do.
It makes sense because your goal is not to build a questionnaire site.
Your goal is to get samples and information about bacteria colonies, right?
If you could avoid building that site, like as much as you can, just avoid it, right?
Absolutely, yes.
Yeah, but the other one, the first one we talked about, the MetaConnect that the microbiologists can use to study and get the data back in the way they want it.
That one sounds more core to your goals, right?
So that one, you said you built that one from scratch with Flask, huh?
It's actually something that has been going on for some time.
So previously, it was used to study gene expression in different types of tissues of plants.
But if you think of gene expression, so that's basically which genes are on or off and how much are they expressed in different tissues.
It's also an abundance matrix.
And so I kind of realized fairly early on when I started working on the microbial data that it's very, very similar.
And a lot of the techniques and tools are the same.
So I just forked the repository and started like making the necessary changes to actually support microbiome data as well.
Yeah, sure.
Get in there, change the title and just go from there.
Nice.
Yeah.
Tell us about it.
Tell us about some of the technologies that you used and stuff like that.
Biological data is actually very well suited for relational databases.
So usually you have like a species or a data set, and then there are sequences related with that.
And with a sequence, you can have functional information.
You can group sequences into clusters or gene families.
So you kind of have this like structure that fits a hierarchical or a relational database very well.
So there's definitely some MySQL connection there.
And for that, I'm using all like the Flask packages.
So just Flask MySQLAlchemy is in there when you're uploading the data through like an admin panel.
So that's just Flask admin that I used.
Users don't actually get to see that part.
So it's a very standard interface.
So through that interface, you can upload the data.
So basically as a by-infantition, you processed all the reads that you got,
and you have your abundance matrix and you upload it.
So then there are some standard analyses that are just triggered on the server and just ran.
As soon as you upload the data, it's being...
Right.
So some sort of like data ingestion.
Yeah.
It loads it up, converts it into the database format, things like that.
Exactly right.
And so it also does a couple of analyses immediately as you upload the data.
And so for that part, I'm just using like Pandas, NumPy, and the Scikit-learn to kind of do those kind of stuff.
So just a whole lot of Flask going on there on the back.
And it's cool that you're using Flask admin.
And of course, if people don't have to, they don't see it.
If it's just the admin see it, it could just, you know, admin panels are always like the worst looking part of the UI.
Exactly right.
So the parts that actually users get to see, that's something where I do spend a bit more time on how it actually looks.
Nice.
So this thing, the goal is going to be to open source it.
Do you think that it makes sense?
I guess probably it doesn't make sense to run it as like a service that people can generally use or does it?
I'm thinking because of the privacy.
But maybe if it's for things like plant data and stuff, like the plants don't have a GDPR.
Yeah, that's true.
Is it something that can be generally useful as a site or just as a project people could clone for their projects?
So I kind of see a couple of different use cases for this.
So one is communication, right?
Let's say you did an awesome study with some microbiome data that you can make public.
You could actually set up your own platform, upload all your data in there and use this kind of like a supplementary web page to your publication.
So it's a great way for communicating things to other people that might not have the bioinformatics expertise to do that kind of analysis themselves.
I also personally use a lot to just locally run it, upload the data set that I'm analyzing, and I just get like all those tools at the click of a button rather than using different scripts and making all those like one-off scripts to do some kind of analysis.
It's almost like a GUI on top of the libraries that you guys are using to study the bacteria.
It really simplifies analyzing the data.
There are also now some students that are starting to use it in our group.
So they have their project, they have their samples.
They went through the learning curve to learn how to process the reads and get that abundance matrix.
It's mostly done using our scripts.
So at that point, it's kind of like nice if you can give them something that's nice and easy to finish up the rest of the analysis.
And so that's also a use case we have.
Yeah, you talked about having students maybe working on some new projects that are kicking off at the university there.
For students out there listening, what kind of skills, you know, maybe they studied biology or maybe they just studied data science.
What kind of skills do you look for for people to work on your projects?
If it would be to extend something like MetaConnect, it would be nice to have someone that has some coding skills already.
Right.
So this semester there will be one student and he'll definitely be working a little bit on the code of MetaConnect.
So then I'm looking for someone that has some coding skills.
But also having some understanding of the biology is necessary.
Right.
You don't get that far if you don't understand any of the biology at all.
So it's really like this combination.
And bioinformatics is such an interesting and broad field that the amount you need of either the informatics or the biology can differ based on different projects.
So projects that I would supervise, they would generally not include any work in a lab.
But there are also people who are doing kind of like a combination of some lab work with some bioinformatics.
That's also perfectly possible.
Yeah, I'm sure it sounds fun.
Students are always looking for research projects to be part of so that they can make those connections at universities.
But it's interesting just to think about biology students trying to get into the software side, kind of like you did with bioinformatics or the reverse, right?
Software people who are kind of interested in biology and whether they can cross over for that.
Actually, I know people did it both ways, right?
So there are plenty of bioinformaticians that have a background in biology.
And then the first couple of years really struggled with the scripting, picking up those kind of skills.
I don't know, people that have like a traditional CS degree and that way got into bioinformatics.
So both are possible.
Actually, it was a couple of years ago necessary to pick one part or the other because there was no formal master in bioinformatics at the university at the time.
So now we actually have that kind of course at the university.
So you can also decide to just do a bioinformatics master and then you kind of have the biology and the computer science in equal amounts.
Yeah, that's great.
One of the libraries that you said you're using on the MetaConnect is something called cytoscape.js.
Well, it's actually a JavaScript library.
So that's basically a library that allows you to visualize networks in the browser.
And so I briefly mentioned it before.
You can represent these communities of bacteria as networks.
So think of it as a social network of bacteria, right?
So bacteria that tend to appear across different samples, they're co-abundant.
And could be that they're somehow related to each other.
They're either dependent on each other or maybe they're dependent on the same other resource.
But the thing is you spot them very often in the same samples.
And so that allows you to kind of like represent the bacteria as nodes and draw an edge between them.
Allows us to kind of study the communities of bacteria because we do expect that bacteria that are often in the same samples somehow need each other to do what they need.
This portion of Talk Python to Me is brought to you by Tidelift.
Tidelift is the first managed open source subscription, giving you commercial support and maintenance for the open source dependencies you use to build your applications.
And with Tidelift, you not only get more dependable software, but you pay the maintainers of the exact packages you're using, which means your software will keep getting better.
The Tidelift subscription covers millions of open source projects across Python, JavaScript, Java, PHP, Ruby, .NET, and more.
And the subscription includes security updates, licensing, verification, and indemnification, maintenance and code improvements, package selection and version guidance, roadmap input, and tooling and cloud integration.
The bottom line is you get the capabilities you'd expect and require from commercial software.
But now, for all the key open source software you depend upon, just visit talkpython.fm/Tidelift to get started today.
And I bring it up because it looks like such a cool library.
Obviously, it just does graphing type stuff.
But the variety of the visualizations there are super cool.
So people who are looking to draw those types of relationships, I think there's a lot of stuff to take here.
There's even one where it represents like different animals linked together and the vertices are actually pictures of animals and stuff like that.
So it's a really nice library for that.
Was it pretty easy to use?
It's very, very performant in terms of drawing the graphs.
Yeah.
But you kind of have to build the interface around it.
It just draws nodes and edges, gives you some functions to interact with them.
But if you want to have like an option to change the color of the nodes, those little things you have to add yourself.
So it's pretty straightforward once you have your data in the right format to visualize it using Cytoscape.js.
I struggled quite a bit to build the interface and all the buttons that I required for my viewer to get them to link.
To get it to behave just right.
Exactly.
Sure.
It's one thing to draw and it's another to make it interactive.
For sure.
So one of the areas that I thought would be fun to talk about would be the pressures of being in an academic space and what counts as like merit and credit in that world versus industry.
So it sounds like a lot of the work that you're doing is around academics, but you also have a little bit of industry experience going on at the same time.
And, you know, with academics, it's all about the academic paper, right?
Yes.
Is that a challenge for my goal is to build this cool library in Python to help biologists, but I can't publish that.
So what am I going to actually do along with that?
What's the tension like there?
I am analyzing some data for a company.
And I think it's a really cool project, but it's their intellectual property.
So I'm not talking too much about it.
And so basically the findings there, that's all the company's thing.
But so software that I'm designing, that's more the academic part.
It's true that like in academia, basically your work is measured by the number of publications that you have.
So I need to kind of keep a balance between them, right?
So I need to make sure that I also get some publications for my resume.
Do you think that the industry is going to, or academia, I guess, is going to change somewhat to recognize software contributions as part of research more?
I mean, this is not a problem just focused on biology, right?
This is a problem in physics and chemistry and mathematics and astronomy, right?
Whatever, right?
Anywhere where there's people building these great libraries, that's taking away from their time to do research, maybe.
If you're really building like a library for other people to use, for sure, that's going to be an issue.
I've mainly been developing applications.
And so then the way we did it was we kind of released the application along with data sets.
And then you can kind of do some research with that data set as well.
So you kind of have done a combination of novel data sets with novel software.
And people can start using it.
And that can also become like a publication on its own.
However, there it does make it challenging to keep on supporting the software.
Because once the publication is out, right?
You got what you need.
There's no more reason to keep adding features to it or whatever, right?
Yes.
So then I need to continue basically building a larger data set in combination with better software to kind of keep it going.
And so I think during my PhD, one of the projects I was working on,
really were very successful in doing that.
It was always a combination of like, here's an online platform with like a cool tool that we developed.
But also each time, here's like a larger data set, more species.
It certainly makes sense to build tools and applications to answer your questions, right?
Because I've worked in research groups before.
And a lot of the work was, we need to answer this question.
We need to visualize this thing.
We need to transform that data.
And it was just writing software to do that.
So have you heard about the Journal of Open Source Software, Joss?
I have.
I actually think it was through one of your podcasts that I learned about it.
Yeah.
We had it on the show.
Is that something relevant in your space?
So far, I don't have any experience with it.
But I do like the idea of breaking down these like big research projects into smaller components
that can be reused, right?
MetaConnect, for instance, is definitely a monolith.
Yeah.
It's like a whole package that does so many different things.
It would be cool if I could basically take some components out of there and maybe get
like a smaller publication out of it through Joss or some other journal.
And it's something I've been trying to do recently, but so far, I haven't really been able to test
it or to put it in practice.
Yeah.
I was just thinking, okay, it seems like some of your stuff that you're building, it repackaged
correctly, it might fit in there, right?
Yes.
So for instance, we have a lot of metadata for the Flemish Gut Flora project.
Right.
So we have thousands of people and we have all this medical information, this information
about their diet and their lifestyle.
And I have a viewer for that.
Now, that's something you can basically use across different disciplines, right?
Every study where you have a ton of metadata would benefit from such a viewer.
That's, for instance, one of the parts that I would like to kind of like separate into its
own repository that could become its own project.
Cool.
Well, maybe I guess school has just started, so it's probably not the easiest time to find
free time, but maybe next summer or something or over winter break.
Yeah.
I'll have a look at it once I have some free time on my hands to work on it.
Absolutely.
So where's this research going and what are you building next?
Like what more analysis do you want to do?
What more libraries or apps are you building?
I'm actually quite happy with the microbiome studies.
It's a very challenging field.
And a lot of the things that we are doing now are association studies.
So we look at the population and see like, okay, if you have more of this bacteria, then
maybe there's a higher chance that you have certain disease.
But that's just an association, right?
It doesn't mean that having that bacteria will actually cause a disease.
Correlation is not causation.
Correlation or causation.
Yep.
Exactly.
And so right now we're moving also towards more like longitudinal studies, intervention
studies to kind of like really establish those causal links.
So that we can say like, yeah, it's really the bacteria that causes something or no, it's
actually disease that causes the person to eat something differently or behave differently.
And that is actually changing the microbes in the gut, for instance.
Is it a signal or is it a cause?
So that's now happening.
And then of course, if you get like time resolved data, that's going to be like a next challenge,
I think, to integrate in all of this.
So it sounds like more data might be on hand and you already have a lot of data.
Where does machine learning factor in your world?
Have you tried to use like machine learning models to understand this and make these inferences?
I know machine learning is extremely good at taking a picture and saying, oh, that means
it's like this, but what about one of these like abundancy grids or something like that?
One of the things that we noticed or that basically my colleagues noticed a couple of years ago
is that we can kind of stratify the Flemish population into four different groups based
on the bacteria that are in the gut.
What is the distinctions there, the categories?
Certain people just have like more of one kind of bacteria, right?
And that seems to be kind of like one group and they're not distinct groups.
It's more like a spectrum.
So we noticed there are these four different groups, right?
So one of the things that would be nice is if basically we could use some machine learning
to automatically classify new samples into these different enterotypes.
You could also start thinking of kind of trying to predict something based on the gut microbes.
But I think that's still some ways off.
It would be great if you could just look at the sample and say like, okay, this person is at
risk for a certain disease.
Maybe that will work.
Maybe not.
So that's still very vague right now, whether we'll be able to do that or not.
But people are probably looking at it.
Yeah, it sounds exciting.
It doesn't sound out of reach at all.
It really depends on like the data that we can generate.
And yeah, we'll need to explore that.
I guess it depends on how reliable the science is that says if it's like this, that means
that, right?
Because you've got to train the models to say, I don't know, maybe the models could make discoveries
that people don't see.
I don't know.
I haven't done enough machine learning, but there's probably some really interesting things
you could do with machine learning and that data.
For sure.
Yes.
So, but whether or not we'll be able to make any kind of predictions towards health, that's
something I'm very careful about.
Categorization one sounds likely.
That's something that will probably be possible based on what I've seen so far.
And as we're generating more and more data, it would be very nice to just do that initial
classification into the enter type in this automatic way.
For sure.
So, well, it sounds like you're making some cool use of Python to study these microbiomes.
And they're just so fascinating because they're really out of reach for us in any way that
we can conceive about it other than a very small view with a microscope.
It's super interesting.
I think so too.
Hopefully that inspires the biologists out there to do more Python and things like that.
Super cool.
So thanks for sharing that with us.
I think probably we'll leave it there for that conversation.
But before you go, I do have the two questions for you.
So if you're working on this project, you can write some Python code.
What editor do you use?
So if I'm working on MetaConnect or any kind of like large project, that would be PyCharm.
If it's more like a very specific analysis, I'll fire up Jupyter Notebooks.
Where do you make that tradeoff?
Where do you say, okay, this is now it's too much for the Jupyter Notebook.
I'm switching to PyCharm.
Like when do you transition from one to the other?
So I have like a couple projects and they really are from the beginning decided to be
like an application I'm developing.
And for that, it's automatically something I will do in PyCharm.
If it's more like processing data, preparing it to do something else with it or something
I just have to do once, maybe twice, then I'll go for the notebook.
Also for reporting back something.
I think the notebooks are really powerful.
So you can just, you know, generate all the graphs, export it to PDF and say, here's the
thing that you asked.
Yeah, that's perfect.
Super.
And then notable PyPI package that makes your life better?
One that I discovered recently that really like saved my day is something called UltraJSON.
I think it's pip install ujson to get it.
And it's basically a very performant version of the JSON library in the standard library.
So I was developing an endpoint that had to like deserialize some JSON objects that were
stored in the database, combine them and serialize them again to something I could then send to
a viewer.
And that's just made everything a couple hundred milliseconds faster, which made the website
so much more responsive.
Oh, that's super cool.
Yeah.
UltraJSON is a JSON encoder and decoder written in pure Python.
I'm sorry, pure C with bindings for Python.
Yeah, that's great.
So you probably have a lot of data on those endpoints, right?
Like the 10,000 measurements or whatever.
Yeah, exactly.
So if like I need to kind of like deserialize one of those complex objects, do something with
it, combine it with like another one and serialize it again, very quickly takes seconds, which for
a web interface is very slow.
So everything that can just take like a couple hundred milliseconds off that time is really
great.
And is it the same API as regular JSON module?
For the most of it, yeah.
Pretty much everywhere in my code, I was able to just write import UJSON as JSON and it worked.
That's sweet.
All right.
Well, that's a great suggestion then because it sounds so easy to adopt and will be helpful
for a lot of folks.
Cool.
All right.
Well, final call to action.
People are out there interested in biology or biologists are out there interested in Python.
when they want to get started, what do you say to them?
Right.
So definitely try some coding in Python.
Even if you're mostly into biology, just knowing a little bit of the basics can make your life
a lot easier.
Just being able to automate something for a couple times can prove very useful, right?
Yeah, absolutely.
You know, escape Excel, right?
Yes.
Or MATLAB.
One of the two.
Yeah.
Like we're collecting more and more data.
So I encounter it so often that people were using Excel and at one point it just hit that
wall and then, you know, Python, Panda, scikit-learn and help you break through that.
So have a look at it if you need it.
Cool.
All right.
Well, Sebastian, thanks for being on the show.
It's great to chat with you.
Yeah, it's great to chat with you as well, Michael.
Thanks.
This has been another episode of Talk Python to Me.
Our guest in this episode was Sebastian Proust, and it's been brought to you by Linode and Tidelift.
Linode is your go-to hosting for whatever you're building with Python.
Get four months free at talkpython.fm/linode.
That's L-I-N-O-D-E.
If you run an open source project, Tidelift wants to help you get paid for keeping it going
strong.
Just visit talkpython.fm/Tidelift, search for your package, and get started today.
Want to level up your Python?
If you're just getting started, try my Python Jumpstart by Building 10 Apps course.
Or if you're looking for something more advanced, check out our new async course that digs into
all the different types of async programming you can do in Python.
And of course, if you're interested in more than one of these, be sure to check out our
Everything Bundle.
It's like a subscription that never expires.
Be sure to subscribe to the show.
Open your favorite podcatcher and search for Python.
We should be right at the top.
You can also find the iTunes feed at /itunes, the Google Play feed at /play, and the
direct RSS feed at /rss on talkpython.fm.
This is your host, Michael Kennedy.
Thanks so much for listening.
I really appreciate it.
Now get out there and write some Python code.
I'll see you next time.
Thank you.