obo_parser 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -2
- data/VERSION +1 -1
- data/lib/obo_parser.rb +2 -2
- data/lib/tokens.rb +13 -8
- data/obo_parser.gemspec +2 -2
- data/test/cell.obo +7842 -1293
- data/test/test_obo_parser.rb +46 -7
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= obo_parser
|
2
2
|
|
3
|
-
A simple Ruby gem for parsing OBO formatted ontology files. Useful for reporting, comparing, and mapping data to other databases. There is presently no functionality for logical inference across the ontology.
|
3
|
+
A simple Ruby gem for parsing OBO 1.2 formatted ontology files. Useful for reporting, comparing, and mapping data to other databases. There is presently no functionality for logical inference across the ontology.
|
4
4
|
|
5
5
|
== Installation
|
6
6
|
|
@@ -10,7 +10,7 @@ A simple Ruby gem for parsing OBO formatted ontology files. Useful for reportin
|
|
10
10
|
|
11
11
|
require 'rubygems'
|
12
12
|
require 'obo_parser'
|
13
|
-
foo = parse_obo_file(File.read('my_ontology.obo')) # => An OboParser instance
|
13
|
+
foo = parse_obo_file(File.read('my_ontology.obo')) # => An OboParser instance
|
14
14
|
first_term = foo.terms.first # => An OboParser#Term instance
|
15
15
|
d = first_term.def # => An OboParser#Tag instance
|
16
16
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
data/lib/obo_parser.rb
CHANGED
@@ -69,7 +69,7 @@ module OboParser
|
|
69
69
|
return nil if tag_name.nil?
|
70
70
|
result = []
|
71
71
|
@other_tags.each do |t|
|
72
|
-
result.push
|
72
|
+
result.push(t) if (t.tag == tag_name)
|
73
73
|
end
|
74
74
|
result
|
75
75
|
end
|
@@ -115,7 +115,7 @@ module OboParser
|
|
115
115
|
end
|
116
116
|
|
117
117
|
class Tag
|
118
|
-
attr_accessor :tag, :value, :xrefs, :comment
|
118
|
+
attr_accessor :tag, :value, :xrefs, :comment, :qualifier
|
119
119
|
end
|
120
120
|
|
121
121
|
end
|
data/lib/tokens.rb
CHANGED
@@ -18,11 +18,12 @@ module OboParser::Tokens
|
|
18
18
|
end
|
19
19
|
|
20
20
|
class TagValuePair < Token
|
21
|
-
attr_reader :tag, :comment, :xrefs
|
21
|
+
attr_reader :tag, :comment, :xrefs, :qualifier
|
22
22
|
@regexp = Regexp.new(/\A\s*([^:]+:.+)\s*\n*/i)
|
23
23
|
def initialize(str)
|
24
24
|
str.strip!
|
25
25
|
tag, value = str.split(':',2)
|
26
|
+
@tag = tag.strip
|
26
27
|
|
27
28
|
value.strip!
|
28
29
|
|
@@ -43,14 +44,18 @@ module OboParser::Tokens
|
|
43
44
|
@xrefs = xref_list.split(",")
|
44
45
|
end
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
if value =~ /\A\"/
|
48
|
+
value =~ /(".*")/
|
49
|
+
@value = $1
|
50
|
+
value.gsub!(@value, '')
|
51
|
+
@qualifier = value.strip
|
52
|
+
else
|
53
|
+
@value = value.strip
|
54
|
+
@qualifier = nil
|
55
|
+
end
|
51
56
|
|
52
|
-
@
|
53
|
-
@value = @value.strip
|
57
|
+
@value = @value[1..-2].strip if @value[0..0] == "\"" # get rid of quote marks
|
58
|
+
@value = @value[1..-2].strip if @value[0..0] == "'" # get rid of quote marks
|
54
59
|
end
|
55
60
|
end
|
56
61
|
|
data/obo_parser.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{obo_parser}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["mjy"]
|
12
|
-
s.date = %q{2011-04-
|
12
|
+
s.date = %q{2011-04-06}
|
13
13
|
s.description = %q{Provides all-in-one object containing the contents of an OBO formatted file. OBO version 1.2 is targeted, though this should work for 1.0. }
|
14
14
|
s.email = %q{diapriid@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|