[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
]
開始行:
[[ノート/ノート]]~
訪問者数 &counter(); 最終更新 &lastmod();
*Gene Ontologyタームを数える [#g5d5547d]
**GOのシステムで使いたい概念・名称の整理 [#oea08d20]
-Gene Name~
たとえば、'yjgK', 'yfgC', 'rho', 'oxyR', 'glnA'など。
-Gene ID~
NCBIの"Genes"の情報で使われるID
|yjgK| 948777 |
|yfgC| 947029 |
|glnA| 948370 |
|oxyR| 948462 |
|glnA| 948370 |
-Gene と GO の関係~
オントロジー上で、Gene (Gene ID)に伴って出てくるGOタームの情報が、
NCBIのassociation fileにある。~
GOATOOLSのdownload_ncbi_associationsでダウンロードできる。
from goatools.base import download_ncbi_associations
gene2go = download_ncbi_associations()
gene2goは、taxonomyID geneID GOID の表になっている。たとえばGeneID=948777に関連するGOタームは
|tax_id |GeneID | GO_ID | Evidence |Qualifier| GO_term | PubMed | Category|
|511145|948777|GO:0005829|IBA|-|cytosol|21873635|Component|
|511145|948777|GO:0005829|IDA|-|cytosol|18304323|Component|
|511145|948777|GO:0044010|IBA|-|single-species biofilm formation|21873635|Process|
|511145|948777|GO:0044010|IMP|-|single-species biofilm formation|19060153|Process|
のように得られる。
-GODag~
GOタームが概念の親子関係(包含関係)で結ばれている。その結ばれ方を「グラフ」として表したものがGODag。~
グラフは循環を含まない(一回りして同じノードに戻ることが無い)ので、Directed (有向) Acyclic (循環しない) Graph --- DAG --- と呼ばれる。~
グラフ情報は、Gene Ontologyサイトからgo.oboおよびgo-basic.oboファイルとしてダウンロードできる。ただし、go.ogoは非循環を保証していないので、処理上エラーを起こすことがある(現実に起こる)。~
1つのGOタームから、DAGを上方向に根(ルート)ノードまでたどって、リストを作ってみる。たとえば GeneName=yjgKにまつわる2つのGOターム 'GO:0005829' と 'GO:0044010' について上方向にたどると、それぞれに
| GO:0005829 | ('GO:0005575', 0), ('GO:0044464', 1), ('GO:0044424', 2), ('GO:0044444', 3) |
| GO:0044010 | ('GO:0008150', 0), ('GO:0051704', 1), ('GO:0009987', 1), ('GO:0044764', 2), ('GO:0042710', 3) |
というGOタームのリストが得られる。それぞれのGOタームの後ろに添えられた数字は根(ルート)から数えた「レベル」を示している。つまり、
--GO:0005829は、ルートのターム GO:0005575(cellular_component)、1段目のターム GO:0044464(cell part)、2段目のターム GO:0044424(intracellular part)、3段目のターム GO:0044444(cytoplasmic part) の下に位置する。
--GO:0044010は、ルートのターム GO:0008150(biological_process)、1段目のターム
GO:0051704(multi-organism process)、同じく1段目のターム GO:0009987(cellular process)、2段目のターム GO:0044764(multi-organism cellular process)、3段目のターム GO:0042710(biofilm formation) の下に位置する。
#ref(GOサンプル.png)
このグラフを生成してくれるソフトが、gotoolsの中にある。[[ここに記述がある:https://github.com/tanghaibao/goatools/blob/master/doc/md/README_go_plot.md]]
このスクリプトを簡単に試してみるには、スタート点となるGOタームをファイルにリストしておき、それを処理する。GITの内容をgoatools-master下に展開してあるとして、ファイル:goatools-master/tests/data/go_plot/go_file_mine.txtに以下のデータ(GeneName
yjgKに関連するGOターム、#以降は色の指定だが、無くてもよい、他にフィールドがあってもよいようだが、最低限これだけは必要らしい)を用意した。
GO:0005829
GO:0044010 #d6fffa
現在ディレクトリをgotools-masterに置いて、コマンド
scripts/go_plot.py --go_file=tests/data/go_plot/go_file_mine.txt -o go_file_mine.png
を実行すると、下記の端末出力
go-basic.obo: fmt(1.2) rel(2019-02-03) 47,381 GO Terms
GO:0008150 # BP 29693 L00 D00 biological_process
#f1fbfd GO:0009987 # BP 11248 L01 D01 A cellular process
#f1fbfd GO:0051704 # BP 1475 L01 D01 B multi-organism process
GO:0044764 # BP 78 L02 D02 AB multi-organism cellular process
GO:0042710 # BP 12 L03 D03 AB biofilm formation
#d6fffa GO:0044010 # BP 4 L04 D04 AB single-species biofilm formation
GO:0005575 # CC 4205 L00 D00 cellular_component
#f1fbfd GO:0044464 # CC 3306 L01 D01 A cell part
GO:0044424 # CC 2366 L02 D02 A intracellular part
GO:0044444 # CC 1262 L03 D03 A cytoplasmic part
#ffffe4 GO:0005829 # CC 3 L04 D04 A cytosol
2 usr 11 GOs WROTE: go_file_mine.png
が得られ、下記のグラフがPNGファイルに出力される。
#ref(./go_file_mine.png,50%)
より複雑な例として、
goatools-master/tests/data/go_plot/go_file_mine2.txtに以下のデータ(GeneName
yfgCに関連するGOターム、#以降は色の指定だが、無くてもよい、他にフィールドがあってもよいようだが、最低限これだけは必要らしい)を用意した。
GO:0003756 #ff0000
GO:0004222 #55AA00
GO:0046872 #AA5500
GO:0005515 #00FF00
GO:0051603 #00AA55
GO:0061077 #0055AA
GO:0008237 #0000FF
GO:0016020 #5500AA
GO:0043165 #AA0055
GO:0030288 #55AA00
現在ディレクトリをgotools-masterに置いて、コマンド
scripts/go_plot.py --go_file=tests/data/go_plot/go_file_mine.txt -o go_file_mine.png
を実行すると、下記の端末出力
go-basic.obo: fmt(1.2) rel(2019-02-03) 47,381 GO Terms
GO:0008150 # BP 29693 L00 D00 biological_process
#f1fbfd GO:0071840 # BP 1728 L01 D01 C cellular component organization or biogenesis
#f1fbfd GO:0009987 # BP 11248 L01 D01 A cellular process
#f1fbfd GO:0008152 # BP 6395 L01 D01 B metabolic process
GO:0006807 # BP 3951 L02 D02 B nitrogen compound metabolic process
GO:0016043 # BP 1699 L02 D02 AC cellular component organization
GO:0006457 # BP 12 L02 D02 A protein folding
GO:0044238 # BP 4205 L02 D02 B primary metabolic process
GO:0071704 # BP 6049 L02 D02 B organic substance metabolic process
GO:1901564 # BP 2880 L03 D03 B organonitrogen compound metabolic process
GO:0061024 # BP 233 L03 D03 AC membrane organization
#0055AA GO:0061077 # BP 4 L03 D03 A chaperone-mediated protein folding
GO:0043170 # BP 2379 L03 D03 B macromolecule metabolic process
GO:0022607 # BP 502 L03 D03 AC cellular component assembly
GO:0071709 # BP 8 L04 D04 AC membrane assembly
GO:0019538 # BP 1169 L03 D04 B protein metabolic process
GO:0006508 # BP 101 L04 D05 B proteolysis
#AA0055 GO:0043165 # BP 0 L05 D05 AC Gram-negative-bacterium-type cell outer membrane assembly
#00AA55 GO:0051603 # BP 36 L05 D06 B proteolysis involved in cellular protein catabolic process
GO:0005575 # CC 4205 L00 D00 cellular_component
#5500AA GO:0016020 # CC 208 L01 D01 B membrane
#f1fbfd GO:0044464 # CC 3306 L01 D01 A cell part
GO:0042597 # CC 3 L02 D02 A periplasmic space
#55AA00 GO:0030288 # CC 0 L03 D03 A outer membrane-bounded periplasmic space
GO:0003674 # MF 11112 L00 D00 molecular_function
#f1fbfd GO:0003824 # MF 7674 L01 D01 A catalytic activity
#f1fbfd GO:0005488 # MF 1906 L01 D01 B binding
GO:0016787 # MF 1647 L02 D02 A hydrolase activity
#00FF00 GO:0005515 # MF 971 L02 D02 B protein binding
GO:0043167 # MF 209 L02 D02 B ion binding
GO:0140096 # MF 444 L02 D02 A catalytic activity, acting on a protein
GO:0016853 # MF 262 L02 D02 A isomerase activity
GO:0016860 # MF 72 L03 D03 A intramolecular oxidoreductase activity
GO:0043169 # MF 59 L03 D03 B cation binding
GO:0008233 # MF 75 L03 D03 A peptidase activity
GO:0016864 # MF 1 L04 D04 A intramolecular oxidoreductase activity, transposing S-S bonds
GO:0070011 # MF 70 L04 D04 A peptidase activity, acting on L-amino acid peptides
#AA5500 GO:0046872 # MF 32 L04 D04 B metal ion binding
#ff0000 GO:0003756 # MF 0 L03 D05 A protein disulfide isomerase activity
GO:0004175 # MF 19 L05 D05 A endopeptidase activity
#0000FF GO:0008237 # MF 9 L05 D05 A metallopeptidase activity
#55AA00 GO:0004222 # MF 1 L06 D06 A metalloendopeptidase activity
10 usr 42 GOs WROTE: go_file_mine2.png
が得られ、下記のグラフがPNGファイルに出力される。
#ref(./go_file_mine2.png)
**Gene Nameごとに、それに関係するGene Ontologyタームを数える [#a29435e7]
これから考える。
考え方
-Gene Name (Gene ID)ごとに、いくつかのGOタームを拾うことができる。
-そのGOタームを「葉」としてGODAG上のサブトリーを定義できる。~
つまり、Gene NameごとにいくつかのGODAGサブトリーを取り出すことができる。
-Gene Name (Gene ID)ごとに、それが作り出すGODAGサブトリー上のノード(=GOターム)集合を作ることができる。~
集合であるから、重複はカウントしない(1つとしてカウントする。)
-興味のあるGene Name集合(複数のGene Nameからなる集合)を考えるとき、その要素の(それぞれの)Gene Nameに対して、上記のGODAG上のGOターム(ノード)集合を求める。
-その結果をGOタームで串刺しにして眺める。つまり、1つのGOタームについて、いくつのGODAG(=Gene NameごとのGODAG)がそのGOタームを属しているか、(Gene Name数を)数える。根(ルート)のGOタームノードは、おそらく全部のGene NameのGODAGが含んでいるだろうから、カウントは全部のGene Name数になる。末端の葉ノードは、最低の場合はカウント=1になるだろうし、複数のGene NameのGODAGに出現しているかもしれない。
終了行:
[[ノート/ノート]]~
訪問者数 &counter(); 最終更新 &lastmod();
*Gene Ontologyタームを数える [#g5d5547d]
**GOのシステムで使いたい概念・名称の整理 [#oea08d20]
-Gene Name~
たとえば、'yjgK', 'yfgC', 'rho', 'oxyR', 'glnA'など。
-Gene ID~
NCBIの"Genes"の情報で使われるID
|yjgK| 948777 |
|yfgC| 947029 |
|glnA| 948370 |
|oxyR| 948462 |
|glnA| 948370 |
-Gene と GO の関係~
オントロジー上で、Gene (Gene ID)に伴って出てくるGOタームの情報が、
NCBIのassociation fileにある。~
GOATOOLSのdownload_ncbi_associationsでダウンロードできる。
from goatools.base import download_ncbi_associations
gene2go = download_ncbi_associations()
gene2goは、taxonomyID geneID GOID の表になっている。たとえばGeneID=948777に関連するGOタームは
|tax_id |GeneID | GO_ID | Evidence |Qualifier| GO_term | PubMed | Category|
|511145|948777|GO:0005829|IBA|-|cytosol|21873635|Component|
|511145|948777|GO:0005829|IDA|-|cytosol|18304323|Component|
|511145|948777|GO:0044010|IBA|-|single-species biofilm formation|21873635|Process|
|511145|948777|GO:0044010|IMP|-|single-species biofilm formation|19060153|Process|
のように得られる。
-GODag~
GOタームが概念の親子関係(包含関係)で結ばれている。その結ばれ方を「グラフ」として表したものがGODag。~
グラフは循環を含まない(一回りして同じノードに戻ることが無い)ので、Directed (有向) Acyclic (循環しない) Graph --- DAG --- と呼ばれる。~
グラフ情報は、Gene Ontologyサイトからgo.oboおよびgo-basic.oboファイルとしてダウンロードできる。ただし、go.ogoは非循環を保証していないので、処理上エラーを起こすことがある(現実に起こる)。~
1つのGOタームから、DAGを上方向に根(ルート)ノードまでたどって、リストを作ってみる。たとえば GeneName=yjgKにまつわる2つのGOターム 'GO:0005829' と 'GO:0044010' について上方向にたどると、それぞれに
| GO:0005829 | ('GO:0005575', 0), ('GO:0044464', 1), ('GO:0044424', 2), ('GO:0044444', 3) |
| GO:0044010 | ('GO:0008150', 0), ('GO:0051704', 1), ('GO:0009987', 1), ('GO:0044764', 2), ('GO:0042710', 3) |
というGOタームのリストが得られる。それぞれのGOタームの後ろに添えられた数字は根(ルート)から数えた「レベル」を示している。つまり、
--GO:0005829は、ルートのターム GO:0005575(cellular_component)、1段目のターム GO:0044464(cell part)、2段目のターム GO:0044424(intracellular part)、3段目のターム GO:0044444(cytoplasmic part) の下に位置する。
--GO:0044010は、ルートのターム GO:0008150(biological_process)、1段目のターム
GO:0051704(multi-organism process)、同じく1段目のターム GO:0009987(cellular process)、2段目のターム GO:0044764(multi-organism cellular process)、3段目のターム GO:0042710(biofilm formation) の下に位置する。
#ref(GOサンプル.png)
このグラフを生成してくれるソフトが、gotoolsの中にある。[[ここに記述がある:https://github.com/tanghaibao/goatools/blob/master/doc/md/README_go_plot.md]]
このスクリプトを簡単に試してみるには、スタート点となるGOタームをファイルにリストしておき、それを処理する。GITの内容をgoatools-master下に展開してあるとして、ファイル:goatools-master/tests/data/go_plot/go_file_mine.txtに以下のデータ(GeneName
yjgKに関連するGOターム、#以降は色の指定だが、無くてもよい、他にフィールドがあってもよいようだが、最低限これだけは必要らしい)を用意した。
GO:0005829
GO:0044010 #d6fffa
現在ディレクトリをgotools-masterに置いて、コマンド
scripts/go_plot.py --go_file=tests/data/go_plot/go_file_mine.txt -o go_file_mine.png
を実行すると、下記の端末出力
go-basic.obo: fmt(1.2) rel(2019-02-03) 47,381 GO Terms
GO:0008150 # BP 29693 L00 D00 biological_process
#f1fbfd GO:0009987 # BP 11248 L01 D01 A cellular process
#f1fbfd GO:0051704 # BP 1475 L01 D01 B multi-organism process
GO:0044764 # BP 78 L02 D02 AB multi-organism cellular process
GO:0042710 # BP 12 L03 D03 AB biofilm formation
#d6fffa GO:0044010 # BP 4 L04 D04 AB single-species biofilm formation
GO:0005575 # CC 4205 L00 D00 cellular_component
#f1fbfd GO:0044464 # CC 3306 L01 D01 A cell part
GO:0044424 # CC 2366 L02 D02 A intracellular part
GO:0044444 # CC 1262 L03 D03 A cytoplasmic part
#ffffe4 GO:0005829 # CC 3 L04 D04 A cytosol
2 usr 11 GOs WROTE: go_file_mine.png
が得られ、下記のグラフがPNGファイルに出力される。
#ref(./go_file_mine.png,50%)
より複雑な例として、
goatools-master/tests/data/go_plot/go_file_mine2.txtに以下のデータ(GeneName
yfgCに関連するGOターム、#以降は色の指定だが、無くてもよい、他にフィールドがあってもよいようだが、最低限これだけは必要らしい)を用意した。
GO:0003756 #ff0000
GO:0004222 #55AA00
GO:0046872 #AA5500
GO:0005515 #00FF00
GO:0051603 #00AA55
GO:0061077 #0055AA
GO:0008237 #0000FF
GO:0016020 #5500AA
GO:0043165 #AA0055
GO:0030288 #55AA00
現在ディレクトリをgotools-masterに置いて、コマンド
scripts/go_plot.py --go_file=tests/data/go_plot/go_file_mine.txt -o go_file_mine.png
を実行すると、下記の端末出力
go-basic.obo: fmt(1.2) rel(2019-02-03) 47,381 GO Terms
GO:0008150 # BP 29693 L00 D00 biological_process
#f1fbfd GO:0071840 # BP 1728 L01 D01 C cellular component organization or biogenesis
#f1fbfd GO:0009987 # BP 11248 L01 D01 A cellular process
#f1fbfd GO:0008152 # BP 6395 L01 D01 B metabolic process
GO:0006807 # BP 3951 L02 D02 B nitrogen compound metabolic process
GO:0016043 # BP 1699 L02 D02 AC cellular component organization
GO:0006457 # BP 12 L02 D02 A protein folding
GO:0044238 # BP 4205 L02 D02 B primary metabolic process
GO:0071704 # BP 6049 L02 D02 B organic substance metabolic process
GO:1901564 # BP 2880 L03 D03 B organonitrogen compound metabolic process
GO:0061024 # BP 233 L03 D03 AC membrane organization
#0055AA GO:0061077 # BP 4 L03 D03 A chaperone-mediated protein folding
GO:0043170 # BP 2379 L03 D03 B macromolecule metabolic process
GO:0022607 # BP 502 L03 D03 AC cellular component assembly
GO:0071709 # BP 8 L04 D04 AC membrane assembly
GO:0019538 # BP 1169 L03 D04 B protein metabolic process
GO:0006508 # BP 101 L04 D05 B proteolysis
#AA0055 GO:0043165 # BP 0 L05 D05 AC Gram-negative-bacterium-type cell outer membrane assembly
#00AA55 GO:0051603 # BP 36 L05 D06 B proteolysis involved in cellular protein catabolic process
GO:0005575 # CC 4205 L00 D00 cellular_component
#5500AA GO:0016020 # CC 208 L01 D01 B membrane
#f1fbfd GO:0044464 # CC 3306 L01 D01 A cell part
GO:0042597 # CC 3 L02 D02 A periplasmic space
#55AA00 GO:0030288 # CC 0 L03 D03 A outer membrane-bounded periplasmic space
GO:0003674 # MF 11112 L00 D00 molecular_function
#f1fbfd GO:0003824 # MF 7674 L01 D01 A catalytic activity
#f1fbfd GO:0005488 # MF 1906 L01 D01 B binding
GO:0016787 # MF 1647 L02 D02 A hydrolase activity
#00FF00 GO:0005515 # MF 971 L02 D02 B protein binding
GO:0043167 # MF 209 L02 D02 B ion binding
GO:0140096 # MF 444 L02 D02 A catalytic activity, acting on a protein
GO:0016853 # MF 262 L02 D02 A isomerase activity
GO:0016860 # MF 72 L03 D03 A intramolecular oxidoreductase activity
GO:0043169 # MF 59 L03 D03 B cation binding
GO:0008233 # MF 75 L03 D03 A peptidase activity
GO:0016864 # MF 1 L04 D04 A intramolecular oxidoreductase activity, transposing S-S bonds
GO:0070011 # MF 70 L04 D04 A peptidase activity, acting on L-amino acid peptides
#AA5500 GO:0046872 # MF 32 L04 D04 B metal ion binding
#ff0000 GO:0003756 # MF 0 L03 D05 A protein disulfide isomerase activity
GO:0004175 # MF 19 L05 D05 A endopeptidase activity
#0000FF GO:0008237 # MF 9 L05 D05 A metallopeptidase activity
#55AA00 GO:0004222 # MF 1 L06 D06 A metalloendopeptidase activity
10 usr 42 GOs WROTE: go_file_mine2.png
が得られ、下記のグラフがPNGファイルに出力される。
#ref(./go_file_mine2.png)
**Gene Nameごとに、それに関係するGene Ontologyタームを数える [#a29435e7]
これから考える。
考え方
-Gene Name (Gene ID)ごとに、いくつかのGOタームを拾うことができる。
-そのGOタームを「葉」としてGODAG上のサブトリーを定義できる。~
つまり、Gene NameごとにいくつかのGODAGサブトリーを取り出すことができる。
-Gene Name (Gene ID)ごとに、それが作り出すGODAGサブトリー上のノード(=GOターム)集合を作ることができる。~
集合であるから、重複はカウントしない(1つとしてカウントする。)
-興味のあるGene Name集合(複数のGene Nameからなる集合)を考えるとき、その要素の(それぞれの)Gene Nameに対して、上記のGODAG上のGOターム(ノード)集合を求める。
-その結果をGOタームで串刺しにして眺める。つまり、1つのGOタームについて、いくつのGODAG(=Gene NameごとのGODAG)がそのGOタームを属しているか、(Gene Name数を)数える。根(ルート)のGOタームノードは、おそらく全部のGene NameのGODAGが含んでいるだろうから、カウントは全部のGene Name数になる。末端の葉ノードは、最低の場合はカウント=1になるだろうし、複数のGene NameのGODAGに出現しているかもしれない。
ページ名: