foreign
thank you um I'd like to thank the
organizers for giving me the opportunity
to talk to you today
um you know this is my first time
presenting at pycon I usually present to
rooms of scientific researchers is a
very different style of talk than what
I'm used to but I'm really excited to
tell you the story of an ongoing
academic open source project to build a
biological database for experimental
data that's generated by researchers and
genomics and I'm really excited to share
it with this community because Django
really plays a starring role and while
there's a bit of technical stuff and
I'll explain a little bit of the biology
to kind of motivate things this is
mostly a talk about how we try to match
our team shifting expertise and variable
level of resourcing to available open
source Tools in order to achieve you
know the goals and requirements of this
project that really changed a lot over
time and I hope it also maybe gives you
a little bit of insight into what it's
like to do software development in an
academic research context which I think
is both in some ways similar and very
different to how many people do software
development
so a little bit about me so I am a
computational biologist I'm a researcher
at the Walton Eliza Hall Institute of
Medical Research or wihai in Melbourne
Australia this work is all being been
done in close collaboration with
colleagues at the University of
Washington and the broadman media
Institute for precision medicine in
Seattle and the work that I'm talking
about has been supported by competitive
grants from the medical research future
fund here in Australia and also from the
national Human Genome Research Institute
which is part of the National Institutes
of Health in the United States
and so with that I'd like to just tell
you a little bit about what kind of data
we're storing and why we're doing that
so fundamentally the data that we're
storing is about protein so proteins are
a type of biological molecule they have
a lot of different functions there you
can think of them sort of as Little
Machines inside your cells that perform
all of the functions that your cells
need to perform so antibodies are a kind
of protein that I think everyone's
learned a lot about over the last few
years that are involved in immunity
enzymes are a class of proteins that
assist in all types of different
chemical reactions whether that's
metabolism or synthesizing the various
different chemicals that your body needs
they have a lot of different different
roles and then there are a lot of other
different sort of
different functions that proteins have
like forming the physical structure of
your cells to things like this chaperone
protein here which actually forms like a
little canister that can open up and
contain other proteins and help them
stabilize and so and I'll just mention
that all of these images of these
protein structures that I'm showing are
from the excellent molecule of the month
series which is run by the protein Data
Bank sort of a kind of a public science
sort of series which I highly recommend
if you want to learn more about the
interesting things that proteins can do
and see more of these cool images
now Decades of work in molecular biology
has taught us these relationship which
is that DNA gets transcribed into RNA
and RNA gets translated into protein and
it's helped us work out the mechanics of
this and the grammar and I'm not going
to go into this because I don't want to
spend all of this time giving you a
public science lecture although if you
want to learn more about any of this
stuff you can come Corner me at the con
at the conference later and I'll answer
any of your questions so we're not going
to focus on this but the takeaway here
is that the DNA sequence which is stored
in your genome inside the nucleus of
your cells contains all of the
information that is needed to determine
the sequence of the protein so the
information flows largely in this way
and that's the kind of the take-home
message here
now proteins are chains of amino acid
it's a biological polymer the amino
acids are the subunits and it's just a
single chain of amino acids there are 20
canonical amino acids so we can give
each of them a single letter and we can
just write the sequence as a string
which was what we're doing here so this
is the the amino acid sequence
of this protein that I showed you before
and so the important thing that I want
to tell you about this is that the
sequence of amino acids determines the
structure of the protein so this this
chain of amino acids is going to fold up
and it's going to fold up into some
shape based on the biophysical
properties of those amino acids and the
shape and the position of the atoms in
that protein structure are what allows
the protein to perform its function or
to do its job so that's what's important
and some of you who you know follow this
uh kind of aspect of science May
recognize this as the protein folding
problem and it's something that a lot of
groups have spent a lot of time trying
to predict is how do you go from a
sequence
to the structure
um and so the structure allows the
protein to do its function so the
function of this protein which is a
caspase protein it's involved in program
cell death is that it kills the cell
when it's time to kill the cell and
there's a lot of context in which that's
important including cancer and also
normal development
but the take home here is that the amino
acid sequence determines whether or not
the protein is going to be able to do
its function based on its structure
now I told you before that we can get to
the amino acid sequence from the DNA
sequence so if I just swap over to the
DNA sequence here we can say that the
DNA sequence is what determines the
function of whether the protein can do
its function and so then a change so if
we change this a to a t which is there
in red kind of in the in the bottom
middle there
um
you know that may cause a change in the
that DNA change may cause a change in
the amino acid sequence that change in
the amino acid sequence may make a
meaningful change to the structure and
that change to the structure may have a
meaningful impact on whether or not the
protein can do its function and despite
the success of tools like Alpha full 2
and primate Ai and other sort of large
predictive models the effect of a
specific amino acid change on a protein
structure and therefore function remains
very difficult to predict and there's
still really no substitute for doing
experiment and advances in genomic
technology particularly High throughput
DNA sequencing and high throughput DNA
synthesis allows us to look at these
changes at scale and that's the type of
experimental data that we're trying to
store in this database
um and so what researchers can do now is
we can measure every change in a single
protein at once so we make a population
of cells where each one has a different
variant of the protein and then we
compete them against each other in some
sort of functional assay and we see
whether or not the protein Works under
that assay condition or not and then
through the application of high
throughput sequencing and then
bioinformatics what we can do is we can
take the data that comes out of this
assay and we can assess a functional
score for each one of those changes that
we're interested in and we can plot it
you know using a heat looking at a heat
map like this and we get all of this
information about which positions in the
protein are important what changes are
tolerated and there's all kinds of
interesting applications for this data
if you want to learn more about the
bioinformatics behind calculating these
scores and how all of this works and
here this stuff explained by a software
engineer rather than by me which I think
is going to give you some interesting
additional context please go see Nick
Morse talk tomorrow which I think is at
noon in this room unless the schedule
has changed
um so that's the background that I
wanted to give you about
um the the science I hope that it was
you know somewhat clear and uh and that
gives you some idea of kind of what
we're dealing with and so we wanted to
build a database to store all this
information and so why do we want a
database when we talk about research
data and um
and and what we want to do with it and
and
how to have it have the most impact a
lot of times we talk about how we want
data to be fair and fair data is an
acronym for findable accessible
interoperable and reusable and so we
want all the public data that's being
you know generated especially the stuff
that's being funded by government grants
and is generated with public funds we
want it all all that data to be fair we
want it to be open we want everybody to
be able to use it and so we need to
organize it in some way
and uh one of the best ways to do this
is through applying data standards so
I'm just going to show you some quick
examples of what actual data looks like
from actual papers chosen basically at
random by what I just had downloaded on
my laptop and that I opened up in the
spreadsheet program so here's one where
you actually have the amino acid
sequences for all the different variants
listed there are some quantities that
were measured here's another one that
uses a very sort of terse single letter
position single letter code to describe
the variations on a sequence which is
not depicted in the spreadsheet here's
another one that does something similar
they measured a whole bunch of
additional different things additional
stuff during their assay it's not
necessarily clear from this screenshot
what the most important value is if you
just want to know what is this protein
variant do
um
and here's another another different one
that is actually
represented as a matrix as you would
make if you wanted to build one of those
heat maps that I showed you briefly on
the previous slide so this is kind of
all over the place right and if what you
want to do is download a data set
because you're interested in some
protein and what it does
um you're going to maybe have a lot of
kind of munging and data cleaning and
you know parsing that you have to do for
this and even worse if you want to do
something like you know do a big
meta-analysis or build a machine
learning model that is a huge amount of
work for you or probably your student to
kind of get all of this stuff into shape
so that you can actually start doing the
work so if we can build a database then
store everything in in a standard format
make that available it's really going to
save a lot of people a lot of time
so I'm going to keep coming back to this
project timeline where I'm going to kind
of walk you through like the kind of how
our project went
um and so faced with this increasingly
unmanageable situation in the literature
that I just gave you a sneak peek of
um my colleagues at the University of
Washington met with some of the other
Pioneers in this field and they decided
that our field needed its own database
because the data is sufficiently
different from other types of data to
not be well served by anything that
already existed and at the time
databases were really either kind of
tiny Boutique efforts like you know
information just about a very specific
gene or specific biological process or
they're run by centrally funded
Government research organizations so
building a database that was sort of you
know mid-sized to serve this growing
field seemed really fanciful
and then I attended pycon Au for the
first time in Melbourne in 2016 and I
learned about Django and after some
conversations with some people who are
here in this room today I was filled
with hubris and I contacted my
collaborators in Seattle and I told them
that I could build the database that
they needed
[Applause]
so what did we think we what do we want
to do like what did success look like to
us when we started this project
well we wanted to build a database where
users could upload their data sets
we wanted to build and we wanted to make
it so that users could find and download
data sets that were interested
interesting to them and this is entirely
targeted at researchers who are
generating the data sets that we're
talking about and we needed to make sure
that it could be managed by a very small
team with limited expertise because
that's what we had
so when we got started we got a very
small amount of money with from a
collaborator who had some flexible
funding for which this work was in scope
and we got started and it was just me
and a student who has just finished his
Master's in bioinformatics he wasn't
sure if he wanted to do a PhD and he
decided he wanted to do a little bit of
work first as like you know doing some
software stuff and so he'd done a little
bit of work with like websites and we've
both heard of Django so we figured that
was good enough to get started and in
the beginning we basically followed the
Django girls tutorial but instead of
making a Blog we built a database for
genomic researchers
and one of the really great benefits of
working with Django you know this worked
one of the benefits of working with
Django especially at the beginning of
the project when we didn't know anything
was that it let us really focus on the
higher level Concepts like getting the
organization of the data right
um so we settled on this hierarchical
organization with these nested records
of different types where an experiment
set encapsulates all of the studies in a
single Paper an experiment describes all
the wet lab steps and the sequencing and
then these score set records store the
actual data and how the data analysis
was performed and the each so we kind of
have this hierarchy which becomes
important when we have a more
complicated experimental design so this
is a real example where we had one set
of
one set of protein variants that was
assayed in a bacteriophage model system
and in a yeast model system and then
they were each analyzed to produce two
different data sets
um and uh and the important thing for us
here was that if somebody
grabbed one of these data sets they
would now be able to easily find all of
the other data sets that were related in
the database and they would be able to
see if the raw data had been analyzed in
a different way or there were alternate
representations of the data and so these
were the kinds of things that we could
spend our time thinking about rather
than thinking about how to just get
words to appear in the browser
um
so when we kicked off
um this is kind of the tech stack that
we were working with so that the
database was hosted in a university
Department within a medical school
they're very concerned about making sure
that everything is working
um
and so you know they were still running
on on Centos 6 so we actually had to get
set up with an AWS virtual machine
running Centos 6 so that we could get
that environment set up and then we
could provide an installation procedure
to the IT department so that they could
get all of our stuff working we were
running uh postgres 9.6 for for the back
end because we ended up using Json
Fields a lot asked me about how that
went it's actually it's awesome it's a
success story The IT department asked us
if we could please just use system
python rather than installing something
so that meant Python 3.4 and we were
using Django one we're also running
rabbitmq and celery so we had a task
queue to offload the longer running data
processing and validation tasks when we
were accepting the user data when we're
accepting the uploads
um and I don't want to dwell on this too
much but this was really hard and it was
a lot of work like I have a PhD in
genomics like I didn't even really know
what devops was and here we are like
trying to do this but you know we we did
it we did the thing and so this is what
version 1.0 looked like
um so here we have uh you know a data
table that was based on on data that was
uploaded by the user
um we had automatically generated
accession numbers you know we have like
a title and abstract and some other
stuff that you can see some other you
know textual metadata uh we had linkouts
to uh an external visualization tool
that would make those heat Maps like I
showed you with some extra annotations
and that could download the data from
the server produce those images and then
give you the sort of interactive plot
and that was located posted um by
another collaborating Institution
um we have download wings so that people
could get the data tables out and then
and we have you know data licensing that
was selectable by the user so this kind
of had all of the pieces that we needed
like this is what we wanted to build and
we were able to do it and it took us
about a year so we went from that first
commit to uh in June of 2017 to uh the
first deployment of the full thing we
got a couple little more pots of money
to keep things going because this is an
academic project we wrote a paper we put
it on the pre-print server and then the
paper got published in November of 2019.
and everybody lives happily ever after
um so here's what we thought was going
to happen so we thought we put the
database up
um
and then users would come and they would
upload the data
and then we would you know maybe do some
maintenance and like maybe you spend
some time building some cool
visualizations and then we would sort of
move on to other things
and uh what actually happened was we
launched the database and then we got
this an overwhelming and unexpected
response from the clinical Community
because they are in the business of
trying to figure out what variants what
genetic variants that are observed in
patients do and we had a whole bunch of
experimental data about all of these
different changes that happen in
proteins many of which are clinically
relevant and they're like well we want
to use that to interpret what's
happening in patients and I'm not going
to tell you anything else about how
clinical Genesis do the data use the
data or how clinical genetics works but
if you're interested please go check out
David Warren's talk which I think is
tomorrow at 11 20 a.m in Hall B and
you'll learn more about the
bioinformatics of variant classification
and see some more Django stuff
um
so we also didn't get as much of a
response from the researchers as we
thought that we were going to and I
think a lot of you saw that coming so we
ended up having to take on some major
curation curation tasks to get all the
old papers in in particular and people
are much more keen to deposit their new
stuff rather than their old stuff and so
this meant that we had to keep working
on the project and invest a lot of time
in developing new features and things
like that
and so all of these things that I told
you before were still true
but what became clear from working with
uh starting to work with the clinical
folks was that we needed really really
good apis because we needed to make sure
that once we had all this data in the
central repository people did not want
to come to our website to get it they
wanted us to push it out to other
biological biological data resources
other front ends clinical Information
Systems other places they wanted to be
able to get it wholesale and this meant
that we needed to have better API
support than what we kept from Django
out of the box because we needed to
customize the data models combine
internal data models in various ways and
we also needed to do things like
maintain different API endpoints for
various collaborators based on their
specific needs
and meanwhile there was sort of trouble
brewing with the project that those of
you who are thinking about dates and
have been around I've dreamed Django for
a long time probably saw coming which
was that uh you know a few months after
we published the paper uh Django 1.11
was no longer getting any security
updates at all and then a little bit
after that you know we ran out of money
and the developer who had done a lot of
really great stuff had also learned
everything that he could learn on this
project and got a really great
opportunity decided you didn't want to
do a PhD that he wanted to be a research
software engineer and he got a great
opportunity to go join a team and do
some really cool stuff and so he left
the project so now it's just me
and Django version 1.11 and a live
website that's running in production the
guy who knew how everything worked is
gone we could hire him back as a
consultant a little bit but that's a
very finite resource the GitHub security
notifications kept getting spicier
and we were trying to figure out what to
do and so obviously this is not going to
work so we need to do something that's
not just maintaining the old Django site
so we could migrate to Django 2.2
long-term support but then we would just
have this problem again later on in not
too long
we could move to Django 3 but all the
information we could find said this
would be a lot of work and it was kind
of new and scary and it also wasn't
clear that we would get the kind of API
support that we needed which again was a
requirement that we didn't know that we
had when we started the project but now
was kind of our major requirement or we
could try something new whatever that is
now fortunately things worked out
because while we were deciding what to
do we ended up and doing a lot of this
additional data curation work we ended
up being successful in some major grant
funding rounds in the United States this
allowed me to hire a new Junior
developer in Melbourne so I wasn't
trying to do it all on my own anymore
and also the host institution that was
running the server finished their
upgrades to Centos 7 just a little bit
after the end of Centos six and we
managed to get permission to run Docker
compose which really simplified our
devops challenges and made it much
easier to kind of get all of these
things to play well together
[Applause]
uh and then we got some huge help when a
senior developer in Seattle who was
working with one of the collaborating
labs was able to contribute some time to
the project and help us figure out a
path forward
so now that we had this experience and
we had some senior people who had their
own preferences we were able to take a
look at this again and what we decided
to do was move from Django 1.11 to fast
API
and even though fast API is obviously
very different from Django the fact that
all the application specific code that
we wrote for data set validation
handling genomic information all of
these other tasks was written in Python
and using pandas and other libraries it
meant that most of what we had done we
could just bring straight over and we
were also even able to use the same
postgres database that we had we didn't
have to really I mean obviously we had
to do some migrations but but that
really pretty much got to stay the same
we just shifted what was on top of it
so now as of uh this sort of the new
version here's what the Technology stock
looks like we've gone from you know
having to figure out how to get
everything working under a specific
version of Centos to doing things in
Docker compose which is way nicer both
for you know deploying it and also for
development it's much easier to set up a
development in a local development
environment now we upgraded the version
of postgresql that we were doing which
is great because now our awesome Json
fields are now even more awesome and
more performant we got to move from
Python 3.4 to 3.9 which made me very
happy and then we also switched from
using Django to using a combination of
fast API and view
and so this really took a lot of work
but we're now basically back to where
the Django site was but we rebuilt it in
the new framework and our hope is that
we've sort of built kind of a new floor
um where where where we where we were
before and now we can start adding some
new features so time will tell and this
took about a year so we started in you
know the first commit in the new version
was in April of 2022 and then in April
of this year we switched over from the
Django version to the new version
um
and so I think the moral of the story is
this and which has been said by by a lot
of other folks in different contexts
which is that it's impossible to know
what to build until you've tried to
build something or build something else
first and it's really held true for all
of the software projects that I've done
as a researcher
um
and I can confidently say that uh
you know having a framework like Django
available that we could pick up and use
to get something built was absolutely
essential for us to succeed in this
project and while we were getting
started we absolutely did not have the
capacity or the funding to take on a
project that required expertise into
programming languages
um we didn't have anywhere near a clear
enough idea of what we needed to build
in order to take advantage of a sort of
a more flexible and open-ended uh kind
of development uh environment like uh
like we're getting with fast API and
view
um and most importantly I think no
amount of us thinking hard about the
problem would have gotten us to the
point that we needed to get to because
we needed the engagement from external
parties uh with different needs and
different backgrounds and we could only
get that by deciding to build something
building it and putting it out into the
world and then seeing what happened
um and so you know we would not have had
success if we had started with the
framework that we're using now and so we
think that this project despite the fact
that we're not currently using Django is
a Django success story and I hope that
you'll agree that that's the case
because uh we never would have gotten to
where we are without Django and I would
really like to thank Django Khan and the
and this audience for giving me the
opportunity to share it with you
um and with that here's some some links
and references if you want the slides
I'll figure out how to give you the
slides
um there's some some links to the to the
papers that were linked in there and
then also the website itself and and our
GitHub
um
and also add that if if anybody wants
papers and you you can just email the
author that's listed and we can send it
to you for free and we love to do that
so if you want biological literature
just just ask the scientists and with
that I would be very happy to take any
questions if there's time
so much for that Alan we have the
Discord where we will take questions I'm
happy to read those out you can do it on
mobile and stuff but it's been a couple
of years so now I need to remember how
fast I can run to get Russell the first
question because of course it is
hey we're back
is it reporting you
um thanks for the talk this is fantastic
and I'd love to hear success stories of
Django anytime
um could you speak to what features of
fast API led to that transition over and
if they are things that Django as a
project as a community could adopt to
like not that you made the wrong choice
but but to prevent other people making
that choice in the future to make to
make Django more appealing to the to the
demographic that we're not currently
satisfying sure
um
so I think that one of the in our
experience in in Django one was that the
the we got a rest API out of the box but
that was essentially exposing the
internal data models and so
changing the API Behavior then would
either require us to write a whole bunch
of code to kind of build a custom API
which we didn't really want to do
or it would require us to be able to
um go back and refactor those basic
models which I think would have been
not also not feasible
so by using fast API and pedantic and
the sort of you know models versus view
models we can build view models which
are relatively easy to consume we can
have a lot of different flavors of view
models and then build the API using that
and that was a really uh kind of the the
main advantage technical advantage that
we were getting was that that ability to
put sort of whatever it is that we
needed in those view models and have it
pretty much just work and even build in
some behavior and other stuff in those
it's also a cool nice I mean one of the
things that I didn't mention is we built
like sort of an SDK kind of thing so
that people can just write python code
and be able to upload and download data
sets so people who are you know you're
sort of like I did a python boot camp
and you know data scientists like wet
lab people
um
and and so it's nice being able we
connect we actually import The View
models into that and do to do vocal
validation and so there's some kind of
other nice features there so that's
that's I think the main thing
you have time for one more question
um uh the is the experimental data
consistent like is it like a
well-established file format for the
data Etc not at all not even close uh
one of the cool things about this
technology is that it's a very
versatile technology and anyone who's
interested in studying proteins whether
that's someone who's interested in
approaching engineering or someone who's
interested in clinical genetics or
someone who's interested in evolution
they're all converging on using this
technology and then they're publishing
their papers and so they're all coming
from different fields with different
backgrounds and different sort of data
conventions and data sharing conventions
and so it is a hot mess
and that's why it's even more important
to have a database that can put all this
stuff in one place so that then the
computer scientists can go there and not
have to learn all this different biology
to you know get it get it what they want
so and with that we're out of time we
would like to thank Alan again
[Applause]