GO DAG graph
Graph
00 Remarks
关于祖先/子孙索引的算法说明
GO 的本体是一个有向无环图(DAG),一个子条目可能同时拥有多个父条目, 所以从任意一个条目出发向上的路径数量是指数级的。旧版本的 Graph.Family() 会枚举出所有的祖先路径,而 Builder.CreateClusterMembers() 又会对每一个条目都调用一次 该函数,导致在完整的 go.obo(约5万条目)上面构建时会直接卡死或者内存溢出。
这里改为:
- 通过记忆化(memoization)的DFS计算出每一个条目的祖先集合(去重,不带路径信息), 复杂度由指数级降低为
O(N * A); - 子孙索引由祖先集合单次反查聚合得到,并且是惰性构建的,即只有真的 需要用到的时候才会去计算。
01 Syntax
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| .ctor | 3 | Build DAG graph from a parsed GO_OBO database model. |
| GetTerm | 1 | get term node by its TermNode.id |
| GetTermId | 1 | 将id可能为alt_id的编号转换为主编号 |
| ParentTable | 1 | 获取得到指定关系类型之下的[term_id => parent term_id()]索引 |
| AncestorTable | 1 | 记忆化的祖先闭包表:[term_id => all ancestor term_id](不包含自身) |
| DescendantTable | 1 | 由祖先闭包反查得到的子孙索引:[term_id => all descendant nodes](不包含自身) |
| GetAncestorTable | 1 | 获取得到完整的祖先闭包表 [term_id => all ancestor term_id] |
| GetDescendantTable | 1 | 获取得到完整的子孙索引表 [term_id => all descendant nodes] |
| GetAncestors | 1 | 获取得到指定的GO词条的所有祖先词条编号(不包含自身) |
| GetDescendants | 1 | 获取得到指定的GO词条的所有子孙节点(不包含自身) |
| IsAncestorOf | 1 | 判断ancestor是否为id的祖先词条 |
| isAParents | 1 | 获取得到当前节点基于is_a关系的直接父节点(已经过滤掉了不存在的悬空引用) |
| Family | 2 | 向上查找到root这个根节点为止的继承链 |
| familyToRoot | 1 | 构建从id一直向上到root的直接子节点为止的所有路径 |
| ancestorChains | 1 | 生成祖先路径:每一条链都是由近及远的祖先节点列表,最后一个元素为根节点。 如果id没有父节点(即自身就是根节点),则返回空集合。 |
| GetClusterMembers | 1 | 这个函数是往下查找,找出当前的term的所有的通过is_a关系继承得到的子类型 |
03 Properties
| Name | Overloads | Summary |
|---|---|---|
| Terms | 1 | 获取得到当前的DAG图之中的所有的节点 |
04 Fields
| Name | Overloads | Summary |
|---|---|---|
| parents | 1 | [term_id => parent term_id list],默认的关系类型索引 |
| altIds | 1 | [alt_id => primary term id] |
| DefaultRelations | 2 | 在进行GO注释传播的时候所默认使用的关系类型 |
| cellular_component | 1 | These terms describe a component of a cell that is part of a larger object, such as an anatomical structure (e.g. |
| biological_process | 1 | A biological process term describes a series of events accomplished by one or more organized assemblies of molecular functions. |
| molecular_function | 1 | Molecular function terms describes activities that occur at the molecular level, such as "catalytic activity" or "binding activity". |
| RootNames | 2 | 三大namespace根节点的名称 |
05 Members
String)Creates GO DAG graph from go.obo file.
| Name | Type | Description |
|---|---|---|
path | String | File path of the GO database: |
String)Build DAG graph from a parsed GO_OBO database model.
| Name | Type | Description |
|---|---|---|
obo | GO_OBO | - |
IEnumerable(Of Term), header, String)Or build DAG graph tree from a specific GO_term collection terms
| Name | Type | Description |
|---|---|---|
terms | IEnumerable(Of Term) | - |
String)get term node by its TermNode.id
| Name | Type | Description |
|---|---|---|
id | String | - |
returns nothing if the given term id is not exists in current DAG graph.
String)将id可能为alt_id的编号转换为主编号
| Name | Type | Description |
|---|---|---|
id | String | - |
如果id既不是主编号也不是alt_id,则原样返回
获取得到指定关系类型之下的[term_id => parent term_id()]索引
| Name | Type | Description |
|---|---|---|
relations | OntologyRelations() | 除了 |
记忆化的祖先闭包表:[term_id => all ancestor term_id](不包含自身)
| Name | Type | Description |
|---|---|---|
relations | OntologyRelations() | - |
由祖先闭包反查得到的子孙索引:[term_id => all descendant nodes](不包含自身)
| Name | Type | Description |
|---|---|---|
relations | OntologyRelations() | - |
获取得到完整的祖先闭包表 [term_id => all ancestor term_id]
| Name | Type | Description |
|---|---|---|
relations | OntologyRelations() | - |
这个表是惰性构建的,并且会被缓存起来,可以安全的重复调用
获取得到完整的子孙索引表 [term_id => all descendant nodes]
| Name | Type | Description |
|---|---|---|
relations | OntologyRelations() | - |
这个表是惰性构建的,并且会被缓存起来,可以安全的重复调用
获取得到指定的GO词条的所有祖先词条编号(不包含自身)
| Name | Type | Description |
|---|---|---|
id | String | - |
includeSelf | Boolean | 是否将id自身也包含进结果集合之中 |
relations | OntologyRelations() | 除了 |
获取得到指定的GO词条的所有子孙节点(不包含自身)
| Name | Type | Description |
|---|---|---|
id | String | - |
includeSelf | Boolean | 是否将id自身也包含进结果集合之中 |
relations | OntologyRelations() | 除了 |
判断ancestor是否为id的祖先词条
| Name | Type | Description |
|---|---|---|
id | String | - |
ancestor | String | - |
relations | OntologyRelations() | - |
获取得到当前节点基于is_a关系的直接父节点(已经过滤掉了不存在的悬空引用)
| Name | Type | Description |
|---|---|---|
term | TermNode | - |
String, String)向上查找到root这个根节点为止的继承链
| Name | Type | Description |
|---|---|---|
id | String | |
root | String | 根节点的base.name,一般为三大namespace的名称: |
每一条链的InheritsChain.Route都是从自身开始向上一直到 root的直接子节点为止(不包含root自身)。如果id就是 root或者root不在其祖先链上面,则返回空集合。
String)Create family tree of the GO terms based on the is_a relationship.
这个函数是往顶层查找直到查找到三大namespace为止
注意:由于GO是一个有向无环图,所以从这里返回的继承链的数量可能是指数级的, 只需要祖先/子孙的集合信息的时候,请优先使用Graph.GetAncestors() 或者Graph.GetDescendants()。
| Name | Type | Description |
|---|---|---|
id | String |
String, String, HashSet(Of String), List(Of InheritsChain))构建从id一直向上到root的直接子节点为止的所有路径
String, HashSet(Of String))生成祖先路径:每一条链都是由近及远的祖先节点列表,最后一个元素为根节点。 如果id没有父节点(即自身就是根节点),则返回空集合。
String)这个函数是往下查找,找出当前的term的所有的通过is_a关系继承得到的子类型
| Name | Type | Description |
|---|---|---|
id | String | - |
不包含id自身,只包含其子孙节点
获取得到当前的DAG图之中的所有的节点
[term_id => parent term_id list],默认的关系类型索引
[alt_id => primary term id]
在进行GO注释传播的时候所默认使用的关系类型
is_a 关系总是会被包含在传播路径之中,而按照GO官方的注释传播约定, part_of 关系也会参与传播,但是 regulates/has_part 等关系 不参与传播。
These terms describe a component of a cell that is part of a larger object, such as an anatomical structure (e.g. rough endoplasmic reticulum or nucleus) or a gene product group (e.g. ribosome, proteasome or a protein dimer).
A biological process term describes a series of events accomplished by one or more organized assemblies of molecular functions. Examples of broad biological process terms are "cellular physiological process" or "signal transduction". Examples of more specific terms are "pyrimidine metabolic process" or "alpha-glucoside transport". The general rule to assist in distinguishing between a biological process and a molecular function is that a process must have more than one distinct steps. A biological process Is Not equivalent To a pathway. At present, the GO does Not Try To represent the dynamics Or dependencies that would be required To fully describe a pathway.
Molecular function terms describes activities that occur at the molecular level, such as "catalytic activity" or "binding activity". GO molecular function terms represent activities rather than the entities (molecules or complexes) that perform the actions, and do not specify where, when, or in what context the action takes place. Molecular functions generally correspond to activities that can be performed by individual gene products, but some activities are performed by assembled complexes of gene products. Examples of broad functional terms are "catalytic activity" and "transporter activity"; examples of narrower functional terms are "adenylate cyclase activity" or "Toll receptor binding". It Is easy To confuse a gene product name With its molecular Function; For that reason GO molecular functions are often appended With the word "activity".
三大namespace根节点的名称