Creating the Meta4 Amazon Machine Image (AMI)

The Meta4 AMI (ami-46687f32) was set up very quickly from a basic Ubuntu Server 12.04.1 LTS amazon image.  If you intend to simply use the Meta4 AMI, then you don't need to read this document; this is just a record of how the AMI was set up, in case you wish to replicate the process elsewhere.

If you're not sure how to work with Amazon, try the links here and here.

1. Setting up the Linux environment

The Ubuntu Server 12.04.1 LTS initial log-in is "ubuntu".  When logged in as "ubuntu":

# act as the root user
sudo -i

# update the install repos
apt-get update

# install apache web-server
apt-get install apache2

# install PHP and a range of libraries
apt-get install php5 libapache2-mod-php5 php5-ps php5-mysql php5-imagick php5-mysql php5-dev

# install MySQL
apt-get install mysql-server #enter password

# install Perl libraries
apt-get install libbio-graphics-perl bioperl bioperl-run libsoap-lite-perl 
apt-get install libio-string-perl libdbi-perl libdbd-mysql-perl libhtml-table-perl

# install git
apt-get install git

# restart the apache server
/etc/init.d/apache2 restart

So the Linux environment is now set up.

2. Setting up the simple Meta4 example

We can now get on with setting up the basic Meta4 example:

# first off clone the latest code
git clone https://github.com/mw55309/meta4.git

# create a MySQL database.  Use the password you set previously
mysqladmin -u root -p create meta4

# enter the MySQL client
mysql -u root -p

        # within MySQL
        # create read and write accounts
        grant all on meta4.* to 'writeaccount'@'localhost' identified by 'writepass';
        grant select on meta4.* to 'readaccount'@'localhost' identified by 'readpass';
        exit

# create the database structure
mysql -u root -p meta4 < meta4/sql/meta4.mysql.sql

# edit meta4/scripts/META4DB.pm
# should be fairly obvious - need to enter the write account details

# cycle through the example data in this order
perl meta4/scripts/load_SAMPLE.pl --name 'An example sample' \
                                  --desc 'Meta4 example sample'

perl meta4/scripts/load_ASSEMBLY.pl --sample_id 1 \
                                    --assembly_params meta4/examples/assembly_parameters.txt \
                                    --desc 'SOAPdenovo assembly'

perl meta4/scripts/load_CONTIG.pl --assembly_id 1 \
                                  --file meta4/examples/contigs.fasta

perl meta4/scripts/load_PREDICTIONS.pl --assembly_id 1 \
                                       --gff meta4/examples/predictions.gff \
                                       --nucfile meta4/examples/nucs_out.fasta \
                                       --profile meta4/examples/prots_out.fasta

perl meta4/scripts/load_DOMAINDB.pl --name Pfam-A \
                                    --version 26.0 \
                                    --file Pfam-A.hmm \
                                    --desc 'Pfam-A version 26.0'

perl meta4/scripts/load_DOMAINS.pl --domain_db_id 1 \
                                   --file meta4/examples/domains_hit.txt

perl meta4/scripts/load_PFAMSCAN.pl --domain_db_id 1 \
                                    --assembly_id 1 \
                                    --file meta4/examples/pfam_scan.out

# copy the web-scripts over to cgi-bin
# make sure they are executable by the apache user
sudo cp meta4/cgi_scripts/* /usr/lib/cgi-bin/

# edit the web META4DB.pm
# this needs to be readable and executable by the apache user
# put only the read account details in here.
# edit the CSS if you must...
sudo vi /usr/lib/cgi-bin/META4DB.pm

Navigate to http://yourserver/cgi-bin/meta4.cgi

Enjoy!

Questions and comments to: mick.watson@roslin.ed.ac.uk