ols 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/lib/ols/term.rb +31 -25
- data/lib/ols/version.rb +1 -1
- data/test/test_ols_term.rb +4 -4
- metadata +17 -17
data/History.txt
CHANGED
data/lib/ols/term.rb
CHANGED
@@ -401,44 +401,50 @@ module OLS
|
|
401
401
|
|
402
402
|
# Remove the children from this ontology graph.
|
403
403
|
#
|
404
|
-
# @see #
|
405
|
-
# @since 0.3.
|
406
|
-
def
|
407
|
-
self.
|
404
|
+
# @see #remove_children
|
405
|
+
# @since 0.3.1
|
406
|
+
def remove_children!
|
407
|
+
self.really_remove_children!
|
408
408
|
end
|
409
409
|
|
410
410
|
# Returns a copy of this ontology term object with the children removed.
|
411
411
|
#
|
412
412
|
# @return [OLS::Term] A copy of this term with the children removed
|
413
413
|
#
|
414
|
-
# @see #
|
415
|
-
# @since 0.3.
|
416
|
-
def
|
414
|
+
# @see #remove_children!
|
415
|
+
# @since 0.3.1
|
416
|
+
def remove_children
|
417
417
|
copy = self.dup
|
418
|
-
copy.
|
418
|
+
copy.really_remove_children!
|
419
419
|
copy
|
420
420
|
end
|
421
421
|
|
422
|
+
alias :detach_parents! :remove_children!
|
423
|
+
alias :detach_parents :remove_children
|
424
|
+
|
422
425
|
# Removes the parents from this ontology graph.
|
423
426
|
#
|
424
|
-
# @see #
|
425
|
-
# @since 0.3.
|
426
|
-
def
|
427
|
-
self.
|
427
|
+
# @see #remove_parents
|
428
|
+
# @since 0.3.1
|
429
|
+
def remove_parents!
|
430
|
+
self.really_remove_parents!
|
428
431
|
end
|
429
432
|
|
430
433
|
# Returns a copy of this ontology term object with the parents removed.
|
431
434
|
#
|
432
435
|
# @return [OLS::Term] A copy of this term with the parents removed
|
433
436
|
#
|
434
|
-
# @see #
|
435
|
-
# @since 0.3.
|
436
|
-
def
|
437
|
+
# @see #remove_parents!
|
438
|
+
# @since 0.3.1
|
439
|
+
def remove_parents
|
437
440
|
copy = self.dup
|
438
|
-
copy.
|
441
|
+
copy.really_remove_parents!
|
439
442
|
copy
|
440
443
|
end
|
441
444
|
|
445
|
+
alias :detach_children! :remove_parents!
|
446
|
+
alias :detach_children :remove_parents
|
447
|
+
|
442
448
|
# Pretty prints the (sub)graph rooted at this ontology term.
|
443
449
|
#
|
444
450
|
# @param [Number] level The indentation level (4 spaces) to start with.
|
@@ -618,23 +624,23 @@ module OLS
|
|
618
624
|
self.flush_graph( [self.term_id] + self.all_parent_ids + self.all_child_ids )
|
619
625
|
end
|
620
626
|
|
621
|
-
# Utility function for #
|
627
|
+
# Utility function for #remove_children and #remove_children! that
|
622
628
|
# actually does the work of removing children.
|
623
629
|
#
|
624
|
-
# @see #
|
625
|
-
# @see #
|
626
|
-
def
|
630
|
+
# @see #remove_children
|
631
|
+
# @see #remove_children!
|
632
|
+
def really_remove_children!
|
627
633
|
self.children = []
|
628
634
|
self.lock_children
|
629
635
|
self.flush_graph( [self.term_id] + self.all_parent_ids )
|
630
636
|
end
|
631
637
|
|
632
|
-
# Utility function for #
|
638
|
+
# Utility function for #remove_parents and #remove_parents! that
|
633
639
|
# actually does the work of removing parents.
|
634
640
|
#
|
635
|
-
# @see #
|
636
|
-
# @see #
|
637
|
-
def
|
641
|
+
# @see #remove_parents
|
642
|
+
# @see #remove_parents!
|
643
|
+
def really_remove_parents!
|
638
644
|
self.parents = []
|
639
645
|
self.lock_parents
|
640
646
|
self.flush_graph( [self.term_id] + self.all_child_ids )
|
@@ -675,7 +681,7 @@ module OLS
|
|
675
681
|
names_to_merge = names2 - names1
|
676
682
|
names_to_merge.each do |name|
|
677
683
|
# puts "--- MERGING #{name} INTO #{graph1.term_id} ---"
|
678
|
-
new_child = graph2[name].
|
684
|
+
new_child = graph2[name].remove_parents
|
679
685
|
|
680
686
|
# replace the new_child's graph
|
681
687
|
graph1_graph = graph1.graph
|
data/lib/ols/version.rb
CHANGED
data/test/test_ols_term.rb
CHANGED
@@ -281,7 +281,7 @@ class OLSTermTest < Test::Unit::TestCase
|
|
281
281
|
# |---+ EMAP:3018
|
282
282
|
|
283
283
|
@emap_term.focus_graph!
|
284
|
-
@emap_term.
|
284
|
+
@emap_term.remove_children!
|
285
285
|
|
286
286
|
assert_equal 'EMAP:3018', @emap_term.term_id
|
287
287
|
assert_equal 'EMAP:0', @emap_term.root.term_id
|
@@ -290,7 +290,7 @@ class OLSTermTest < Test::Unit::TestCase
|
|
290
290
|
|
291
291
|
# Test the copy variant of this function
|
292
292
|
@mp_term.focus_graph!
|
293
|
-
new_term = @mp_term.
|
293
|
+
new_term = @mp_term.remove_children
|
294
294
|
|
295
295
|
assert new_term.object_id != @mp_term.object_id
|
296
296
|
assert new_term.is_leaf?
|
@@ -321,7 +321,7 @@ class OLSTermTest < Test::Unit::TestCase
|
|
321
321
|
# |---> EMAP:3021
|
322
322
|
|
323
323
|
@emap_term.focus_graph!
|
324
|
-
@emap_term.
|
324
|
+
@emap_term.remove_parents!
|
325
325
|
|
326
326
|
assert_equal 'EMAP:3018', @emap_term.term_id
|
327
327
|
assert @emap_term.is_root?
|
@@ -330,7 +330,7 @@ class OLSTermTest < Test::Unit::TestCase
|
|
330
330
|
|
331
331
|
# Test the copy variant of this function
|
332
332
|
@mp_term.focus_graph!
|
333
|
-
new_term = @mp_term.
|
333
|
+
new_term = @mp_term.remove_parents
|
334
334
|
|
335
335
|
assert new_term.object_id != @mp_term.object_id
|
336
336
|
assert_equal 96, new_term.size
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ols
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-11-08 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: savon
|
16
|
-
requirement: &
|
16
|
+
requirement: &2157249240 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2157249240
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &2157248800 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2157248800
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: shoulda
|
38
|
-
requirement: &
|
38
|
+
requirement: &2157248380 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2157248380
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: vcr
|
49
|
-
requirement: &
|
49
|
+
requirement: &2157247960 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2157247960
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: webmock
|
60
|
-
requirement: &
|
60
|
+
requirement: &2157247540 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2157247540
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: simplecov
|
71
|
-
requirement: &
|
71
|
+
requirement: &2157247120 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2157247120
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: simplecov-rcov
|
82
|
-
requirement: &
|
82
|
+
requirement: &2157246700 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *2157246700
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: mocha
|
93
|
-
requirement: &
|
93
|
+
requirement: &2157246280 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *2157246280
|
102
102
|
description: ! "\n OLS provides a simple interface to the EBI's Ontology Lookup
|
103
103
|
Service (http://www.ebi.ac.uk/ontology-lookup/).\n It provides an easy lookup
|
104
104
|
of ontology terms and automagically builds up ontology trees for you.\n "
|