Python

To say "Hello world" in Python CGI Web Programming in 5 minutes

by Forrest Sheng Bao http://fsbao.net

I have lotta Python programs for bioinformatics research. I wanted to put them onto the web. I only developed Web apps in PHP before. And it seemed to be a big pain for porting a Python program to the web. But, I figured out in 5 minutes.

First, you need an Apache server on your Linux/Mac OS/Windows box. If you are gonna use data base, you need a database server. There are tons of blogs addressing these issues. So I won't be gossipy here. Suppose everything we mention below happens on your server-even web browsing.

enumerate() array elements rather than indexing them in Python

by Forrest Sheng Bao http://fsbao.net

Recently, I am debugging two Python programs about graphs. I get very confused in many times, whether I am visiting an array element or the index of the array element. For example, I need to get the vertex number by indexing an array, and use that vertex number to index another array.

So, my friend Lay Yuan in Arizona State University told me a trick, using enumerate() in Python. This makes things much much more easier. I guess you are smart enough so this example can explain every thing to you

>>> for i,arr in enumerate([6,3,2,3,4]):
...     print i, arr
...
0 6
1 3
2 2
3 3
4 4

Python editing and debugging on Linux

by Forrest Sheng Bao http://fsbao.net

Python is my favorite programming language. There are many Python editors, debuggers and IDEs. Some good editors/IDE are geditor(comes with Gnome desktop by default), SPE (Stani's Python Editor) and Eric. There is a debugger with GUI called Winpdb. The default debugger is IDLE, developed by Python Software Foundation.

No EOF(), the Python way

by Forrest Sheng Bao http://fsbao.net

Today, I was writing a program and gonna to find a function to detect whether EOF, the end of file marker, was reached. But I failed. Not such function in file I/O of Python. Then I did some googling and realized we don't need an EOF detection function. Take a look at this: http://groups.google.com/group/comp.lang.python/browse_thread/thread/ed25388487b3ac7b

Searching phased siRNAs from mapping result over genomes in linear (O(n)) time complexity

by Forrest Sheng Bao http://fsbao.net

In bioinformatics, we prefer constant or linear algorithms. The reason is obvious. But, sometimes, something strange just happened in some papers.

In 2006, Ho-Ming Chen, Yi-Hang Li and Shu-Hsing Wu published a paper on PNAS, "Bioinformatic prediction and experimental validation of a microRNA-directed tandem trans-acting siRNA cascade in Arabidopsis", http://www.pnas.org/content/104/9/3318.abstract.

Truncating siRNAs by 5' and 3' adapters and categorizing them

by Forrest Sheng Bao http://fsbao.net

Some genes in DNA sequences are very short, for example 15 bases. They are too short to sequence. So, we can add some adapters at 5' and 3' to extend it to 34 bases. Besides, we have a huge pool of sequences from different sources and we mixed them up for sequencing. So we can also use the adapter as an indicator to mark the source of the gene.

PyWavelets and pywfdb library for biomedical time series analysis

by Forrest Sheng Bao http://fsbao.net

I am so excited today that I have found a very cool Python library for doing wavelet decomposition, the PyWavelets. It is developed by Filip Wasilewski

Plotting in matplotlib/pylab

by Forrest Sheng Bao http://fsbao.net

I like Python, the simple but elegant syntax. I can't love any other programming languages more than Python. So I prefer to do my scientific computing in Python. I am very happy to find Numpy/SciPy package. matplotlib/pylab makes it possible for me to visualize my results. Neat!

Here is my first plotting script using matplotlib/pylab:

Python implementation of Nussinov Folding Algorithm for RNA Secondary Structure Prediction

#This software is a free software. 
#Thus, it is licensed under GNU General Public License.
#Python implementation to Nussinov Folding Algorithm 
#for Homework 7 of Bioinformatics class.
#Forrest Bao, Nov.  
Syndicate content