Python

Generating Synthetic Genomic Data

Applying statistical methods is a large part of the work of a bioinformatician. Apart from some more classical techniques, machine learning algorithms are also regularly applied to clinical and biological data (notably, clustering techniques such as k-means). Some techniques such as artificial neural networks have recently found great success in areas such as image recognition and natural language processing. However, these techniques do not perform as well on small datasets with high dimensionality, a problem known as "the curse of dimensionality". [...]

By | 2017-04-29T23:00:58+00:00 January 7, 2016|Categories: Bioinformatics, Python|Tags: , |0 Comments

[Python] Iterators vs Generators

In Python, there are iterators and generators. You probably already use iterators without even knowing that you do so. But understanding the difference between those two concepts is really important since choosing one over the other has a huge impact on memory usage. If you are working with small datasets, memory usage might not be your first concern. However, with big datasets, it is another story. So what are they exactly, iterators and generators? Iterators The process of going through [...]

By | 2017-04-29T15:37:35+00:00 September 18, 2015|Categories: Performance, Python|0 Comments

Mutable Default Arguments in Python

A member of the platform recently stumbled upon a bug in his python code. Once we got to the bottom of it, we were surprised to find that the bug in question had been caused by a peculiar behavior of Python. Let's take the following code as example : def foo(bar=[]):     bar.append('a') return bar Intuitively, this piece of code might seem like it ought to return the list ['a'] whenever it is run. In practice, it is not quite so. >>>foo() [...]

By | 2017-05-01T09:53:39+00:00 August 7, 2015|Categories: Python|0 Comments

Put Those CPUs to Good Use !

If you're like me, you've probably noticed that, by default, the python scripts we write only use a portion of the processing power at our disposal.. As such, you've probably said to yourself: Hey, I paid good money for a quad-core CPU ! What's happening ? While it's true that nowadays, most CPUs are multi-core, the code we write must also be tailored appropriately in order to make use of more than one at a time. So let's dive into [...]

By | 2017-04-24T13:28:50+00:00 July 12, 2015|Categories: Performance, Python|Tags: |0 Comments

Be better at programming with static program analysis

- What is static program analysis ? Static program analysis allows the gathering of informations about the execution behaviour of your code without actually executing it. It is the opposite of dynamic program analysis (like debugging) which required the code to be executed. - Ok! But why should I use this in practice ? To save time by suppressing the save/execute cycles induced by syntax errors (missing ";", function or variable not initialized, typos, ...). Correcting these errors at the [...]

By | 2017-04-29T17:13:51+00:00 May 8, 2015|Categories: Performance, Python, R|Tags: , |0 Comments