Sunday, August 14, 2011

Trying Ubuntu Linux (5)

The project I had yesterday (here) was to set up my server (Apache) in Linux under VirtualBox so that it is visible from the host (OS X Lion). I solved that eventually by sticking with NAT mode and issuing this command in Terminal (with Ubuntu powered down):

VBoxManage modifyvm Ubuntu --natpf1 "server,tcp,,8080,,8080"

This is exactly what the docs say to do. The extra twist was to modify /etc/apache2/ports.conf to add:

NameVirtualHost *:8080
Listen 8080


and to modify /etc/apache2/sites-available/default. I basically duplicated the whole <VirtualHost entry and changed the second part to read:

<VirtualHost *:8080>
..

And now it works. From the host in Safari or using curl in Terminal:

http://127.0.0.1:8080/cgi-bin/test.py

SERVER_SOFTWARE Apache/2.2.17 (Ubuntu)
SCRIPT_NAME /cgi-bin/test.py
SERVER_SIGNATURE
Apache/2.2.17 (Ubuntu) Server at localhost Port 8080
REQUEST_METHOD GET
SERVER_PROTOCOL HTTP/1.1
QUERY_STRING
..
HTTP_USER_AGENT Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7) AppleWebKit/534.48.3 (KHTML, like Gecko) Version/5.1 Safari/534.48.3
HTTP_CONNECTION keep-alive
SERVER_NAME localhost
..
SERVER_PORT 8080
..
SERVER_ADMIN webmaster@localhost
HTTP_HOST localhost:8080
REQUEST_URI /cgi-bin/test.py
HTTP_ACCEPT text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
GATEWAY_INTERFACE CGI/1.1
..
HTTP_ACCEPT_LANGUAGE en-us
HTTP_ACCEPT_ENCODING gzip, deflate



The other thing I've done today is to install EMBOSS and PyCogent.

sudo apt-get install emboss

How easy is that! The rebase files are at

http://rebase.neb.com/rebase/rebase.files.html

We want # 5 and # 31 as described. chmod for the EMBOSS directories so we can write there:

sudo chmod 777 -R /usr/share/EMBOSS
rebaseextract


tell it where the files are, and it'll do its thing.

head -5 /usr/share/EMBOSS/data/REBASE/embossre.enz > cat

# REBASE enzyme patterns for EMBOSS
#
# Format:
# namepatternlenncutsbluntc1c2c3c4
#


put a sequence file DA19.txt on the Desktop

remap -sequence DA19.txt

DA19


SgeI
| PcsI
SgeI | SgeI
Cac8I | NspI | | SgeI HindIII
| PcsI Cac8I | SgeI | | | SgeI | Cac8I
\ \ \ \ \ \ \ \ \ \ \
GACGAACGCTGGCGGCGTGCTTAACACATGCAAGTCGAACGGAGCGAATGAAAGCTTGCT

..


[ UPDATE: Something wrong with the formatting here. The HindIII site, AAGCTT, is at the far right. ]

Get Cython:

sudo apt-get install cython

Get Pycogent from http://sourceforge.net/projects/pycogent/:

tar -xzvf ~/Downloads/PyCogent-1.5.1.tgz
python setup.py build
sudo python setup.py install


I tested Pocogent by downloading sequences and making a phylogenetic tree as described here (I had to install a MUSCLE binary first). I pasted the source into four scripts.

Not exactly as before, but it looks reasonable.



No comments: