When coding, I typically have a purpose – usually a project surrounding my Fpnotebook site. But projects with a purpose often drag on, hit frustrating road blocks and often lack a firm endpoint. As much as I like writing code, side projects can become just one more task on the burner.
I do not do crosswords or Sudoko, but I can understand the passion for conquering a finite puzzle; short coding tasks and exercises are my Crossword. This past year I completed a Data Science certification from Microsoft (more on this in a forth coming post), and that involved quite a string of exercises and puzzles over the 9 course curriculum. Even this though, was coding for a purpose (certification) and I was glad to be done with it. At times, I’ve done coding puzzles on Project Euler or Hacker Rank, but the problems are often generic.
So I was glad to recently find Rosalind, coding puzzles specific to bioinformatics. The problems start simply (e.g. calculating a count of DNA nucleotides) and quickly advance to more complex problems (e.g. calculating population growth using variants of the Fibonacci sequence to take into account clutch size). I had no idea Fibonacci had more use than a cliche coding problem; one of its original 1100 AD uses was to calculate Rabbit colony population growth.
You are given a description for each coding puzzle and sample data with associated sample solutions. You can use this to create a coding solution. When you are ready for the test data, click a button and a text file is downloaded; five minutes is all you have to submit the solution from that point. I exceeded this a few times for some of the problems, since some non-optimized solutions take far more than 5 minutes to complete. For example, I had to memoize my Fibonacci sequence generator to get a result in time.
One problem I found challenging (factoring in population growth along with a death rate after a given life span), required subtracting a Fibonacci sequence (offset by a given life span) from the population count.
I use Python in Anaconda Jupyter Notebooks to code the problems. This makes set-up completely painless for more simple problem. However, for more complex problems, I want intellisense, and use Visual Code and Visual Studio.
If you are a Bio-geek who likes to code, Rosalind is one more way to procrastinate on your other tasks with a purpose.