hello again ubuntu

我接触的第一个linux发行版就是基于ubuntu的Macbuntu,那时候还是10.04的时代,后来自己不小心弄坏了MBR,连Windows也进不去,捉了不少难,好在从此学会PE重建主引导的方法。之后进转投Fedora,直到现在又用回ubuntu。

最主要的原因就是受够了Fedora那难看的字体,而从一开始ubuntu给我的印象就是漂亮,比windows漂亮,至于Mac吗,还没用过暂不置评。放弃Fedora还有一个原因是yum包管理也开始觉得不爽,每次我要search install软件,都要先更新下,前天安装HTSeq又遇到更新源频频出问题,慢的叫人抓狂。

转到ubuntu之后,顺便也把博客从octopress迁移到hexo。octopress是基于ruby的,而hexo基于node,速度比前者明显快多了,随着博客文章越来越多,我越来越在意这种差别。最后,把用到过得几个命令记下来:

  • source somefile reload the file,but only affect current session, will lose when restart terminal
  • dpkg -i xxx.deb install xxx soft which is in ubuntu deb format
  • nvm use version num use the specified version of node nvm ls list all installed versions of node

EOF

use KOBAS to identify enriched pathways

看着手里公司做好的KEGG富集列表,总想自己试试看自己能做怎么样。之前想着自己用python写个脚本来做,开始写才发现,这活不是一个几行脚本能搞定的,不过发现了keggrest package,一个实现了KEGG API的好东西,基本上get link list都有了。今天发现了KOBAS,才知道国人已经为傻瓜化KEGG注释搭建web server.我要做的就是把合适的基因号导入,然后run就行了。

###ID prepare
我的基因号现在形如:

  • AT1G01170
  • AT1G01480
  • AT1G01490

我要把它转为:

  • ath:AT1G01170
  • ath:AT1G01480
  • ath:AT1G01490
  • ath:AT1G01610

tophat install and usage note

###install tophat

I got our RNA-seq all data a couple of days ago, after playing with python keggrest package grabing KEGG anotaion data some while, I decided to try installing tophat on my PC and run mapping with real project data.

Generally just follow the instructions on tophat’s offical page is enough. Some points are listed below:

  • bowtie. Download and unpack the latest bowtie2, copy it to somewhere you wish, and most importanly add ‘bowtie2’ ‘bowtie2-build’ and ‘bowtie2-inspect’ to your $PATH like this: export PATH=$PATH:/home/popcui/bio/bowtie* A better way to do this is echo previous command to ‘~/.bashrc’

  • You can either download the precompiled binary release which is more convinent but mybe a little bit slow, or you build tophat from source. And before that, you need to install SAM tools

  • SAM tools. First download SAM tools, then make it(you may want to check the INSTALL file for more info) You can add make razip option note: do not forget to add copy SAM tools misc bcftools to a path you wish and add it to your $PATH.

Now if everything is OK, download the test data and fire up tophat on it to make sure all work as expected.

###prepare your reference

If you have bowtie2 installed and want to use it with tophat2, you must create Bowtie2 indexes for your data using Bowtie2-build. For me, as I already have ref.gtf and ref.fa in hand, all I need to do is bowtie2-build ./rna-data/ref.fa ./bt2/ref.fa Reference genome .fa file comes first, and the indexes I want to build will be saved to ‘./bt2/ref.fa’

Now we have everything ready, let’s begin mapping right away.tophat2 -p 4 -G ./rna-data/ref.gtf -o col_th ./bt2/ref.fa ./rna-data/Col_0.clean.fq ‘-p’ specify the number of threads you want to use, since I have an i3-380 cpu which support virtual threading, I use 4 cpus.’-G’ stands for genes and transcripts anotation. ‘-o’ obviously imply the path you want to have output files saved, then comes reference genome file and input clean data.

how to get help on python console

  • help(argument) where the argument maybe the module, object, class, method name you are intrested, of course you may need first to import it if it is a module or an object that comes with a module.
  • dir(argument) similar with previous help() function, the difference is dir() display short message than help() does. Also, you can do this help(dir) to check out dir() usage.
  • the previous two functions applies to all platforms,now comes another tip which works on unix-like machine: pydoc -k keyword.

And as always, you can google it, if those tricks don’t satisfy you.

apple new ad

##apple wwdc 2013 keynote

###beginning declaration:

if everyone is busy making something, how can anyone perfect anything? We start to confuse convenience with joy,abundance with choice, designing something requires focus. The first thing we ask is: what do we want people to feel? Delight/surprise/love/connection, then we begin to craft around our intention, it takes time, there are a thousand nos for every yes. We simplify, we perfect, we start over, until every idea we touch enhances each life it touches, only then do we sign our work.

closing ad:

This is it, this is what matters—the experience of our product. How it make someone feel? Will it make life better? Does it deserve to exist? We spend a lot of time on the feel of great things, until every idea we touch enhances each life it touches. You may rarely look at it, but you always feel it. This is our signature, and it means everything.

