obo_parser 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 68e87651b5cb9c55b71d4b0127a20da75a921e64
4
- data.tar.gz: a997dd54c72fc43f914b393afd25275ad4afaeea
3
+ metadata.gz: ea197b66fa1650e919ff7fdf4f9eebdeec337769
4
+ data.tar.gz: 3670014dce7e8ca9f829bbe7e84bf1730cc68ef7
5
5
  SHA512:
6
- metadata.gz: ef073c53535a62bffba9b612e1d8adbf54353c5dc9da9f8d2710fbb448cbb2c4dc0bebaf5f5ed0ecb6d05a067e0a7c032320f83a3d25d8e2826fa7282e523a6d
7
- data.tar.gz: 0161db3d88aad51f8f99937409ae2ddc79b4523df658d120dddd92cd5c63c48035c1ab6ed44c9b23e749a2b765ecdc895e8b25fbdef5b5a75027fb3a614a690c
6
+ metadata.gz: cf46ba35c98764c1e73b3bd18a56b3ccb8a0bc3a9e4e69724304e592ec8751dea8b2ef4fba88a71233e0980f374173e6f851b69903df147f5aa1068e9e53f9bb
7
+ data.tar.gz: 3948022c74a041d5ac509160bdb9b51431ab6b6a22579a32a22d810fa183cd3c461dc632fedd196300c44a6327c59b00c1acddd2ae67bb58f5265349f705a9cb
data/.gitignore CHANGED
@@ -22,3 +22,6 @@ rdoc
22
22
  pkg
23
23
 
24
24
  ## PROJECT::SPECIFIC
