Bioinformatics Analyst at Seven Bridges & PhD Student at METU


Bioinformatics, web programming, coding in general

Get Size of MySQL Databases

Use below query in MySQL command prompt to get a table of databases and their sizes in MB.

SELECT table_schema "DB Name", Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" FROM information_schema.tables GROUP BY table_schema;

Make a Shortcut for SSH Connections

Open ~/.ssh/config for editing:

subl ~/.ssh/config

Add your host definition as follows:

Host mistral
    HostName mistral.ii.metu.edu.tr
    User gbudak

MiClip 1.3 Installation

MiClip is a CLIP-seq data peak calling algorithm implemented in R but currently it doesn’t show up in the CRAN but you can obtain it from the archive and install from the source or tar.gz file.

Download the tar.gz file:

wget https://cran.r-project.org/src/contrib/Archive/MiClip/MiClip_1.3.tar.gz

Start R:


Install dependencies:


Finally install MiClip 1.3:

install.packages("MiClip_1.3.tar.gz", repos = NULL, type="source")

Then you can test it by loading the package and viewing its help file.

Running StarCluster Load Balancer in Background in Linux

StarCluster loadbalancer command is regularly monitors the jobs in queue and it adds or removes nodes to the master node that is created beforehand to effectively complete the queue.

To run in in the background without killing it when the terminal closed:

nohup starcluster loadbalance cluster_name >loadbalance.log 2>&1 &

or to keep standard output and standard error logs separate:

nohup starcluster loadbalance cluster_name > loadbalance.access.log 2> loadbalance.error.log &

This will start the process and output the process ID (PID) which can be used to check or kill it. Also, the standard outputs and errors will be written into loadbalance.log file in current home directory.

Processes in Linux can be obtained with following command in Terminal:


To kill a process:

kill <PID>

Change Apache’s Default User www-data or Home Directory /var/www/

I was getting errors from StarCluster run due to not being able to find .starcluster directory in /var/www/.

This directory has config file and log directories for StarCluster so without it, it can’t run.

To solve the issue, I set up my own user in Apache envvars instead of www-data which also changes default home directory to mine.

Edit following file with super user permissions:

sudo nano /etc/apache2/envvars

Enter your username to following lines and save:

export APACHE_RUN_USER=user
export APACHE_RUN_GROUP=user

Restart the server:

sudo service apache2 restart

Transfer Files to Your AWS S3 Storage in Linux

Download following tool and install:

cd ~/Downloads
git clone https://github.com/s3tools/s3cmd.git
cd s3cmd/
sudo python setup.py install

Next, execute following to create a configuration file to connect to your AWS S3 account:

s3cmd –configure

And finally use the following command to transfer any directory to your bucket:

s3cmd sync <path-to-folder> s3://<s3-bucket-name>

More on installation, setup and usage of s3cmd

ImportError: Reportlab Version 2.1+ is needed!

Little bug in xhtml2pdf version 0.0.5. To fix:

$ sudo nano /usr/local/lib/python2.7/dist-packages/xhtml2pdf/util.py

Change the following lines:

if not (reportlab.Version[0] == "2" and reportlab.Version[2] >= "1"):
    raise ImportError("Reportlab Version 2.1+ is needed!")

REPORTLAB22 = (reportlab.Version[0] == "2" and reportlab.Version[2] >= "2")

With these lines:

if not (reportlab.Version[:3] >= "2.1"):
    raise ImportError("Reportlab Version 2.1+ is needed!")

REPORTLAB22 = (reportlab.Version[:3] >= "2.1")