pyobo 0.12.2__py3-none-any.whl → 0.12.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyobo/__init__.py +12 -4
- pyobo/api/names.py +8 -1
- pyobo/getters.py +10 -3
- pyobo/identifier_utils/__init__.py +2 -0
- pyobo/identifier_utils/api.py +3 -2
- pyobo/sources/__init__.py +2 -0
- pyobo/sources/drugbank/drugbank.py +1 -1
- pyobo/sources/gwascentral/gwascentral_study.py +1 -1
- pyobo/sources/intact.py +79 -0
- pyobo/struct/__init__.py +2 -1
- pyobo/struct/functional/ontology.py +2 -2
- pyobo/struct/obo/__init__.py +9 -0
- pyobo/{reader.py → struct/obo/reader.py} +21 -18
- pyobo/struct/obograph/__init__.py +16 -0
- pyobo/struct/obograph/export.py +315 -0
- pyobo/struct/obograph/reader.py +242 -0
- pyobo/struct/obograph/utils.py +47 -0
- pyobo/struct/struct.py +13 -23
- pyobo/struct/struct_utils.py +22 -14
- pyobo/struct/typedef.py +4 -0
- pyobo/struct/vocabulary.py +7 -0
- pyobo/version.py +1 -1
- {pyobo-0.12.2.dist-info → pyobo-0.12.4.dist-info}/METADATA +3 -2
- {pyobo-0.12.2.dist-info → pyobo-0.12.4.dist-info}/RECORD +28 -23
- pyobo/obographs.py +0 -152
- /pyobo/{reader_utils.py → struct/obo/reader_utils.py} +0 -0
- {pyobo-0.12.2.dist-info → pyobo-0.12.4.dist-info}/WHEEL +0 -0
- {pyobo-0.12.2.dist-info → pyobo-0.12.4.dist-info}/entry_points.txt +0 -0
- {pyobo-0.12.2.dist-info → pyobo-0.12.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
pyobo/.DS_Store,sha256=00b8c741cd5b001c03c1a582f55bfbcda0ad16f0e55019d64f93241b74991980,8196
|
|
2
|
-
pyobo/__init__.py,sha256=
|
|
2
|
+
pyobo/__init__.py,sha256=ae0b55a37ac88a8423fd32252683d3447102bcce078fe4c2a418f78196e9d648,3434
|
|
3
3
|
pyobo/__main__.py,sha256=70e610d8e10bc45fbd4fa9ee67dc672d2bbd6cb1e4e9e8a7aec4a8cfb11c0fd3,83
|
|
4
4
|
pyobo/api/__init__.py,sha256=259870a4519a6baa5df1180378837e67c688e8ecbe46e9a3d4a90e6435c79e1d,2955
|
|
5
5
|
pyobo/api/alts.py,sha256=478b3162574616f2827bd73107f80f5dfdaf5971eaf6c6813109109dba89e522,3032
|
|
@@ -7,7 +7,7 @@ pyobo/api/combine.py,sha256=ed3f108fc5b5c164352a0289b0ed641511d9c6441cadf28cd610
|
|
|
7
7
|
pyobo/api/edges.py,sha256=4849b6809c7a2e83a48571a3d75578dae2e0e0589d15af6326a5bd1f39e57f09,1974
|
|
8
8
|
pyobo/api/hierarchy.py,sha256=37f27381f08a3c859adb4a1d46132fa60889a5ccce8867620db2e4353aa5a69f,10314
|
|
9
9
|
pyobo/api/metadata.py,sha256=b2d25a897fe5ef1d11d55efb4cdc07bcfb6892e67e128a9bf473112fbd0d896b,1029
|
|
10
|
-
pyobo/api/names.py,sha256=
|
|
10
|
+
pyobo/api/names.py,sha256=674d2fb91794ec218a2f7f4466f300310bb75462ca625245ccc0474f8915e310,10935
|
|
11
11
|
pyobo/api/properties.py,sha256=6d85af1ebd5b7f4c5d232323faab9d8f8a11a419eab0a86eca36052b22b2f778,6914
|
|
12
12
|
pyobo/api/relations.py,sha256=6dfda59d8ae2c3addb816d7dad2b97856916c6f2e6114f7a774bfcaff1c25747,5859
|
|
13
13
|
pyobo/api/species.py,sha256=631cc978295fb8a23ea6360ba6ee7bf7b8dd0dec93917a6340381d99cf4c2b0a,2376
|
|
@@ -21,10 +21,10 @@ pyobo/cli/database_utils.py,sha256=8d0eea4a0fa8664f90f910b5db536451ba9778d8342bc
|
|
|
21
21
|
pyobo/cli/lookup.py,sha256=1b11bbe771979c345ff8df494562919900b95e237c7c437997595ee42de31c76,9163
|
|
22
22
|
pyobo/cli/utils.py,sha256=9e6b57b311b44d61088e321efa387f6aacebd3d6d337bf8d1c589fb871b3304d,1738
|
|
23
23
|
pyobo/constants.py,sha256=c1ffa4f12c1ddee556adf728ef4ac51da44f228fe6fca9b58b9ab8f263acc87b,5112
|
|
24
|
-
pyobo/getters.py,sha256=
|
|
24
|
+
pyobo/getters.py,sha256=0bbd39aeba8b4511230ebadd209b2c9c64b117f81d80e1a1327230a068a13eeb,17618
|
|
25
25
|
pyobo/gilda_utils.py,sha256=b9384002b00b48dcc98be86b47d954bed41c8b9548c380aaab62fa9ad929d0aa,1990
|
|
26
|
-
pyobo/identifier_utils/__init__.py,sha256=
|
|
27
|
-
pyobo/identifier_utils/api.py,sha256=
|
|
26
|
+
pyobo/identifier_utils/__init__.py,sha256=8921c06613b0a9666662939fa5734bb8aa2e4988fb652562697ec1179b93f2ca,793
|
|
27
|
+
pyobo/identifier_utils/api.py,sha256=b65d99d4b8d223341d7d3bd4b7bc2e41ce7b52e218b0779b90bacde6a9beaa61,9247
|
|
28
28
|
pyobo/identifier_utils/relations/__init__.py,sha256=2961f492b8530a678a9e010887b5530c3de1cc2df8f294e210a18dbb748d01db,159
|
|
29
29
|
pyobo/identifier_utils/relations/api.py,sha256=c625bca0f09379ba7ef544d05aaf4b998ee9798945a90f3b98b6d763ef9d36df,5764
|
|
30
30
|
pyobo/identifier_utils/relations/data.json,sha256=88b6ce5fb632faa389b512b68f1b73acdd54b552a1aaa8043430eb5e0020a0bc,113169
|
|
@@ -35,11 +35,8 @@ pyobo/mocks.py,sha256=8f9e392bd3ff0cfb0306e6070eb8724cb8e694fa0d951744b5c4652e15
|
|
|
35
35
|
pyobo/ner/__init__.py,sha256=0199b704f1235184d521069034823c3d9960ff6756205c299649b87a4bbd4041,153
|
|
36
36
|
pyobo/ner/api.py,sha256=b34309833eac8f5dea881d531323bf682f35d377e09d807066ba1183282964dc,2167
|
|
37
37
|
pyobo/ner/normalizer.py,sha256=4e90d93801877f72f2fab8069db986e79cc749533a068a8b07a9d7c9e37cb9c2,954
|
|
38
|
-
pyobo/obographs.py,sha256=8b4258792727430b6c4f15833116313905abb83511f1fee565091c400323f49d,4345
|
|
39
38
|
pyobo/plugins.py,sha256=c04afe369c99ed9eae12bd2e18334e7972ce199a2419b166a377becf63cd2893,1232
|
|
40
39
|
pyobo/py.typed,sha256=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855,0
|
|
41
|
-
pyobo/reader.py,sha256=6fc2522a89772b718eaa6278e2abc7d5ca536378b537992b34bfe12bcfd10d72,52246
|
|
42
|
-
pyobo/reader_utils.py,sha256=5324154d08576e167d7c28b3660dbaa394e67878acf7ea9930abd0170201460a,4423
|
|
43
40
|
pyobo/resource_utils.py,sha256=6e5a1229b1df30bcf4841f009213247cb386ab0e85c8ef02114e8b360d0f54c9,4406
|
|
44
41
|
pyobo/resources/__init__.py,sha256=43d9e293b1e0a4808238dec610aa5bc37cfd64833b345270a063697a9927da70,38
|
|
45
42
|
pyobo/resources/ncbitaxon.py,sha256=92484774b0f45247cb4090b34e3851a5c175dde2da03e472d891c9953968116b,1979
|
|
@@ -49,7 +46,7 @@ pyobo/resources/ro.tsv,sha256=62f9412cf00acb6c38221798ccef68c75620e9690774c57331
|
|
|
49
46
|
pyobo/resources/so.py,sha256=4bebe643b2fc009134f057c6543209a8d40d68b3d49ae27a1c2e45e2158732b0,1466
|
|
50
47
|
pyobo/resources/so.tsv,sha256=50964a153100bff5eccd861bba7e167fa6f88e8bc38d229cd51591411713cc3c,82068
|
|
51
48
|
pyobo/sources/README.md,sha256=0296f0a48da16d8422c3837a284fd5000a5f3a64d01e47936eb34413121b5f82,901
|
|
52
|
-
pyobo/sources/__init__.py,sha256=
|
|
49
|
+
pyobo/sources/__init__.py,sha256=fb9f5ba3c87a3ea2f2d28144659897c99de0ad824e4ed2382035a8814184313c,4683
|
|
53
50
|
pyobo/sources/agrovoc.py,sha256=489b1b27b2adc5d2541bd4629a66f609f2dfce92bd78eccfd30c79f608feeace,787
|
|
54
51
|
pyobo/sources/antibodyregistry.py,sha256=3726d4ccf1286e7e73aebd6252f0bc67d72ea83103335bb4eec8d5d540037664,3353
|
|
55
52
|
pyobo/sources/bigg/__init__.py,sha256=e292beef5071d08bfddcfaa665e714297f4b71aa5b5bdc26ef304df6f85ba582,349
|
|
@@ -74,7 +71,7 @@ pyobo/sources/cvx.py,sha256=97d0acbae76bf54ca8d0f35c8c94db346eb610e51cac05688a3d
|
|
|
74
71
|
pyobo/sources/depmap.py,sha256=7f05bfd54901e49b6c797c137dbd017e32ef626fb17feb17c1feb368f2a4960f,3585
|
|
75
72
|
pyobo/sources/dictybase_gene.py,sha256=78bbde62732e26cd92c2d287ca3e34b678e9f058f2d72157a0f0e8b9bd5d6164,2672
|
|
76
73
|
pyobo/sources/drugbank/__init__.py,sha256=880b2dbd9419d3525c25e0089b606727ddb7501be2f1a490e2d1158440e8540a,178
|
|
77
|
-
pyobo/sources/drugbank/drugbank.py,sha256=
|
|
74
|
+
pyobo/sources/drugbank/drugbank.py,sha256=5a216ccbfe883599207ad99b518904d6f3e983974bc2305fcf7715263228d705,10914
|
|
78
75
|
pyobo/sources/drugbank/drugbank_salt.py,sha256=69b565fe280b7a698cc3850b8b7fc8b5381f09aab7bb26e3aa7b13f5187b0b59,1646
|
|
79
76
|
pyobo/sources/drugcentral.py,sha256=9fb9bbcbaf0b3c494163dde2e627a6695366ca1c74cb7293efd2419871a610a1,4047
|
|
80
77
|
pyobo/sources/expasy.py,sha256=25f116d229b5c25858db82add7a037e8c5b405e40dbfd76d3ff67a1f581c8755,11053
|
|
@@ -90,7 +87,7 @@ pyobo/sources/go.py,sha256=cd72c37dca9b894eb43371540adab37cfcd8a07952be4533000f1
|
|
|
90
87
|
pyobo/sources/gtdb.py,sha256=ab420486568c8ad1d6a39200cb6979f2e5cc2d67a40addeb2303a60ecb031138,5221
|
|
91
88
|
pyobo/sources/gwascentral/__init__.py,sha256=55d1c8801551fb7e81ee02ee851e175795179ff120359d3e8b583d36384e8d8d,231
|
|
92
89
|
pyobo/sources/gwascentral/gwascentral_phenotype.py,sha256=4af302177b18a9cdc5e6735709fefa033221353ebdf191c79d3a4ed0819fb7ca,1788
|
|
93
|
-
pyobo/sources/gwascentral/gwascentral_study.py,sha256=
|
|
90
|
+
pyobo/sources/gwascentral/gwascentral_study.py,sha256=7f30e246e594f38d3ce60725cee58d2dbc4312c21d572b2a5d270c53405d5e73,2672
|
|
94
91
|
pyobo/sources/hgnc/__init__.py,sha256=d5084cec674febf03108ccda073da4dd244b9034ce912da15213cc2c44d21963,157
|
|
95
92
|
pyobo/sources/hgnc/hgnc.py,sha256=f05121570f4e4b06f4d70bbf6950363349a726de22c6f2ed5e3e43411591bf95,16377
|
|
96
93
|
pyobo/sources/hgnc/hgncgenefamily.py,sha256=e3e8d0b750d59a7da3d0ac2b100e248e8dad51af54c045405a12704e36db20cd,3710
|
|
@@ -98,6 +95,7 @@ pyobo/sources/icd/__init__.py,sha256=0eb65597be8ff1eb2c278b6564f71ab8556b5d59082
|
|
|
98
95
|
pyobo/sources/icd/icd10.py,sha256=61ab55ce0af6dbd27f59e25c6b8150007a96af1edcecde1f1db85bd5c4354de5,2587
|
|
99
96
|
pyobo/sources/icd/icd11.py,sha256=5b6e59f8028cfbd41f860151d1164514be2653a50078c0fc8748c20b815ee11b,4867
|
|
100
97
|
pyobo/sources/icd/icd_utils.py,sha256=8fbc63228bd61b4f86c47eee5d6ad76433b52d7132a3fe0275680f4874c85c96,4525
|
|
98
|
+
pyobo/sources/intact.py,sha256=7e78d9e164acadf67b6df963a4c58116d4861a4e959aef0fb1d7d1f6c6f15cfe,2497
|
|
101
99
|
pyobo/sources/interpro.py,sha256=d6d99771293946b8228fbd35183aa845b77f7c46af1e5f3f03a6887f92ba10b1,4809
|
|
102
100
|
pyobo/sources/itis.py,sha256=6b1d54c40ece2a97176c497aaa3113fbf78ea32845e918fc76de4a1bf254dbbf,2876
|
|
103
101
|
pyobo/sources/kegg/__init__.py,sha256=8553f4b6ec15a6234c8a416ffdb34faf3b98bfe1c0d7f6cf742bcdc7e7e6e458,219
|
|
@@ -169,19 +167,26 @@ pyobo/ssg/base.html,sha256=fef95d5026be80bd984cd63a1a002ec4d4f74e06840f9f39bc5fe
|
|
|
169
167
|
pyobo/ssg/index.html,sha256=da62c16a198f7ad2468599c5d7e4da4d7b81e02a18a25a59da741a579746e676,4346
|
|
170
168
|
pyobo/ssg/term.html,sha256=b522c82774980d37ad2bd8361280cacaee1a1dc855a351145e4fda62119e38aa,3869
|
|
171
169
|
pyobo/ssg/typedef.html,sha256=2ab76acc1eb18edebcf5b1b7dc3dba00bfb5d49aef36e124a3134d23e106f938,2038
|
|
172
|
-
pyobo/struct/__init__.py,sha256=
|
|
170
|
+
pyobo/struct/__init__.py,sha256=653697fa0c263df189df3550d1e79772c8c4f20e6886a8fffaccc676fbbb94d2,1474
|
|
173
171
|
pyobo/struct/functional/__init__.py,sha256=d536edb7fe86a1aad19607df3dea62b49dd0b4bb2b30f31b8431a842700a499e,32
|
|
174
172
|
pyobo/struct/functional/dsl.py,sha256=780b4e5616b8dc823cee610945a95ffa109aa43287992dd4dd51511c461f96fb,101183
|
|
175
173
|
pyobo/struct/functional/macros.py,sha256=cc654f131fa685d4afc87d8c7b5e8565da1b789dd5d73045a77b3e033a8ced52,13785
|
|
176
174
|
pyobo/struct/functional/obo_to_functional.py,sha256=785c46fdb00dc45f3903f67ad24ae4fcb6d187ce48208373fc9d42833a85f6b8,13273
|
|
177
|
-
pyobo/struct/functional/ontology.py,sha256=
|
|
175
|
+
pyobo/struct/functional/ontology.py,sha256=c261c91ed950d3a6564ffcbda379fb228ffd28f0d873cb5f9c1a237a4e744328,9338
|
|
178
176
|
pyobo/struct/functional/utils.py,sha256=73e5c6d9227b0a162dcfb294dcad05f93ea870c8d87af7a2d16c6591f9249ad1,3487
|
|
177
|
+
pyobo/struct/obo/__init__.py,sha256=c49005278cae796050bf706bb53b871c9ec0ccea8280eb8780a638450a1cb16d,157
|
|
178
|
+
pyobo/struct/obo/reader.py,sha256=6dd8c153e8210c8da1cceed08a4c4bf4addaa3355529b2d34d03960d7c446916,52261
|
|
179
|
+
pyobo/struct/obo/reader_utils.py,sha256=5324154d08576e167d7c28b3660dbaa394e67878acf7ea9930abd0170201460a,4423
|
|
180
|
+
pyobo/struct/obograph/__init__.py,sha256=078acd3fd3824e73179bc629434adaaf5b309f8188c3d6f88100fe215baa1f2c,452
|
|
181
|
+
pyobo/struct/obograph/export.py,sha256=a4630989db4171855683d76a169ef6a554dad3c3944401fdb0b4ea37cdef93da,9747
|
|
182
|
+
pyobo/struct/obograph/reader.py,sha256=dbae3255e0fc6b78c6c7d11a194655c456d243fa7043fe9c915c3d4bcc2225f3,8525
|
|
183
|
+
pyobo/struct/obograph/utils.py,sha256=8ded244a40b6e0c53da56447ab5fcaf89e635a18d611263a348dd3a59aaf67f4,1516
|
|
179
184
|
pyobo/struct/reference.py,sha256=4fc7d3b665cd18c8dfbbb2b8b49de4bc30a8e101d14ff26bf5f88e9c562bc2d3,11735
|
|
180
|
-
pyobo/struct/struct.py,sha256=
|
|
181
|
-
pyobo/struct/struct_utils.py,sha256=
|
|
182
|
-
pyobo/struct/typedef.py,sha256=
|
|
185
|
+
pyobo/struct/struct.py,sha256=fd60053e55c16c3ca2222852ad0f8bd6de20ac8151e096340d271086d6fa9099,89172
|
|
186
|
+
pyobo/struct/struct_utils.py,sha256=a4fa0ee672bc626095fbc0df66f0b948ad35ff39b55971b0145cd6bd80e640fb,39511
|
|
187
|
+
pyobo/struct/typedef.py,sha256=8817a49f6426a9adc9ed8462d5db3d3324780b2ad3874d8781a1648e64fe9ce5,12429
|
|
183
188
|
pyobo/struct/utils.py,sha256=ce4a4e138d894087e4374adce6a34434ad375482a691fff9eed1e88cc24aef56,906
|
|
184
|
-
pyobo/struct/vocabulary.py,sha256=
|
|
189
|
+
pyobo/struct/vocabulary.py,sha256=1d853a86c2d0e34dd6bd64e68d1323b8ac51d3a4b2932a6bde4fc8c4b52104e9,4645
|
|
185
190
|
pyobo/utils/__init__.py,sha256=08035263cbc6abfeaff2b5a159121d9e4f96a392c0d91f568e0d67a9b5aa2cec,17
|
|
186
191
|
pyobo/utils/cache.py,sha256=136ccd03b82afd534699a36bad129e5f3e73aba5c3184fb93d5a24af30d99227,3098
|
|
187
192
|
pyobo/utils/io.py,sha256=fa0cb5a8633a6c9fb95eb2f74e08fbf69acc4fc229b89c18dd233921b80378a9,5100
|
|
@@ -189,9 +194,9 @@ pyobo/utils/iter.py,sha256=ad845b6da1491f131a134c94fab419a026a0608aed7afd3db98d2
|
|
|
189
194
|
pyobo/utils/misc.py,sha256=99d1f6e88b48d3f0cdbd7fff8a908556bf949278fcf0ef639e5cc8a421d0f4db,2684
|
|
190
195
|
pyobo/utils/ndex_utils.py,sha256=128902592d345ab93fe32f2575e42e53269a0bac8dcc18370da81497e2767336,2326
|
|
191
196
|
pyobo/utils/path.py,sha256=cc37f10de8e0ef90a6063cc2b1c5d1b0993e41649536f04bfddc892d61a3bc4f,3398
|
|
192
|
-
pyobo/version.py,sha256=
|
|
193
|
-
pyobo-0.12.
|
|
194
|
-
pyobo-0.12.
|
|
195
|
-
pyobo-0.12.
|
|
196
|
-
pyobo-0.12.
|
|
197
|
-
pyobo-0.12.
|
|
197
|
+
pyobo/version.py,sha256=a57d58ec84e8181d4fa5ab4ce8c6fbd23ae0a3be23927e993efd3b67d3cc6966,926
|
|
198
|
+
pyobo-0.12.4.dist-info/licenses/LICENSE,sha256=41c80964a1b1956e41c013670812fc5592d5b51bd7b3cd4287d949450488a498,1076
|
|
199
|
+
pyobo-0.12.4.dist-info/WHEEL,sha256=ec89e25a684ec3ad8fb2a9be806e47666a27f7dcdcf9b55bff3f1d3ed5e60e0a,78
|
|
200
|
+
pyobo-0.12.4.dist-info/entry_points.txt,sha256=00d833beec05ffdff58a90a8c49b5b04ce80e22d8c92ddfd80c3f340eea1bc6b,42
|
|
201
|
+
pyobo-0.12.4.dist-info/METADATA,sha256=6a63fea373d80648846c0e7a0885c887f9597e27d5c2c84302cd49427bf90d09,21658
|
|
202
|
+
pyobo-0.12.4.dist-info/RECORD,,
|
pyobo/obographs.py
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
"""Convert PyOBO into OBO Graph."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
import logging
|
|
6
|
-
from collections.abc import Iterable
|
|
7
|
-
from typing import TYPE_CHECKING
|
|
8
|
-
|
|
9
|
-
import bioregistry
|
|
10
|
-
from bioontologies.obograph import (
|
|
11
|
-
Definition,
|
|
12
|
-
Edge,
|
|
13
|
-
Graph,
|
|
14
|
-
GraphDocument,
|
|
15
|
-
Meta,
|
|
16
|
-
Node,
|
|
17
|
-
Synonym,
|
|
18
|
-
Xref,
|
|
19
|
-
)
|
|
20
|
-
from tqdm import tqdm
|
|
21
|
-
|
|
22
|
-
from pyobo.struct import Obo, OBOLiteral, Reference, Term
|
|
23
|
-
from pyobo.struct.typedef import definition_source, is_a
|
|
24
|
-
|
|
25
|
-
if TYPE_CHECKING:
|
|
26
|
-
from bioontologies.robot import ParseResults
|
|
27
|
-
|
|
28
|
-
__all__ = [
|
|
29
|
-
"graph_from_obo",
|
|
30
|
-
"parse_results_from_obo",
|
|
31
|
-
]
|
|
32
|
-
|
|
33
|
-
logger = logging.getLogger(__name__)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
def parse_results_from_obo(obo: Obo) -> ParseResults:
|
|
37
|
-
"""Get parse results from an OBO graph."""
|
|
38
|
-
graph = graph_from_obo(obo)
|
|
39
|
-
from bioontologies.robot import ParseResults
|
|
40
|
-
|
|
41
|
-
return ParseResults(graph_document=GraphDocument(graphs=[graph]))
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
def graph_from_obo(obo: Obo, use_tqdm: bool = True) -> Graph:
|
|
45
|
-
"""Get an OBO Graph object from a PyOBO object."""
|
|
46
|
-
nodes: list[Node] = []
|
|
47
|
-
edges: list[Edge] = []
|
|
48
|
-
for term in tqdm(
|
|
49
|
-
obo,
|
|
50
|
-
disable=not use_tqdm,
|
|
51
|
-
unit="term",
|
|
52
|
-
unit_scale=True,
|
|
53
|
-
desc=f"[{obo._prefix_version}] to OBO Graph JSON",
|
|
54
|
-
):
|
|
55
|
-
nodes.append(_get_class_node(term))
|
|
56
|
-
edges.extend(_iter_edges(term))
|
|
57
|
-
return Graph(
|
|
58
|
-
id=bioregistry.get_bioregistry_iri("bioregistry", obo.ontology),
|
|
59
|
-
prefix=obo.ontology,
|
|
60
|
-
meta=_get_meta(obo),
|
|
61
|
-
nodes=nodes,
|
|
62
|
-
edges=edges,
|
|
63
|
-
standardized=True, # from construction :)
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
def _get_meta(obo: Obo) -> Meta:
|
|
68
|
-
return Meta(
|
|
69
|
-
version=obo.data_version,
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def _get_class_node(term: Term) -> Node:
|
|
74
|
-
if term.provenance or term.definition:
|
|
75
|
-
definition = Definition.from_parsed(
|
|
76
|
-
value=term.definition, references=_prep_prov(term.provenance)
|
|
77
|
-
)
|
|
78
|
-
else:
|
|
79
|
-
definition = None
|
|
80
|
-
xrefs = [
|
|
81
|
-
Xref.from_parsed(
|
|
82
|
-
predicate=Reference.from_reference(mapping_predicate),
|
|
83
|
-
value=Reference.from_reference(mapping_object),
|
|
84
|
-
)
|
|
85
|
-
for mapping_predicate, mapping_object in term.get_mappings(
|
|
86
|
-
include_xrefs=True, add_context=False
|
|
87
|
-
)
|
|
88
|
-
]
|
|
89
|
-
synonyms = [
|
|
90
|
-
Synonym.from_parsed(
|
|
91
|
-
name=synonym.name,
|
|
92
|
-
predicate=Reference.from_reference(synonym.predicate),
|
|
93
|
-
synonym_type=Reference.from_reference(synonym.type) if synonym.type else None,
|
|
94
|
-
references=_prep_prov(synonym.provenance),
|
|
95
|
-
)
|
|
96
|
-
for synonym in term.synonyms
|
|
97
|
-
]
|
|
98
|
-
|
|
99
|
-
meta = Meta(
|
|
100
|
-
definition=definition,
|
|
101
|
-
xrefs=xrefs,
|
|
102
|
-
synonyms=synonyms,
|
|
103
|
-
basicPropertyValues=None, # TODO properties
|
|
104
|
-
deprecated=term.is_obsolete or False,
|
|
105
|
-
)
|
|
106
|
-
return Node(
|
|
107
|
-
# FIXME do expansion same as for OFN
|
|
108
|
-
id=f"https://bioregistry.io/{term.curie}",
|
|
109
|
-
lbl=term.name,
|
|
110
|
-
meta=meta,
|
|
111
|
-
type="CLASS",
|
|
112
|
-
reference=Reference.from_reference(term.reference),
|
|
113
|
-
standardized=True,
|
|
114
|
-
)
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
def _prep_prov(provenance):
|
|
118
|
-
rv = []
|
|
119
|
-
for x in provenance:
|
|
120
|
-
match x:
|
|
121
|
-
case Reference():
|
|
122
|
-
rv.append(Reference.from_reference(x))
|
|
123
|
-
case OBOLiteral():
|
|
124
|
-
logger.debug("not implemented to convert literal provenance")
|
|
125
|
-
continue
|
|
126
|
-
return rv
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
def _iter_edges(term: Term) -> Iterable[Edge]:
|
|
130
|
-
for parent in term.parents:
|
|
131
|
-
yield Edge.from_parsed(
|
|
132
|
-
Reference.from_reference(term.reference),
|
|
133
|
-
Reference.from_reference(is_a.reference),
|
|
134
|
-
Reference.from_reference(parent),
|
|
135
|
-
)
|
|
136
|
-
|
|
137
|
-
for typedef, targets in term.relationships.items():
|
|
138
|
-
for target in targets:
|
|
139
|
-
yield Edge.from_parsed(
|
|
140
|
-
Reference.from_reference(term.reference),
|
|
141
|
-
Reference.from_reference(typedef),
|
|
142
|
-
Reference.from_reference(target),
|
|
143
|
-
)
|
|
144
|
-
|
|
145
|
-
for provenance_reference in term.provenance:
|
|
146
|
-
if isinstance(provenance_reference, Reference):
|
|
147
|
-
yield Edge.from_parsed(
|
|
148
|
-
Reference.from_reference(term.reference),
|
|
149
|
-
Reference.from_reference(definition_source.reference),
|
|
150
|
-
Reference.from_reference(provenance_reference),
|
|
151
|
-
)
|
|
152
|
-
# TODO also look through xrefs and seealso to get provenance xrefs?
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|