obo 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/VERSION +1 -1
- data/lib/obo/parser.rb +2 -2
- data/lib/obo/version.rb +1 -1
- data/test/test_obo.rb +25 -0
- metadata +8 -18
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e16927a494bf3379df6023df94df5c6edf87918d
|
4
|
+
data.tar.gz: 4c191ef4175dd9e59302b1aea6c5f150d4fa1394
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 68359ab9cc3ba6989e1dc74d2847309b4a2066b23646e52811bd6898b5501c763e80540a76211607b1fdff487134fbc56db3e44db17b91c683ce7b4697ab085f
|
7
|
+
data.tar.gz: 7e842778b3b1aac99ceebc06e527db3285de94fd14f2875510108dab9c087608dc7aa043114d1320271c919450d6418a6e36d55ed1e4ea7fe7320baa8ba6c424
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/lib/obo/parser.rb
CHANGED
@@ -4,7 +4,7 @@ require_relative 'stanza'
|
|
4
4
|
module Obo
|
5
5
|
class Parser
|
6
6
|
STANZA_START = /^\[(.*?)\]/
|
7
|
-
TAG_VALUE = /^(.*?):\s*([^!]*)\n/
|
7
|
+
TAG_VALUE = /^(.*?):\s*([^!]*)\s*(.*?)\n/
|
8
8
|
|
9
9
|
def initialize(filename)
|
10
10
|
@io = File.open(filename)
|
@@ -25,7 +25,7 @@ module Obo
|
|
25
25
|
while io.gets
|
26
26
|
case $_
|
27
27
|
when TAG_VALUE
|
28
|
-
stanza.add($1, $2)
|
28
|
+
stanza.add($1, $2.strip)
|
29
29
|
when STANZA_START
|
30
30
|
yielder << stanza
|
31
31
|
stanza = Stanza.new($1.strip)
|
data/lib/obo/version.rb
CHANGED
data/test/test_obo.rb
CHANGED
@@ -20,9 +20,32 @@ class TestObo < MiniTest::Unit::TestCase
|
|
20
20
|
assert_equal 'Typedef', first_stanza.name
|
21
21
|
assert_equal 'OBO_REL:is_a', first_stanza['id']
|
22
22
|
assert_equal 'is_a', first_stanza['name']
|
23
|
+
|
23
24
|
assert first_stanza['is_reflexive']
|
24
25
|
end
|
25
26
|
|
27
|
+
def test_stanza_fields_and_values
|
28
|
+
@obo = Obo::Parser.new('test/data/so_2_4_3.obo')
|
29
|
+
terms = []
|
30
|
+
|
31
|
+
@obo.elements.each do |elm|
|
32
|
+
terms << elm
|
33
|
+
end
|
34
|
+
|
35
|
+
sofa = terms[1]
|
36
|
+
assert_equal "SO:0000000", sofa["id"]
|
37
|
+
assert_equal "Sequence_Ontology", sofa["name"]
|
38
|
+
assert_equal "SOFA", sofa["subset"]
|
39
|
+
assert_equal true, sofa.is_obsolete
|
40
|
+
|
41
|
+
region = terms[2]
|
42
|
+
assert_equal "SO:0000001", region["id"]
|
43
|
+
#tests stripping of comments
|
44
|
+
assert_equal "SO:0000110", region["is_a"]
|
45
|
+
assert_equal %{"sequence" EXACT []}, region["synonym"]
|
46
|
+
|
47
|
+
end
|
48
|
+
|
26
49
|
def test_fancy_methods
|
27
50
|
first_stanza = @obo.elements.find{|element| element.is_a? Obo::Stanza}
|
28
51
|
assert_equal 'OBO_REL:is_a', first_stanza.id
|
@@ -51,6 +74,8 @@ class TestObo < MiniTest::Unit::TestCase
|
|
51
74
|
@obo.elements.count
|
52
75
|
assert_equal 27, @obo.elements.count
|
53
76
|
end
|
77
|
+
|
54
78
|
end
|
55
79
|
|
56
80
|
|
81
|
+
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: obo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.5
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Robert Syme
|
@@ -10,12 +9,11 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2014-04-22 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: bundler
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
18
|
- - ~>
|
21
19
|
- !ruby/object:Gem::Version
|
@@ -23,12 +21,11 @@ dependencies:
|
|
23
21
|
type: :development
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
25
|
- - ~>
|
29
26
|
- !ruby/object:Gem::Version
|
30
27
|
version: '1.3'
|
31
|
-
description:
|
28
|
+
description: 'The OBO format is the text file format used by OBO-Edit, the open-source,
|
32
29
|
platform-independent application for viewing and editing ontologies. The format
|
33
30
|
is described here: http://www.geneontology.org/GO.format.obo-1_2.shtml'
|
34
31
|
email:
|
@@ -60,33 +57,26 @@ files:
|
|
60
57
|
homepage: http://github.com/robsyme/obo
|
61
58
|
licenses:
|
62
59
|
- MIT
|
60
|
+
metadata: {}
|
63
61
|
post_install_message:
|
64
62
|
rdoc_options: []
|
65
63
|
require_paths:
|
66
64
|
- lib
|
67
65
|
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
-
none: false
|
69
66
|
requirements:
|
70
|
-
- -
|
67
|
+
- - '>='
|
71
68
|
- !ruby/object:Gem::Version
|
72
69
|
version: '0'
|
73
|
-
segments:
|
74
|
-
- 0
|
75
|
-
hash: 2033594933957096070
|
76
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
-
none: false
|
78
71
|
requirements:
|
79
|
-
- -
|
72
|
+
- - '>='
|
80
73
|
- !ruby/object:Gem::Version
|
81
74
|
version: '0'
|
82
|
-
segments:
|
83
|
-
- 0
|
84
|
-
hash: 2033594933957096070
|
85
75
|
requirements: []
|
86
76
|
rubyforge_project:
|
87
|
-
rubygems_version:
|
77
|
+
rubygems_version: 2.0.3
|
88
78
|
signing_key:
|
89
|
-
specification_version:
|
79
|
+
specification_version: 4
|
90
80
|
summary: A parser for the OBO flat file format
|
91
81
|
test_files:
|
92
82
|
- test/data/ro.obo
|