Creative Commons License
This blog by Tommy Tang is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

My github papge

Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Wednesday, August 21, 2013

install GIMP 2.8 in Ubuntu 12.04

I was trying to make some figures, and google told me GIMP is a very popular software as an alternative to Photoshop.

Ubuntu 12.04 has GIMP 2.6 installed. To update to GIMP 2.8, follow the instructions here:
http://www.maketecheasier.com/upgrade-to-gimp-2-8-in-ubuntu/2012/05/04

and install the plugins:
http://www.webupd8.org/2013/02/gimp-284-released-install-it-in-ubuntu.html

It takes long time to make a good-looking figure.
I will write a post to demonstrate how to make a heatmap by R next time.

Saturday, July 20, 2013

install bioawk in unbuntu

Bioawk is written by Heng Li, and it can handle formats like:
bed:
     1:chrom 2:start 3:end 4:name 5:score 6:strand 7:thickstart 8:thickend 9:rgb 10:blockcount 11:blocksizes 12:blockstarts
sam:
    1:qname 2:flag 3:rname 4:pos 5:mapq 6:cigar 7:rnext 8:pnext 9:tlen 10:seq 11:qual
vcf:
    1:chrom 2:pos 3:id 4:ref 5:alt 6:qual 7:filter 8:info
gff:
    1:seqname 2:source 3:feature 4:start 5:end 6:score 7:filter 8:strand 9:group 10:attribute
fastx: 1:name 2:seq 3:qual 4:comment

 I followed the tutorial here https://github.com/vsbuffalo/bioawk-tutorial

my first try did not work

tommy@tommy-ThinkPad-T420:~$ git clone git://github.com/lh3/bioawk.git && cd bioawk && make && mv awk bioawk && sudo cp bioawk /usr/local/bin/
Cloning into 'bioawk'...
remote: Counting objects: 163, done.
remote: Compressing objects: 100% (89/89), done.
remote: Total 163 (delta 95), reused 136 (delta 74)
Receiving objects: 100% (163/163), 112.32 KiB, done.
Resolving deltas: 100% (95/95), done.
yacc -d awkgram.y
make: yacc: Command not found
make: *** [ytab.o] Error 127


It looks like I do not have  yacc or bison (the GNU
equivalent) installed.

tommy@tommy-ThinkPad-T420:~/bioawk$ sudo synaptic

search yacc, and install the bison.

after that, it worked.

tommy@tommy-ThinkPad-T420:~/bioawk$ bioawk
usage: bioawk [-F fs] [-v var=value] [-c fmt] [-H] [-f progfile | 'prog'] [file ...]

a quick tutorial for git:
https://github.com/vsbuffalo/git-demo



ubuntu 12.04 networking restart

If I suspend my computer at school, I can not connect to the internet when I get home. I searched on line and found the command at terminal:
 /etc/init.d/networking start

but it did not work, it says the command is deprecated....

Instead, type

tommy@tommy-ThinkPad-T420:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:21:cc:71:ab:50  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:20 Memory:f2500000-f2520000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:3526 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3526 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:440923 (440.9 KB)  TX bytes:440923 (440.9 KB)

wlan0     Link encap:Ethernet  HWaddr 60:d8:19:c7:42:9b  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:238663 errors:0 dropped:0 overruns:0 frame:0
          TX packets:168877 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:310906582 (310.9 MB)  TX bytes:20035785 (20.0 MB)

tommy@tommy-ThinkPad-T420:~$ sudo ifconfig wlan0 down
[sudo] password for tommy: 
tommy@tommy-ThinkPad-T420:~$ sudo ifconfig wlan0 up

Now, I had no problem! Thanks to my roommate YuRen!

Monday, July 1, 2013

book recommendation: Sed & Awk 101 Hacks

I highly recommend this book for text manipulation
http://www.thegeekstuff.com/sed-awk-101-hacks-ebook/

Through my limited experience of "bioinformatics", I realized that we spend a lot of time to reformat the data ( mostly in txt format) to some other formats which can be fed into other programs.
python has a very good re (regular expression) module for that purpose, but I do like the one liner of Sed and Awk. Sometimes, I am just too lazy to write something like:

ifile = open(<filename>)

for line in ifile:
    do some parse

ifile.close()


because Sed and Awk read file line by line, execute the command for one line, and then process the next line, it is very concise without writing the explicit for loops.

This book is very comprehensive and has a lot of practical examples making you follow easily. I just finished Chapter 5 and I found it is really helpful, although I had some experience with sed and awk.

Wednesday, May 29, 2013

Run APE plasmid editor in linux

I used to like APE on windows.  I want to run it on linux (ubuntu 12.04 LTS) also.

A quick google search:
http://www.allandebono.org/ubuntu,ape/plasmid-editor/


I followed the instruction.

first download the APE for linux here http://biologylabs.utah.edu/jorgensen/wayned/ape/Download/

unzip it, you will find two folders, one for Linux, the other one for Mac_OS

copy the "APE linux" folder to  your home directory:  /home/tommy/APE_linux.    I rename it as APE_linux, as linux "hates" the empty space.

cd  /usr/bin
ls tclsh8.5

if you see it is there, you are fine. otherwise you have to install it:

sudo apt-get install tk8.5 tcl8.5

tclsh8.5 /home/tommy/APE_linux/AppMain.tcl







Saturday, March 30, 2013

check file and folder size in linux


How to check file and folder size
http://www.cyberciti.biz/faq/how-do-i-find-the-largest-filesdirectories-on-a-linuxunixbsd-filesystem/


How do I find the largest top files and directories on a Linux or Unix like operating systems?

Sometime it is necessary to find out what file(s) or directories are eating up all your disk space. Further, it may be necessary to find out it at the particular location such as /tmp or /var or /home.
There is no simple command available to find out the largest files/directories on a Linux/UNIX/BSD filesystem. However, combination of following three commands (using pipes) you can easily find out list of largest files:
  • du : Estimate file space usage.
  • sort : Sort lines of text files or given input data.
  • head : Output the first part of files i.e. to display first 10 largest file.
Type the following command at the shell prompt to find out top 10 largest file/directories:
# du -a /var | sort -n -r | head -n 10
Output:
1008372 /var
313236  /var/www
253964  /var/log
192544  /var/lib
152628  /var/spool
152508  /var/spool/squid
136524  /var/spool/squid/00
95736   /var/log/mrtg.log
74688   /var/log/squid
62544   /var/cache
If you want more human readable output try:
$ cd /path/to/some/where
$ du -hsx * | sort -rh | head -10

Where,
  • du command -h option : display sizes in human readable format (e.g., 1K, 234M, 2G).
  • du command -s option : show only a total for each argument (summary).
  • du command -x option : skip directories on different file systems.
  • sort command -r option : reverse the result of comparisons.
  • sort command -h option : compare human readable numbers. This is GNU sort specific option only.
  • head command -10 OR -n 10 option : show the first 10 lines.
The above command will only work of GNU/sort is installed. Other Unix like operating system should use the following version (see comments below):
 
for i in G M K; do du -ah | grep [0-9]$i | sort -nr -k 1; done | head -n 11
 
Updated for accuracy!