The Lab Notes
The main theme of our research is to understand how gene regulation and genome organization tie in with each other. The Lab Notes are the latest headlines from the lab, featuring a collection of random thoughts and useful code snippets.
Every now and then I need to make a rotating animation of a 3D plot. The R package
rgl turns out to have everything you need, but the grip is a little difficult. Below is an example that will walk you through the steps to make this animation.
First things first, you must make sure that
rgl is installed. On Unbuntu, you may also have to install additional libraries. And by the end, you will need to use
imagemagick, so at the shell command line you can issue
sudo apt-get install libglu1-mesa-dev
sudo apt-get install imagemagick
You can now start R. Since the package is on the CRAN, you can install it as usual.
For the purposes of this example, we create a random 3D cloud that consist of two Gaussian spheres next to each other.
# Distribute 1000 points at random among two spheres.
x <- matrix(rnorm(3000, mean=rep(c(0,2), each=1500)),
cols <- rep(c("dodgerblue4", "dodgerblue2"), each=500)
Now we plot the cloud in 3D and save the frames to different .png files. After the call to
plot3d you can resize the window...
Since the outbreak of AIDS more than 30 years ago in the United States, HIV/AIDS is still one of the top ten causes of death worldwide . One of the difficulties to cure HIV/AIDS is due to the lack of an effective HIV vaccine, although numerous laboratories are searching for it.
In 1995, David Ho first promoted a “hit hard, hit early” approach to eliminate HIV-1 infection in the early phase of the infection . Yet, later on this approach was abandoned because of the high risk of side effects and the high cost of the treatment, this approach is still a milestone in the history of HIV/AIDS treatment. Nowadays, the standard approach for HIV/AIDS treatment is based on the standard antiretroviral therapy (ART) combining at least three antiretroviral (ARV) drugs to maximally suppress the HIV virus and stop the progression of HIV disease. Typical combinations include 2 nucleoside Reverse Transcriptase Inhibitors (NRTIs) + 1 Protease Inhibitor (PI) or 2 NRTIs + 1 non-nucleoside Reverse Transcriptase Inhibitor (NNRTI) . Clinical studies showed that ART is able to impressively decrease the mortality of AIDS patients.
It was gradually realized that one of the main reasons...
For a long time I wondered how R was able to recognize gzipped files and decompress them on the fly. This is neat because the large data files that we manipulate in bio-informatics are better kept compressed on the disk and decompressed upon loading them in memory.
Most binary file formats start with a magic number, indicating which file type it is. A properly gzipped file starts with
1F8B. You need to read the first two bytes, and once you figure out whether the file is compressed, you either read the file as usual, or read it with the functions of the
Here I wrote a small module called
gzopen.py. After importing the class
gzopen, you can use it to seamlessly open gzipped files.
# -*- coding:utf-8 -*-
"""Generic opener that decompresses gzipped files
if needed. Encapsulates an open file or a GzipFile.
Use the same way you would use 'open()'.
def __init__(self, fname):
f = open(fname)
# Read magic number (the first 2 bytes) and rewind.
magic_number = f.read(2)
# Encapsulated 'self.f' is a file or a GzipFile.
if magic_number == '\x1f\x8b':
self.f = gzip...
I have been inspired to study virology by the movie Outbreak directed by Wolfgang Petersen in 1995. Since that time, I have been wondering how this tiny monster is so powerful as to bring disasters in our daily life. With this question always in the back of my mind, I walked into the world of microbes trying to reveal its mystery.
My current work in the laboratory is on the Human Immunodeficiency Virus type 1 (HIV-1), which causes Acquired Immuno-Deficiency Syndrome (AIDS). The phenomenon that most caught my attention is that HIV-1 is able to keep itself silent during the infection, which is called latency. Latent viruses are like a dormant volcano; they can be reactivated any time in favourable conditions. Therefore HIV-1-infected patients need to receive Highly Active Antiretroviral Therapy (HAART) with no interruption. Plasma virus rises within two to three weeks after discontinuation of HAART (from 20 to 50 RNA copies per mL, see Davey et al., 1999 for detail).
In order to be silent and invisible, HIV-1 needs secret places to hide and to make the infection persistent. Such special environments are called reservoirs, where viruses persist for longer...
Perhaps some of you have read my first post on The Grand Locus. That was already two years ago. Back then I was a beginner group leader. Back then I was enthusiastic. Back then I believed in openness.
Well, guess what, nothing has changed. I am still a beginner, I am still enthusiastic, and I still believe in openness. There will be blog, but this time I am not alone. I’ve got the most amazing team with me. So let’s get started with the Lab Notes.