Upload
others
View
16
Download
0
Embed Size (px)
Citation preview
OpenOpen--Bio BOF 2004 at GIW2004Bio BOF 2004 at GIW2004
BiopythonBiopythonとと Python Python のご紹介のご紹介
Yasushi MASUDA Yasushi MASUDA ymasudaymasuda at at cubelab.comcubelab.com
OpenOpen--Bio BOF 2004 at GIW2004Bio 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
OpenOpen--Bio BOF 2004 at GIW2004Bio BOF 2004 at GIW2004
バイオインフォマティクスとバイオインフォマティクスと Python (1/3)Python (1/3)
日々の雑用をこなす日々の雑用をこなす
–– csvcsv,,XML XML データの読み書きデータの読み書き ((csvcsv, xml), xml)––パーザの構築パーザの構築 (formatter, re)(formatter, re)––ディレクトリツリー単位の反復処理,ディレクトリツリー単位の反復処理,zip/tar zip/tar の読の読み書きみ書き((os.pathos.path, , zipfilezipfile, , tarfiletarfile))
–– HTTP HTTP やや FTP FTP からの反復ダウンロードからの反復ダウンロード((urlliburllib, , ftplibftplib))
OpenOpen--Bio BOF 2004 at GIW2004Bio BOF 2004 at GIW2004
バイオインフォマティクスとバイオインフォマティクスと Python (2/3)Python (2/3)
DB DB サービスの構築サービスの構築
–– DBMS (DBMS (PostgreSQLPostgreSQL,,MySQLMySQL,,OracleOracle,,etcetc......) ) ややファイルベースファイルベースDB (Access, FileMaker) DB (Access, FileMaker) の操作の操作CGI CGI インタフェースの開発インタフェースの開発 ((cgicgi, , httpserverhttpserver))
XPAK (appeared in GIW2000, Python+PostgreSQL+Python Imaging Library)
OpenOpen--Bio BOF 2004 at GIW2004Bio BOF 2004 at GIW2004
バイオインフォマティクスとバイオインフォマティクスと Python (3/3)Python (3/3)
データの解析や表示データの解析や表示
–– CCライブラリでの数値計算ライブラリでの数値計算(Numeric/(Numeric/numarraynumarray))
––画像処理/グラフ化画像処理/グラフ化 (PIL, (PIL, matplotlibmatplotlib etc)etc)
–– クロスプラットフォームなクロスプラットフォームなGUI GUI アプリケーションの開発アプリケーションの開発((TkinterTkinter, , PyQtPyQt, , wxPythonwxPython, , etc.)etc.)
Spherical Som visualization (Python+wxPython+VTK, not published)
BL-SOM visualization (Python +Tk+DDBJ ClastalX, not published)
OpenOpen--Bio BOF 2004 at GIW2004Bio BOF 2004 at GIW2004
BioPythonBioPython プロジェクトプロジェクト
Jeffrey Chang, Andrew Jeffrey Chang, Andrew DalkeDalke(Aug 1999)(Aug 1999)
The The BiopythonBiopython Project Project (http://(http://www.biopython.orgwww.biopython.org/) is /) is a new open collaborative effort a new open collaborative effort to develop to develop freely available Python libraries and and applicationsapplications that address the that address the needs of current and future needs of current and future work in bioinformatics, work in bioinformatics, including including sequence analysissequence analysis, , structural biologystructural biology, , pathwayspathways, , expression dataexpression data, etc., etc.
Biopython projecthttp://www.biopython.org/
OpenOpen--Bio BOF 2004 at GIW2004Bio BOF 2004 at GIW2004
BiopythonBiopython の機能の機能 (1/2)(1/2)
配列情報の操作配列情報の操作–– 相補鎖,転写,翻訳相補鎖,転写,翻訳
データファイルの解釈データファイルの解釈–– CDD, CDD, ECellECell, EMBL, Enzyme, FASTA, , EMBL, Enzyme, FASTA, GenBankGenBank, NCBI , NCBI
Geo, Geo, GobaseGobase, MASE, , MASE, MetaToolMetaTool, , InterProInterPro, , KabatKabat, KEGG, , KEGG, LocusLinkLocusLink, NBRF/PIR, , NBRF/PIR, AffymetirxAffymetirx CelCel, NDB, PDB, , NDB, PDB, PrositeProsite, Rebase, SAF, , Rebase, SAF, SwissProtSwissProt, etc.., etc..
WebWebサービスへのアクセスサービスへのアクセス–– NCBI (NCBI (EntrezEntrez, BLAST, , BLAST, PubMedPubMed), Swiss), Swiss--Prot, Prot, ExPASyExPASy
スタンドアロンプログラムへのアクセススタンドアロンプログラムへのアクセス–– BLAST, BLAST, ClustalwClustalw, EMBOSS, SVM etc..., EMBOSS, SVM etc...
OpenOpen--Bio BOF 2004 at GIW2004Bio BOF 2004 at GIW2004
BiopythonBiopython の機能の機能 (2/2)(2/2)
汎用の解析アルゴリズム汎用の解析アルゴリズム実装実装
GA, HMM, kGA, HMM, k--Means, kMeans, k--NN, naive NN, naive BayesBayes, ANN, , ANN, pairwisepairwise alignment, SVDalignment, SVDお絵かきツールお絵かきツール–– CromosomeCromosome, Pathway, PathwaySQL DB SQL DB との連携との連携–– BioSQLBioSQL: : BiopythonBiopython のオブのオブジェクトをジェクトを DB DB 化化
Randomly generated Organism
UQ4NXT
54TSZKUZ4XAV
0
R68Y2IM39HFOEECG5U
VM8F1S
IV3NN8
1
N9VTBA
6ELXN7
MPO9Y4
QQ6J1I
5X9GSJ
GY9PXU
9HAGTP
EIY7IM
3PBNQW
2
CLHNROZPAJI3
O0CKIPK3ZK3L
FJI45X
W2VJAS
ZFZ7EL
QJ59TA
Y8FTEI
MDQH0N
3
62DL32
5DLOHN
4
1P1RBS
4RHMPM
5EJ8056B9ZJFTPIWEF
VT87Y0
VW661T
DFMF1J
YVNOOD
YK2XZB
QZISI9
7VKXFQ
CFVJA2
0ECQQR
5
DNSK0B
ZA3F8B
6
EH9KP3
BS1IJK
1HBHJ1
KZ5B3S
7
5M591W
249M2SZRA0SZ
OUWQ7O
VEOHC5
WT0O6V
Z21G1G
MOEVPS
WL57C8
GR8ETH
VS6SRL
9RXE9K
8
J35AQM
8KZ6U4
J6TWU1XVT8OF
9
6IOO5T
VF3MM6
ZMOYMJ
NB21C9
LOPC2G
R3DGB6
O8RFUJ
NLJK4R
B5EHV0
ERIM5R
6TRIEZ
DAY5UM7M5VLZN5ZDJ8
QX9OT5
10
AAC4MYBUAJGA
11
HE9J8DT4SMDH
XL62PV
EPBWVJ
JHQ81D
1WEPDHA26W4DGHY7TY
8KF62S
QJEV1P
12
OpenOpen--Bio BOF 2004 at GIW2004Bio BOF 2004 at GIW2004
いいところばかりではありませんいいところばかりではありません
ドキュメントの整備がいまひとつドキュメントの整備がいまひとつ
––各機能の説明がソースコードにしかない各機能の説明がソースコードにしかない
––入門者向けの機能網羅的な文書がない入門者向けの機能網羅的な文書がない
⇒⇒ もっとドキュメントの充実と整理を!もっとドキュメントの充実と整理を!
コア開発者のアクティビティコア開発者のアクティビティ
––進学,就職などで手が離せない進学,就職などで手が離せない ((らしいらしい))–– メンテナンスの停止しているモジュールがあるメンテナンスの停止しているモジュールがある
⇒⇒ 現在,メンテナンス体制を見直し中現在,メンテナンス体制を見直し中
OpenOpen--Bio BOF 2004 at GIW2004Bio BOF 2004 at GIW2004
情報源とコミュニティ情報源とコミュニティ
公式ページ公式ページ–– http://http://www.biopython.orgwww.biopython.org//–– ダウンロード,マニュアルなどダウンロード,マニュアルなど
メイリングリストメイリングリスト–– ユーザユーザ: : [email protected]@biopython.org–– 開発開発: : [email protected]@biopython.org
和訳マニュアル和訳マニュアル–– http://http://www.cubelab.com/ymasuda/python/biopythonwww.cubelab.com/ymasuda/python/biopython//–– 坂井俊哉坂井俊哉氏,石田貴士氏,増田により翻訳氏,石田貴士氏,増田により翻訳
–– 日本語のメイリングリスト,コミュニティページ日本語のメイリングリスト,コミュニティページ......はまだはまだ((必要ですか?必要ですか?))
OpenOpen--Bio BOF 2004 at GIW2004Bio BOF 2004 at GIW2004
まとめまとめ
BiopythonBiopython には魅力的な機能が一杯です.には魅力的な機能が一杯です.
ぜひぜひBiopythonBiopython にトライしてみてください.にトライしてみてください.
BiopythonBiopython ははあなたを求めていますあなたを求めています!!!!!!
OpenOpen--Bio BOF 2004 at GIW2004Bio 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 webbrowser
webbrowser.open('outfile.html')
OpenOpen--Bio BOF 2004 at GIW2004Bio 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 catechinconjugate 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
OpenOpen--Bio BOF 2004 at GIW2004Bio BOF 2004 at GIW2004
Acknowledgements and CopyrightsAcknowledgements and Copyrights
資料中に使われているクリップアートワークは,資料中に使われているクリップアートワークは,Microsoft Microsoft OfficeOnlineOfficeOnlineクリップアートコレクションをもとに作成しました.クリップアートコレクションをもとに作成しました.
使用条件については使用条件についてはhttp://http://office.microsoft.comoffice.microsoft.com/clipart//clipart/ をご覧ください.をご覧ください.
その他クリップアートを使わない図形や写真,および本文テキストの著作その他クリップアートを使わない図形や写真,および本文テキストの著作権は増田泰権は増田泰 ((ymasudaymasuda at at ethercube.comethercube.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/ で入手できます