solvebio 1.5.0
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.
- data/.gitignore +7 -0
- data/.travis.yml +13 -0
- data/Gemfile +4 -0
- data/Gemspec +3 -0
- data/LICENSE +21 -0
- data/Makefile +17 -0
- data/README.md +64 -0
- data/Rakefile +59 -0
- data/bin/solvebio.rb +36 -0
- data/demo/README.md +14 -0
- data/demo/dataset/facets.rb +13 -0
- data/demo/dataset/field.rb +13 -0
- data/demo/depository/README.md +24 -0
- data/demo/depository/all.rb +13 -0
- data/demo/depository/retrieve.rb +13 -0
- data/demo/depository/versions-all.rb +13 -0
- data/demo/query/query-filter.rb +30 -0
- data/demo/query/query.rb +13 -0
- data/demo/query/range-filter.rb +18 -0
- data/demo/test-api.rb +98 -0
- data/lib/apiresource.rb +130 -0
- data/lib/cli/auth.rb +122 -0
- data/lib/cli/help.rb +13 -0
- data/lib/cli/irb.rb +58 -0
- data/lib/cli/irbrc.rb +53 -0
- data/lib/cli/options.rb +75 -0
- data/lib/client.rb +152 -0
- data/lib/credentials.rb +67 -0
- data/lib/errors.rb +81 -0
- data/lib/filter.rb +312 -0
- data/lib/help.rb +46 -0
- data/lib/locale.rb +47 -0
- data/lib/main.rb +37 -0
- data/lib/query.rb +415 -0
- data/lib/resource.rb +414 -0
- data/lib/solvebio.rb +14 -0
- data/lib/solveobject.rb +101 -0
- data/lib/tabulate.rb +706 -0
- data/solvebio.gemspec +75 -0
- data/test/data/netrc-save +6 -0
- data/test/helper.rb +3 -0
- data/test/test-auth.rb +54 -0
- data/test/test-client.rb +27 -0
- data/test/test-error.rb +36 -0
- data/test/test-filter.rb +70 -0
- data/test/test-netrc.rb +42 -0
- data/test/test-query-batch.rb +60 -0
- data/test/test-query-init.rb +29 -0
- data/test/test-query-paging.rb +123 -0
- data/test/test-query.rb +88 -0
- data/test/test-resource.rb +47 -0
- data/test/test-solveobject.rb +27 -0
- data/test/test-tabulate.rb +127 -0
- metadata +158 -0
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemspec
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Solve, Inc. (https://www.solvebio.com)
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/Makefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# I'll admit it -- I'm an absent-minded old-timer who has trouble
|
2
|
+
# learning new tricks.
|
3
|
+
|
4
|
+
.PHONY: test
|
5
|
+
|
6
|
+
RUBY ?= ruby
|
7
|
+
RAKE ?= rake
|
8
|
+
|
9
|
+
test: check
|
10
|
+
|
11
|
+
#: Default target; same as "make check"
|
12
|
+
all: check
|
13
|
+
true
|
14
|
+
|
15
|
+
#: Same as corresponding rake task
|
16
|
+
%:
|
17
|
+
$(RAKE) $@
|
data/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
[](https://travis-ci.org/solvebio/solvebio-ruby)
|
2
|
+
|
3
|
+
# SolveBio Ruby Client
|
4
|
+
|
5
|
+
|
6
|
+
This packages provides a command-line interface (CLI) and Ruby API interface to SolveBio.
|
7
|
+
|
8
|
+
For more information about the SolveBio API, https://www.solvebio.com/docs/api/
|
9
|
+
For more information about SolveBio, see https://www.solvebio.com
|
10
|
+
|
11
|
+
# Installation
|
12
|
+
|
13
|
+
Right now we only support installing from git:
|
14
|
+
|
15
|
+
git clone https://github.com/solvebio/solvebio-ruby.git
|
16
|
+
cd solvebio-ruby
|
17
|
+
gem install netrc # install gem dependencies, may need sudo
|
18
|
+
rake test # or make test
|
19
|
+
sudo rake install # or make install
|
20
|
+
|
21
|
+
This also builds a *solvebio* gem which you can use elsewhere.
|
22
|
+
|
23
|
+
But note, you can also run right inside the git repository without installing anything. For example, running:
|
24
|
+
|
25
|
+
git clone https://github.com/solvebio/solvebio-ruby.git
|
26
|
+
solvebio-ruby/bin/solvebio.rb
|
27
|
+
|
28
|
+
will get you into a solvebio irb shell. Just about any Ruby file in the project can be run standalone, and when done so, it demos that Ruby code.
|
29
|
+
|
30
|
+
# Optional Gem dependencies
|
31
|
+
|
32
|
+
The following optional gems can make your shell experience better
|
33
|
+
|
34
|
+
* [bond](http://tagaholic.me/bond/)
|
35
|
+
|
36
|
+
Better command completion
|
37
|
+
|
38
|
+
* [launchy](https://github.com/copiousfreetime/launchy)
|
39
|
+
|
40
|
+
Opens help URLs in a web browser tab
|
41
|
+
|
42
|
+
* [rb18n-core](https://https://github.com/ai/r18n)
|
43
|
+
|
44
|
+
Localization for number formatting
|
45
|
+
|
46
|
+
# Demo code and Documentation
|
47
|
+
|
48
|
+
See the [demo folder](https://github.com/solvebio/solvebio-ruby/tree/dev/demo) for ready-to-run examples.
|
49
|
+
|
50
|
+
The online [SolveBio Python API documentation](https://www.solvebio.com/docs/api/?python) has additional examples. To use these with the Ruby client, change `import solvebio` to `require 'solvebio'` and change `solvebio.` to `SolveBio::` everywhere it occurs.
|
51
|
+
|
52
|
+
e.g., a Python example:
|
53
|
+
|
54
|
+
solvebio.Depository.retrieve("ClinVar").versions()
|
55
|
+
|
56
|
+
the same Python example ported to Ruby:
|
57
|
+
|
58
|
+
SolveBio::Depository.retrieve("ClinVar").versions()
|
59
|
+
|
60
|
+
As with any other Ruby method call, you can drop the final parenthesis if you like.
|
61
|
+
|
62
|
+
# To Do
|
63
|
+
|
64
|
+
This hasn't been extensively field tested yet.
|
data/Rakefile
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# -*- Ruby -*-
|
3
|
+
|
4
|
+
ROOT_DIR = File.dirname(__FILE__)
|
5
|
+
Gemspec_filename = 'solvebio.gemspec'
|
6
|
+
|
7
|
+
def gemspec
|
8
|
+
@gemspec ||= eval(File.read(Gemspec_filename), binding, Gemspec_filename)
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'rubygems/package_task'
|
12
|
+
|
13
|
+
desc "Validate the gemspec"
|
14
|
+
task :gemspec do
|
15
|
+
gemspec.validate
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "Build the gem"
|
19
|
+
task :package=>:gem
|
20
|
+
task :gem=>:gemspec do
|
21
|
+
Dir.chdir(ROOT_DIR) do
|
22
|
+
sh "gem build solvebio.gemspec"
|
23
|
+
FileUtils.mkdir_p 'pkg'
|
24
|
+
FileUtils.mv gemspec.file_name, 'pkg'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
desc "Install the gem locally"
|
29
|
+
task :install => :gem do
|
30
|
+
Dir.chdir(ROOT_DIR) do
|
31
|
+
sh %{gem install --both pkg/#{gemspec.file_name}}
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
require 'rake/testtask'
|
36
|
+
desc "Test everything."
|
37
|
+
Rake::TestTask.new(:test) do |t|
|
38
|
+
t.libs << './lib'
|
39
|
+
t.test_files = FileList['test/test-*.rb']
|
40
|
+
t.verbose = true
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
require 'rbconfig'
|
45
|
+
RUBY_PATH = File.join(RbConfig::CONFIG['bindir'],
|
46
|
+
RbConfig::CONFIG['RUBY_INSTALL_NAME'])
|
47
|
+
desc "Run all of the demo files."
|
48
|
+
task :'run-demo' do
|
49
|
+
FileList['demo/*.rb']+FileList['demo/*/*.rb'].each do |ruby_file|
|
50
|
+
puts(('-' * 20) + ' ' + ruby_file + ' ' + ('-' * 20))
|
51
|
+
system(RUBY_PATH, ruby_file)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
task :test => :lib
|
56
|
+
|
57
|
+
desc "same as test"
|
58
|
+
task :check => :test
|
59
|
+
task :default => :test
|
data/bin/solvebio.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
4
|
+
# SolveBio Ruby command-line program
|
5
|
+
|
6
|
+
require_relative '../lib/solvebio'
|
7
|
+
require_relative '../lib/cli/options'
|
8
|
+
require_relative '../lib/cli/irb'
|
9
|
+
|
10
|
+
DIR = File.dirname(__FILE__)
|
11
|
+
TEST_PROGRAM = File.join(DIR, %w(.. demo test-api.rb))
|
12
|
+
|
13
|
+
include SolveBio::CLIOptions
|
14
|
+
options, rest, parser = process_options(ARGV)
|
15
|
+
|
16
|
+
rest = ['shell'] if rest.empty?
|
17
|
+
|
18
|
+
include SolveBio::Auth
|
19
|
+
|
20
|
+
cmd = rest.shift
|
21
|
+
case cmd
|
22
|
+
when 'shell'
|
23
|
+
IRB::shell
|
24
|
+
when 'login'
|
25
|
+
login *rest
|
26
|
+
when 'logout'
|
27
|
+
logout
|
28
|
+
when 'whoami'
|
29
|
+
whoami
|
30
|
+
when 'test'
|
31
|
+
system(TEST_PROGRAM)
|
32
|
+
else
|
33
|
+
$stderr.puts "Unknown solvbio.rb command: #{cmd}"
|
34
|
+
$stderr.puts parser
|
35
|
+
exit 1
|
36
|
+
end
|
data/demo/README.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# Intro
|
2
|
+
|
3
|
+
SolveBio aims to provide robust access to highly curated biological datasets. While our datasets do not conform to any proprietary formats, they are organized in a systematic way.
|
4
|
+
|
5
|
+
*Depositories* (data repositories) are simply versioned containers of datasets
|
6
|
+
|
7
|
+
A depository contains many versions, which in turn contain many datasets. Each dataset represents an independent “datastore”. Datasets store semi-structured data similar to typical “NoSQL” databases.
|
8
|
+
|
9
|
+
The [depository folder](https://github.com/solvebio/solvebio-ruby/blob/dev/demo/depository) has examples involving retrieving, getting version information or listing depositories.
|
10
|
+
|
11
|
+
*Datasets* are access points to data. Dataset names are unique within versions of a depository. The
|
12
|
+
[dataset folder](https://github.com/solvebio/solvebio-ruby/blob/dev/demo/dataset) has programs for retrieving properties of a dataset.
|
13
|
+
|
14
|
+
However, issuing queries on a dataset is probably what you will most want to do. The [query folder](https://github.com/solvebio/solvebio-ruby/blob/dev/demo/query) contains examples of queries.
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Simple use of SolveBio::DatsetField.retrieve ... facets
|
3
|
+
|
4
|
+
require 'solvebio'
|
5
|
+
|
6
|
+
# SolveBio.api_key = 'set-me-correctly'
|
7
|
+
unless SolveBio.api_key
|
8
|
+
puts 'Please set SolveBio.api_key. Hint: solvebio.rb login'
|
9
|
+
exit 1
|
10
|
+
end
|
11
|
+
|
12
|
+
fields = SolveBio::DatasetField.retrieve(691).facets
|
13
|
+
puts fields
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Simple use of SolveBio::DatsetField.retrieve
|
3
|
+
|
4
|
+
require 'solvebio'
|
5
|
+
|
6
|
+
# SolveBio.api_key = 'set-me-correctly'
|
7
|
+
unless SolveBio.api_key
|
8
|
+
puts 'Please set SolveBio.api_key. Hint: solvebio.rb login'
|
9
|
+
exit 1
|
10
|
+
end
|
11
|
+
|
12
|
+
fields = SolveBio::DatasetField.retrieve(1)
|
13
|
+
puts fields
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Depositories
|
2
|
+
|
3
|
+
A *depository* (or data repository) is like a source code repository,
|
4
|
+
but for datasets. Depositories have one or more versions, which in
|
5
|
+
turn contain one or more datasets. Typically, depositories contain a
|
6
|
+
series of datasets that are compatible with each other (i.e. they come
|
7
|
+
from the same data source or project).
|
8
|
+
|
9
|
+
Right now, all depositories are curated by the SolveBio team.
|
10
|
+
|
11
|
+
* retrieve a depository
|
12
|
+
|
13
|
+
The [retrieve.rb](https://github.com/solvebio/solvebio-ruby/blob/dev/demo/depository/retrieve.rb) Ruby program shows how to retrieve a single depository
|
14
|
+
|
15
|
+
* listing a depository
|
16
|
+
|
17
|
+
The [all.rb](https://github.com/solvebio/solvebio-ruby/blob/dev/demo/depository/all.rb) Ruby program shows how to list all depositories
|
18
|
+
|
19
|
+
* list all versions of a depository
|
20
|
+
|
21
|
+
The [versions-all.rb](https://github.com/solvebio/solvebio-ruby/blob/dev/demo/depository/all.rb) Ruby program shows how to list all versions
|
22
|
+
of a depository
|
23
|
+
|
24
|
+
See also the [SolveBio Depository API](https://www.solvebio.com/docs/api/#depositories)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Simple use of SolveBio::Depository.all
|
3
|
+
|
4
|
+
require 'solvebio'
|
5
|
+
|
6
|
+
# SolveBio.api_key = 'set-me-correctly'
|
7
|
+
unless SolveBio.api_key
|
8
|
+
puts 'Please set SolveBio::api_key. Hint: solvebio.rb login'
|
9
|
+
exit 1
|
10
|
+
end
|
11
|
+
|
12
|
+
depo = SolveBio::Depository.all
|
13
|
+
puts depo.to_s
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Simple use of SolveBio::Depository.retrieve
|
3
|
+
|
4
|
+
require 'solvebio'
|
5
|
+
|
6
|
+
# SolveBio.api_key = 'set-me-correctly'
|
7
|
+
unless SolveBio.api_key
|
8
|
+
puts 'Please set SolveBio.api_key. Hint: solvebio.rb login'
|
9
|
+
exit 1
|
10
|
+
end
|
11
|
+
|
12
|
+
depo = SolveBio::Depository.retrieve('ClinVar')
|
13
|
+
puts depo.to_s
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Simple use of SolveBio::Depository.retrieve({DEPOSITORY_ID}).versions.all
|
3
|
+
|
4
|
+
require 'solvebio'
|
5
|
+
|
6
|
+
# SolveBio.api_key = 'set-me-correctly'
|
7
|
+
unless SolveBio.api_key
|
8
|
+
puts 'Please set SolveBio.api_key. Hint: solvebio.rb login'
|
9
|
+
exit 1
|
10
|
+
end
|
11
|
+
|
12
|
+
depo = SolveBio::Depository.retrieve('ClinVar').versions.all
|
13
|
+
puts depo.to_s
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Simple use of SolveBio::Query with simple equality tests, sometimes
|
3
|
+
# with "and" or "or"
|
4
|
+
|
5
|
+
require 'solvebio'
|
6
|
+
|
7
|
+
# SolveBio.api_key = 'set-me-correctly'
|
8
|
+
unless SolveBio.api_key
|
9
|
+
puts 'Please set SolveBio.api_key. Hint: solvebio.rb login'
|
10
|
+
exit 1
|
11
|
+
end
|
12
|
+
|
13
|
+
ds = SolveBio::Dataset.retrieve('ClinVar/2.0.0-1/Variants')
|
14
|
+
|
15
|
+
results = ds.query.filter :hg19_start__in => [148562304, 148459988]
|
16
|
+
|
17
|
+
puts results.to_h # Show as a hash
|
18
|
+
puts '=' * 10
|
19
|
+
puts results # show in a more formatted way
|
20
|
+
|
21
|
+
# Here is the same thing but a little more inefficiently
|
22
|
+
|
23
|
+
filters2 =
|
24
|
+
SolveBio::Filter.new(:hg19_start => 148459988) |
|
25
|
+
SolveBio::Filter.new(:hg19_start => 148562304) |
|
26
|
+
|
27
|
+
results = ds.query(:filters => filters2)
|
28
|
+
|
29
|
+
puts '=' * 10
|
30
|
+
puts results
|
data/demo/query/query.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Simple use of SolveBio::Query
|
3
|
+
|
4
|
+
require 'solvebio'
|
5
|
+
|
6
|
+
# SolveBio.api_key = 'set-me-correctly'
|
7
|
+
unless SolveBio.api_key
|
8
|
+
puts 'Please set SolveBio.api_key. Hint: solvebio.rb login'
|
9
|
+
exit 1
|
10
|
+
end
|
11
|
+
|
12
|
+
dataset = SolveBio::Dataset.retrieve('ClinVar/2.0.0-1/Variants')
|
13
|
+
puts dataset.query
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Simple use of SolveBio::Query
|
3
|
+
|
4
|
+
require 'solvebio'
|
5
|
+
|
6
|
+
# SolveBio.api_key = 'set-me-correctly'
|
7
|
+
unless SolveBio.api_key
|
8
|
+
puts 'Please set SolveBio.api_key. Hint: solvebio.rb login'
|
9
|
+
exit 1
|
10
|
+
end
|
11
|
+
|
12
|
+
filters = SolveBio::RangeFilter.
|
13
|
+
new "hg38", "13", 32200000, 32500000
|
14
|
+
|
15
|
+
ds = SolveBio::Dataset.retrieve 'ClinVar/2.0.0-1/Variants'
|
16
|
+
|
17
|
+
results = ds.query(:filters => filters)
|
18
|
+
puts results
|
data/demo/test-api.rb
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Test SolveBio API
|
3
|
+
require_relative '../lib/solvebio'
|
4
|
+
|
5
|
+
DEPOSITORY = 'ClinVar'
|
6
|
+
DEPOSITORY_VERSION = "#{DEPOSITORY}/2.0.0-1"
|
7
|
+
DATASET = "#{DEPOSITORY_VERSION}/Variants"
|
8
|
+
|
9
|
+
# Custom Exception class for running basic tests
|
10
|
+
class TestFail < RuntimeError
|
11
|
+
end
|
12
|
+
|
13
|
+
DEBUG = ARGV.size > 1
|
14
|
+
|
15
|
+
# Function for running small tests with nice printing and checks
|
16
|
+
def run_and_verify(func, title='run a test', check_func_symbols)
|
17
|
+
puts "Trying to #{title}..."
|
18
|
+
response = func.call
|
19
|
+
check_func_symbols.each do |sym|
|
20
|
+
unless response.send(sym)
|
21
|
+
raise TestFail, "Failed on #{DATASET} using #{sym}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
puts "\x1b[32mOK!\x1b[39m\n"
|
25
|
+
return response
|
26
|
+
end
|
27
|
+
|
28
|
+
creds = SolveBio::Credentials.get_credentials
|
29
|
+
unless creds
|
30
|
+
puts 'You must be logged in as a SolveBio user ' +
|
31
|
+
'in order to run the test suite!'
|
32
|
+
exit(1)
|
33
|
+
end
|
34
|
+
|
35
|
+
SolveBio::Client.client.api_key = creds[1]
|
36
|
+
|
37
|
+
begin
|
38
|
+
# depository things
|
39
|
+
load_depo = proc { SolveBio::DepositoryVersion.
|
40
|
+
retrieve(DEPOSITORY_VERSION) }
|
41
|
+
begin
|
42
|
+
dataset = run_and_verify(load_depo, 'load a depository version',
|
43
|
+
[:id, :to_s, :inspect, :instance_url])
|
44
|
+
rescue SolveBio::Error => exc
|
45
|
+
raise TestFail, "Loading #{DEPOSITORY_VERSION} failed! (#{exc})"
|
46
|
+
end
|
47
|
+
|
48
|
+
# depository things
|
49
|
+
load_depo = proc { SolveBio::Depository.retrieve(DEPOSITORY) }
|
50
|
+
begin
|
51
|
+
dataset = run_and_verify(load_depo, 'load a depository',
|
52
|
+
[:to_s, :versions, :versions_url,
|
53
|
+
:first, :max, :min])
|
54
|
+
rescue SolveBio::Error => exc
|
55
|
+
raise TestFail, "Loading #{DEPOSITORY} failed! (#{exc})"
|
56
|
+
end
|
57
|
+
|
58
|
+
# try loading a Dataset
|
59
|
+
load_dataset = proc { SolveBio::Dataset.retrieve(DATASET) }
|
60
|
+
begin
|
61
|
+
dataset = run_and_verify(load_dataset, 'load a dataset',
|
62
|
+
[:depository, :depository_version, :fields])
|
63
|
+
rescue SolveBio::Error => exc
|
64
|
+
raise TestFail, "Loading #{DATASET} failed! (#{exc})"
|
65
|
+
end
|
66
|
+
|
67
|
+
# try loading a DatasetField
|
68
|
+
load_dataset = proc { SolveBio::DatasetField.retrieve(1) }
|
69
|
+
begin
|
70
|
+
dataset = run_and_verify(load_dataset, 'load a dataset field',
|
71
|
+
[:facets, :instance_url])
|
72
|
+
rescue SolveBio::Error => exc
|
73
|
+
raise TestFail, "Loading DataSetField 1 failed! (#{exc})"
|
74
|
+
end
|
75
|
+
|
76
|
+
# run a basic query
|
77
|
+
query_dataset = proc {
|
78
|
+
dataset = SolveBio::Dataset.retrieve(DATASET)
|
79
|
+
dataset.query({:paging=>true, :limit => 10})
|
80
|
+
}
|
81
|
+
query = run_and_verify(query_dataset, 'run a basic query',
|
82
|
+
[:size, :inspect, :clone])
|
83
|
+
|
84
|
+
# # run a basic filter
|
85
|
+
# basic_filter = proc { query.filter(clinical_significance='Pathogenic') }
|
86
|
+
# run_and_verify(basic_filter, 'run a basic filter')
|
87
|
+
|
88
|
+
# # run a range filter
|
89
|
+
# range_filter = solvebio.RangeFilter(build="hg19",
|
90
|
+
# chromosome=1,
|
91
|
+
# start=100000,
|
92
|
+
# last=900000)
|
93
|
+
# run_and_verify(proc { query.filter(range_filter) },
|
94
|
+
# 'run a range filter')
|
95
|
+
|
96
|
+
rescue TestFail, exc
|
97
|
+
puts "\n\n\x1b[31mFAIL!\x1b[39m #{exc}"
|
98
|
+
end
|