SemanticSBML 0.0.1

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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/SemanticSBML.rb +38 -0
  3. metadata +86 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b151c38448ad2404065630a79e4aff5719906a46
4
+ data.tar.gz: 98a483f571fb32302b6b42ab9dd30f1cfb11b54d
5
+ SHA512:
6
+ metadata.gz: 2e6352c86842f5e468c32b6a7850e07c134fb1431cdb128631995f6ae59247198f32ce3addbeff0972d83544a9209a640e21d774a0c0c756039565d253b63dcf
7
+ data.tar.gz: f2240f39b912ddd6ad878148bbe36c1222d0dd911e5757528c29d2cda3ce985d0a8767da8737880b5e49737e757e42d3826530ed6b75c8596cfdcb8d7e10f366
@@ -0,0 +1,38 @@
1
+ require 'typhoeus'
2
+ require 'json'
3
+
4
+ class SemanticSBML
5
+
6
+ def self.get_supported_dbs
7
+ JSON.parse(Typhoeus.get("http://www.semanticsbml.org/semanticSBML/annotate/imported_resources.json").response_body)["result"].uniq
8
+ end
9
+
10
+ def self.get_linked_ressources
11
+ JSON.parse(Typhoeus.get("http://www.semanticsbml.org/semanticSBML/annotate/linked_resources.json").response_body)["result"].uniq
12
+ end
13
+
14
+ def self.consult(name,precision,full_info)
15
+ #the arguments have to be valid
16
+ raise "The precision argument has to be between 0 and 1" unless (0...1).include?(precision)
17
+ raise "The info flag has to be 1 or 0" if ![1,0].include?(full_info)
18
+
19
+ JSON.parse(Typhoeus.get("http://www.semanticsbml.org/semanticSBML/annotate/search.json?q=#{name}&precision=#{full_info}&full_info=#{full_info}").response_body)["result"].uniq.first
20
+ end
21
+
22
+ def self.show_matches(matches)
23
+ matches.each do |elem|
24
+ puts "hyperlink: #{elem["hyperlink"]}"
25
+ puts "uri: #{elem["uri"]}"
26
+ puts "name: #{elem["name"]}"
27
+ puts ""
28
+ end
29
+ end
30
+
31
+ def self.get_readable_miriam_urn(miriam_urn)
32
+ Typhoeus.get("http://www.semanticsbml.org/semanticSBML/annotate/name?urn=#{miriam_urn}").response_body
33
+ end
34
+
35
+ def self.get_url_to_miriam_urn(miriam_urn)
36
+ Typhoeus.get("http://www.semanticsbml.org/semanticSBML/annotate/name?urn=#{miriam_urn}").response_body
37
+ end
38
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: SemanticSBML
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Steven Stadler
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: typhoeus
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.6'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.6.7
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '0.6'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.6.7
33
+ - !ruby/object:Gem::Dependency
34
+ name: json
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.8'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 1.8.1
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '1.8'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 1.8.1
53
+ description: 'SemanticSBML is an application to annotate stoichiometric models. This
54
+ gem has the purpose to consult the REST API of this application to support the further
55
+ work of bioinformaticians. '
56
+ email: steven.stadler@gmail.com
57
+ executables: []
58
+ extensions: []
59
+ extra_rdoc_files: []
60
+ files:
61
+ - lib/SemanticSBML.rb
62
+ homepage: http://www.joermungandr.com
63
+ licenses:
64
+ - MIT
65
+ metadata: {}
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubyforge_project:
82
+ rubygems_version: 2.2.1
83
+ signing_key:
84
+ specification_version: 4
85
+ summary: A interface to work with the SemanticSBML REST API!
86
+ test_files: []