Wednesday, March 31, 2010

GSL :: Installation

GSL - GNU Scientific Libraries

Installation Steps:
$ wget http://gnu.tropicalnorthqueensland.com.au/gnu/gsl/gsl-1.14.tar.gz
$ tar zxvf gsl-1.14.tar.gz
$ cd gsl-1.14

$ ./configure
$ make
 
If you have sudo access, then
$ sudo make install

If you want it to be created in a local directory
$ make install DESTDIR=/path/to/directory/

On Ubuntu, 
$ sudo apt-get install gsl-bin



Saturday, March 27, 2010

Emacs :: Auto-save

To prevent Emacs from auto-saving and creating a backup file called file~

edit ~/.emacs

enter the line below
(setq make-backup-files nil) 

Wednesday, March 24, 2010

MySQL :: Warnings

Its always  a good idea to check the warnings.

mysql> show warnings;

Also make sure that above command is run right after the warnings, this will be rewritten after each command.

Tuesday, March 16, 2010

Ubuntu :: lenny :: install Java

Copy the lines below to /etc/apt/sources.list

Run the update
$ sudo apt-get update

Install Java
$ sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-jdk sun-java6-fonts

Check:
$ java -version
$ which javac




RDP :: Classifier :: Local Installation

Download RDP Classifier - 
http://sourceforge.net/projects/rdp-classifier/

Unzip the file
$ unzip rdp_classifier_2.1.zip

Move to the newly created directory
$ cd rdp_classifier_2.1

Execute Classifier
$ java -Xmx1g -jar rdp_classifier-2.1.jar -q queryfile -o outputfile.txt -f [allrank|fixrank|db]
- query file can be FASTA, Genbank or EMBL format
- outputfile.txt is the output file
- -f, --format all tab delimited output format: [allrank|fixrank|db]. Default is allrank.
allrank: outputs the results for all ranks applied for each sequence: seqname, orientation, taxon name, rank, conf, ...
fixrank: only outputs the results for fixed ranks in order: no rank, domain, phylum, class, order, family, genus
db: outputs the seqname, trainset_no, tax_id, conf. This is good for storing in a database

Thursday, March 11, 2010

Shell Script :: Remove empty lines

To empty lines from a file
$ sed '/^$/d' filename > filename.out; mv filename.out filename

- removes all blank lines in the file
- writes to another file called filename.out
- rename the filename.out as filename

Tuesday, March 9, 2010

BASH :: Set binaries in Home directory

Edit the file
$ vim ~/.bashrc
write the lines
PATH=$PATH:$HOME/bin
export PATH

restart the bash
$source ~/.bashrc

To check your current shell
$ echo $SHELL

If the current shell is not bash, it can be changed using
$ chsh
- enter password
- enter the path, usually /bin/bash

Log out and Log in.

Now go to home directory
- if the bin is already present skip the next command, else
$ mkdir bin
- now link a command to the binary
$ ln -s /path/to/the/binary binary_name

Sunday, March 7, 2010

RUBY :: Install gem

In Ruby, to search for a specific gem in the local machine
$ gem list
- this will list the local gems

To search for a specific gem remotely
$ gem query --remote --name-matches <search_name>
- this lists the gems that matches the search_name

Select the gem to install
$ gem install <search_name>

Check: find the installed gem in the local list

Saturday, March 6, 2010

Linux :: Server 32-bit or 64-bit

To check the kernel version
$ uname -a
Linux server_name 2.6.26-2-686 #1 SMP Fri Aug 14 01:27:18 UTC 2009 i686 GNU/Linux
- if it is *.686 then it is 32-bit
- if it is *.x86_64 then it is 64-bit

Friday, March 5, 2010

MySQL :: Create user

To create user
mysql> create user <username> identified by '<password>'

Then grant privileges
mysql> grant select, insert, update, delete, create, drop on <database_name>.* to '<username>'@'<mysql_host>';
or 
mysql> grant all privileges on <database_name>.* to '<username>'@'<mysql_host>';

MySQL :: Backup and Restore

To backup the database
$ mysqldump -u user -p backup.sql

or To backup specific tables from the database
$ mysqldump -u -p [table1 table2 ..] > backup.sql

or To backup set of databases
$ mysqldump -u user -p --databases [database_name database_name ..] >backup.sql

or To backup all databases
$ mysqldump -u user -p --all-databases > backup.sql

or To backup only the structure of the MySQL database, with no data
$ mysqldump -u user -p --no-data --databases [..] > backup.sql

or To zip the MySQL data
$ mysqldump -u user -p --all-databases | gzip > backup.sql.gz

-------------
To restore a database from backup.sql
$ mysql -u user -p < backup.sql

To restore all databases from backup.sql
$ mysql -u user -p < backup.sql

or Restore from a conpressed file
$ gzip | backup.sql.gz > mysql -u user -p

Linux :: Adding User

To add a person outside U,
$ adduser <username>

- enter a temporary password
- enter other details

To provide SSH access to user, add the username in sshd_config file
$ vim /etc/ssh/sshd_config
go to the line saying 'AllowUsers' and add user
AllowUsers root
<username>

restart the sshd daemon
$ /etc/init.d/ssh restart

CHECK:
Login using the username and password, to check whether is works

ERROR:
- check the log file in /var/log/auth.log

Mothur :: interactive command

Mothur is downloaded and stored in a file
/path/to/Mothur/

After, 'make' the binary for calling mothur is in
/path/to/Mothur/Mothur.source/mothur

To execute this command from any folder, provide a soft link to the folder in /usr/local/bin/
$ ln -s /path/to/Mothur/Mothur-source/mothur mothur

To confirm the setup
$ which mothur
/usr/local/bin/mothur

mothur command can now be run from any folder.

Thursday, March 4, 2010

Mothur :: Local Installation

On Ubuntu
$ wget http://www.mothur.org/w/images/2/2b/Mothur.source.zip
- This is latest version of Mothur as i write

$ unzip Mothur.source.zip
$ cd Mothur.source
$ make

If problem, usually readline error
- check if readline is installed,
$ dpkg -l | grep readline
- readline-common is not the one we are looking
- it must be libreadline5 or libreadline5-dev
- install these packages
$ sudo apt-get install libreadline5-dev

if NO problem, start the mothur package
$ ./mothur

if there is a make problem, enter a line
-lncurses\
in the makefile 

Ubuntu :: SSHFS

Find out more about this
- this will help mount the remote filesystem
- work on the files at local machine

https://help.ubuntu.com/community/SSHFS