25
+
26
+ *.gem
27
+
data/.travis ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.4
@@ -1,14 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- obo_parser (0.4.0)
5
- rake (~> 11.1.2)
4
+ obo_parser (0.4.1)
5
+ rake (~> 12.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- awesome_print (1.7.0)
11
- byebug (9.0.6)
10
+ awesome_print (1.8.0)
12
11
  coderay (1.1.1)
13
12
  diff-lcs (1.3)
14
13
  ffi (1.9.18)
@@ -31,7 +30,8 @@ GEM
31
30
  rb-fsevent (~> 0.9, >= 0.9.4)
32
31
  rb-inotify (~> 0.9, >= 0.9.7)
33
32
  ruby_dep (~> 1.2)
34
- lumberjack (1.0.11)
33
+ logger (1.2.8)
34
+ lumberjack (1.0.12)
35
35
  method_source (0.8.2)
36
36
  nenv (0.3.0)
37
37
  notiffany (0.1.1)
@@ -41,38 +41,39 @@ GEM
41
41
  coderay (~> 1.1.0)
42
42
  method_source (~> 0.8.1)
43
43
  slop (~> 3.4)
44
- rake (11.1.2)
45
- rb-fsevent (0.9.8)
46
- rb-inotify (0.9.8)
47
- ffi (>= 0.5.0)
48
- rspec (3.5.0)
49
- rspec-core (~> 3.5.0)
50
- rspec-expectations (~> 3.5.0)
51
- rspec-mocks (~> 3.5.0)
52
- rspec-core (3.5.4)
53
- rspec-support (~> 3.5.0)
54
- rspec-expectations (3.5.0)
44
+ rake (12.0.0)
45
+ rb-fsevent (0.10.2)
46
+ rb-inotify (0.9.10)
47
+ ffi (>= 0.5.0, < 2)
48
+ rspec (3.6.0)
49
+ rspec-core (~> 3.6.0)
50
+ rspec-expectations (~> 3.6.0)
51
+ rspec-mocks (~> 3.6.0)
52
+ rspec-core (3.6.0)
53
+ rspec-support (~> 3.6.0)
54
+ rspec-expectations (3.6.0)
55
55
  diff-lcs (>= 1.2.0, < 2.0)
56
- rspec-support (~> 3.5.0)
57
- rspec-mocks (3.5.0)
56
+ rspec-support (~> 3.6.0)
57
+ rspec-mocks (3.6.0)
58
58
  diff-lcs (>= 1.2.0, < 2.0)
59
- rspec-support (~> 3.5.0)
60
- rspec-support (3.5.0)
59
+ rspec-support (~> 3.6.0)
60
+ rspec-support (3.6.0)
61
61
  ruby_dep (1.5.0)
62
62
  shellany (0.0.1)
63
63
  slop (3.6.0)
64
- thor (0.19.4)
64
+ thor (0.20.0)
65
65
 
66
66
  PLATFORMS
67
67
  ruby
68
68
 
69
69
  DEPENDENCIES
70
- awesome_print (~> 1.6)
70
+ awesome_print (~> 1.8)
71
71
  bundler (~> 1.5)
72
- byebug
73
- guard-rspec
72
+ guard-rspec (~> 4.7.3)
73
+ logger (~> 1.2.8)
74
74
  obo_parser!
75
- rspec (~> 3.4)
75
+ pry (~> 0.10.4)
76
+ rspec (~> 3.6)
76
77
 
77
78
  BUNDLED WITH
78
- 1.14.3
79
+ 1.15.4
data/README.md CHANGED
@@ -1,10 +1,13 @@
1
+ [![Build Status](https://travis-ci.org/mjy/obo_parser.svg?branch=master)](https://travis-ci.org/mjy/obo_parser)
2
+ [![Dependency Status](https://gemnasium.com/badges/github.com/mjy/obo_parser.svg)](https://gemnasium.com/github.com/mjy/obo_parser)
3
+
1
4
  # obo_parser
2
5
 
3
6
  A simple Ruby gem for parsing OBO 1.2 (?4) 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
7
 
5
8
  ## Installation
6
9
 
7
- gem install obo_parser
10
+ gem install obo_parser
8
11
 
9
12
  ## Use
10
13
 
@@ -12,8 +15,8 @@ A simple Ruby gem for parsing OBO 1.2 (?4) formatted ontology files. Useful for
12
15
 
13
16
  require 'rubygems'
14
17
  require 'obo_parser'
15
- foo = parse_obo_file(File.read('my_ontology.obo')) # => An OboParser instance
16
- first_term = foo.terms.first # => An OboParser#Term instance
18
+ o = parse_obo_file(File.read('my_ontology.obo')) # => An OboParser instance
19
+ first_term = o.terms.first # => An OboParser#Term instance
17
20
 
18
21
  first_term.id.value # => 'HAO:1234'
19
22
 
@@ -30,20 +33,20 @@ A simple Ruby gem for parsing OBO 1.2 (?4) formatted ontology files. Useful for
30
33
  o = first_term.other_tags # => [OboParser#Tag, ... ] An array of tags that are not specially referenced in an OboParser::Stanza
31
34
  o.first # => An OboParser#Tag instance
32
35
 
33
- first_typedef = foo.typdefs.first # => An OboParser#Typdef instance
36
+ first_typedef = o.typdefs.first # => An OboParser#Typdef instance
34
37
  first_typdef.id.value # => 'Some typedef id'
35
38
  first_typdef.name.value # => 'Some typedef name'
36
39
 
37
- foo.terms.first.tags_named('synonym') # => [OboParser#Tag, ... ]
38
- foo.terms.first.tags_named('synonym').first.tag # => 'synonym'
39
- foo.terms.first.tags_named('synonym').first.value # => 'Some label'
40
+ o.terms.first.tags_named('synonym') # => [OboParser#Tag, ... ]
41
+ o.terms.first.tags_named('synonym').first.tag # => 'synonym'
42
+ o.terms.first.tags_named('synonym').first.value # => 'Some label'
40
43
 
41
- foo.terms.first.relationships # => [['relationship', 'FOO:123'], ['other_relationship', 'FOO:456'] ...] An array of [relation, related term id], includes 'is_a', 'disjoint_from' and Typedefs
44
+ o.terms.first.relationships # => [['relationship', 'FOO:123'], ['other_relationship', 'FOO:456'] ...] An array of [relation, related term id], includes 'is_a', 'disjoint_from' and Typedefs
42
45
 
43
46
  ### Convenience methods
44
47
 
45
- foo.term_hash # => { term (String) => id (String), ... for each [Term] in the file. } !! Assumes names terms are unique, they might not be, in which case you get key collisions.
46
- foo.id_hash # => { id (String) => term (String), ... for each [Term] in the file. }
48
+ o.term_hash # => { term (String) => id (String), ... for each [Term] in the file. } !! Assumes names terms are unique, they might not be, in which case you get key collisions.
49
+ o.id_hash # => { id (String) => term (String), ... for each [Term] in the file. }
47
50
 
48
51
  See also /test/test_obo_parser.rb
49
52
 
@@ -51,10 +54,18 @@ See also /test/test_obo_parser.rb
51
54
 
52
55
  A small set of methods (e.g. comparing OBO ontologies) utilizing the gem are included in /lib/utilities.rb. For example: 1) shared labels across sets of ontologies can be found and returned, 2) ontologies can be dumped into a simple Cytoscape node/edge format; 3) given a set of correspondances between two ontologies various reports can be made.
53
56
 
57
+ ### Viz
58
+
59
+ OboParser::Utilities::Viz.mock_coordinate_space(o, size: 100) # => STDOUT tab delimited table with x, y, z, identifier, label
60
+
54
61
  ## Documentation
55
62
 
56
63
  Code documentation is slowly being formalized using Yard.
57
64
 
65
+ ## Contributing
66
+
67
+ Fork, test, code, test, pull request.
68
+
58
69
  ## Copyright
59
70
 
60
71
  Copyright (c) 2010-2017 Matt Yoder. See LICENSE for details.
data/Rakefile CHANGED
@@ -1,9 +1,8 @@
1
- #!/usr/bin/env rake
2
- require "bundler/gem_tasks"
3
-
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new('spec')
7
-
8
- task :default => :rspec
1
+ begin
2
+ require 'rspec/core/rake_task'
3
+ require "bundler/gem_tasks"
4
+ RSpec::Core::RakeTask.new(:spec)
5
+ task :default => :spec
6
+ rescue LoadError
7
+ end
9
8
 
@@ -1,16 +1,16 @@
1
- # uses the PhyloTree parser/lexer engine by Krishna Dole which in turn was based on
1
+ # Uses the PhyloTree parser/lexer engine by Krishna Dole which in turn was based on
2
2
  # Thomas Mailund's <mailund@birc.dk> 'newick-1.0.5' Python library
3
-
4
- #== Outstanding issues:
5
- # * Better documentation
6
- # * More tests
7
-
3
+ #
4
+ # A basic OBO file handling utility.
5
+ #
8
6
  module OboParser
9
7
 
10
- require File.expand_path(File.join(File.dirname(__FILE__), 'tokens'))
11
- require File.expand_path(File.join(File.dirname(__FILE__), 'parser'))
12
- require File.expand_path(File.join(File.dirname(__FILE__), 'lexer'))
13
- require File.expand_path(File.join(File.dirname(__FILE__), 'utilities'))
8
+ require File.expand_path(File.join(File.dirname(__FILE__), 'obo_parser/tokens'))
9
+ require File.expand_path(File.join(File.dirname(__FILE__), 'obo_parser/parser'))
10
+ require File.expand_path(File.join(File.dirname(__FILE__), 'obo_parser/lexer'))
11
+ require File.expand_path(File.join(File.dirname(__FILE__), 'obo_parser/utilities'))
12
+ require File.expand_path(File.join(File.dirname(__FILE__), 'obo_parser/utilities/viz'))
13
+ require File.expand_path(File.join(File.dirname(__FILE__), 'obo_parser/utilities/helpers'))
14
14
 
15
15
  class OboParser
16
16
  attr_accessor :terms, :typedefs
@@ -27,7 +27,9 @@ module OboParser
27
27
 
28
28
  # Warning! This assumes terms are unique, they are NOT required to be so in an OBO file.
29
29
  # Ignores hash colisions!!
30
- def term_hash # :yields: Hash (String => String) (name => id)
30
+ # @return [Hash]
31
+ # (String => String) (name => id)
32
+ def term_hash
31
33
  @terms.inject({}) {|sum, t| sum.update(t.name.value => t.id.value)}
32
34
  end
33
35
 
@@ -4,15 +4,14 @@ class OboParser::Lexer
4
4
  @input = input
5
5
  @next_token = nil
6
6
  end
7
-
7
+
8
8
  # checks whether the next token is of the specified class.
9
9
  def peek(token_class)
10
10
  token = read_next_token(token_class)
11
11
  return token.class == token_class
12
12
  end
13
13
 
14
- # return (and delete) the next token from the input stream, or raise an exception
15
- # if the next token is not of the given class.
14
+ # return (and delete) the next token from the input stream, or raise an exception # if the next token is not of the given class.
16
15
  def pop(token_class)
17
16
  token = read_next_token(token_class)
18
17
  @next_token = nil
@@ -22,13 +21,13 @@ class OboParser::Lexer
22
21
  return token
23
22
  end
24
23
  end
25
-
24
+
26
25
  private
27
- # read (and store) the next token from the input, if it has not already been read.
28
- def read_next_token(token_class)
29
- if @next_token
30
- return @next_token
31
- else
26
+ # read (and store) the next token from the input, if it has not already been read.
27
+ def read_next_token(token_class)
28
+ if @next_token
29
+ return @next_token
30
+ else
32
31
  # check for a match on the specified class first
33
32
  if match(token_class)
34
33
  return @next_token
@@ -38,19 +37,19 @@ class OboParser::Lexer
38
37
  return @next_token if match(t)
39
38
  }
40
39
  end
41
- # no match, either end of string or lex-error
42
- if @input != ''
43
- raise(OboParser::ParseError, "Lex Error, unknown token at #{@input[0..10]}...", caller)
44
- else
40
+ # no match, either end of string or lex-error
41
+ if @input != ''
42
+ raise(OboParser::ParseError, "Lex Error, unknown token at #{@input[0..10]}...", caller)
43
+ else
45
44
  return nil
46
45
  end
47
46
  end
48
47
  end
49
-
48
+
50
49
  def match(token_class)
51
50
  if (m = token_class.regexp.match(@input))
52
51
  @next_token = token_class.new(m[1])
53
- @input = @input[m.end(0)..-1]
52
+ @input = @input[m.end(0)..-1]
54
53
  return true
55
54
  else
56
55
  return false
File without changes
@@ -66,11 +66,13 @@ module OboParser::Tokens
66
66
  qq = 0 # some failsafes
67
67
  while xref_list.length > 0
68
68
  qq += 1
69
- debugger if qq == 499
70
- raise "#{xref_list}" if qq > 500
69
+ raise "#{xref_list} is seemingly infinite" if qq > 500
71
70
  xref_list.gsub!(/\A\s*,\s*/, '')
72
71
 
73
- xref_list =~ /\A(.+?:[^\"|\{|\,]+)/i
72
+ xref_list =~ /\A(.+?:[^\"\{\,]+)/i
73
+
74
+ # xref_list =~ /\A(.+?:[^\"|\{|\,]+)/i
75
+
74
76
  v = $1
75
77
 
76
78
  if !(v == "") && !v.nil?
@@ -79,7 +81,7 @@ module OboParser::Tokens
79
81
  xref_list.gsub!(/\A#{r}\s*/, '')
80
82
  @xrefs.push(v) if !v.nil?
81
83
  end
82
-
84
+
83
85
  xref_list.strip!
84
86
 
85
87
  # A description
@@ -111,7 +113,7 @@ module OboParser::Tokens
111
113
  else
112
114
  @value = value.strip
113
115
  end
114
-
116
+
115
117
  @value = @value[1..-2].strip if @value[0..0] == "\""
116
118
  @tag = tag.strip
117
119
  @value.strip!
@@ -137,7 +139,7 @@ module OboParser::Tokens
137
139
  @tag = 'relationship'
138
140
  @xrefs = []
139
141
  @relation, @related_term = str.split(/\s/,3)
140
-
142
+
141
143
  str =~ /\s+!\s+(.*)\s*\n*/i
142
144
  @comment = $1
143
145
 
@@ -195,9 +197,22 @@ module OboParser::Tokens
195
197
  end
196
198
  end
197
199
 
200
+ # returns key => value hash for tokens like 'foo=bar' or foo = 'b a ar'
198
201
  # note we grab EOL and ; here
199
202
  class ValuePair < Token
200
- @regexp = Regexp.new(/\A\s*([\w\d\_\&]+\s*=\s*((\'[^\']+\')|(\(.*\))|(\"[^\"]+\")|([^\s\n\t;]+)))[\s\n\t;]+/i) # returns key => value hash for tokens like 'foo=bar' or foo = 'b a ar'
203
+ @regexp = Regexp.new(
204
+ /\A\s*
205
+ ([\w\&]+\s*=\s*
206
+ (
207
+ (\'[^\']+\')|
208
+ (\(.*\))|
209
+ (\"[^\"]+\")|
210
+ ([^\s;]+)
211
+ )
212
+ )[\s;]+
213
+ /ix
214
+ )
215
+
201
216
  def initialize(str)
202
217
  str.strip!
203
218
  str = str.split(/=/)
@@ -221,35 +236,35 @@ module OboParser::Tokens
221
236
  #class LParen < Token
222
237
  # @regexp = Regexp.new('\A\s*(\()\s*')
223
238
  #end
224
-
239
+
225
240
  #class RBracket < Token
226
241
  # @regexp = Regexp.new('\A\s*(\])\s*')
227
242
  #end
228
-
243
+
229
244
  #class RParen < Token
230
245
  # @regexp = Regexp.new('\A\s*(\))\s*')
231
246
  #end
232
-
247
+
233
248
  #class Equals < Token
234
249
  # @regexp = Regexp.new('\A\s*(=)\s*')
235
250
  #end
236
-
251
+
237
252
  #class BckSlash < Token
238
253
  # @regexp = Regexp.new('\A\s*(\/)\s*')
239
254
  #end
240
-
255
+
241
256
  #class Colon < Token
242
257
  # @regexp = Regexp.new('\A\s*(:)\s*')
243
258
  #end
244
-
259
+
245
260
  #class SemiColon < Token
246
261
  # @regexp = Regexp.new('\A\s*(;)\s*')
247
262
  #end
248
-
263
+
249
264
  #class Comma < Token
250
265
  # @regexp = Regexp.new('\A\s*(\,)\s*')
251
266
  #end
252
-
267
+
253
268
  #class Number < Token
254
269
  # @regexp = Regexp.new('\A\s*(-?\d+(\.\d+)?([eE][+-]?\d+)?)\s*')
255
270
  # def initialize(str)
@@ -1,6 +1,4 @@
1
- require 'rubygems'
2
- require 'byebug'
3
- require File.expand_path(File.join(File.dirname(__FILE__), 'obo_parser'))
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '../obo_parser'))
4
2
 
5
3
  module OboParser::Utilities
6
4
 
@@ -0,0 +1,23 @@
1
+ module OboParser
2
+ module Utilities
3
+
4
+ # Methods to aid in visualization
5
+ module Helpers
6
+
7
+ # @return [Array]
8
+ # rows of data from ontology, just ID, name
9
+ def self.simple_data(ontology)
10
+ data = []
11
+
12
+ ontology.terms.each do |t|
13
+ row = []
14
+ row.push(t.id.value)
15
+ row.push(t.name.value)
16
+ data.push row
17
+ end
18
+ data
19
+ end
20
+
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,49 @@
1
+ module OboParser
2
+ module Utilities
3
+
4
+ # Methods to aid in visualization
5
+ module Viz
6
+
7
+ # @params [ontology]
8
+ # the result of a parse_obo_file
9
+ def self.mock_coordinate_space(ontology, size: 20, cutoff: nil)
10
+ data = ::OboParser::Utilities::Helpers.simple_data(ontology)
11
+
12
+ x,y,z = 1,1,1
13
+ center_distance = ( size / 2)
14
+ edge_length = (size / 2) - (size * 0.2)
15
+ total_terms = ontology.terms.size
16
+ grid_length = Math.cbrt(total_terms).ceil.to_i
17
+ cutoff ||= size + 1
18
+
19
+ data.each_with_index do |row, i|
20
+ break if i > cutoff
21
+ print x * center_distance
22
+ print "\t"
23
+ print y * center_distance
24
+ print "\t"
25
+ print z * center_distance
26
+ print "\t"
27
+ print row[0]
28
+ print "\t"
29
+ print row[1]
30
+ print "\n"
31
+
32
+ x = x + 1
33
+ if (x % grid_length) == 0
34
+ x = 1
35
+ y = y + 1
36
+ end
37
+
38
+ if (y % grid_length) == 0
39
+ y = 1
40
+ x = 1
41
+ z = z + 1
42
+ end
43
+ end
44
+ true
45
+ end
46
+
47
+ end
48
+ end
49
+ end
@@ -1,3 +1,3 @@
1
1
  module OboParser
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -5,7 +5,7 @@ require 'obo_parser/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'obo_parser'
8
- spec.version = OboParser::VERSION # "0.3.8"
8
+ spec.version = OboParser::VERSION
9
9
 
10
10
  spec.authors = ["Matt Yoder"]
11
11
  spec.email = ["diapriid@gmail.com"]
@@ -17,12 +17,13 @@ Gem::Specification.new do |spec|
17
17
  spec.files = `git ls-files -z`.split("\x0")
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_dependency 'rake', '~> 11.1.2'
21
- spec.add_development_dependency 'rspec', '~> 3.4'
20
+ spec.add_dependency 'rake', '~> 12.0'
21
+ spec.add_development_dependency 'rspec', '~> 3.6'
22
22
  spec.add_development_dependency 'bundler', '~> 1.5'
23
- spec.add_development_dependency 'guard-rspec'
24
- spec.add_development_dependency 'byebug'
25
- spec.add_development_dependency 'awesome_print', '~> 1.6'
23
+ spec.add_development_dependency 'guard-rspec', '~> 4.7.3'
24
+ spec.add_development_dependency 'pry', '~> 0.10.4'
25
+ spec.add_development_dependency 'awesome_print', '~> 1.8'
26
+ spec.add_development_dependency 'logger', '~> 1.2.8'
26
27
 
27
28
  end
28
29
 
@@ -242,7 +242,7 @@ describe OboParser do
242
242
 
243
243
  specify 'complex_file_parsing_3' do
244
244
  expect(of = File.read(File.expand_path(File.join(File.dirname(__FILE__), '../files/tgma.obo')) ) ).to be_truthy
245
- expect(foo = parse_obo_file(of)).to be_truthy
245
+ expect(parse_obo_file(of)).to be_truthy
246
246
 
247
247
  # assert_equal 'anatomical entity', foo.terms.first.name.value
248
248
  # assert_equal 'ventral mesofurco-profurcal muscle', foo.terms[1].name.value
@@ -266,7 +266,7 @@ describe OboParser do
266
266
 
267
267
  specify 'file_completes_without_typedefs' do
268
268
  expect(of2 = File.read(File.expand_path(File.join(File.dirname(__FILE__), '../files/obo_1.0_test_wo_typedefs.txt')) )).to be_truthy
269
- expect(foo = parse_obo_file(of2)).to be_truthy
269
+ expect(parse_obo_file(of2)).to be_truthy
270
270
  end
271
271
 
272
272
  end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe OboParser::Utilities::Viz do
4
+ let(:o) { parse_obo_file(
5
+ File.read(File.expand_path(File.join(File.dirname(__FILE__), '../../files/hao.obo')) )
6
+ ) }
7
+
8
+ specify '#mock_coordinate_space' do
9
+ capture_stderr do
10
+ expect(OboParser::Utilities::Viz.mock_coordinate_space(o, size: 50, cutoff: 10)).to be_truthy
11
+ end
12
+ end
13
+ end
@@ -3,9 +3,10 @@ require 'bundler/setup'
3
3
  Bundler.setup
4
4
 
5
5
  require 'obo_parser'
6
- require 'byebug'
6
+ require 'pry'
7
7
  require 'awesome_print'
8
8
  require 'fileutils'
9
+ require "stringio"
9
10
 
10
11
  # FileUtils::mkdir_p 'tmp'
11
12
 
@@ -29,4 +30,13 @@ end
29
30
  # return (value <= midpoint*(1.0 + percentage)) & (value >= midpoint*(1.0 - percentage))
30
31
  # end
31
32
 
33
+ # https://stackoverflow.com/questions/4459330/how-do-i-temporarily-redirect-stderr-in-ruby
34
+ def capture_stderr
35
+ previous_stdout, $stdout = $stdout, StringIO.new
36
+ yield
37
+ $stdout.string
38
+ ensure
39
+ $stdout = previous_stdout
40
+ end
41
+
32
42
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: obo_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Yoder
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 11.1.2
19
+ version: '12.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 11.1.2
26
+ version: '12.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.4'
33
+ version: '3.6'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '3.4'
40
+ version: '3.6'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -56,44 +56,58 @@ dependencies:
56
56
  name: guard-rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 4.7.3
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 4.7.3
69
69
  - !ruby/object:Gem::Dependency
70
- name: byebug
70
+ name: pry
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: 0.10.4
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: 0.10.4
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: awesome_print
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '1.6'
89
+ version: '1.8'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.8'
97
+ - !ruby/object:Gem::Dependency
98
+ name: logger
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.2.8
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: '1.6'
110
+ version: 1.2.8
97
111
  description: 'Provides all-in-one object containing the contents of an OBO formatted
98
112
  file. OBO version 1.2 is targeted, though this should work for 1.0. '
99
113
  email:
@@ -104,21 +118,21 @@ extra_rdoc_files: []
104
118
  files:
105
119
  - ".document"
106
120
  - ".gitignore"
121
+ - ".travis"
107
122
  - Gemfile
108
123
  - Gemfile.lock
109
124
  - Guardfile
110
125
  - LICENSE
111
126
  - README.md
112
127
  - Rakefile
113
- - VERSION
114
- - init.rb
115
- - install.rb
116
- - lib/lexer.rb
117
128
  - lib/obo_parser.rb
129
+ - lib/obo_parser/lexer.rb
130
+ - lib/obo_parser/parser.rb
131
+ - lib/obo_parser/tokens.rb
132
+ - lib/obo_parser/utilities.rb
133
+ - lib/obo_parser/utilities/helpers.rb
134
+ - lib/obo_parser/utilities/viz.rb
118
135
  - lib/obo_parser/version.rb
119
- - lib/parser.rb
120
- - lib/tokens.rb
121
- - lib/utilities.rb
122
136
  - obo_parser.gemspec
123
137
  - obo_parser/version.rb
124
138
  - spec/files/cell.obo
@@ -128,6 +142,7 @@ files:
128
142
  - spec/files/obo_1.0_test_wo_typedefs.txt
129
143
  - spec/files/tgma.obo
130
144
  - spec/lib/obo_parser_spec.rb
145
+ - spec/lib/utilities/viz_spec.rb
131
146
  - spec/spec_helper.rb
132
147
  - tasks/obo_parser_tasks.rake
133
148
  - test/cell.obo
@@ -136,7 +151,6 @@ files:
136
151
  - test/obo_1.0_test.txt
137
152
  - test/obo_1.0_test_wo_typedefs.txt
138
153
  - test/tgma.obo
139
- - uninstall.rb
140
154
  homepage: http://github.com/mjy/obo_parser
141
155
  licenses:
142
156
  - MIT
@@ -157,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
171
  version: '0'
158
172
  requirements: []
159
173
  rubyforge_project:
160
- rubygems_version: 2.6.4
174
+ rubygems_version: 2.6.12
161
175
  signing_key:
162
176
  specification_version: 4
163
177
  summary: Ruby parsering for OBO files.
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.3.7
data/init.rb DELETED
@@ -1 +0,0 @@
1
- # Include hook code here
data/install.rb DELETED
@@ -1 +0,0 @@
1
- # Install hook code here
@@ -1 +0,0 @@
1
- # Uninstall hook code here