14
Open-Bio BOF 2004 at GIW2004 Open-Bio BOF 2004 at GIW2004 Biopython Biopython Python Python のご紹介 のご紹介 Yasushi MASUDA Yasushi MASUDA ymasuda at cubelab.com ymasuda at cubelab.com

Open bio2004 biopython

  • Upload
    -

  • View
    223

  • Download
    0

Embed Size (px)

Citation preview

Open-Bio BOF 2004 at GIW2004Open-Bio BOF 2004 at GIW2004

BiopythonBiopython と と Python Python のご紹介 のご紹介

Yasushi MASUDA Yasushi MASUDA ymasuda at cubelab.comymasuda at cubelab.com

Open-Bio BOF 2004 at GIW2004Open-Bio BOF 2004 at GIW2004

プログラミング言語 プログラミング言語 PythonPython

– (Perl (Perl や や Ruby Ruby のようなのような ) ) スクリプト言語スクリプト言語– 1990 1990 年ごろから開発,安定したリリース年ごろから開発,安定したリリース– トリッキーな言語機能より読みやすさ優先トリッキーな言語機能より読みやすさ優先– C/C++ C/C++ ライブラリの組み込みが容易ライブラリの組み込みが容易– (( 最近は最近は ) ) 和文ドキュメントが充実している和文ドキュメントが充実している

Python Homehttp://python.org/

PyJUG (Japanese UG)http://python.jp/

def xpdlist(fname): f = open(fname, 'r') ret = [] for i in f.readlines(): si = i.strip() if len(si)>0: ret.append(si) return ret

Open-Bio BOF 2004 at GIW2004Open-Bio BOF 2004 at GIW2004

バイオインフォマティクスと バイオインフォマティクスと Python (1/3)Python (1/3)

日々の雑用をこなす日々の雑用をこなす– csvcsv ,, XML XML データの読み書き データの読み書き (csv, xml)(csv, xml)– パーザの構築 パーザの構築 (formatter, re)(formatter, re)– ディレクトリツリー単位の反復処理,ディレクトリツリー単位の反復処理, zip/tar zip/tar

の読み書きの読み書き(os.path, zipfile, tarfile)(os.path, zipfile, tarfile)

– HTTP HTTP や や FTP FTP からの反復ダウンロードからの反復ダウンロード(urllib, ftplib)(urllib, ftplib)

Open-Bio BOF 2004 at GIW2004Open-Bio BOF 2004 at GIW2004

バイオインフォマティクスと バイオインフォマティクスと Python (2/3)Python (2/3)

DB DB サービスの構築サービスの構築– DBMS DBMS

(PostgreSQL(PostgreSQL ,, MySQLMySQL ,, OracleOracle ,, etc...) etc...) ややファイルベースファイルベース DB (Access, FileMaker) DB (Access, FileMaker) の操の操作作CGI CGI インタフェースの開発 インタフェースの開発 (cgi, httpserver)(cgi, httpserver)

XPAK (appeared in GIW2000, Python+PostgreSQL+Python Imaging Library)

Open-Bio BOF 2004 at GIW2004Open-Bio BOF 2004 at GIW2004

バイオインフォマティクスと バイオインフォマティクスと Python (3/3)Python (3/3)

データの解析や表示データの解析や表示– CC ライブラリでの数値計算 ライブラリでの数値計算

(Numeric/numarray)(Numeric/numarray)– 画像処理/グラフ化 画像処理/グラフ化 (PIL, (PIL,

matplotlib etc)matplotlib etc)– クロスプラットフォームなクロスプラットフォームな

GUI GUI アプリケーションのアプリケーションの開発開発(Tkinter, PyQt, wxPython, (Tkinter, PyQt, wxPython, etc.)etc.)Spherical Som visualization (Python+

wxPython+VTK, not publ ished)

BL-SOM visualizat ion (Python +Tk+DDBJ ClastalX, not publ ished)

Open-Bio BOF 2004 at GIW2004Open-Bio BOF 2004 at GIW2004

BioPython BioPython プロジェクトプロジェクト

Jeffrey Chang, Andrew Dalke Jeffrey Chang, Andrew Dalke (Aug 1999)(Aug 1999)

