obo_parser 0.3.4 → 0.3.5
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.
- data/README.rdoc +12 -3
- data/VERSION +1 -1
- data/lib/tokens.rb +3 -2
- data/lib/utilities.rb +193 -53
- data/obo_parser.gemspec +26 -28
- data/test/cell.obo +1 -1
- data/test/go.obo +18523 -0
- data/test/hao.obo +14175 -0
- data/test/test_obo_parser.rb +38 -4
- data/test/tgma.obo +18522 -0
- metadata +12 -12
- data/.gitignore +0 -21
data/test/test_obo_parser.rb
CHANGED
@@ -99,7 +99,6 @@ class Test_Lexer < Test::Unit::TestCase
|
|
99
99
|
assert_equal 2, foo.terms.first.relationships.size
|
100
100
|
assert_equal(['CL:0000272', 'CL:0000610'], foo.terms.first.relationships.collect{|r| r[1]}.sort)
|
101
101
|
assert_equal(['is_a', 'is_a'], foo.terms.first.relationships.collect{|r| r[0]}.sort)
|
102
|
-
|
103
102
|
end
|
104
103
|
|
105
104
|
def test_parse_term
|
@@ -143,11 +142,8 @@ class Test_Lexer < Test::Unit::TestCase
|
|
143
142
|
assert_equal 'part_of', t.relation
|
144
143
|
assert_equal 'CL:0000333', t.related_term
|
145
144
|
assert_equal 'Foo', t.comment
|
146
|
-
|
147
145
|
end
|
148
146
|
|
149
|
-
|
150
|
-
|
151
147
|
def test_tagvaluepair
|
152
148
|
lexer = OboParser::Lexer.new("id: PATO:0000179")
|
153
149
|
assert lexer.pop(OboParser::Tokens::TagValuePair)
|
@@ -221,6 +217,44 @@ class Test_Parser < Test::Unit::TestCase
|
|
221
217
|
assert_equal 2, foo.terms[9].relationships.size
|
222
218
|
end
|
223
219
|
|
220
|
+
def test_complex_file_parsing2
|
221
|
+
assert of = File.read(File.expand_path(File.join(File.dirname(__FILE__), '../test/hao.obo')) )
|
222
|
+
foo = parse_obo_file(of)
|
223
|
+
assert_equal 'anatomical entity', foo.terms.first.name.value
|
224
|
+
assert_equal 'ventral mesofurco-profurcal muscle', foo.terms[1].name.value
|
225
|
+
|
226
|
+
#tmp = foo.terms[9].tags_named('synonym')
|
227
|
+
#assert_equal 2, tmp.size
|
228
|
+
#assert_equal 'xylem initial', tmp.first.value
|
229
|
+
#assert_equal 'xylem mother cell', tmp[1].value
|
230
|
+
#assert_equal([], tmp[1].xrefs)
|
231
|
+
|
232
|
+
#assert_equal 2, foo.terms[9].relationships.size
|
233
|
+
end
|
234
|
+
|
235
|
+
def test_complex_file_parsing3
|
236
|
+
assert of = File.read(File.expand_path(File.join(File.dirname(__FILE__), '../test/tgma.obo')) )
|
237
|
+
foo = parse_obo_file(of)
|
238
|
+
# assert_equal 'anatomical entity', foo.terms.first.name.value
|
239
|
+
# assert_equal 'ventral mesofurco-profurcal muscle', foo.terms[1].name.value
|
240
|
+
|
241
|
+
#tmp = foo.terms[9].tags_named('synonym')
|
242
|
+
#assert_equal 2, tmp.size
|
243
|
+
#assert_equal 'xylem initial', tmp.first.value
|
244
|
+
#assert_equal 'xylem mother cell', tmp[1].value
|
245
|
+
#assert_equal([], tmp[1].xrefs)
|
246
|
+
|
247
|
+
#assert_equal 2, foo.terms[9].relationships.size
|
248
|
+
end
|
249
|
+
|
250
|
+
def test_complex_file_parsing4
|
251
|
+
assert of = File.read(File.expand_path(File.join(File.dirname(__FILE__), '../test/go.obo')) )
|
252
|
+
foo = parse_obo_file(of)
|
253
|
+
assert_equal 'hemolymph', foo.terms.first.name.value
|
254
|
+
assert_equal 'hemocyte', foo.terms[1].name.value
|
255
|
+
assert_equal 1, foo.terms.first.relationships.size
|
256
|
+
end
|
257
|
+
|
224
258
|
def test_file_completes_without_typedefs
|
225
259
|
@of2 = File.read(File.expand_path(File.join(File.dirname(__FILE__), '../test/obo_1.0_test_wo_typedefs.txt')) )
|
226
260
|
assert foo = parse_obo_file(@of2)
|