2008-07-29

Dr. Randy Pausch has left us

by Forrest Sheng Bao http://fsbao.net

My friends, do you still remember a professor giving us a "Last Lecture" last September about his childhood dreams and his research? Do you still remember he said "We cannot change the cards we are dealt, just how we play the hand"? Do you still remember that you were shocked by his speech video on YouTube as millions of people around the globe? I just got the news on Monday morning that Dr. Randy Pausch has left us last Friday, of complications from pancreatic cancer.

Many people ask me why I love USA so much. Well, I think one major reason is because I love heroes and this land loves heroes too. He fought with pancreatic cancer and left us "an enduring legacy", as said on the special webpage for him by Carnegie Mellon University. http://www.cmu.edu/randyslecture/

Dr. Randy Pausch is a former professor of School of Computer Science, Carnegie Mellon University. He is a pioneer in virtual reality and an ACM (Association for Computing Machineries) fellow, which is the world's highest honor in Computer Science field. But I think the highest honor for him, should be "a hero" or "an American hero".

Pancreatic cancer took his life but never beat him. When he got the bad news that he had pancreatic cancer, he was happy that he could be the 20% patients who can be cured by surgeries. Later, he tried an experimental treatment of 45% chance to save his life. He never gave up fighting with the cancer and lasted about 2 years - while doctors assessed he could only live 6 months.

He made every last minute of his life benefit the world. He gave us a "Last Lecture" about his childhood dreams and how he did research to make the dream true. Millions of people were enlightened by his speech from YouTube around the world. He helped a non-profit organizations to fight with pancreatic cancer and testified before US congress and asked for more support to the research on pancreatic cancer. What he did, saved and will save our life.

Did he leave us? Well, he left us an enduring legacy, his words, his philosophy, his work for advancing the research on pancreatic cancer and the most important, the courage to face against difficulties. Just as the famous quote in "The Old Man and The Sea", "A man can be destroyed but not defeated".

Here are several legacies he left us:
  1. His homepage: http://download.srv.cs.cmu.edu/~pausch/ You can find his Powerpoint slides of his last lecture and transcripts there.
  2. Special webpage made by CMU for him: http://www.cmu.edu/randyslecture/ You can order DVDs of his last lecture in $7, including all fees.
  3. Video of his "Last Lecture": http://www.youtube.com/watch?v=ji5_MqicxSo
  4. His lecture "Time Management": http://video.google.com/videoplay?docid=-5784740380335567758
  5. His book: "The Last Lecture": http://www.thelastlecture.com/
And here are some organizations he mentioned to continue our fight against cancer:
  1. Pancreatic Cancer Action Network: http://www.pancan.org/
  2. Lustgarten Foundation: http://www.lustgarten.org/
Maybe we can do something to support them.

Here is all what I wanna say. There is a group on Facebook called "Randy Pausch is my hero!" I joined it and became a fan of Dr. Pausch. I just wanna say it again: Dr. Pausch, you are my hero!

2008-07-20

Apple iBook G3 500Mhz, 128 MB memory, 12-inch LCD, running Xubuntu Linux 7.04

by Forrest Sheng Bao http://fsbao.net

I have a neighbor called Jordan. He gave me an Apple laptop for free last week. This is an old iBook, made in 2002. The CPU is very poor, G3 500Mhz. It even doesn't have a DVD drive. So it is impossible to install Mac OS X onto it. But, don't panic. Linux, the most powerful operating system in the world, gives me an ultimate solution to rock this old brick.

I tried Ubuntu 7.10 and 8.04. But they couldn't sport my LCD out-of-the-box. Maybe the LCD is too old, 800x600 resolution. Anyway, Xubuntu 7.04 could work on it out-of-the-box. Another concern of mine to using Xubuntu is coz Xfce is more thin than Gnome on this laptop with only 128MB memory.

The installation is pretty easy. Since it has only 10G hard drive, I just let Ubuntu automatically partition. Though this laptop has no Apple Airport and I don't wanna burn my wallet on an Airport card, Xubuntu 7.04 supports my Linksys WUSB54GC out-of-the-box. Xfce desktop takes only 78MB memory space. But I can run web browser, email client, instant messenger, music player, and even Python interpreter to run my computing program. Great! i could take this laptop everywhere and write down my ideas in Abiword, a light word processing software. Openoffice is too bulky. And, the battery is still good - with 4-hour life time after fully charging. The laptop could suspend if I close the book and will wake up after I open it up. Plus, the Apple logo light and power indicator near the lock work fine.

Apple computers are of great design. You don't need to loose a dozen of screws to upgrade your memory. Just flip your keyboard. See that illustration on the back of the keyboard?

If you look at the fancy Xfce login interface, you wouldn't feel that you are using an old laptop.

Logitech QuickCam Communicate MP Plus on Ubuntu Linux 7.10/8.04

by Forrest Sheng Bao http://fsbao.net

