bio-sparql-client 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,41 @@
1
+ # Bio-SPARQL-client
2
+ #
3
+ # Copyright (C) 2015
4
+ #
5
+ # author: Natapol Pornputtapong <natapol@chalmers.se>
6
+ #
7
+ # Documentation: Natapol Pornputtapong (RDoc'd and embellished by William Webber)
8
+ #
9
+
10
+ # raise "Please, use ruby 1.9.0 or later." if RUBY_VERSION < "1.9.0"
11
+
12
+
13
+ $: << File.join(File.expand_path(File.dirname(__FILE__)))
14
+
15
+ #Internal library
16
+ require 'open-uri'
17
+ require 'json'
18
+ require 'i18n'
19
+
20
+ #External library
21
+ #require 'bio-vcf'
22
+ require 'bio'
23
+ require 'sparql'
24
+ require 'sparql/client'
25
+
26
+
27
+ require 'bio-sparql-client/term.rb'
28
+ require 'bio-sparql-client/chembl.rb'
29
+ require 'bio-sparql-client/reactome.rb'
30
+ require 'bio-sparql-client/uniprot.rb'
31
+ require 'bio-sparql-client/kegg.rb'
32
+ require 'bio-sparql-client/identifiers.rb'
33
+ require 'bio-sparql-client/bioportal.rb'
34
+
35
+ I18n.enforce_available_locales = false
36
+
37
+ #library
38
+
39
+ module BSPARQLCLI
40
+
41
+ end
@@ -0,0 +1,13 @@
1
+ #
2
+ # Exodus
3
+ # Copyright (C) 2014
4
+ #
5
+ # author: Natapol Pornputtapong <natapol.por@gmail.com>
6
+ #
7
+ # Documentation: Natapol Pornputtapong (RDoc'd and embellished by William Webber)
8
+ #
9
+
10
+ # raise "Please, use ruby 1.9.0 or later." if RUBY_VERSION < "1.9.0"
11
+
12
+ require 'exodb/addon/string.rb'
13
+
@@ -0,0 +1,26 @@
1
+ #
2
+ # Exodus
3
+ # Copyright (C) 2014
4
+ #
5
+ # author: Natapol Pornputtapong <natapol.por@gmail.com>
6
+ #
7
+ # Documentation: Natapol Pornputtapong (RDoc'd and embellished by William Webber)
8
+ #
9
+
10
+ # raise "Please, use ruby 1.9.0 or later." if RUBY_VERSION < "1.9.0"
11
+
12
+ class String
13
+
14
+ def is_miriam?
15
+ return self =~ /^urn:miriam:/
16
+ end
17
+
18
+ def id
19
+ return self.is_miriam? ? self.split(':', 4)[-1] : ''
20
+ end
21
+
22
+ def namespace
23
+ return self.is_miriam? ? self.split(':', 4)[2] : ''
24
+ end
25
+
26
+ end
@@ -0,0 +1,33 @@
1
+ # Bio-SPARQL-client
2
+ #
3
+ # Copyright (C) 2015
4
+ #
5
+ # author: Natapol Pornputtapong <natapol@chalmers.se>
6
+ #
7
+ # Documentation: Natapol Pornputtapong (RDoc'd and embellished by William Webber)
8
+ #
9
+
10
+ module BSPARQLCLI
11
+
12
+ class BioPortal < SPARQL::Client
13
+
14
+ ENDPOINT = 'http://sparql.bioontology.org'
15
+
16
+ def initialize()
17
+ super(ENDPOINT)
18
+ end
19
+
20
+ end
21
+ end
22
+
23
+ #sparql = BSPARQLCLI::BioPortal.new()
24
+ #query = sparql.select(:vrtID, :graph).distinct.where(
25
+ # [:vrtID, RDF::META['hasVersion'], :version],
26
+ # [:version, RDF::META['hasDataGraph'], :graph]
27
+ #).limit(10)
28
+ #
29
+ #puts query.inspect
30
+ #
31
+ #query.each_solution do |solution|
32
+ # puts solution.inspect
33
+ #end
@@ -0,0 +1,30 @@
1
+ # Bio-SPARQL-client
2
+ #
3
+ # Copyright (C) 2015
4
+ #
5
+ # author: Natapol Pornputtapong <natapol@chalmers.se>
6
+ #
7
+ # Documentation: Natapol Pornputtapong (RDoc'd and embellished by William Webber)
8
+ #
9
+
10
+ module BSPARQLCLI
11
+
12
+ class ChEMBL < SPARQL::Client
13
+
14
+ ENDPOINT = 'http://www.ebi.ac.uk/rdf/services/chembl/sparql'
15
+
16
+ def initialize()
17
+ super(ENDPOINT)
18
+ end
19
+
20
+ end
21
+ end
22
+
23
+ #sparql = BSPARQLCLI::ChEMBL.new()
24
+ ##query = sparql.select(:molecule).where([:molecule, 'a', :type], [:type, 'rdfs:subClassOf*', 'cco:Substance']).prefix('rdfs: <http://www.w3.org/2000/01/rdf-schema#>').prefix('cco: <http://rdf.ebi.ac.uk/terms/chembl#>').offset(100).limit(10)
25
+ #query = sparql.select(:molecule).where([:molecule, 'a', :type], [:type, RDF::RDFS['subClassOf'], BSPARQLCLI::ChEMBL::CCO['Substance']]).limit(10)
26
+ #
27
+ #query.each_solution do |solution|
28
+ # puts solution.inspect
29
+ #end
30
+
@@ -0,0 +1,18 @@
1
+ #
2
+ # Exodus
3
+ # Copyright (C) 2014
4
+ #
5
+ # author: Natapol Pornputtapong <natapol.por@gmail.com>
6
+ #
7
+ # Documentation: Natapol Pornputtapong (RDoc'd and embellished by William Webber)
8
+ #
9
+
10
+ # raise "Please, use ruby 1.9.0 or later." if RUBY_VERSION < "1.9.0"
11
+
12
+ module Dactyls
13
+
14
+ class CreateUserError < Exception
15
+
16
+ end
17
+
18
+ end
@@ -0,0 +1,34 @@
1
+ # Bio-SPARQL-client
2
+ #
3
+ # Copyright (C) 2015
4
+ #
5
+ # author: Natapol Pornputtapong <natapol@chalmers.se>
6
+ #
7
+ # Documentation: Natapol Pornputtapong (RDoc'd and embellished by William Webber)
8
+ #
9
+
10
+ module BSPARQLCLI
11
+
12
+ class Identifiers < SPARQL::Client
13
+
14
+ ENDPOINT = 'http://identifiers.org/services/sparql'
15
+
16
+ def initialize()
17
+ super(ENDPOINT)
18
+ end
19
+
20
+ end
21
+ end
22
+
23
+ #sparql = BSPARQLCLI::Identifiers.new()
24
+ #query = sparql.select(:species, :go_term, :go_description).distinct.where(
25
+ # [:model, RDF::SBMLRDF['species'], :s],
26
+ # [:s, RDF::SBMLRDF['name'], :species],
27
+ # [:s, RDF::BQBIO['isVersionOf'], :go_term],
28
+ #).filter(:model == 'biomodel:BIOMD0000000001').limit(10)
29
+ #
30
+ #puts query.inspect
31
+ #
32
+ #query.each_solution do |solution|
33
+ # puts solution.inspect
34
+ #end
@@ -0,0 +1,32 @@
1
+ # Bio-SPARQL-client
2
+ #
3
+ # Copyright (C) 2015
4
+ #
5
+ # author: Natapol Pornputtapong <natapol@chalmers.se>
6
+ #
7
+ # Documentation: Natapol Pornputtapong (RDoc'd and embellished by William Webber)
8
+ #
9
+
10
+ module BSPARQLCLI
11
+
12
+ class KEGG < SPARQL::Client
13
+
14
+ ENDPOINT = 'http://www.genome.jp/sparql/linkdb'
15
+
16
+ def initialize()
17
+ super(ENDPOINT)
18
+ end
19
+
20
+ end
21
+ end
22
+
23
+ #sparql = BSPARQLCLI::KEGG.new()
24
+ #query = sparql.select().where(
25
+ # [:s, :p, :o]
26
+ #).limit(10)
27
+ #
28
+ #puts query.inspect
29
+ #
30
+ #query.each_solution do |solution|
31
+ # puts solution.inspect
32
+ #end
@@ -0,0 +1,34 @@
1
+ # Bio-SPARQL-client
2
+ #
3
+ # Copyright (C) 2015
4
+ #
5
+ # author: Natapol Pornputtapong <natapol@chalmers.se>
6
+ #
7
+ # Documentation: Natapol Pornputtapong (RDoc'd and embellished by William Webber)
8
+ #
9
+
10
+ module BSPARQLCLI
11
+
12
+ class Reactome < SPARQL::Client
13
+
14
+ ENDPOINT = 'http://www.ebi.ac.uk/rdf/services/reactome/sparql'
15
+
16
+ def initialize()
17
+ super(ENDPOINT)
18
+ end
19
+
20
+ end
21
+ end
22
+
23
+ #sparql = BSPARQLCLI::Reactome.new()
24
+ #query = sparql.select(:pathway, :pathwayname).distinct().where(
25
+ # [:pathway, RDF::RDF22['type'], RDF::BIOPAX3['Pathway']],
26
+ # [:pathway, RDF::BIOPAX3['displayName'], :pathwayname],
27
+ # [:pathway, RDF::BIOPAX3['organism'], RDF::URI.new("http://identifiers.org/taxonomy/9606")]
28
+ #).limit(10)
29
+ #
30
+ #puts query.inspect
31
+ #
32
+ #query.each_solution do |solution|
33
+ # puts solution.inspect
34
+ #end
@@ -0,0 +1,70 @@
1
+ # Bio-SPARQL-client
2
+ #
3
+ # Copyright (C) 2015
4
+ #
5
+ # author: Natapol Pornputtapong <natapol@chalmers.se>
6
+ #
7
+ # Documentation: Natapol Pornputtapong (RDoc'd and embellished by William Webber)
8
+ #
9
+
10
+ module RDF
11
+
12
+ #EMBL prefix
13
+ RDF22 = RDF::Vocabulary.new("http://www.w3.org/1999/02/22-rdf-syntax-ns#")
14
+ DCTERMS = RDF::Vocabulary.new("http://purl.org/dc/terms/")
15
+ BIOPAX3 = RDF::Vocabulary.new("http://www.biopax.org/release/biopax-level3.owl#")
16
+ CCO = RDF::Vocabulary.new("http://rdf.ebi.ac.uk/terms/chembl#")
17
+ VOID = RDF::Vocabulary.new("http://rdfs.org/ns/void#")
18
+ PAV = RDF::Vocabulary.new("http://purl.org/pav/2.0/")
19
+ OBO = RDF::Vocabulary.new("http://purl.obolibrary.org/obo/")
20
+ SIO = RDF::Vocabulary.new("http://semanticscience.org/resource/")
21
+ EFO = RDF::Vocabulary.new("http://www.ebi.ac.uk/efo/")
22
+ ATLAS = RDF::Vocabulary.new("http://rdf.ebi.ac.uk/resource/atlas/")
23
+ ATLASTERMS = RDF::Vocabulary.new("http://rdf.ebi.ac.uk/terms/atlas/")
24
+ SBMLRDF = RDF::Vocabulary.new("http://identifiers.org/biomodels.vocabulary#")
25
+ BQBIO = RDF::Vocabulary.new("http://biomodels.net/biology-qualifiers#")
26
+ BIOMODEL = RDF::Vocabulary.new("http://identifiers.org/biomodels.db/")
27
+
28
+ #UNIPROT
29
+ FALDO = RDF::Vocabulary.new("http://biohackathon.org/resource/faldo#")
30
+ UP = RDF::Vocabulary.new("http://purl.uniprot.org/core/")
31
+ TAXON = RDF::Vocabulary.new("http://purl.uniprot.org/taxonomy/")
32
+ KEYWORDS = RDF::Vocabulary.new("http://purl.uniprot.org/keywords/")
33
+ UNIPROTKB = RDF::Vocabulary.new("http://purl.uniprot.org/uniprot/")
34
+ EC = RDF::Vocabulary.new("http://purl.uniprot.org/enzyme/")
35
+ BIBO = RDF::Vocabulary.new("http://purl.org/ontology/bibo/")
36
+
37
+ #BioPortal
38
+ META = RDF::Vocabulary.new("http://bioportal.bioontology.org/metadata/def/")
39
+
40
+ #KEGG
41
+ #bif bif:
42
+ #dawgt http://www.w3.org/2001/sw/DataAccess/tests/test-dawg#
43
+ #dbpedia http://dbpedia.org/resource/
44
+ #dbpprop http://dbpedia.org/property/
45
+ #fn http://www.w3.org/2005/xpath-functions/#
46
+ #go http://purl.org/obo/owl/GO#
47
+ #math http://www.w3.org/2000/10/swap/math#
48
+ #mesh http://purl.org/commons/record/mesh/
49
+ #mf http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#
50
+ #nci http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#
51
+ #obo http://www.geneontology.org/formats/oboInOwl#
52
+ #product http://www.buy.com/rss/module/productV2/
53
+ #protseq http://purl.org/science/protein/bysequence/
54
+ #rdfa http://www.w3.org/ns/rdfa#
55
+ #rdfdf http://www.openlinksw.com/virtrdf-data-formats#
56
+ #sc http://purl.org/science/owl/sciencecommons/
57
+ #scovo http://purl.org/NET/scovo#
58
+ #sd http://www.w3.org/ns/sparql-service-description#
59
+ #sql sql:
60
+ #vcard2006 http://www.w3.org/2006/vcard/ns#
61
+ #virtcxml http://www.openlinksw.com/schemas/virtcxml#
62
+ #virtrdf http://www.openlinksw.com/schemas/virtrdf#
63
+ #xf http://www.w3.org/2004/07/xpath-functions
64
+ #xml http://www.w3.org/XML/1998/namespace
65
+ #xsl10 http://www.w3.org/XSL/Transform/1.0
66
+ #xsl1999 http://www.w3.org/1999/XSL/Transform
67
+ #xslwd http://www.w3.org/TR/WD-xsl
68
+ #yago http://dbpedia.org/class/yago/
69
+
70
+ end
@@ -0,0 +1,34 @@
1
+ # Bio-SPARQL-client
2
+ #
3
+ # Copyright (C) 2015
4
+ #
5
+ # author: Natapol Pornputtapong <natapol@chalmers.se>
6
+ #
7
+ # Documentation: Natapol Pornputtapong (RDoc'd and embellished by William Webber)
8
+ #
9
+
10
+ module BSPARQLCLI
11
+
12
+ class UniProt < SPARQL::Client
13
+
14
+ ENDPOINT = 'http://beta.sparql.uniprot.org/sparql'
15
+
16
+ def initialize()
17
+ super(ENDPOINT)
18
+ end
19
+
20
+ end
21
+ end
22
+
23
+ #sparql = BSPARQLCLI::UniProt.new()
24
+ #query = sparql.select(:taxon, :name).where(
25
+ # [:taxon, 'a', RDF::UP['Taxon']],
26
+ # [:taxon, RDF::UP['scientificName'], :name],
27
+ # [:taxon, RDF::RDFS['subClassOf'], RDF::TAXON['2']]
28
+ #).limit(10)
29
+ #
30
+ #puts query.inspect
31
+ #
32
+ #query.each_solution do |solution|
33
+ # puts solution.inspect
34
+ #end
@@ -0,0 +1,12 @@
1
+ # Bio-SPARQL-client
2
+ #
3
+ # Copyright (C) 2015
4
+ #
5
+ # author: Natapol Pornputtapong <natapol@chalmers.se>
6
+ #
7
+ # Documentation: Natapol Pornputtapong (RDoc'd and embellished by William Webber)
8
+ #
9
+
10
+ module BSPARQLCLI
11
+ VERSION = "0.0.1"
12
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bio-sparql-client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Natapol Pornputtapong
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sparql-client
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.1'
27
+ description: A ruby wrapper for bio SPARQL service
28
+ email:
29
+ - natapol.por@gmail.com
30
+ - natapol.pornputtapong@yale.edu
31
+ executables: []
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - LICENSE
36
+ - README.md
37
+ - Rakefile
38
+ - bio-sparql-client.gemspec
39
+ - error
40
+ - lib/bio-sparql-client.rb
41
+ - lib/bio-sparql-client/addon.rb
42
+ - lib/bio-sparql-client/addon/string.rb
43
+ - lib/bio-sparql-client/bioportal.rb
44
+ - lib/bio-sparql-client/chembl.rb
45
+ - lib/bio-sparql-client/exception.rb
46
+ - lib/bio-sparql-client/identifiers.rb
47
+ - lib/bio-sparql-client/kegg.rb
48
+ - lib/bio-sparql-client/reactome.rb
49
+ - lib/bio-sparql-client/term.rb
50
+ - lib/bio-sparql-client/uniprot.rb
51
+ - lib/bio-sparql-client/version.rb
52
+ homepage: http://rubygems.org/gems/bio-sparql-client
53
+ licenses:
54
+ - GPL-3.0
55
+ metadata: {}
56
+ post_install_message:
57
+ rdoc_options: []
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ requirements: []
71
+ rubyforge_project:
72
+ rubygems_version: 2.0.14
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: A ruby wrapper for bio SPARQL service
76
+ test_files: []
77
+ has_rdoc: