Builder
01 Syntax
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| safeArray | 1 | 安全的空值处理 |
| isTrue | 1 | 判断obo文本之中的逻辑值标记是否为真,例如is_obsolete: true |
| DescendantSets | 1 | 由祖先闭包反查得到子孙索引 |
| AncestorSets | 1 | 计算出DAG图之中所有节点的祖先闭包集合 |
| walkAncestors | 1 | 记忆化的祖先闭包递归求解,visiting用于防止因为数据错误 而出现的环导致的无限递归 |
| ParentIndex | 1 | 构建出[term_id => parent term_id()]的索引 |
| AltIdIndex | 1 | 建立[alt_id => primary term id]映射表 |
| CreateClusterMembers | 1 | 由祖先集合反查得到每一个GO词条的所有的子孙节点 |
| BuildTree | 1 | 从obo词条集合之中构建出DAG图的节点集合 |
| ConstructNode | 1 | Creates a node in this DAG graph |
03 Members
``0())安全的空值处理
与SafeQuery的区别在于:SafeQuery在遇到Nothing的时候会向 控制台输出一条警告信息,而在go.obo之中有大量的词条并没有 is_a/relationship/xref这些字段,使用SafeQuery会 刷出数以十万计的警告信息,从而严重的拖慢构建的 speed
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
source | ``0() | - |
String)判断obo文本之中的逻辑值标记是否为真,例如is_obsolete: true
| Name | Type | Description |
|---|---|---|
value$ | String | - |
Dictionary(Of TermNode), Dictionary(Of String, String()))由祖先闭包反查得到子孙索引
这个函数是Builder.CreateClusterMembers()的新的实现: 只需要对祖先集合做一次反查聚合即可,复杂度为O(N * A), 而不像旧版本那样需要枚举出所有指数级数量的祖先路径。
| Name | Type | Description |
|---|---|---|
tree | Dictionary(Of TermNode) | - |
ancestors | Dictionary(Of String, String()) |
|
[term_id => all descendant nodes],不包含term自身
Dictionary(Of String, String()))计算出DAG图之中所有节点的祖先闭包集合
由于GO是一个有向无环图,一个节点可能会有多个父节点,所以直接递归枚举路径 会得到指数级数量的结果。在这里只关心集合而不关心路径,所以通过记忆化 的DFS,让每一个节点的祖先集合只被计算一次。
| Name | Type | Description |
|---|---|---|
parents | Dictionary(Of String, String()) |
|
[term_id => all ancestor term_id],不包含term自身,与拓扑顺序无关
String, Dictionary(Of String, String()), Dictionary(Of String, String()), HashSet(Of String))记忆化的祖先闭包递归求解,visiting用于防止因为数据错误 而出现的环导致的无限递归
Dictionary(Of TermNode), OntologyRelations())构建出[term_id => parent term_id()]的索引
注意:has_part/regulates之类的关系按照GO官方的约定不参与 注释的传播,所以默认只使用is_a与part_of。
| Name | Type | Description |
|---|---|---|
tree | Dictionary(Of TermNode) | - |
relations | OntologyRelations() | 除了 |
IEnumerable(Of Term))建立[alt_id => primary term id]映射表
旧的注释数据之中可能会使用已经被废弃掉的alt_id编号, 通过这个映射表可以将其回填为最新的主编号
| Name | Type | Description |
|---|---|---|
file | IEnumerable(Of Term) | - |
由祖先集合反查得到每一个GO词条的所有的子孙节点
| Name | Type | Description |
|---|---|---|
tree | Graph | - |
IEnumerable(Of Term))从obo词条集合之中构建出DAG图的节点集合
在这里会做如下的几项数据清洗工作:
- 跳过被标记为
is_obsolete的废弃词条; - 跳过重复编号的词条,避免
Dictionary添加元素的时候抛出异常; - 跳过在当前的词表之中不存在的父节点引用,避免产生悬空的
Nothing引用; - 将
relationship关系也解析为节点引用,使得part_of之类的边也可以被遍历。
| Name | Type | Description |
|---|---|---|
file | IEnumerable(Of Term) | - |
Creates a node in this DAG graph
| Name | Type | Description |
|---|---|---|
term | Term | - |