biointerchange 0.1.0 → 0.1.2

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.
Files changed (45) hide show
  1. data/.travis.yml +3 -3
  2. data/Gemfile +2 -1
  3. data/README.md +192 -7
  4. data/Rakefile +1 -1
  5. data/VERSION +1 -1
  6. data/examples/vocabulary.rb +23 -0
  7. data/generators/javaify.rb +131 -0
  8. data/generators/pythonify.rb +67 -0
  9. data/generators/rdfxml.rb +152 -44
  10. data/lib/biointerchange/core.rb +2 -1
  11. data/lib/biointerchange/exceptions.rb +27 -0
  12. data/lib/biointerchange/genomics/gff3_rdf_ntriples.rb +21 -18
  13. data/lib/biointerchange/gff3o.rb +495 -0
  14. data/lib/biointerchange/gvf1o.rb +730 -0
  15. data/lib/biointerchange/registry.rb +2 -2
  16. data/lib/biointerchange/sio.rb +10951 -5845
  17. data/lib/biointerchange/sofa.rb +2171 -1300
  18. data/spec/exceptions_spec.rb +6 -0
  19. data/spec/gff3_rdfwriter_spec.rb +7 -1
  20. data/spec/text_mining_pdfx_xml_reader_spec.rb +6 -0
  21. data/spec/text_mining_pubannos_json_reader_spec.rb +6 -0
  22. data/spec/text_mining_rdfwriter_spec.rb +6 -0
  23. data/supplemental/java/biointerchange/pom.xml +45 -0
  24. data/supplemental/java/biointerchange/src/main/java/org/biointerchange/App.java +58 -0
  25. data/supplemental/java/biointerchange/src/main/java/org/biointerchange/AppSIO.java +49 -0
  26. data/supplemental/java/biointerchange/src/main/java/org/biointerchange/vocabulary/GFF3O.java +647 -0
  27. data/supplemental/java/biointerchange/src/main/java/org/biointerchange/vocabulary/GVF1O.java +946 -0
  28. data/supplemental/java/biointerchange/src/main/java/org/biointerchange/vocabulary/SIO.java +15390 -0
  29. data/supplemental/java/biointerchange/src/main/java/org/biointerchange/vocabulary/SOFA.java +2968 -0
  30. data/supplemental/java/biointerchange/src/test/java/org/biointerchange/AppTest.java +38 -0
  31. data/supplemental/python/biointerchange/__init__.py +4 -0
  32. data/supplemental/python/biointerchange/gff3o.py +581 -0
  33. data/supplemental/python/biointerchange/gvf1o.py +864 -0
  34. data/supplemental/python/biointerchange/sio.py +11772 -0
  35. data/supplemental/python/biointerchange/sofa.py +2422 -0
  36. data/supplemental/python/example.py +19 -0
  37. data/supplemental/python/setup.py +13 -0
  38. data/web/about.html +3 -0
  39. data/web/api.html +219 -0
  40. data/web/index.html +4 -3
  41. data/web/ontologies.html +109 -0
  42. data/web/webservices.html +1 -0
  43. metadata +144 -117
  44. data/docs/exceptions_readme.txt +0 -13
  45. data/lib/biointerchange/gff3.rb +0 -135