The Biopython Project The Biopython Project (http://www.biopython.org/) is a (http://www.biopython.org/) is a new open collaborative effort to new open collaborative effort to develop develop freely available Python libraries and applications and applications that that address the needs of current address the needs of current and future work in and future work in bioinformatics, including bioinformatics, including sequence analysissequence analysis, , structural structural biologybiology, , pathwayspathways, , expression expression datadata, etc., etc.

Biopython projecthttp://www.biopython.org/

Open-Bio BOF 2004 at GIW2004Open-Bio BOF 2004 at GIW2004

Biopython Biopython の機能 の機能 (1/2)(1/2)

配列情報の操作配列情報の操作– 相補鎖,転写,翻訳相補鎖,転写,翻訳

データファイルの解釈データファイルの解釈– CDD, ECell, EMBL, Enzyme, FASTA, GenBank, CDD, ECell, EMBL, Enzyme, FASTA, GenBank,

NCBI Geo, Gobase, MASE, MetaTool, InterPro, NCBI Geo, Gobase, MASE, MetaTool, InterPro, Kabat, KEGG, LocusLink, NBRF/PIR, Affymetirx Cel, Kabat, KEGG, LocusLink, NBRF/PIR, Affymetirx Cel, NDB, PDB, Prosite, Rebase, SAF, SwissProt, etc..NDB, PDB, Prosite, Rebase, SAF, SwissProt, etc..

WebWeb サービスへのアクセスサービスへのアクセス– NCBI (Entrez, BLAST, PubMed), Swiss-Prot, ExPASyNCBI (Entrez, BLAST, PubMed), Swiss-Prot, ExPASy

スタンドアロンプログラムへのアクセススタンドアロンプログラムへのアクセス– BLAST, Clustalw, EMBOSS, SVM etc...BLAST, Clustalw, EMBOSS, SVM etc...

Open-Bio BOF 2004 at GIW2004Open-Bio BOF 2004 at GIW2004

Biopython Biopython の機能 の機能 (2/2)(2/2)

汎用の解析アルゴリズ汎用の解析アルゴリズム実装ム実装

GA, HMM, k-Means, k-GA, HMM, k-Means, k-NN, naive Bayes, ANN, NN, naive Bayes, ANN, pairwise alignment, SVDpairwise alignment, SVD

お絵かきツールお絵かきツール– Cromosome, PathwayCromosome, Pathway

SQL DB SQL DB との連携との連携– BioSQL: Biopython BioSQL: Biopython のオのオ

ブジェクトを ブジェクトを DB DB 化化

Random ly generated O rganism

UQ 4NXT

54T S Z K

UZ 4XA V

0

R68Y 2I

M 39HF O

EE CG 5U

VM 8F 1S

IV 3NN8

1

N9VT BA

6E LX N7

M P O 9Y4

Q Q 6J1I

5X 9G SJ

G Y 9PX U

9HAG T P

E IY 7I M

3P BNQ W

2

CLHNRO

Z P AJI3

O 0CKI P

K 3Z K 3L

F JI45X

W 2V JA S

Z F Z 7E L

Q J59T A

Y 8F T E I

M DQ H0N

3

62DL32

5DLO HN

4

1P1RBS

4RHM P M

5EJ805

6B9Z JF

T P IW E F

VT 87Y0

VW 661T

DF M F 1J

YV NO O D

YK 2XZ B

Q Z ISI 9

7VK XF Q

CF V JA 2

0ECQ Q R

5

DNS K 0B

Z A3F 8B

6

E H9K P 3

B S 1I JK

1HBHJ1

K Z 5B 3S

7

5M 591W

249M 2S

Z RA0S Z

O UW Q 7O

VE O HC5

W T 0O 6V

Z 21G 1G

M O EV P S

W L57C8

G R8E T H

VS 6SRL

9RX E9K

8

J35A Q M

8KZ 6U4

J6T W U1

XV T 8O F

9

6IO O 5T

V F 3M M 6

Z M O Y M J

NB21C9

LO P C2G

R3DG B 6

O 8RF UJ

NLJK 4R

B 5E HV0

E RI M 5R

6T RIE Z

DAY 5UM

7M 5V LZ

N5Z DJ8

Q X 9O T 5

10

A A C4M Y

B UAJG A

11

HE 9J8D

T 4S M DH

XL62P V

EP BW V J

JHQ 81D

1W E P DH

A26W 4D

G HY 7T Y

8K F 62S

Q JEV 1P

12

Open-Bio BOF 2004 at GIW2004Open-Bio BOF 2004 at GIW2004

いいところばかりではありませんいいところばかりではありません

ドキュメントの整備がいまひとつドキュメントの整備がいまひとつ– 各機能の説明がソースコードにしかない各機能の説明がソースコードにしかない– 入門者向けの機能網羅的な文書がない入門者向けの機能網羅的な文書がない⇒⇒   もっとドキュメントの充実と整理を!もっとドキュメントの充実と整理を!

コア開発者のアクティビティコア開発者のアクティビティ– 進学,就職などで手が離せない 進学,就職などで手が離せない (( らしいらしい ))– メンテナンスの停止しているモジュールがあるメンテナンスの停止しているモジュールがある⇒⇒   現在,メンテナンス体制を見直し中現在,メンテナンス体制を見直し中

Open-Bio BOF 2004 at GIW2004Open-Bio BOF 2004 at GIW2004

情報源とコミュニティ情報源とコミュニティ

公式ページ公式ページ– http://www.biopython.org/http://www.biopython.org/– ダウンロード,マニュアルなどダウンロード,マニュアルなど

メイリングリストメイリングリスト– ユーザユーザ : [email protected]: [email protected]– 開発開発 : [email protected]: [email protected]

和訳マニュアル和訳マニュアル– http://www.cubelab.com/ymasuda/python/biopython/http://www.cubelab.com/ymasuda/python/biopython/– 坂井俊哉氏,石田貴士氏,増田により翻訳坂井俊哉氏,石田貴士氏,増田により翻訳– 日本語のメイリングリスト,コミュニティページ日本語のメイリングリスト,コミュニティページ ......

はまだはまだ (( 必要ですか?必要ですか? ))

Open-Bio BOF 2004 at GIW2004Open-Bio BOF 2004 at GIW2004

まとめまとめ

Biopython Biopython には魅力的な機能が一杯ですには魅力的な機能が一杯です..

ぜひぜひ Biopython Biopython にトライしてみてくださにトライしてみてください.い.

Biopython Biopython ははあなたを求めていますあなたを求めています !!!!!!

Open-Bio BOF 2004 at GIW2004Open-Bio BOF 2004 at GIW2004

例題 例題 (1/2)(1/2)from Bio.WWW import NCBI# NCBI にクエリを出すres = NCBI.query('Search', 'PubMed',   term='BioPython',doptcmdl='Summary')# 結果を読み出してファイルに保存of = open('outfile.html', 'wb')of.write(res.read())of.close()# ブラウザで表示import webbrowserwebbrowser.open('outfile.html')

Open-Bio BOF 2004 at GIW2004Open-Bio BOF 2004 at GIW2004

例題 例題 (2/2)(2/2)

['15336256', '15221224', '15210717', '15186836', '15161048', '15141082', '15133320', '15133034',...'6263546', '7426031', '6774736', '229857', '4992780', '5273780']['Saito A', 'Doi Y', 'Tanaka A', 'Matsuura N', 'Ubukata M', 'Nakajima N'] Systematic synthesis of four epicatechin series procyanidin trimers andtheir inhibitory activity on the Maillard reaction and antioxidantactivity. Bioorg Med Chem 2004 Sep 15;12(18):4783-90.['Ihara N', 'Kurisawa M', 'Chung JE', 'Uyama H', 'Kobayashi S'] Enzymatic synthesis of a catechin conjugate of polyhedral oligomeric...

from Bio.PubMed import Dictionary, search_for# カテキン合成を PubMed でサーチentries = search_for('catechin synthesis')print entriesfrom Bio.Medline import RecordParser# Medline エントリのパーザを作成recparser = RecordParser()# 最初の 10 件について, 3 秒ごとにクエリを出し,サーチ結果をパーザで解析して,# 著者,タイトル,出典を表示rdict = Dictionary(delay=3.0, parser=recparser)for e in entries[:10]: record = rdict[e] print record.authors, record.title, record.source

Open-Bio BOF 2004 at GIW2004Open-Bio BOF 2004 at GIW2004

Acknowledgements and CopyrightsAcknowledgements and Copyrights

資料中に使われているクリップアートワークは,資料中に使われているクリップアートワークは, Microsoft Microsoft OfficeOnline OfficeOnline クリップアートコレクションをもとに作成しました.クリップアートコレクションをもとに作成しました.

使用条件については使用条件については http://office.microsoft.com/clipart/ http://office.microsoft.com/clipart/ をご覧くださいをご覧ください..

その他クリップアートを使わない図形や写真,および本文テキストその他クリップアートを使わない図形や写真,および本文テキスト の著作権は増田泰 の著作権は増田泰 (ymasuda at ethercube.com) (ymasuda at ethercube.com) に帰属し,以下のに帰属し,以下の

条件で再配布および改変を認めます.条件で再配布および改変を認めます.Copyright NoticeCopyright Yasushi Masuda, 2004 All Rights ReservedPermission to use, copy, modify, and distribute this product for any purpose and without fee is hereby granted, provided that above copyright notice and this permission notice is attached with every copies or distributions.

DisclaimerYasushi Masuda (the author hereafter) disclaims all warranties with regard to this product, including all implied warranties of merchantability and fitness, in no event the author shall be liable for any special, indirect or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whatever in an action pf contract, negligence or other tortious action, arising out of or in connection with the use or derivation of this product.The author makes any warranty, express or implied, or assumes any liability or responsibility for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, or represents that its use would not infringe privately-owned rights. Reference herein to any specific commercial products, process, or service by trade name, trademark, manufacturer, or otherwise, does not necessarily constitute or imply its endorsement, recommendation, or favoring by the author. The views and opinions of authors expressed herein do not necessarily state or reflect those of the author, and shall not be used for advertising or product endorsement purposes.

PDF 版は http://www.cubelab.com/ymasuda/python/misc/ で入手できます