ols 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,8 @@
1
+ === 0.3.2 2011-11-09
2
+
3
+ * Bugfix - the term_name was getting lost off of the new nodes when we merged two graphs.
4
+ * Small feature enhancement - when printing the graph to stdout, add an option to print out the term_name too.
5
+
1
6
  === 0.3.1 2011-11-08
2
7
 
3
8
  * Renamed the OLS::Term.detach_* methods to much more sensible names.
@@ -21,7 +21,7 @@ module OLS
21
21
  source.raw_graph.each do |term_id,term_details|
22
22
  old_term = term_details[:object]
23
23
 
24
- new_term = OLS::Term.new( old_term.term_id, old_term.term_id, self )
24
+ new_term = OLS::Term.new( old_term.term_id, old_term.term_name, self )
25
25
  [
26
26
  :@already_fetched_parents,
27
27
  :@already_fetched_children,
@@ -447,8 +447,9 @@ module OLS
447
447
 
448
448
  # Pretty prints the (sub)graph rooted at this ontology term.
449
449
  #
450
+ # @param [Boolean] show_term_name Show the term name?
450
451
  # @param [Number] level The indentation level (4 spaces) to start with.
451
- def print_graph(level=1)
452
+ def print_graph(show_term_name=false,level=1)
452
453
  if is_root?
453
454
  print "*"
454
455
  else
@@ -457,9 +458,11 @@ module OLS
457
458
  print( self.has_children? ? "+" : ">" )
458
459
  end
459
460
 
460
- puts " #{self.term_id}"
461
+ print_str = " #{self.term_id}"
462
+ print_str << " - #{self.term_name}" if show_term_name
463
+ puts print_str
461
464
 
462
- self.children.each { |child| child.print_graph(level + 1)}
465
+ self.children.each { |child| child.print_graph(show_term_name,level + 1)}
463
466
  end
464
467
 
465
468
  # Save an image file showing graph structure of all children from the current term.
@@ -2,5 +2,5 @@
2
2
 
3
3
  module OLS
4
4
  # OLS::VERSION - The OLS gem version
5
- VERSION = "0.3.1"
5
+ VERSION = "0.3.2"
6
6
  end
@@ -435,6 +435,9 @@ class OLSTermTest < Test::Unit::TestCase
435
435
  assert main_merge_node.children.map(&:term_id).include? 'EMAP:3003'
436
436
  assert main_merge_node.children.map(&:term_id).include? 'EMAP:3018'
437
437
 
438
+ assert_equal 'TS18,perioptic mesenchyme', @emap_term.root['EMAP:2636']['EMAP:2822']['EMAP:2987']['EMAP:3003']['EMAP:3012'].term_name
439
+ assert_equal 'TS18,retina', @emap_term.root['EMAP:2636']['EMAP:2822']['EMAP:2987']['EMAP:3003']['EMAP:3013'].term_name
440
+
438
441
  # Also check that the internal graph has been merged accordingly
439
442
  raw_graph = @emap_term.instance_variable_get(:@graph).raw_graph
440
443
  emap3003_graph = raw_graph['EMAP:3003'][:object].instance_variable_get(:@graph).raw_graph
@@ -517,29 +520,29 @@ class OLSTermTest < Test::Unit::TestCase
517
520
  should 'allow users to print a graph representation of the graph to STDOUT' do
518
521
  @emap_term.focus_graph!
519
522
  emap_graph = <<-EMAP
520
- * EMAP:0
521
- |---+ EMAP:2636
522
- |---+ EMAP:2822
523
- |---+ EMAP:2987
524
- |---+ EMAP:3018
525
- |---+ EMAP:3022
526
- |---+ EMAP:3023
527
- |---+ EMAP:3024
528
- |---> EMAP:3025
529
- |---> EMAP:3026
530
- |---+ EMAP:3027
531
- |---> EMAP:3029
532
- |---> EMAP:3028
533
- |---+ EMAP:3030
534
- |---> EMAP:3031
535
- |---> EMAP:3032
536
- |---> EMAP:3019
537
- |---+ EMAP:3020
538
- |---> EMAP:3021
523
+ * EMAP:0 - Mouse_anatomy_by_time_xproduct
524
+ |---+ EMAP:2636 - TS18,embryo
525
+ |---+ EMAP:2822 - TS18,organ system
526
+ |---+ EMAP:2987 - TS18,sensory organ
527
+ |---+ EMAP:3018 - TS18,nose
528
+ |---+ EMAP:3022 - TS18,process,nose
529
+ |---+ EMAP:3023 - TS18,fronto-nasal process
530
+ |---+ EMAP:3024 - TS18,frontal process
531
+ |---> EMAP:3025 - TS18,ectoderm,frontal process
532
+ |---> EMAP:3026 - TS18,mesenchyme,frontal process
533
+ |---+ EMAP:3027 - TS18,latero-nasal process
534
+ |---> EMAP:3029 - TS18,mesenchyme,latero-nasal process
535
+ |---> EMAP:3028 - TS18,ectoderm,latero-nasal process
536
+ |---+ EMAP:3030 - TS18,medial-nasal process
537
+ |---> EMAP:3031 - TS18,ectoderm,medial-nasal process
538
+ |---> EMAP:3032 - TS18,mesenchyme,medial-nasal process
539
+ |---> EMAP:3019 - TS18,naso-lacrimal groove
540
+ |---+ EMAP:3020 - TS18,olfactory pit
541
+ |---> EMAP:3021 - TS18,nasal epithelium
539
542
  EMAP
540
543
 
541
544
  assert_output(emap_graph.lstrip,nil) do
542
- @emap_term.root.print_graph
545
+ @emap_term.root.print_graph(true)
543
546
  end
544
547
  end
545
548
  end
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.1
4
+ version: 0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-08 00:00:00.000000000 Z
12
+ date: 2011-11-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: savon
16
- requirement: &2157249240 !ruby/object:Gem::Requirement
16
+ requirement: &2156771440 !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: *2157249240
24
+ version_requirements: *2156771440
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &2157248800 !ruby/object:Gem::Requirement
27
+ requirement: &2156771000 !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: *2157248800
35
+ version_requirements: *2156771000
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: shoulda
38
- requirement: &2157248380 !ruby/object:Gem::Requirement
38
+ requirement: &2156770580 !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: *2157248380
46
+ version_requirements: *2156770580
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: vcr
49
- requirement: &2157247960 !ruby/object:Gem::Requirement
49
+ requirement: &2156770160 !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: *2157247960
57
+ version_requirements: *2156770160
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: webmock
60
- requirement: &2157247540 !ruby/object:Gem::Requirement
60
+ requirement: &2156769740 !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: *2157247540
68
+ version_requirements: *2156769740
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
- requirement: &2157247120 !ruby/object:Gem::Requirement
71
+ requirement: &2156769320 !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: *2157247120
79
+ version_requirements: *2156769320
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: simplecov-rcov
82
- requirement: &2157246700 !ruby/object:Gem::Requirement
82
+ requirement: &2156768900 !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: *2157246700
90
+ version_requirements: *2156768900
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: mocha
93
- requirement: &2157246280 !ruby/object:Gem::Requirement
93
+ requirement: &2156768480 !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: *2157246280
101
+ version_requirements: *2156768480
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 "