The QuickCam Communicate MP Plus (USB ID number: 046d:09a1) is supported by uvcvideo project. Thus, it could work with Linux without any problem. But Ubuntu 7.10/8.04 doesn't support it out of the box, maybe because they didn't come with the latest version of uvcvideo.

So, a five-minute work is needed to rock the webcam.

  1. Download the latest uvcvideo driver by executing
    svn checkout svn://svn.berlios.de/linux-uvc/linux-uvc/trunk
    Then you should see a new folder called trunk under current working directory. Enter that folder.
  2. Compile the driver. Please make sure that you have installed the Linux kernel source code before doing so.
    forrest@dolphin:~/trunk$ make
    Building USB Video Class driver...
    make[1]: Entering directory `/usr/src/linux-headers-2.6.22-15-generic'
    CC [M] /home/forrest/trunk/uvc_driver.o
    LD [M] /home/forrest/trunk/uvcvideo.o
    Building modules, stage 2.
    MODPOST 1 modules
    LD [M] /home/forrest/trunk/uvcvideo.ko
    make[1]: Leaving directory `/usr/src/linux-headers-2.6.22-15-generic'
  3. I found the sudo make install doesn't work. So, go to the directory containing old uvcvideo driver and replace the old kernel module (on my computer, it is /lib/modules/2.6.22-15-generic/ubuntu/media/usbvideo/uvcvideo.ko ) by the new uvcvideo.ko under your current working directory. It would be better to backup the old uvcvideo.ko before overwriting. For example, I did:
    sudo mv /lib/modules/2.6.22-15-generic/ubuntu/media/usbvideo/uvcvideo.ko /lib/modules/2.6.22-15-generic/ubuntu/media/usbvideo/uvcvideo-bakcup.ko
    sudo cp uvcvideo.ko /lib/modules/2.6.22-15-generic/ubuntu/media/usbvideo/uvcvideo.ko
  4. Remove the old kernel module and load the new one.
    sudo modprobe -r uvcvideo
    sudo modprobe uvcvideo
  5. Then you can test it by any webcam capture problem, for example, the cheese or camstream, or Skype. When capturing video, the green indication LED on the webcam will be on. The snd_usb_audio module should support the building microphone of the webcam out-of-the-box.

If you have any problem, don't hesitate to bother me.

2008-07-16

Linksys WUSB54GC on Mac OS 10.4

by Forrest Sheng Bao http://fsbao.net

I just a got an eMac with only $20. It comes with Ubuntu 6.06 for PowerPC. Well, Ubuntu doesn't support PowerPC Mac anymore, only ports for PowerPC Mac and IBM PowerPC/Cell servers. No, I don't like them. It wastes me almost one day to make it work, including copying the xorg.conf of OpenSuSE to my Ubuntu on PowerPC. But, the Ubuntu still couldn't start X. SuSE is so stupid and slowly. I don't like it either.

So, I decided to return to Mac OS. I have no Ethernet at home, but a free Wi-Fi. Then I gotta make my USB wireless network adapter work. Here is how to make it:
  1. Download the driver: http://www.ralinktech.com.tw/data/RTUSB%20D70-1.1.3.0%20D71W-1.1.7.0%20UI-1.3.0.0_2006_11_10.dmg
  2. Install it as usual
  3. cd /System/Library/Extensions/RT2500USBWirelessDriver.kext/Contents/
  4. sudo vi Info.plist
  5. Edit any key like this (Blogger filtered all XML tags) :
    http://forums.macrumors.com/showthread.php?t=235917


  6. Save the file and do like these last two steps:
es112:/System/Library/Extensions/RT2500USBWirelessDriver.kext/Contents forrest$ sudo /usr/sbin/kextcache -k /System/Library/Extensions
es112:/System/Library/Extensions/RT2500USBWirelessDriver.kext/Contents forrest$ sudo kextload /System/Library/Extensions/RT2500USBWirelessDriver.kext/
kextload: /System/Library/Extensions/RT2500USBWirelessDriver.kext/ loaded successfully
Then plug the USB wireless adapter and you will find a network interface.

But I still don't know how to set WEP keys on Mac OS X. Could someone help me?

2008-07-07

No EOF(), the Python way

by Forrest Sheng Bao http://fsbao.net

Today, I was writing a program and gonna 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 that 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

If you try to read some stuff, but you get nothing, then you have reached the EOF. Stupid and simple, ah?

My program now looks like:

while True:
testline = f.readline()
if len(testline) ==0:
break # EOF
#do some other stuff
According to Python documents, I don't think I need to do this when using readline() function, because "Read until EOF using readline() and return a list containing the lines thus read". http://docs.python.org/lib/bltin-file-objects.html

2008-07-05

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.

They used a p-test to find potential areas with phased siRNAs, small RNAs that are successive to each other. I think this is rather an inefficient way. First, the genome of Arabidopsis is not quite long, 100 million nucleotides, not 1 billion nts. If you could develop an O(n) algorithm, considering the high speed of contemporary computers, it's a snap. Second, I am not quite sure about the accuracy of their algorithm.

