logoruby


给方法传递参数,值传递(不改变自身) ,引用传递(改变自身)

Posted in css, education, 网球 by wanguan2000 on the 02月 19th, 2009

int是值传递(不改变自身) ,数组引用传递(改变自身)

C#

using System;
namespace Wrox.ProCSharp.ParameterTestSample
{
class ParameterTest
{
static void SomeFunction(int[] ints, int i)
{
ints[0] = 100;
i = 100;
}
public static int Main()
{
int i = 0;
int[] ints = {0,1,2,4,8};
Console.WriteLine(”i= ” + i);
Console.WriteLine(”Calling SomeFunction…”);

SomeFunction(ints, i);
Console.WriteLine(”i= ” + i);
Console.WriteLine(”ints[0] = ” + ints[0]);
return 0;
}

}

}

ruby中也一样:

class Apple

def method1(ints, i)

ints[0] = 100
i = 100
puts “xx”
end

def method2()
i =0
ints =[3,4,5]
puts i
puts ints
self.method1(ints, i)
puts i
puts ints
end
end

a = Apple.new()
a.method2()

评论关闭

Perl API Installation for Ensembl

Posted in bioinformatics, mysql, rails, 网球 by wanguan2000 on the 02月 12th, 2009

http://www.ensembl.org/info/data/ftp/index.html

http://hgdownload.cse.ucsc.edu/downloads.html

EnsEMBL 简介

[编辑] 主办机构

EnsEMBL是由Sanger中心EMBL-EBL共同维护的基因组注释系统。该项目的主要组织者就是BioPerl的元老Ewan Birney

[编辑] 目标

EnsEMBL力图实现以下目标:

  • 准确的基因组自动注释
  • 基于注释信息的全面分析
  • 向全世界公开发布注释与分析结果
  • 以开源合作的方式开发注释与分析所需要的软件(因为是E.B.在管,这里说的软件当然主要是基于Perl/BioPerl。另外这里说的软件仅能用于以EnsEMBL database格式存储的基因组信息)

[编辑] EnsEMBL Perl API 概述

[编辑] EnsEMBL Core

用于组织和分析:

  • 基因组的原始序列
  • 染色体名字等最高级的注释(Top-level annotation)
  • Gene,Transcript(mRNA/ncRNA等),Translation(peptide)的注释
  • microarray(芯片)探针对应的基因组位置的信息
  • 其它外部注释信息的链接(例如GO)

[编辑] EnsEMBL Compara

用于组织和分析:

  • 物种间的局部多序列比对结果
  • 共线性区(Synteny Region)的注释
  • 旁系同源(Paralogue)/直系同源(Orthologue)基因的注释
  • 蛋白家族的定义

[编辑] EnsEMBL Variation

用于组织和分析:

  • SNP(单核甘酸多态)/in-del/CNV等形式的variation注释
  • 群体/基因型/等位基因状态
  • 连锁不平衡信息

[编辑] EnsEMBL EST

软件上是和EnsEMBL Core一样的,只是数据不一样

[编辑] EnsEMBL Perl API 安装

[编辑] 安装BioPerl

需要先安装BioPerl(请参考BioPerl安装)

$ cvs -d :pserver:cvs@code.open-bio.org:/home/repository/bioperl login

Logging in to :pserver:cvs@code.open-bio.org:2401/home/repository/bioperl

CVS password: cvs

$ cvs -d :pserver:cvs@code.open-bio.org:/home/repository/bioperl checkout -r bioperl-release-1-2-3 bioperl-live

另外数据库(一般是MySQL)也是必需的

[编辑] 安装EnsEMBL的模块

文件会被安装到当前目录下

$ cvs -d :pserver:cvsuser@cvs.sanger.ac.uk:/cvsroot/ensembl login

Logging in to :pserver:cvsuser@cvs.sanger.ac.uk:2401/cvsroot/ensembl

CVS password: CVSUSER

$ cvs -d :pserver:cvsuser@cvs.sanger.ac.uk:/cvsroot/ensembl checkout -r branch-ensembl-45 ensembl

上面最后一行安装的是EnsEMBL Core,若需要安装EnsEMBL Variation,则需将最后的ensembl换成ensembl-variation,即:

$ cvs -d :pserver:cvsuser@cvs.sanger.ac.uk:/cvsroot/ensembl checkout -r branch-ensembl-45 ensembl-variation

[编辑] 设置环境变量

目的是让Perl可以找到相关模块:

PERL5LIB=${PERL5LIB}:/path/to/BioPerl/modules