@@ -0,0 +1,38 @@
1
+ package org.biointerchange;
2
+
3
+ import junit.framework.Test;
4
+ import junit.framework.TestCase;
5
+ import junit.framework.TestSuite;
6
+
7
+ /**
8
+ * Unit test for simple App.
9
+ */
10
+ public class AppTest
11
+ extends TestCase
12
+ {
13
+ /**
14
+ * Create the test case
15
+ *
16
+ * @param testName name of the test case
17
+ */
18
+ public AppTest( String testName )
19
+ {
20
+ super( testName );
21
+ }
22
+
23
+ /**
24
+ * @return the suite of tests being tested
25
+ */
26
+ public static Test suite()
27
+ {
28
+ return new TestSuite( AppTest.class );
29
+ }
30
+
31
+ /**
32
+ * Rigourous Test :-)
33
+ */
34
+ public void testApp()
35
+ {
36
+ assertTrue( true );
37
+ }
38
+ }
@@ -0,0 +1,4 @@
1
+ from gff3o import *
2
+ from gvf1o import *
3
+ from sio import *
4
+
@@ -0,0 +1,581 @@
1
+ import rdflib
2
+
3
+ from rdflib import Namespace
4
+
5
+ __namespace_GFF3O = Namespace('http://www.biointerchange.org/gff3o#')
6
+
7
+ def _namespace_GFF3O(accession):
8
+ return __namespace_GFF3O[accession]
9
+
10
+ class GFF3O:
11
+
12
+ @classmethod
13
+ def strand(cls):
14
+ """Either:
15
+ Strand of the feature.
16
+ (cls, GFF3_0010)
17
+ Or:
18
+ Strand of a target -- if applicable.
19
+ (GFF3_0045)
20
+ """
21
+ return [ _namespace_GFF3O('GFF3_0010'), _namespace_GFF3O('GFF3_0045') ]
22
+
23
+ @classmethod
24
+ def attributes(cls):
25
+ """Tag name/value pair attributes of a feature that are not covered by object-/data-properties of the ontology. Tags that are represented as object-/data-properties are: ID, Name, Alias, Parent, Target, Gap, Derives_from, Dbxref, Ontology_term, Ontology_term, or Is_circular
26
+ (cls, GFF3_0012)
27
+ """
28
+ return _namespace_GFF3O('GFF3_0012')
29
+
30
+ @classmethod
31
+ def parent(cls):
32
+ """Link out to the parent feature.
33
+ (cls, GFF3_0014)
34
+ """
35
+ return _namespace_GFF3O('GFF3_0014')
36
+
37
+ @classmethod
38
+ def contains(cls):
39
+ """Relationship that describes which features belong to a feature set.
40
+ (cls, GFF3_0015)
41
+ """
42
+ return _namespace_GFF3O('GFF3_0015')
43
+
44
+ @classmethod
45
+ def region(cls):
46
+ """Either:
47
+ FALDO "Region" instance replacement for a feature's start, stop, strand properties.
48
+ (cls, GFF3_0021)
49
+ Or:
50
+ FALDO "Region" instance replacement for a target's start, stop, strand properties.
51
+ (GFF3_0050)
52
+ """
53
+ return [ _namespace_GFF3O('GFF3_0021'), _namespace_GFF3O('GFF3_0050') ]
54
+
55
+ @classmethod
56
+ def species(cls):
57
+ """NCBI Taxonomy Ontology "NCBITaxon_1" (cls, or sub-classes) instance that denotes the species for a feature set.
58
+ (GFF3_0023)
59
+ """
60
+ return _namespace_GFF3O('GFF3_0023')
61
+
62
+ @classmethod
63
+ def set_properties(cls):
64
+ """Either:
65
+ Properties that are directly associated with Set class instances.
66
+ (cls, GFF3_0025)
67
+ Or:
68
+ Properties that are directly associated with Set class instances.
69
+ (GFF3_0027)
70
+ """
71
+ return [ _namespace_GFF3O('GFF3_0025'), _namespace_GFF3O('GFF3_0027') ]
72
+
73
+ @classmethod
74
+ def feature_properties(cls):
75
+ """Either:
76
+ Properties that are directly associated with Feature class instances.
77
+ (cls, GFF3_0026)
78
+ Or:
79
+ Properties that are directly associated with Feature class instances.
80
+ (GFF3_0028)
81
+ """
82
+ return [ _namespace_GFF3O('GFF3_0026'), _namespace_GFF3O('GFF3_0028') ]
83
+
84
+ @classmethod
85
+ def dbxref(cls):
86
+ """A database cross-reference to associate a sequence alteration to its representation in another database.
87
+ (cls, GFF3_0034)
88
+ """
89
+ return _namespace_GFF3O('GFF3_0034')
90
+
91
+ @classmethod
92
+ def ontology_term(cls):
93
+ """A cross-reference to an ontology term that is associated with a feature.
94
+ (cls, GFF3_0035)
95
+ """
96
+ return _namespace_GFF3O('GFF3_0035')
97
+
98
+ @classmethod
99
+ def target(cls):
100
+ """Identifies the target that the features aligns to.
101
+ (cls, GFF3_0039)
102
+ """
103
+ return _namespace_GFF3O('GFF3_0039')
104
+
105
+ @classmethod
106
+ def target_properties(cls):
107
+ """Either:
108
+ Properties that are directly associated with Target class instances.
109
+ (cls, GFF3_0044)
110
+ Or:
111
+ Properties that are directly associated with Target class instances.
112
+ (GFF3_0040)
113
+ """
114
+ return [ _namespace_GFF3O('GFF3_0044'), _namespace_GFF3O('GFF3_0040') ]
115
+
116
+ @classmethod
117
+ def strand(cls):
118
+ """Either:
119
+ Strand of the feature.
120
+ (cls, GFF3_0010)
121
+ Or:
122
+ Strand of a target -- if applicable.
123
+ (GFF3_0045)
124
+ """
125
+ return [ _namespace_GFF3O('GFF3_0010'), _namespace_GFF3O('GFF3_0045') ]
126
+
127
+ @classmethod
128
+ def derives_from(cls):
129
+ """Describes a temporal relationship between two features, where the object denotes the subjects origin.
130
+ (cls, GFF3_0047)
131
+ """
132
+ return _namespace_GFF3O('GFF3_0047')
133
+
134
+ @classmethod
135
+ def region(cls):
136
+ """Either:
137
+ FALDO "Region" instance replacement for a feature's start, stop, strand properties.
138
+ (cls, GFF3_0021)
139
+ Or:
140
+ FALDO "Region" instance replacement for a target's start, stop, strand properties.
141
+ (GFF3_0050)
142
+ """
143
+ return [ _namespace_GFF3O('GFF3_0021'), _namespace_GFF3O('GFF3_0050') ]
144
+
145
+ @classmethod
146
+ def seqid(cls):
147
+ """ID of the landmark that establishes the coordinate system for the current feature.
148
+ (cls, GFF3_0004)
149
+ """
150
+ return _namespace_GFF3O('GFF3_0004')
151
+
152
+ @classmethod
153
+ def source(cls):
154
+ """A free text qualifier that describes the algorithm or operating procedure that generated this feature. For example, the name of the software that generated this feature or a database name.
155
+ (cls, GFF3_0005)
156
+ """
157
+ return _namespace_GFF3O('GFF3_0005')
158
+
159
+ @classmethod
160
+ def type(cls):
161
+ """Type of the feature, which is either a term from the "lite" version of the Sequence Ontology (cls, SOFA), a term from the full Sequence Ontology (SO) that is a child of sequence_feature (SO:0000110), or a SOFA or SO accession number.
162
+ (GFF3_0006)
163
+ """
164
+ return _namespace_GFF3O('GFF3_0006')
165
+
166
+ @classmethod
167
+ def start(cls):
168
+ """Either:
169
+ Start coordinate of the feature on the seqid landmark.
170
+ (cls, GFF3_0007)
171
+ Or:
172
+ Start coordinate of the target.
173
+ (GFF3_0042)
174
+ """
175
+ return [ _namespace_GFF3O('GFF3_0007'), _namespace_GFF3O('GFF3_0042') ]
176
+
177
+ @classmethod
178
+ def end(cls):
179
+ """Either:
180
+ End coordinate of the feature on the seqid landmark.
181
+ (cls, GFF3_0008)
182
+ Or:
183
+ End coordinate of the target.
184
+ (GFF3_0043)
185
+ """
186
+ return [ _namespace_GFF3O('GFF3_0008'), _namespace_GFF3O('GFF3_0043') ]
187
+
188
+ @classmethod
189
+ def score(cls):
190
+ """Score of the feature. For example, an E-value for sequence similarity features or a P-value for ab initio gene prediction features.
191
+ (cls, GFF3_0009)
192
+ """
193
+ return _namespace_GFF3O('GFF3_0009')
194
+
195
+ @classmethod
196
+ def phase(cls):
197
+ """Phase for "CDS" features. It indicates where the feature begins with reference to the reading frame. For forward strand features, phase is counted from the start field, whilst for reverse strand features, phase is counted from the end field.
198
+ (cls, GFF3_0011)
199
+ """
200
+ return _namespace_GFF3O('GFF3_0011')
201
+
202
+ @classmethod
203
+ def tag(cls):
204
+ """Tag name of a feature attribute.
205
+ (cls, GFF3_0013)
206
+ """
207
+ return _namespace_GFF3O('GFF3_0013')
208
+
209
+ @classmethod
210
+ def version(cls):
211
+ """Version of the GFF3 specification that defines the feature set contents.
212
+ (cls, GFF3_0022)
213
+ """
214
+ return _namespace_GFF3O('GFF3_0022')
215
+
216
+ @classmethod
217
+ def build(cls):
218
+ """Name of a genome assembly build that denotes the provenance of features in a feature set. For example, 'NCBI 36' or 'FlyBase r4.1'.
219
+ (cls, GFF3_0024)
220
+ """
221
+ return _namespace_GFF3O('GFF3_0024')
222
+
223
+ @classmethod
224
+ def set_properties(cls):
225
+ """Either:
226
+ Properties that are directly associated with Set class instances.
227
+ (cls, GFF3_0025)
228
+ Or:
229
+ Properties that are directly associated with Set class instances.
230
+ (GFF3_0027)
231
+ """
232
+ return [ _namespace_GFF3O('GFF3_0025'), _namespace_GFF3O('GFF3_0027') ]
233
+
234
+ @classmethod
235
+ def feature_properties(cls):
236
+ """Either:
237
+ Properties that are directly associated with Feature class instances.
238
+ (cls, GFF3_0026)
239
+ Or:
240
+ Properties that are directly associated with Feature class instances.
241
+ (GFF3_0028)
242
+ """
243
+ return [ _namespace_GFF3O('GFF3_0026'), _namespace_GFF3O('GFF3_0028') ]
244
+
245
+ @classmethod
246
+ def attribute_properties(cls):
247
+ """Properties that are directly associated with Attribute class instances.
248
+ (cls, GFF3_0029)
249
+ """
250
+ return _namespace_GFF3O('GFF3_0029')
251
+
252
+ @classmethod
253
+ def dbxref_properties(cls):
254
+ """Properties that are directly associated with DBXRef class instances.
255
+ (cls, GFF3_0031)
256
+ """
257
+ return _namespace_GFF3O('GFF3_0031')
258
+
259
+ @classmethod
260
+ def name(cls):
261
+ """Either:
262
+ Name of an external database. For example, "dbSNP" or "OMIM".
263
+ (cls, GFF3_0032)
264
+ Or:
265
+ Name of a feature, which can be used for display purposes. The name is not a unique property among features.
266
+ (GFF3_0036)
267
+ """
268
+ return [ _namespace_GFF3O('GFF3_0032'), _namespace_GFF3O('GFF3_0036') ]
269
+
270
+ @classmethod
271
+ def xref(cls):
272
+ """External database identifier. For example, for dbSNP, this identifier could be "rs3131969".
273
+ (cls, GFF3_0033)
274
+ """
275
+ return _namespace_GFF3O('GFF3_0033')
276
+
277
+ @classmethod
278
+ def name(cls):
279
+ """Either:
280
+ Name of an external database. For example, "dbSNP" or "OMIM".
281
+ (cls, GFF3_0032)
282
+ Or:
283
+ Name of a feature, which can be used for display purposes. The name is not a unique property among features.
284
+ (GFF3_0036)
285
+ """
286
+ return [ _namespace_GFF3O('GFF3_0032'), _namespace_GFF3O('GFF3_0036') ]
287
+
288
+ @classmethod
289
+ def alias(cls):
290
+ """An alternative name for a feature. This can be another descriptive name of a feature, such as a locus name or accession number.
291
+ (cls, GFF3_0037)
292
+ """
293
+ return _namespace_GFF3O('GFF3_0037')
294
+
295
+ @classmethod
296
+ def target_properties(cls):
297
+ """Either:
298
+ Properties that are directly associated with Target class instances.
299
+ (cls, GFF3_0044)
300
+ Or:
301
+ Properties that are directly associated with Target class instances.
302
+ (GFF3_0040)
303
+ """
304
+ return [ _namespace_GFF3O('GFF3_0044'), _namespace_GFF3O('GFF3_0040') ]
305
+
306
+ @classmethod
307
+ def target_id(cls):
308
+ """ID or accession of the target alignment.
309
+ (cls, GFF3_0041)
310
+ """
311
+ return _namespace_GFF3O('GFF3_0041')
312
+
313
+ @classmethod
314
+ def start(cls):
315
+ """Either:
316
+ Start coordinate of the feature on the seqid landmark.
317
+ (cls, GFF3_0007)
318
+ Or:
319
+ Start coordinate of the target.
320
+ (GFF3_0042)
321
+ """
322
+ return [ _namespace_GFF3O('GFF3_0007'), _namespace_GFF3O('GFF3_0042') ]
323
+
324
+ @classmethod
325
+ def end(cls):
326
+ """Either:
327
+ End coordinate of the feature on the seqid landmark.
328
+ (cls, GFF3_0008)
329
+ Or:
330
+ End coordinate of the target.
331
+ (GFF3_0043)
332
+ """
333
+ return [ _namespace_GFF3O('GFF3_0008'), _namespace_GFF3O('GFF3_0043') ]
334
+
335
+ @classmethod
336
+ def gap(cls):
337
+ """Gap describing the feature/target alignment if the sequences are not collinear. The formal description of this property has been lost due to a dead link in the GFF3 specification.
338
+ (cls, GFF3_0046)
339
+ """
340
+ return _namespace_GFF3O('GFF3_0046')
341
+
342
+ @classmethod
343
+ def note(cls):
344
+ """A free text note.
345
+ (cls, GFF3_0048)
346
+ """
347
+ return _namespace_GFF3O('GFF3_0048')
348
+
349
+ @classmethod
350
+ def is_circular(cls):
351
+ """Describes whether a feature is circular or not.
352
+ (cls, GFF3_0049)
353
+ """
354
+ return _namespace_GFF3O('GFF3_0049')
355
+
356
+ @classmethod
357
+ def Set(cls):
358
+ """Set of genomic sequence features, whose identifiers are unique within the set.
359
+ (cls, GFF3_0001)
360
+ """
361
+ return _namespace_GFF3O('GFF3_0001')
362
+
363
+ @classmethod
364
+ def Feature(cls):
365
+ """A genomic sequence feature.
366
+ (cls, GFF3_0002)
367
+ """
368
+ return _namespace_GFF3O('GFF3_0002')
369
+
370
+ @classmethod
371
+ def Attribute(cls):
372
+ """Describes additional feature attributes besides ID, Name, Alias, Parent, Target, Gap, Derives_from, Dbxref, Ontology_term, Ontology_term, or Is_circular.
373
+ (cls, GFF3_0003)
374
+ """
375
+ return _namespace_GFF3O('GFF3_0003')
376
+
377
+ @classmethod
378
+ def Strand(cls):
379
+ """Class describing a genomic strand. Instances of the class (cls, individuals) are used to denote forward-/reverse-strands, etc.
380
+ (GFF3_0016)
381
+ """
382
+ return _namespace_GFF3O('GFF3_0016')
383
+
384
+ @classmethod
385
+ def DBXRef(cls):
386
+ """A class describing relationships between features and external databases.
387
+ (cls, GFF3_0030)
388
+ """
389
+ return _namespace_GFF3O('GFF3_0030')
390
+
391
+ @classmethod
392
+ def Target(cls):
393
+ """Indicates a feature's "target" of a nucleotide-to-nucleotide or protein-to-nucleotide alignment.
394
+ (cls, GFF3_0038)
395
+ """
396
+ return _namespace_GFF3O('GFF3_0038')
397
+
398
+ @classmethod
399
+ def Positive(cls):
400
+ """Location on the positive (cls, forward) strand.
401
+ (GFF3_0017)
402
+ """
403
+ return _namespace_GFF3O('GFF3_0017')
404
+
405
+ @classmethod
406
+ def Negative(cls):
407
+ """Location on the negative (cls, reverse) strand.
408
+ (GFF3_0018)
409
+ """
410
+ return _namespace_GFF3O('GFF3_0018')
411
+
412
+ @classmethod
413
+ def UnknownStrand(cls):
414
+ """Strand was not determined, which leaves it open whether the location is on the positive (cls, forward) or negative (reverse) strand.
415
+ (GFF3_0019)
416
+ """
417
+ return _namespace_GFF3O('GFF3_0019')
418
+
419
+ @classmethod
420
+ def NotStranded(cls):
421
+ """Strand is not applicable.
422
+ (cls, GFF3_0020)
423
+ """
424
+ return _namespace_GFF3O('GFF3_0020')
425
+
426
+ @classmethod
427
+ def is_object_property(cls, uri):
428
+ """Determines whether the given URI is an object property.
429
+
430
+ uri -- URI that is tested for being an object property
431
+ """
432
+ if uri == _namespace_GFF3O('GFF3_0010'):
433
+ return True
434
+ if uri == _namespace_GFF3O('GFF3_0012'):
435
+ return True
436
+ if uri == _namespace_GFF3O('GFF3_0014'):
437
+ return True
438
+ if uri == _namespace_GFF3O('GFF3_0015'):
439
+ return True
440
+ if uri == _namespace_GFF3O('GFF3_0021'):
441
+ return True
442
+ if uri == _namespace_GFF3O('GFF3_0023'):
443
+ return True
444
+ if uri == _namespace_GFF3O('GFF3_0025'):
445
+ return True
446
+ if uri == _namespace_GFF3O('GFF3_0026'):
447
+ return True
448
+ if uri == _namespace_GFF3O('GFF3_0034'):
449
+ return True
450
+ if uri == _namespace_GFF3O('GFF3_0035'):
451
+ return True
452
+ if uri == _namespace_GFF3O('GFF3_0039'):
453
+ return True
454
+ if uri == _namespace_GFF3O('GFF3_0044'):
455
+ return True
456
+ if uri == _namespace_GFF3O('GFF3_0045'):
457
+ return True
458
+ if uri == _namespace_GFF3O('GFF3_0047'):
459
+ return True
460
+ if uri == _namespace_GFF3O('GFF3_0050'):
461
+ return True
462
+ return False
463
+
464
+ @classmethod
465
+ def is_datatype_property(cls, uri):
466
+ """Determines whether the given URI is a datatype property.
467
+
468
+ uri -- URI that is tested for being a datatype property
469
+ """
470
+ if uri == _namespace_GFF3O('GFF3_0004'):
471
+ return True
472
+ if uri == _namespace_GFF3O('GFF3_0005'):
473
+ return True
474
+ if uri == _namespace_GFF3O('GFF3_0006'):
475
+ return True
476
+ if uri == _namespace_GFF3O('GFF3_0007'):
477
+ return True
478
+ if uri == _namespace_GFF3O('GFF3_0008'):
479
+ return True
480
+ if uri == _namespace_GFF3O('GFF3_0009'):
481
+ return True
482
+ if uri == _namespace_GFF3O('GFF3_0011'):
483
+ return True
484
+ if uri == _namespace_GFF3O('GFF3_0013'):
485
+ return True
486
+ if uri == _namespace_GFF3O('GFF3_0022'):
487
+ return True
488
+ if uri == _namespace_GFF3O('GFF3_0024'):
489
+ return True
490
+ if uri == _namespace_GFF3O('GFF3_0027'):
491
+ return True
492
+ if uri == _namespace_GFF3O('GFF3_0028'):
493
+ return True
494
+ if uri == _namespace_GFF3O('GFF3_0029'):
495
+ return True
496
+ if uri == _namespace_GFF3O('GFF3_0031'):
497
+ return True
498
+ if uri == _namespace_GFF3O('GFF3_0032'):
499
+ return True
500
+ if uri == _namespace_GFF3O('GFF3_0033'):
501
+ return True
502
+ if uri == _namespace_GFF3O('GFF3_0036'):
503
+ return True
504
+ if uri == _namespace_GFF3O('GFF3_0037'):
505
+ return True
506
+ if uri == _namespace_GFF3O('GFF3_0040'):
507
+ return True
508
+ if uri == _namespace_GFF3O('GFF3_0041'):
509
+ return True
510
+ if uri == _namespace_GFF3O('GFF3_0042'):
511
+ return True
512
+ if uri == _namespace_GFF3O('GFF3_0043'):
513
+ return True
514
+ if uri == _namespace_GFF3O('GFF3_0046'):
515
+ return True
516
+ if uri == _namespace_GFF3O('GFF3_0048'):
517
+ return True
518
+ if uri == _namespace_GFF3O('GFF3_0049'):
519
+ return True
520
+ return False
521
+
522
+ @classmethod
523
+ def is_class(cls, uri):
524
+ """Determines whether the given URI is a class.
525
+
526
+ uri -- URI that is tested for being a class
527
+ """
528
+ if uri == _namespace_GFF3O('GFF3_0001'):
529
+ return True
530
+ if uri == _namespace_GFF3O('GFF3_0002'):
531
+ return True
532
+ if uri == _namespace_GFF3O('GFF3_0003'):
533
+ return True
534
+ if uri == _namespace_GFF3O('GFF3_0016'):
535
+ return True
536
+ if uri == _namespace_GFF3O('GFF3_0030'):
537
+ return True
538
+ if uri == _namespace_GFF3O('GFF3_0038'):
539
+ return True
540
+ return False
541
+
542
+ @classmethod
543
+ def is_named_individual(cls, uri):
544
+ """Determines whether the given URI is a named individual.
545
+
546
+ uri -- URI that is tested for being a named individual
547
+ """
548
+ if uri == _namespace_GFF3O('GFF3_0017'):
549
+ return True
550
+ if uri == _namespace_GFF3O('GFF3_0018'):
551
+ return True
552
+ if uri == _namespace_GFF3O('GFF3_0019'):
553
+ return True
554
+ if uri == _namespace_GFF3O('GFF3_0020'):
555
+ return True
556
+ return False
557
+
558
+ @classmethod
559
+ def with_parent(cls, uris, parent):
560
+ """Returns only those URIs that fall under a designated parent URI.
561
+
562
+ uris -- Set of URIs that are tested whether they have the given parent URI.
563
+ parent -- Parent URI.
564
+ """
565
+ return filter(lambda uri: cls.has_parent(uri, parent), uris)
566
+
567
+ @classmethod
568
+ def has_parent(cls, uri, parent):
569
+ """Recursively tries to determine the parent for a given URI.
570
+
571
+ uri -- URI that is tested for whether it has the given parent URI.
572
+ parent -- Parent URI.
573
+ """
574
+ if cls.__parent_properties.has_key(uri):
575
+ if cls.__parent_properties[uri] == parent:
576
+ return True
577
+ return cls.has_parent(cls.__parent_properties[uri], parent)
578
+ return False
579
+
580
+ __parent_properties = { _namespace_GFF3O('GFF3_0010') : _namespace_GFF3O('GFF3_0026') , _namespace_GFF3O('GFF3_0012') : _namespace_GFF3O('GFF3_0026') , _namespace_GFF3O('GFF3_0014') : _namespace_GFF3O('GFF3_0026') , _namespace_GFF3O('GFF3_0015') : _namespace_GFF3O('GFF3_0025') , _namespace_GFF3O('GFF3_0021') : _namespace_GFF3O('GFF3_0025') , _namespace_GFF3O('GFF3_0023') : _namespace_GFF3O('GFF3_0025') , _namespace_GFF3O('GFF3_0034') : _namespace_GFF3O('GFF3_0026') , _namespace_GFF3O('GFF3_0035') : _namespace_GFF3O('GFF3_0026') , _namespace_GFF3O('GFF3_0039') : _namespace_GFF3O('GFF3_0026') , _namespace_GFF3O('GFF3_0045') : _namespace_GFF3O('GFF3_0044') , _namespace_GFF3O('GFF3_0047') : _namespace_GFF3O('GFF3_0026') , _namespace_GFF3O('GFF3_0050') : _namespace_GFF3O('GFF3_0044') , _namespace_GFF3O('GFF3_0004') : _namespace_GFF3O('GFF3_0028') , _namespace_GFF3O('GFF3_0005') : _namespace_GFF3O('GFF3_0028') , _namespace_GFF3O('GFF3_0006') : _namespace_GFF3O('GFF3_0028') , _namespace_GFF3O('GFF3_0007') : _namespace_GFF3O('GFF3_0028') , _namespace_GFF3O('GFF3_0008') : _namespace_GFF3O('GFF3_0028') , _namespace_GFF3O('GFF3_0009') : _namespace_GFF3O('GFF3_0028') , _namespace_GFF3O('GFF3_0011') : _namespace_GFF3O('GFF3_0028') , _namespace_GFF3O('GFF3_0013') : _namespace_GFF3O('GFF3_0029') , _namespace_GFF3O('GFF3_0022') : _namespace_GFF3O('GFF3_0027') , _namespace_GFF3O('GFF3_0024') : _namespace_GFF3O('GFF3_0027') , _namespace_GFF3O('GFF3_0032') : _namespace_GFF3O('GFF3_0031') , _namespace_GFF3O('GFF3_0033') : _namespace_GFF3O('GFF3_0031') , _namespace_GFF3O('GFF3_0036') : _namespace_GFF3O('GFF3_0028') , _namespace_GFF3O('GFF3_0037') : _namespace_GFF3O('GFF3_0028') , _namespace_GFF3O('GFF3_0041') : _namespace_GFF3O('GFF3_0040') , _namespace_GFF3O('GFF3_0042') : _namespace_GFF3O('GFF3_0040') , _namespace_GFF3O('GFF3_0043') : _namespace_GFF3O('GFF3_0040') , _namespace_GFF3O('GFF3_0046') : _namespace_GFF3O('GFF3_0028') , _namespace_GFF3O('GFF3_0048') : _namespace_GFF3O('GFF3_0028') , _namespace_GFF3O('GFF3_0049') : _namespace_GFF3O('GFF3_0028') }
581
+