I think the precise search would also work and very easy. For example, if you wanna know whether the 21-nt siRNA starting from i-th nt succeeds 21-nt siRNA starting from i-21-th nt , just search whether the later siRNA can be mapped on to the Arabidopsis genome, while the mapping data is already available. The time complexity of worst case is O(n), where n is the length of the genome. Plus, my algorithm has nothing to do how many successive siRNAs you wanna find. I can tell you all cases in an O(n) run.

I think their algorithm is inaccuracy, coz it's just a prediction, and not of linear time complexity. I really got confused why they develop an sophisticated and inaccurate algorithm with higher time complexity. Just simple search is ok. Take a look at their code. It's not simple, right? http://www.pnas.org/content/104/9/3318/suppl/DC1#SC.

Of course, the mapping data format is the same as mentioned in that PNAS paper. The start position of each small RNA signature in terms of coordinate, and strand (1: Watson; -1: Crick) which are separated by Tab as shown below.

# 11927 -1 TGGCGATGATGATCAAT
# 28152 1 CATCCTTCGATGTTGTG
# 42408 1 CTCTTAGCTAAGAGCCA

Here comes my code. You can save it as phase.py and run it as

python phase.py test.csv 21
after downloading the test later.
#This software is a free software.
#Thus, it is licensed under GNU General Public License.
#Forrest Bao, Dept. of Computer Science/Electrical Engineering, Texas Tech University
#Jul. 5, 2008 <> <>

# to find phased small RNAs
# run it in "phase.siRNA" folder as python phase.siRNA sense_WT_TMV_21.csv 21
# last modified Jul. 5

import string,os
from os.path import *
from numpy import *
from pylab import *
import cPickle

f1=open(sys.argv[1], 'r')
pool=[]
totalseq = 0;
for line in f1.readlines():
pool.append(line.split());
f1.close()

count = list(pool)
for i in xrange(0,len(count)):
count[i].append(0);

for i in xrange(len(pool)-1,-1,-1):
k = int(pool[i][1])
phase = int(sys.argv[2]);
for j in xrange(i-1,i-phase-1,-1): # fixed time loop, $phase times
if k-phase == int(pool[j][1]):
count[j][3]+=count[i][3]+1

output='siRNA\t\tlocation\tstrand\tphase\n'
for i in xrange(0,len(count)):
if count[i][3]>0:
output+=pool[i][0]+'\t'+pool[i][1]+'\t'+pool[i][2]+'\t'+str(count[i][3])+'\n'

print output

And this is my test data, please save the data as test.csv.

ACGTCACCCTTACGGATTTAC 6134 -1
TTTACGTCACCCTTACGGATT 6137 -1
TAATTTGGTTTACGTCACCCT 6145 -1
TTACGTAATTTGGTTTACGTC 6150 -1
ACATTACGTAATTTGGTTTAC 6153 -1
AACATTACGTAATTTGGTTTA 6154 -1
AAACATTACGTAATTTGGTTT 6155 -1
TCGATTTAAATGGAACCTAAA 6174 -1
TTCGATTTAAATGGAACCTAA 6175 -1
TTTCGATTTAAATGGAACCTA 6176 -1
AGGTTTCGATTTAAATGGAAC 6179 -1
ACAGGTTTCGATTTAAATGGA 6181 -1
TCCAGGAAATAACAGGTTTCG 6192 -1
GTTAACAGGTGATCCAGGAAA 6204 -1
CGTTAACAGGTGATCCAGGAA 6205 -1
CGCGTACGTTAACAGGTGATC 6211 -1
ACGCCACGCGTACGTTAACAG 6217 -1
TACGCCACGCGTACGTTAACA 6218 -1
TGTAATATACGCCACGCGTAC 6225 -1
CCCACTGTAATATACGCCACG 6230 -1
AGTTATTCCCACTGTAATATA 6237 -1
TAGTTATTCCCACTGTAATAT 6238 -1
TTAGTTATTCCCACTGTAATA 6239 -1
CACTTTTAGTTATTCCCACTG 6244 -1
AGGATTCGAACCTCTCACTTT 6259 -1
GAGGATTCGAACCTCTCACTT 6260 -1
Comments are welcomed. I will write a short article to arXiv later.

2008-07-03

Deploying LAMP on Ubuntu Linux from apt-get

by Forrest Sheng Bao http://fsbao.net

Validated on Ubuntu 8.04.

  1. sudo apt-get install apache2 php5 libapache2-mod-php5 php5-mysql mysql-server php5-gd opensshd
  2. edit /etc/apache2/sites-available/default
  3. sudo a2enmod rewrite
  4. vim /etc/apache2/sites-available/default and set AllowOverride all
  5. restart Apache: sudo apachectl -k graceful
  6. test
  7. mysql -u root -p
  8. mysql> create database drupal character set utf8 collate utf8_general_ci ;
    Query OK, 1 row affected (0.00 sec)
  9. mysql> use drupal
  10. mysql> grant all on drupal.* to 'xxx'@'localhost' identified by 'YYYYYYYY';