首先下载并安装GO::TermFinder
perl -MCPAN -e shell
cpan> install GO::TermFinder
安装完成之后,至example下载GoView.conf, *.pl,以及examples.html文件。其实这些也已经安装在了本机,你也可以在安装目录下找到。
这里主要介绍使用batchGOView.pl来直接生成报告文件。我们先看一眼batchGoView.pl的原代码。
#读取配置文件 my $confFile = shift; my $conf = &ReadConfFile($confFile); #依据配置文件高置参数 my $ontology = GO::OntologyProvider::OboParser->new(ontologyFile => $conf->{'ontologyFile'}, aspect => $conf->{'aspect'}); my $annotation = GO::AnnotationProvider::AnnotationParser->new(annotationFile=>$conf->{'annotationFile'}); …… my $termFinder = GO::TermFinder->new(annotationProvider=> $annotation, ontologyProvider => $ontology, aspect => $conf->{'aspect'}, @additionalArgs); #生成报告文件 my $report = GO::TermFinderReport::Html->new(); &GenerateFrameset;#报告文件规范 …… #依次读取文件并分析 foreach my $file (@ARGV){ print "Analyzing $file\n"; # 从文件中读取基因列表,从这个命令中我们可以看出,基因文件的格式必须是每行一个基因名这样的格式,中间无空行。 my @genes = GenesFromFile($file); # 进行从基因名到GO名目的映射。 my @pvalues = $termFinder->findTerms(genes => \@genes, calculateFDR => $conf->{'calculateFDR'}); # 调用GO::View module来生成报告所需的图片。 my $goView = GO::View->new(-ontologyProvider => $ontology, -annotationProvider => $annotation, -termFinder => \@pvalues, -aspect => $conf->{'aspect'}, -configFile => $confFile, -imageDir => $conf->{'outDir'}, -imageLabel => "Batch GO::View", -nodeUrl => $conf->{'goidUrl'}, -geneUrl => $conf->{'geneUrl'}, -pvalueCutOff => $conf->{'pvalueCutOff'}); # 而后将这些结果整合到html中来,以便查看。 my $imageFile; if ($goView->graph) { $imageFile = $goView->showGraph; } my $htmlFile = &GenerateHTMLFile($file, $goView->imageMap, \@pvalues, scalar($termFinder->genesDatabaseIds), "Terms for $file"); print $listFh a({-href => $htmlFile, -target => 'result'}, $htmlFile), br; } ……
[......]
有人问我能不能把多显示分辨率设置软件修改成非交互式的,而是直接接受参数的那种,好用于无人干预条件下。我想这个建议不错。
于是基于之前《基于对话框的Window扩展显示器软件》及《
修改显示器分辨率的小软件 》基础上,稍加修改,写了这个可以工作于windows xp下的dos命令。
立即下载:ouMulScr
使用方法:
- 关闭扩展桌面:ouMulScr 0
- 开启扩展桌面:[......]
首先声明,这里并不是我用perl来写个算法。如果需要算法相关的东西,得去看文献。
这里,其实只是借对格兰氏阳性细菌蛋白质定位的预测为例,来说明如何利用他人提供的在线查询功能来实现批处理。
假设现在有一个完整的基因组需要您去预测它当中的每一个开放阅读框翻译出来的蛋白质可能的细胞内定位,怎么办呢?手工一个一个提交到网站上去?一共会有四五千个蛋白,等你提交完,你的手和大脑都会不工作了吧?要不自己下载个软件来本地预测吧?我试过去安装那些要求的软件环境,也许是我的系统过新吧,一个c语言库的版本,一个g77让我就头大得不知道该怎么继续下去。于是我还是下定决心,用perl的lwp来伪装成浏览器提交申请,自动批处理吧。也许一觉醒来,全部都做完了。
我们要用到的网站是http://www.psort.org/psortb/。据网站上宣传,Based on a study last performed in 2010, PSORTb v3.0.2 is the most precise bacterial localization prediction tool available. 第二个原因就是can currently submit one or more Gram-positive or Gram-negative bacterial sequences or archaeal sequences in FASTA format。这对于研究格兰氏阳性菌的我来说的确很不错的网站。
最基本的,用lwp来虚拟提交一份表单上去:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #!/usr/bin/perl use LWP::UserAgent; $ua = LWP::UserAgent->new; $ua->agent("Mozilla 8.0 beta"); use HTTP::Request::Common qw(POST); my $req = (POST 'http://www.psort.org/psortb/results.pl', ["seq" => ">$genes{name}\n$genes{translation}", "organism" => "bacteria", "gram"=>"positive", "advancedgram"=>"none", "format"=>"long", "sendresults"=>"display"); $request = $ua->request($req); print $request->as_string; |
结果得到的,怎么都是500 Internal Server Error。于是在网上狂google,也没有找到直接的答案。半夜两点,突然想起,为什么不自己想法来解决问题。于是开始用tcpdump抓包,对比从firefox发送出去的包和perl发送出去的包,具体看看有什么不同。[......]
当我们在使用statusnet当中的google map时,发现那个放大缩小的level条不见了。这样很不方便使用。加上它其实并不难。打开\plugins\Mapstraction\js\mxn.google.core.js文件,在原代码:
1 2 3 4 5 6 7 8 9 10 11 12 | mxn.register('google', { Mapstraction: { init: function(element,api) { var me = this; if (GMap2) { if (GBrowserIsCompatible()) { this.maps[api] = new GMap2(element); GEvent.addListener(this.maps[api], 'click', function(marker,location) { ... |
改变为:
dd3902ca5bc5ad5eec3e1f9d5f45193[......]
上次介绍的荧光按钮其实是其于这一次的代码基础上加上了背景特效而已。那么一个漂亮的CSS3按钮应该如何实现呢?
其实很简单。首先确定按钮风格。CSS3的色彩模式为RGBA,RGB大家都很熟悉,A呢其实就是透明度。看代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | .button, .button:visited { background: #222 url(overlay.png) repeat-x; display: inline-block; padding: 5px 10px 6px; color: #fff; text-decoration: none; -moz-border-radius: 6px; -webkit-border-radius: 6px; -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.6); -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.6); text-shadow: 0 -1px 1px rgba(0,0,0,0.25); border-bottom: 1px solid rgba(0,0,0,0.25); position: relative; cursor: pointer } |
然后确定按钮的大小。分成small, medium 和 large。
dd3902ca5[......]
在safari 4以上的效果最好,FireFox 3.5效果一般。
我们在wordpress控制台编写表格时,常常会觉着它很丑。如果使用的模板本身不带有表单模板的话,那显示起来就会更丑,就会象下面这个表单这个样子。
| 列一 | 项二 | 项三 | 项四 | |
| 行一 | 人 | 有 | 的 | 和 |
| 行二 | 产 | 不 | 为 | 这 |
| 行三 | 要 | 在 | 地 | 一 |
| 行四 | 是 | 中 | 国 | ; |
| 行五 | 以 | 发 | 了 | 民 |
为了让表单书写起来更轻松,并且阅读起来更漂亮,我介绍一种一劳永逸的办法给大家。这个办法还包括九种非常漂亮的表格样式。比如:
| 列一 | 项二 | 项三 | 项四 | |
| 行一 | 人 | 有 | 的 | 和 |
| 行二 | 产 | 不 | 为 | 这 |
| 行三 | 要 | 在 | 地 | 一 |
| 行四 | 是 | 中 | 国 | ; |
| 行五 | 以 | 发 | 了 | 民 |
首先我们来看一眼九种漂亮的表单的样式:
[......]

近期评论