ncbo_annotator 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/ncbo_annotator.rb +14 -0
  2. metadata +4 -4
@@ -30,6 +30,9 @@ module NCBO
30
30
  @options.merge!(args)
31
31
 
32
32
  @ontologies = nil
33
+
34
+ # Check to make sure mappingTypes are capitalized
35
+ fix_params
33
36
 
34
37
  raise ArgumentError, ":apikey is required, you can obtain one at http://bioportal.bioontology.org/accounts/new" if @options[:apikey].nil?
35
38
  end
@@ -42,6 +45,7 @@ module NCBO
42
45
  def annotate(text = nil, options = {})
43
46
  @options[:textToAnnotate] = text unless text.nil?
44
47
  @options.merge!(options) unless options.empty?
48
+ fix_params
45
49
 
46
50
  raise ArgumentError, ":textToAnnotate must be included" if @options[:textToAnnotate].nil?
47
51
 
@@ -81,6 +85,16 @@ module NCBO
81
85
 
82
86
  private
83
87
 
88
+ def fix_params
89
+ @options[:mappingTypes] = @options[:mappingTypes].split(",") unless @options[:mappingTypes].kind_of?(Array)
90
+ @options[:ontologiesToExpand] = @options[:ontologiesToExpand].split(",") unless @options[:ontologiesToExpand].kind_of?(Array)
91
+ @options[:ontologiesToKeepInResult] = @options[:ontologiesToKeepInResult].split(",") unless @options[:ontologiesToKeepInResult].kind_of?(Array)
92
+ @options[:semanticTypes] = @options[:semanticTypes].split(",") unless @options[:semanticTypes].kind_of?(Array)
93
+ @options[:stopWords] = @options[:stopWords].split(",") unless @options[:stopWords].kind_of?(Array)
94
+
95
+ @options[:mappingTypes].collect! {|e| e.capitalize}
96
+ end
97
+
84
98
  def annotate_post
85
99
  url = @options[:annotator_location] + "/annotator"
86
100
  options = @options.clone
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ncbo_annotator
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 7
10
- version: 1.0.7
9
+ - 8
10
+ version: 1.0.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Paul R Alexander
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-28 00:00:00 -08:00
18
+ date: 2011-12-01 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency