Tuesday, 16 February 2016

Folding proteins with a fractal

Yesterday I posted about the fractal algorithm adapted to function optimising, the test I showed was nice, but dealing with a 2D function is not so great if you plan to go big.

After that Guillem forgot to go home and stayed coding a little more at the office. This morning the algorithm was able to load test proteins and try to fold them by minimising the Lennard-Jones potential of the cluster. He sleept in the sofa!

Here you see it folding a 5 atoms "protein":

It was intially able to deal with only 5 atoms proteins, so we spent the day adapting the algorithm to this new problem, and after everything seemed to be in the right place the fractal can now easily find the optimum folding of a 11 atoms test protein in about 10 minutes (the code is running on only one core of an intel i7 by now).

The progression of the error (in those cases the optimum folding and its potential is public) is fantastic at first glance and we plan to check some more complicated molecules tomorrow.

The key here is that this fractal algorithm can be greatly improved by making it to run parallelized over a cuda GPU, so this boost in speed could allow us to fold medium sized proteins on a standard PC some near future. Porting it to Tensor Flow will be mandatory.

In the video above, on the top you see a couple of 2D projections of the molecule. In red, the known best positions, in blue, actual best found. Red starts will be taken away in next video because only distances are important, not the absolute positions, so blues never go on top of reds anyhow.

Bottom left you see the error in orders of magnitud, so when it get to -6 error is about 0.000001.

And now the 11 atoms example:

Before going nuts with tensor flow we will continue a little more by adding more atoms just to find out how well it scales up, but folding 11 atoms is actually a hard challenge as you need to optimise a 11x3 = 33 dimensions -and quite complicated- real function.

I can not resist showing you a couple of shoots of the "folding protein" process:

Guillem with his face of molecule folding kid

Sergio drawing fractals while Guillem does the actual work


  1. Sergio, if you are thinking about TensorFlow, I could help you. I've been developing now for a while in this framework. You just tell me :).


    1. I already counted on you, Samu ;-) ...but we are still developing different algorithm ideas before focusing on the speed, we only use one core, any modern phone would outperform us!