phenoscaperb 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7cdb4d2944c4a7754d8d8024b8528fd9c0470f75
4
+ data.tar.gz: 2b1cd5af6ef8938a9e60d8068f19f70a36efaf2c
5
+ SHA512:
6
+ metadata.gz: c368c6a26ac0c956b00dcf34c94fffffb3c73bad358e291a7916b828bdd5e93966cc4e016549effc1c69fb752212cde056b6edd1dc479a49cd54dfb0776982f0
7
+ data.tar.gz: b13308c4e5a589b19559ac15f44ea191f7b008b0c7f4fbe99149ff7152a0e08a946ab662792405d51d5dd8561ccfc97e34d6524f333c59ba8f4fd711c33c48b7
@@ -0,0 +1,38 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /lib/bundler/man/
26
+
27
+ # for a library or gem, you might want to ignore these files since the code is
28
+ # intended to run in multiple environments; otherwise, check them in:
29
+ #Gemfile.lock
30
+ .ruby-version
31
+ .ruby-gemset
32
+
33
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
34
+ .rvmrc
35
+
36
+ cache/
37
+
38
+ lib/serrano/response.rb
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ cache: bundler
3
+ rvm:
4
+ - 2.1.8
5
+ - 2.2.4
6
+ - 2.4.2
7
+ script:
8
+ bundle exec rake test TESTOPTS="-v"
@@ -0,0 +1,3 @@
1
+ ## 0.1.0 (2017-12-19)
2
+
3
+ * First release to rubygems
@@ -0,0 +1,25 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who
4
+ contribute through reporting issues, posting feature requests, updating documentation,
5
+ submitting pull requests or patches, and other activities.
6
+
7
+ We are committed to making participation in this project a harassment-free experience for
8
+ everyone, regardless of level of experience, gender, gender identity and expression,
9
+ sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
10
+
11
+ Examples of unacceptable behavior by participants include the use of sexual language or
12
+ imagery, derogatory comments or personal attacks, trolling, public or private harassment,
13
+ insults, or other unprofessional conduct.
14
+
15
+ Project maintainers have the right and responsibility to remove, edit, or reject comments,
16
+ commits, code, wiki edits, issues, and other contributions that are not aligned to this
17
+ Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed
18
+ from the project team.
19
+
20
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by
21
+ opening an issue or contacting one or more of the project maintainers.
22
+
23
+ This Code of Conduct is adapted from the Contributor Covenant
24
+ (http:contributor-covenant.org), version 1.0.0, available at
25
+ http://contributor-covenant.org/version/1/0/0/
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,71 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ phenoscaperb (0.1.0)
5
+ faraday (~> 0.12.0.1)
6
+ faraday_middleware (~> 0.11.0.1)
7
+ multi_json (~> 1.12, >= 1.12.1)
8
+ nokogiri (~> 1.8, >= 1.8.1)
9
+ thor (~> 0.20.0)
10
+ xml-to-hash (~> 1.0, >= 1.0.3)
11
+
12
+ GEM
13
+ remote: https://rubygems.org/
14
+ specs:
15
+ addressable (2.5.0)
16
+ public_suffix (~> 2.0, >= 2.0.2)
17
+ codecov (0.1.10)
18
+ json
19
+ simplecov
20
+ url
21
+ crack (0.4.3)
22
+ safe_yaml (~> 1.0.0)
23
+ docile (1.1.5)
24
+ faraday (0.12.0.1)
25
+ multipart-post (>= 1.2, < 3)
26
+ faraday_middleware (0.11.0.1)
27
+ faraday (>= 0.7.4, < 1.0)
28
+ hashdiff (0.3.2)
29
+ json (2.0.3)
30
+ mini_portile2 (2.3.0)
31
+ multi_json (1.12.2)
32
+ multipart-post (2.0.0)
33
+ nokogiri (1.8.1)
34
+ mini_portile2 (~> 2.3.0)
35
+ power_assert (0.3.1)
36
+ public_suffix (2.0.5)
37
+ rake (12.0.0)
38
+ safe_yaml (1.0.4)
39
+ simplecov (0.14.1)
40
+ docile (~> 1.1.0)
41
+ json (>= 1.8, < 3)
42
+ simplecov-html (~> 0.10.0)
43
+ simplecov-html (0.10.0)
44
+ test-unit (3.2.1)
45
+ power_assert
46
+ thor (0.20.0)
47
+ url (0.3.2)
48
+ vcr (3.0.3)
49
+ webmock (2.3.2)
50
+ addressable (>= 2.3.6)
51
+ crack (>= 0.3.2)
52
+ hashdiff
53
+ xml-to-hash (1.0.3)
54
+ nokogiri (~> 1, >= 1.6)
55
+
56
+ PLATFORMS
57
+ ruby
58
+
59
+ DEPENDENCIES
60
+ bundler (~> 1.14, >= 1.14.6)
61
+ codecov (~> 0.1.10)
62
+ json (~> 2.0, >= 2.0.3)
63
+ phenoscaperb!
64
+ rake (~> 12.0, >= 12.0.0)
65
+ simplecov (~> 0.14.1)
66
+ test-unit (~> 3.2, >= 3.2.1)
67
+ vcr (~> 3.0, >= 3.0.3)
68
+ webmock (~> 2.3, >= 2.3.2)
69
+
70
+ BUNDLED WITH
71
+ 1.16.0
data/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (C) 2017 Scott Chamberlain
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,153 @@
1
+ phenoscaperb
2
+ ============
3
+
4
+ [![gem version](https://img.shields.io/gem/v/phenoscaperb.svg)](https://rubygems.org/gems/phenoscaperb)
5
+ [![Build Status](https://travis-ci.org/phenoscape/phenoscaperb.svg?branch=master)](https://travis-ci.org/phenoscape/phenoscaperb)
6
+ [![codecov.io](http://codecov.io/github/phenoscape/phenoscaperb/coverage.svg?branch=master)](http://codecov.io/github/phenoscape/phenoscaperb?branch=master)
7
+
8
+ `phenoscaperb` is a low level client for the [Phenoscape API][phenoscapeapi]
9
+
10
+ [Phenoscape][] is a datastore of computable phenotypes for studies of evolution and genetics.
11
+
12
+ ## Changes
13
+
14
+ For changes see the [Changelog][changelog]
15
+
16
+ ## API
17
+
18
+ Taxa
19
+
20
+ * `/taxon` - `Phenoscape::Taxon.taxon`
21
+ * `/taxon/with_rank` - `Phenoscape::Taxon.taxon_with_rank`
22
+ * `/taxon/with_phenotype` - `Phenoscape::Taxon.with_phenotype`
23
+ * `/taxon/annotations` - `Phenoscape::Taxon.annotations`
24
+
25
+ Genes
26
+
27
+ * `/gene` - `Phenoscape::Gene.gene`
28
+ * `/gene/search` - `Phenoscape::Gene.search`
29
+ * `/gene/affecting_entity_phenotype` - `Phenoscape::Gene.affecting_entity_phenotype`
30
+
31
+ Terms
32
+
33
+ * `/term` - `Phenoscape::Terms.term`
34
+ * `/term/search` - `Phenoscape::Terms.search`
35
+ * `/term/search_classes` - `Phenoscape::Terms.search_classes`
36
+ * `/term/label` - `Phenoscape::Terms.label`
37
+ * `/term/labels` - `Phenoscape::Terms.labels`
38
+ * `/term/classification` - `Phenoscape::Terms.classification`
39
+ * `/term/all_ancestors` - `Phenoscape::Terms.all_ancestors`
40
+ * `/term/all_descendants` - `Phenoscape::Terms.all_descendants`
41
+ * `/term/least_common_subsumers` - `Phenoscape::Terms.least_common_subsumers`
42
+
43
+ Ontotrace
44
+
45
+ * `/ontotrace` - `Phenoscape::Ontotrace.ontotrace`
46
+
47
+ Studies
48
+
49
+ * `/studies/query` - `Phenoscape::Studies.query`
50
+ * `/studies/taxa` - `Phenoscape::Studies.taxa`
51
+ * `/studies/phenotypes` - `Phenoscape::Studies.phenotypes`
52
+ * `/studies/matrix` - `Phenoscape::Studies.matrix`
53
+
54
+ ## Install
55
+
56
+ ### Development version
57
+
58
+ ```
59
+ git clone git@github.com:phenoscape/phenoscaperb.git
60
+ cd phenoscaperb
61
+ rake install
62
+ ```
63
+
64
+ ### Release version
65
+
66
+ ```
67
+ gem install phenoscaperb
68
+ ```
69
+
70
+ ## Setup
71
+
72
+ This is most likely not needed ...
73
+
74
+ You can swap out the base URL by passing named options in a block to `Phenoscape.configuration`.
75
+
76
+ This will also be the way to set up other user options, if any are needed down the road (though `base_url` is the only one right now).
77
+
78
+ ```ruby
79
+ Phenoscape.configuration do |config|
80
+ config.base_url = "the new url"
81
+ end
82
+ ```
83
+
84
+ ## in Ruby
85
+
86
+ A few examples
87
+
88
+ `Phenoscape::Taxa.taxon`
89
+
90
+ ```ruby
91
+ require 'phenoscaperb'
92
+ tax = Phenoscape::Taxa
93
+ tax.taxon(iri: "http://purl.obolibrary.org/obo/VTO_0067193")
94
+ #> => {"rank"=>{"@id"=>"http://purl.obolibrary.org/obo/TAXRANK_0000006", "label"=>"species"},
95
+ #> "label"=>"Apterichtus equatorialis",
96
+ #> "extinct"=>false,
97
+ #> "common_name"=>"Finless eel",
98
+ #> "@id"=>"http://purl.obolibrary.org/obo/VTO_0067193"}
99
+ ```
100
+
101
+ `Phenoscape::Genes.gene`
102
+
103
+ ```ruby
104
+ require 'phenoscaperb'
105
+ ge = Phenoscape::Genes
106
+ ge.gene(iri: "http://www.informatics.jax.org/marker/MGI:104842")
107
+ #> => {"@id"=>"http://www.informatics.jax.org/marker/MGI:104842", "label"=>"Coil", "taxon"=>{"@id"=>"http://purl.obolibrary.org/obo/NCBITaxon_10090", "label"=>"Mus musculus"}}
108
+ ```
109
+
110
+ `Phenoscape::Ontotrace.ontotrace`
111
+
112
+ ```ruby
113
+ require 'phenoscaperb'
114
+ onto = Phenoscape::Ontotrace
115
+ onto.ontotrace(taxon: "<http://purl.obolibrary.org/obo/VTO_0058051>", entity: "<http://purl.obolibrary.org/obo/BFO_0000050>", ret: "text")
116
+ #> => <?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<nexml xmlns=\"http://www.nexml.org/2009\" xmlns:dc=\"http://purl.org/dc/terms/\" xmlns:dwc=\"http://rs.tdwg.org/dwc/terms/\" xmlns:obo=\"http://purl.obolibrary.org/obo/\" xmlns:ps=\"http://vocab.phenoscape.org/\" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" version=\"0.9\" xsi:schemaLocation=\"http://www.nexml.org/2009 http://www.nexml.org/2009/nexml.xsd http://www.bioontologies.org/obd/schema/pheno http://purl.org/phenoscape/phenoxml.xsd\">\r\n <meta xsi:type=\"LiteralMeta\" property=\"dc:creator\" />\r\n <meta xsi:type=\"LiteralMeta\" property=\"dc:description\">Generated from the Phenoscape Knowledgebase on 2017-12-19 by Ontotrace query:\r\n* taxa: &lt;http://purl.obolibrary.org/obo/VTO_0058051&gt;\r\n* entities: &lt;http://purl.obolibrary.org/obo/BFO_0000050&gt;</meta>\r\n <otus id=\"t4813128d-4f2b-417f-bf5a-d568dd584a64\" />\r\n <characters id=\"c49fb5508-08a8-4252-93eb-50ac042eca46\" xsi:type=\"StandardCells\" otus=\"t4813128d-4f2b-417f-bf5a-d568dd584a64\">\r\n <format />\r\n <matrix />\r\n </characters>\r\n <trees id=\"t416da46f-0871-4c9a-ae39-43edbe473b6d\" otus=\"t4813128d-4f2b-417f-bf5a-d568dd584a64\" />\r\n</nexml>\r\n
117
+ ```
118
+
119
+ ## cli
120
+
121
+ cli options thus far
122
+
123
+ * `ph version`
124
+ * `ph taxon`
125
+ * `ph term`
126
+
127
+ For the `jq` command line tool see <https://stedolan.github.io/jq/>
128
+
129
+ ```
130
+ ph taxon http://purl.obolibrary.org/obo/VTO_0067193 | jq .
131
+ ```
132
+
133
+ ```
134
+ {
135
+ "rank": {
136
+ "@id": "http://purl.obolibrary.org/obo/TAXRANK_0000006",
137
+ "label": "species"
138
+ },
139
+ "label": "Apterichtus equatorialis",
140
+ "extinct": false,
141
+ "common_name": "Finless eel",
142
+ "@id": "http://purl.obolibrary.org/obo/VTO_0067193"
143
+ }
144
+ ```
145
+
146
+ ## Meta
147
+
148
+ * Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by its terms.
149
+ * License: MIT
150
+
151
+ [Phenoscape]: http://kb.phenoscape.org
152
+ [phenoscapeapi]: http://kb.phenoscape.org/apidocs/#/
153
+ [changelog]: https://github.com/sckott/phenoscaperb/blob/master/CHANGELOG.md
@@ -0,0 +1,42 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs << "test"
6
+ t.test_files = FileList['test/test-*.rb']
7
+ t.verbose = true
8
+ t.warning = false
9
+ end
10
+
11
+ desc "Run tests"
12
+ task :default => :test
13
+
14
+ desc "Build phenoscaperb docs"
15
+ task :docs do
16
+ system "yardoc"
17
+ end
18
+
19
+ desc "bundle install"
20
+ task :bundle do
21
+ system "bundle install"
22
+ end
23
+
24
+ desc "clean out builds"
25
+ task :clean do
26
+ system "ls | grep [0-9].gem | xargs rm"
27
+ end
28
+
29
+ desc "Build phenoscaperb"
30
+ task :build do
31
+ system "gem build phenoscaperb.gemspec"
32
+ end
33
+
34
+ desc "Install phenoscaperb"
35
+ task :install => [:bundle, :build] do
36
+ system "gem install phenoscaperb-#{Phenoscape::VERSION}.gem"
37
+ end
38
+
39
+ desc "Release to Rubygems"
40
+ task :release => :build do
41
+ system "gem push phenoscaperb-#{Phenoscape::VERSION}.gem"
42
+ end
data/bin/ph ADDED
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "thor"
4
+ require "phenoscaperb"
5
+ require "multi_json"
6
+
7
+ class Sr < Thor
8
+ include Thor::Actions
9
+ # class_option :json, :type => :boolean, :default => false
10
+
11
+ desc "taxon [IRI]", "Get taxon by taxon IRI"
12
+ long_desc <<-LONGDESC
13
+ `ph taxon` accepts an IRI to search for taxa
14
+
15
+ \x5$ ph taxon http://purl.obolibrary.org/obo/VTO_0067193
16
+
17
+ {"rank":{"@id":"http://purl.obolibrary.org/obo/TAXRANK_0000006","label":"species"},"label":"Apterichtus equatorialis","extinct":false,"common_name":"Finless eel","@id":"http://purl.obolibrary.org/obo/VTO_0067193"}
18
+ LONGDESC
19
+ option :iri, :type => :string
20
+ def taxon(iri=nil)
21
+ tax = Phenoscape::Taxa
22
+ puts MultiJson.encode(tax.taxon(iri: iri))
23
+ end
24
+
25
+ desc "term [IRI]", "Info for a term"
26
+ long_desc <<-LONGDESC
27
+ `ph term` accepts a term IRI
28
+
29
+ \x5$ ph term http://purl.obolibrary.org/obo/UBERON_0011618
30
+
31
+ {"@id":"http://purl.obolibrary.org/obo/UBERON_0011618","label":"basihyal bone","definition":"Replacement bone that is median and is the anterior-most bone of the ventral hyoid arch.","relationships":[{"property":{"@id":"http://purl.obolibrary.org/obo/RO_0002202","label":"develops from"},"value":{"@id":"http://purl.obolibrary.org/obo/UBERON_0011615","label":"basihyal cartilage"}}]}
32
+ LONGDESC
33
+ option :iri, :type => :string
34
+ def term(iri=nil)
35
+ tm = Phenoscape::Terms
36
+ puts MultiJson.encode(tm.term(iri: iri))
37
+ end
38
+
39
+ desc "version", "Get phenoscaperb version"
40
+ def version
41
+ puts Phenoscape::VERSION
42
+ end
43
+
44
+ end
45
+
46
+ Sr.start(ARGV)
@@ -0,0 +1,33 @@
1
+ require "phenoscaperb/version"
2
+ require "phenoscaperb/request"
3
+ require "phenoscaperb/Taxa"
4
+ require "phenoscaperb/Ontotrace"
5
+ require "phenoscaperb/Terms"
6
+ require "phenoscaperb/Genes"
7
+ require "phenoscaperb/Studies"
8
+
9
+ # @!macro phenoscape_params
10
+ # @param verbose [Boolean] Print request headers to stdout. Default: false
11
+
12
+ # @!macro phenoscape_options
13
+ # @param options [Hash] Hash of options for configuring the request, passed on to Faraday.new
14
+ # - timeout [Fixnum] open/read timeout Integer in seconds
15
+ # - open_timeout [Fixnum] read timeout Integer in seconds
16
+ # - proxy [Hash] hash of proxy options
17
+ # - uri [String] Proxy Server URI
18
+ # - user [String] Proxy server username
19
+ # - password [String] Proxy server password
20
+ # - params_encoder [Hash] not sure what this is
21
+ # - bind [Hash] A hash with host and port values
22
+ # - boundary [String] of the boundary value
23
+ # - oauth [Hash] A hash with OAuth details
24
+
25
+ ##
26
+ # Phenoscape - The top level module for using methods to access the Phenoscape API
27
+
28
+ module Phenoscape
29
+ extend Configuration
30
+
31
+ define_setting :base_url, "http://kb.phenoscape.org/api"
32
+
33
+ end