这个广告给人感觉 Tim Cook掌舵之下的苹果不再那么激进,少了”think different”那样的凌厉,锐不可当的气势,‘You can quote them, disagree with them, glorify or vilify them. About the only thing you can’t do is ignore them’取而代之的是一种胜券在握的淡定从容。的确,成长为市值最高的科技的苹果也需要这种转变,过去是适应规则,而今是指定推广标准了。

think different ad

more vim

如果觉得昨天的vim学完后,不过瘾,这里还有几个好玩儿的命令。

  • :!ls 不退出当前编辑页面情况下执行ls命令。这ls可换成其他任意一个shell命令,这个在调试程序的时候经常用到,比如我改了一个地方,接着想看看执行情况,就可以这样。
  • 导航 h l j k 分别是左移动,右移动,下移动一行,上移动一行;n + shift g移动到第n行 shift g不加行号,默认移动到末行; ctrl g显示当前正在编辑的文件名,光标所在行号; gg移动到首行 G移动到末行。
  • 编辑 dd删除当前行 dd n往下删除n行 yy n往下复制n行 p讲粘帖板内容插入到当前行下面,o当前行下面插入一个空行并进入编辑模式 O当前行的**上面 **插入一行并进入编辑模式。
  • :split txt2 分出一个窗口并打开文件’txt2’,ctrl w可以在两个窗口间跳转。

此外还有,单个字符替换,单个词的删除,以及从当前位置删除到行首或行尾等也经常用到。比较新的linux发行版会附带一个vim教程’vimtutor’,让你通过操作学习使用vim.

windows下怎样安装R包

不管是看书还是讲R的ppt提到安装R包,都很简单:install.packages("package name")。可是在windows下试过之后,就会知道,安装目录下的library不可写,R程序会提示你使用一个自定义的library,会让你选‘是’还是‘否’,于是选是,下载完包之后,用lib("package name")加载一下,发现找不到前面安装的包,反复试过都是这样。

搜索一下,发现我们需要人工建一个library,然后告诉R这个library的位置。这里有操作说明。其实就是配置一个叫’R_LIBS’的环境变量。然后在安装,lib("package name")加载,都没问题了。

TED talks:10 top time-saving tech tips

今天看到David Pogue在TED关于节省时间技巧的演讲,转述到这里,顺便加上我自己平时使用的技巧。

web

  • space => scroll down one page
  • shift + space => scroll up one page
  • ctrl + + => 放大显示文本
  • ctrl + - => 缩小显示文本

###more than that
you can use these with any web browser, if you use ‘vimperater’ or ‘vimium’, you can throw away mouse when surfing the internet. Or you can use shortcuts listed below if you don’t want to learn to use above extensions.

'R in action' note0

##Getting help

1
2
3
4
5
6
help.start()  #fire up general help
help("function name") #usage about a function
help(package="package name") #list index of functions and
#datasets in a package
?function name # eq to help("function name")
??string #search for 'string' in docs

packages

1
2
3
4
5
6
installed.packages() #list all installed packages
install.packages() #install a package, if no package name given
#you'll be prompted to select a mirror site and
#then select a package in a list
lib(package name) #load a custom package. If the package is installed by you
#you need to load it tell R to load it first before using it

##file manipulation

1
2
3
4
5
6
getwd() #get current working directory
setwd() #set current working directory. Note the dir path should be given
#as "F:/R/project/somewhere" instead of
#using back slash(used for escaping)
dir.create("path/dir name") #create a dir. But you may find no function
#such as dir.remove() or dir.delete() here :-)

At last, if you find some piece of code in this book not running in wondows version R, you should try it out in unix version before considering it a mistake.

a laborious solution for 'asms missing' when installing wondows xp sp3

朋友公司发福利, 每人一台acer D271上网本,打电话告诉我啥系统也木有,让我帮忙装各xp.拿到手里一看,确实挺薄。拿出u盘,开工。

我用的YUMI制作多启动u盘。安装程序拷贝完文件,重启就遇到问题了,”需要cd上的asms”,上网搜,微软给的解释在这里.原因是安装程序无法与CD-ROM通讯。给的解决方法试过之后,没效果。注册表编辑器打不开。短时间内又找不到一个新的Ghost盘,win pe也试过,还是不行。

我的笨办法是,在另一台电脑上,把.iso文件解压缩,将‘I386’文件夹拷贝到u盘,然后。。。是的,提示缺哪个文件,就手工定位到u盘上述目录,起先我还怕会有很多文件要这样弄,装完之后发现也不是很多。

安装过程熟悉了dos的切换目录命令:’cd’

1
2
3
4
 
cd # display current working directory eq to 'chdir'
cd /? #show help info about 'cd' also can be used with other commands
cd /D D:\ # change dir to D drive

不得不说:

  • acer也太不厚道了,你节省成本可以理解,但是至少也弄一个带图形桌面的linux发行版吧,弄一个只有命令行的linux来凑数对用户不负责。
  • 还在固守win xp的人们,今天离xp 停止支持还有332天,朋友这台本,acer 官网上没有提供xp的驱动了。