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 +4 -4
- data/lib/togostanza/cli.rb +1 -0
- data/lib/togostanza/stanza/querying.rb +11 -25
- data/lib/togostanza/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0379c6310562da1453a679c51d90c6496ae83095
|
4
|
+
data.tar.gz: 1073dd02b8261acf5780349581f07243523d2182
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d4292ab3bff30defb01f8fbe94aaf37c3f2d9a1e9388d21b4188df4ed11d171baec65efa474e14c97c6738c590b9b06ddc7fc84ac2f82bbb73a5dc697955c6c
|
7
|
+
data.tar.gz: a7839f24738a41d013e1650bbd9e3704dd08baa8b41e64c8016e32813100e99dfcc8cb90adf1d20d17adda90ec15ed8bc3739361c7601d83e04ae26aa15c733f
|
data/lib/togostanza/cli.rb
CHANGED
@@ -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://
|
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,
|
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(
|
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
|
data/lib/togostanza/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2015-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|