PERL5LIB=${PERL5LIB}:/path/to/ensembl-core/modules

PERL5LIB=${PERL5LIB}:/path/to/ensembl-variation/modules

PERL5LIB=${PERL5LIB}:/path/to/ensembl-compara/modules

export PERL5LIB

请把”/path/to/BioPerl/modules”换成BioPerl模块实际安装的目录。同理,后面的”/path/to/ensembl-core/modules”等,也应该换成EnsEMBL模块实际安装的目录。

[编辑] 下载EnsEMBL数据库

该步不是必须的,本地化与否的优劣,请大家自己考虑。

请到EnsEMBL的FTP下载mysql数据库文件并导入本地mysql数据库,即可在本地使用EnsEMBL的数据。

注意:数据库很大,特别是EnsEMBL Compara。

[编辑] EnsEMBL Perl API 更新

EnsEMBL的数据和API的版本是一一对应的,数据更新过之后必须更新对应的API。用CVS可以很方便地更新,只需在模块安装的目录下运行:

cvs -q update -d -P -r branch-ensembl-45

[编辑] EnsEMBL Perl API 基本用法

要使用EnsEMBL的数据库,首先需要链接上数据库,由于EnsEMBL定义了很多对象及其Adaptor,所以提供了统一的 Bio::EnsEMBL::Registry模块来方便地获取这些Adaptor(曾几何时,要自己建DBAdaptor,然后再建对象的 Adaptor),同时可以避免建立多余的DBAdaptor。

  • 获取预设的数据库连接

use Bio::EnsEMBL::Registry;

my $registry = ‘Bio::EnsEMBL::Registry’;

$registry->load_registry_from_db(-host => ‘ensembldb.ensembl.org’,-user => ‘anonymous’);

  • 获取您所需要的注释信息

上面提到的所有注释信息都可以经由对应的对象的Adaptor获得,例如Gene:

my $gene_adaptor = $registry->get_adaptor( ‘Human’, ‘Core’, ‘Gene’ ); #获得GeneAdaptor对象,可用于读取人的EnsEMBL Core数据库内的信息

my $gene = $gene_adaptor->fetch_by_stable_id(”ENSG00000099889″); #获得一个基因序列及其他注释信息

又例如基因组片段(Slice):

my $slice_adaptor = $registry->get_adaptor(”Human”,”Core”,”Slice”);

my $slice = $slice_adaptor->fetch_by_region(”chromosome”,”14″,”5623425″,”5673425″); # 获得基因组上的一段序列

上面提到的基因组片段(Slice)还可以结合其他Adaptor,查找该片段上的任何注释信息(基因、Exon、多态、芯片探针、等等等等……)。

[编辑] 可以使用EnsEMBL的物种

目前只有部分物种有EnsEMBL化的注释系统:

Human 人 / Mouse 小鼠 / Zebrafish 斑马鱼 / C.elegans 秀丽隐杆线虫 / Cat 猫 / Chicken 鸡 / Chimpanzee 黑猩猩 / Cow 牛 / Dog 狗 / Elephant 象 / Fruitfly 果蝇 / Platypus 鸭嘴兽 / Rabbit 兔 / Rat 大鼠 / S.cerevisiae 酵母 , 等等(主要是动物)

Oryza sativa 栽培稻 / Oryza rufipogon 野生稻 / Zea mays 玉米 / Arabidopsis thaliana 拟南芥

Introduction

All data sets in the Ensembl system are stored in relational databases (MySQL). For each of the Ensembl databases the project provides a specific Perl API. As Ensembl takes also advantage of code provided by the BioPerl project; installation of the BioPerl package is included in these instructions.

Ensembl uses the Concurrent Versions System (CVS) for storing the source code and keeping track of source code revisions. This system will help you keeping up to date with developments and bug fixes. You will need CVS installed if you want to download Ensembl code. Graphical CVS clients are also available for Windows, e.g. WinCVS or TortoiseCVS.

If your computer system is protected by a firewall, this firewall needs to allow outgoing connections to TCP port 2401. There is also a web-based CVS repository, which allows you to download Unix tar archives in case CVS access through a firewall is not possible.

Installation Procedure

  1. Create an installation directory
    $ cd
    $ mkdir src
    $ cd src
  2. Log into the BioPerl CVS server (using a password of cvs):
    $ cvs -d :pserver:cvs@code.open-bio.org:/home/repository/bioperl login
    Logging in to :pserver:cvs@code.open-bio.org:2401/home/repository/bioperl
    CVS password: cvs
  3. Install BioPerl (version 1.2.3)
    $ cvs -d :pserver:cvs@code.open-bio.org:/home/repository/bioperl checkout -r bioperl-release-1-2-3 bioperl-live

    Important note: you must install version 1.2.3, not a more recent version. Starting with 1.2.4, major changes were made to the BioPerl API which have made it incompatible with Ensembl

  4. Log into the Ensembl CVS server at Sanger (using a password of CVSUSER):
    $ cvs -d :pserver:cvsuser@cvs.sanger.ac.uk:/cvsroot/ensembl login
    Logging in to :pserver:cvsuser@cvs.sanger.ac.uk:2401/cvsroot/ensembl
    CVS password: CVSUSER
  5. Install the Ensembl Core Perl API for version 52
    $ cvs -d :pserver:cvsuser@cvs.sanger.ac.uk:/cvsroot/ensembl checkout -r branch-ensembl-52 ensembl
  6. If required, install the Ensembl Variation Perl API for version 52
    $ cvs -d :pserver:cvsuser@cvs.sanger.ac.uk:/cvsroot/ensembl checkout -r branch-ensembl-52 ensembl-variation
  7. If required, install the Ensembl Functional Genomics Perl API for version 52
    $ cvs -d :pserver:cvsuser@cvs.sanger.ac.uk:/cvsroot/ensembl checkout -r branch-ensembl-52 ensembl-functgenomics
  8. If required, install the Ensembl Compara Perl API for verion 52
    $ cvs -d :pserver:cvsuser@cvs.sanger.ac.uk:/cvsroot/ensembl checkout -r branch-ensembl-52 ensembl-compara

    NB: You can install as many Ensembl APIs as you need in this way. To install all the APIs in one go, use the command:

    $ cvs -d :pserver:cvsuser@cvs.sanger.ac.uk:/cvsroot/ensembl checkout -r branch-ensembl-52 ensembl-api
  9. Set up your environmentYou have to tell Perl where to find the modules you just installed. You can do this by using the use lib clause in your script but if you want to make these modules available for all your scripts, the best way is to add them into the PERL5LIB environment variable.
    • Under bash, ksh, or any sh-derived shell:
      PERL5LIB=${PERL5LIB}:${HOME}/src/bioperl-live
      PERL5LIB=${PERL5LIB}:${HOME}/src/ensembl/modules
      PERL5LIB=${PERL5LIB}:${HOME}/src/ensembl-compara/modules
      export PERL5LIB
    • Under csh or tcsh:
      setenv PERL5LIB ${PERL5LIB}:${HOME}/src/bioperl-live
      setenv PERL5LIB ${PERL5LIB}:${HOME}/src/ensembl/modules
      setenv PERL5LIB ${PERL5LIB}:${HOME}/src/ensembl-compara/modules
    • Under Windows (assuming you installed the APIs in C:\src\):
      set PERL5LIB=C:\src\bioperl-live;C:\src\ensembl\modules;C:\src\ensembl-compara\modules

    NB: If you installed extra Ensembl APIs, don’t forget to add their path to the PERL5LIB environment variable.

Additional Tips for Windows users

  • You will of course need Perl installed to use the API! This is available free of charge from ActiveState.
  • You will also need to install the DBD::MySQL package using PPM (Perl Package Manager), a command-line tool which is bundled with ActivePerl.
  • If the existing mysql-driver (”libmysql.dll”) doesn’t work, replace it – e.g. with the one distributed with “php-5-2-3-win32-installer.msi”

Additional Modules

Additional modules for accessing GO data may be found here:

Update Procedure

In case you want to update the Perl APIs to a more recent version, keep in mind that the API and database versions must be identical; you can use a simple CVS command to achieve this.

  1. Change the working directory to the directory into which you originally installed the APIs.
    $ cd
    $ cd src
  2. For each of the APIs, change into its top-directory before issuing the CVS update command. So for the Ensembl Core API, which has been automatically installed into the ensembl directory use the following commands:
    $ cd ensembl
    $ cvs -q update -d -P -r branch-ensembl-52
    $ cd ..

    CVS will automatically add, modify or delete files so that your working directory will resemble the ensembl-branch you selected.

    In case you are asked for a password, repeat the login steps in the installation procedure above. (The password is normally stored in encrypted form in a file in your home directory and remembered between CVS operations.)

评论关闭

性价比高的网球品牌

Posted in 网球 by wanguan2000 on the 09月 12th, 2008

Bonny-波力
http://www.bonny.cn/

Teloon 天龙
http://www.teloon.com/

评论关闭