togostanza 2.0.0 → 2.1.0

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: a3a84fadcce286880cf1905ef4ba2468e9ab0838
4
- data.tar.gz: 20df3090d324e8a82b9aafb556eb6cd9b0844e6f
3
+ metadata.gz: 0379c6310562da1453a679c51d90c6496ae83095
4
+ data.tar.gz: 1073dd02b8261acf5780349581f07243523d2182
5
5
  SHA512:
6
- metadata.gz: 671db4dce5c8235e401c5e0b40014f5eafb3172133a729d05ca2a80197c2332f3a90dfc4456eb4801048031762d539d21ddb2ad2ed0261cd76dd9aa0384306e0
7
- data.tar.gz: 34f60db878f722079c567fe7f510829ba226dfac48dd3359694d579638b2a6fe3ae10db9f63eab5af0e1e52b14a9c33edca53f90475fe6a17f2e5a066354115a
6
+ metadata.gz: 0d4292ab3bff30defb01f8fbe94aaf37c3f2d9a1e9388d21b4188df4ed11d171baec65efa474e14c97c6738c590b9b06ddc7fc84ac2f82bbb73a5dc697955c6c
7
+ data.tar.gz: a7839f24738a41d013e1650bbd9e3704dd08baa8b41e64c8016e32813100e99dfcc8cb90adf1d20d17adda90ec15ed8bc3739361c7601d83e04ae26aa15c733f
@@ -48,6 +48,7 @@ module TogoStanza
48
48
  template 'template.hbs.erb', "#{file_name}/template.hbs"
49
49
  template 'metadata.json.erb', "#{file_name}/metadata.json"
50
50
 
51
+ create_file "#{file_name}/sparql/.keep"
51
52
  create_file "#{file_name}/assets/#{stanza_id}/.keep"
52
53
  end
53
54
 
@@ -1,43 +1,29 @@
1
1
  require 'sparql/client'
2
+ require 'flavour_saver'
2
3
 
3
4
  module TogoStanza::Stanza
4
5
  module Querying
5
6
  MAPPINGS = {
6
- togogenome: 'http://ep.dbcls.jp/sparql7',
7
- uniprot: 'http://ep.dbcls.jp/sparql7',
8
- go: 'http://ep.dbcls.jp/sparql7'
7
+ togogenome: 'http://togogenome.org/sparql'
9
8
  }
10
9
 
11
- def query(endpoint, sparql)
10
+ def query(endpoint, text_or_filename)
11
+ path = File.join(root, 'sparql', text_or_filename)
12
+
13
+ if File.exist?(path)
14
+ data = OpenStruct.new params
15
+ text_or_filename = Tilt.new(path).render(data)
16
+ end
17
+
12
18
  client = SPARQL::Client.new(MAPPINGS[endpoint] || endpoint)
13
19
 
14
20
  #Rails.logger.debug "SPARQL QUERY: \n#{sparql}"
15
21
 
16
- client.query(sparql).map {|binding|
22
+ client.query(text_or_filename).map {|binding|
17
23
  binding.each_with_object({}) {|(name, term), hash|
18
24
  hash[name] = term.to_s
19
25
  }
20
26
  }
21
27
  end
22
-
23
- def uniprot_url_from_togogenome(gene_id)
24
- # refseq の UniProt
25
- # slr1311 の時 "http://purl.uniprot.org/refseq/NP_439906.1"
26
- query(:togogenome, <<-SPARQL).first[:up]
27
- PREFIX insdc: <http://insdc.org/owl/>
28
- PREFIX idorg: <http://rdf.identifiers.org/database/>
29
-
30
- SELECT DISTINCT ?up
31
- FROM <http://togogenome.org/graph/refseq/>
32
- WHERE {
33
- ?s insdc:feature_locus_tag "#{gene_id}" .
34
- ?s rdfs:seeAlso ?np .
35
- ?s rdfs:seeAlso ?xref .
36
- ?np rdf:type idorg:Protein .
37
- BIND (STRAFTER(STR(?np), "ncbiprotein/") AS ?npid)
38
- BIND (IRI(CONCAT("http://purl.uniprot.org/refseq/", ?npid)) AS ?up)
39
- }
40
- SPARQL
41
- end
42
28
  end
43
29
  end
@@ -1,3 +1,3 @@
1
1
  module TogoStanza
2
- VERSION = '2.0.0'
2
+ VERSION = '2.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: togostanza
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keita Urashima
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-10 00:00:00.000000000 Z
11
+ date: 2015-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport