bio-basespace-sdk 0.1.2
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.
Potentially problematic release.
This version of bio-basespace-sdk might be problematic. Click here for more details.
- data/.document +5 -0
- data/.rspec +1 -0
- data/.travis.yml +11 -0
- data/Gemfile +16 -0
- data/License.txt +275 -0
- data/README.md +671 -0
- data/Rakefile +54 -0
- data/VERSION +1 -0
- data/examples/0_app_triggering.rb +135 -0
- data/examples/1_authentication.rb +156 -0
- data/examples/2_browsing.rb +84 -0
- data/examples/3_accessing_files.rb +129 -0
- data/examples/4_app_result_upload.rb +102 -0
- data/examples/5_purchasing.rb +119 -0
- data/lib/basespace.rb +126 -0
- data/lib/basespace/api/api_client.rb +313 -0
- data/lib/basespace/api/base_api.rb +242 -0
- data/lib/basespace/api/basespace_api.rb +789 -0
- data/lib/basespace/api/basespace_error.rb +80 -0
- data/lib/basespace/api/billing_api.rb +115 -0
- data/lib/basespace/model.rb +78 -0
- data/lib/basespace/model/app_result.rb +158 -0
- data/lib/basespace/model/app_result_response.rb +40 -0
- data/lib/basespace/model/app_session.rb +99 -0
- data/lib/basespace/model/app_session_compact.rb +43 -0
- data/lib/basespace/model/app_session_launch_object.rb +58 -0
- data/lib/basespace/model/app_session_response.rb +41 -0
- data/lib/basespace/model/application.rb +47 -0
- data/lib/basespace/model/application_compact.rb +44 -0
- data/lib/basespace/model/basespace_model.rb +60 -0
- data/lib/basespace/model/coverage.rb +48 -0
- data/lib/basespace/model/coverage_meta_response.rb +40 -0
- data/lib/basespace/model/coverage_metadata.rb +43 -0
- data/lib/basespace/model/coverage_response.rb +40 -0
- data/lib/basespace/model/file.rb +172 -0
- data/lib/basespace/model/file_response.rb +40 -0
- data/lib/basespace/model/genome_response.rb +40 -0
- data/lib/basespace/model/genome_v1.rb +56 -0
- data/lib/basespace/model/list_response.rb +53 -0
- data/lib/basespace/model/multipart_upload.rb +288 -0
- data/lib/basespace/model/product.rb +50 -0
- data/lib/basespace/model/project.rb +103 -0
- data/lib/basespace/model/project_response.rb +40 -0
- data/lib/basespace/model/purchase.rb +89 -0
- data/lib/basespace/model/purchase_response.rb +39 -0
- data/lib/basespace/model/purchased_product.rb +56 -0
- data/lib/basespace/model/query_parameters.rb +86 -0
- data/lib/basespace/model/query_parameters_purchased_product.rb +67 -0
- data/lib/basespace/model/refund_purchase_response.rb +40 -0
- data/lib/basespace/model/resource_list.rb +48 -0
- data/lib/basespace/model/response_status.rb +42 -0
- data/lib/basespace/model/run_compact.rb +55 -0
- data/lib/basespace/model/sample.rb +127 -0
- data/lib/basespace/model/sample_response.rb +40 -0
- data/lib/basespace/model/user.rb +80 -0
- data/lib/basespace/model/user_compact.rb +45 -0
- data/lib/basespace/model/user_response.rb +40 -0
- data/lib/basespace/model/variant.rb +57 -0
- data/lib/basespace/model/variant_header.rb +44 -0
- data/lib/basespace/model/variant_info.rb +48 -0
- data/lib/basespace/model/variants_header_response.rb +40 -0
- data/spec/basespaceapi_spec.rb +26 -0
- data/spec/basespaceerror_spec.rb +87 -0
- data/spec/basespacemodel_spec.rb +57 -0
- metadata +239 -0
@@ -0,0 +1,99 @@
|
|
1
|
+
# Copyright 2013 Toshiaki Katayama, Joachim Baran
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
# See the License for the specific language governing permissions and
|
12
|
+
# limitations under the License.
|
13
|
+
|
14
|
+
require 'basespace/model'
|
15
|
+
|
16
|
+
module Bio
|
17
|
+
module BaseSpace
|
18
|
+
|
19
|
+
# App sessions records when an App is being launched.
|
20
|
+
class AppSession < Model
|
21
|
+
|
22
|
+
# Create a new AppSession instance.
|
23
|
+
def initialize
|
24
|
+
@swagger_types = {
|
25
|
+
'Id' => 'str',
|
26
|
+
'Href' => 'str',
|
27
|
+
'Type' => 'str',
|
28
|
+
'UserCreatedBy' => 'User',
|
29
|
+
'DateCreated' => 'datetime',
|
30
|
+
'Status' => 'str',
|
31
|
+
'StatusSummary' => 'str',
|
32
|
+
'Application' => 'Application',
|
33
|
+
'References' => 'list<AppSessionLaunchObject>',
|
34
|
+
}
|
35
|
+
@attributes = {
|
36
|
+
'Id' => nil,
|
37
|
+
'Href' => nil, # The URI of BaseSpace
|
38
|
+
'Type' => nil,
|
39
|
+
# TODO UserUserCreatedBy in Python code would be typo of UserCreatedBy (bug in Python SDK)
|
40
|
+
'UserCreatedBy' => nil, # The user that triggered your application
|
41
|
+
'DateCreated' => nil, # The datetime the user acted in BaseSpace
|
42
|
+
'Status' => nil,
|
43
|
+
'StatusSummary' => nil,
|
44
|
+
'Application' => nil,
|
45
|
+
'References' => nil,
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
# Return a string representation of the object, showing user information, ID and status.
|
50
|
+
def to_s
|
51
|
+
return "App session by #{get_attr('UserCreatedBy')} - Id: #{get_attr('Id')} - status: #{get_attr('Status')}"
|
52
|
+
end
|
53
|
+
|
54
|
+
# Serialize references.
|
55
|
+
#
|
56
|
+
# +api+:: BaseSpaceAPI instance.
|
57
|
+
def serialize_references(api)
|
58
|
+
ref = []
|
59
|
+
# [TODO] should this attribute initialized with []?
|
60
|
+
get_attr('References').each do |r|
|
61
|
+
res = r.serialize_object(api) # AppSessionLaunchObject
|
62
|
+
ref << res
|
63
|
+
end
|
64
|
+
set_attr('References', ref)
|
65
|
+
return self
|
66
|
+
end
|
67
|
+
|
68
|
+
# Returns whether the App is running.
|
69
|
+
def can_work_on
|
70
|
+
return ['running'].include?(get_attr('Status').downcase)
|
71
|
+
end
|
72
|
+
|
73
|
+
# Sets the status of the AppSession.
|
74
|
+
#
|
75
|
+
# Note: once set to 'completed' or 'aborted', no more work can be done to the instance
|
76
|
+
#
|
77
|
+
# +api+:: BaseSpaceAPI instance.
|
78
|
+
# +status+:: Status value, either: completed, aborted, working, or suspended.
|
79
|
+
# +summary+:: Status summary.
|
80
|
+
def set_status(api, status, summary)
|
81
|
+
current_status = get_attr('Status')
|
82
|
+
if current_status.downcase == 'complete' or current_status.downcase == 'aborted'
|
83
|
+
raise "The status of AppSession = #{self.to_s} is #{current_status}, no further status changes are allowed."
|
84
|
+
end
|
85
|
+
|
86
|
+
# To prevent the AppResult object from being in an inconsistent state
|
87
|
+
# and having two identical objects floating around, we update the current object
|
88
|
+
# and discard the returned object
|
89
|
+
new_session = api.set_app_session_state(get_attr('Id'), status, summary)
|
90
|
+
set_attr('Status', new_session.status)
|
91
|
+
set_attr('StatusSummary', new_session.status_summary)
|
92
|
+
return self
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
end # module BaseSpace
|
98
|
+
end # module Bio
|
99
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Copyright 2013 Toshiaki Katayama, Joachim Baran
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
# See the License for the specific language governing permissions and
|
12
|
+
# limitations under the License.
|
13
|
+
|
14
|
+
require 'basespace/model'
|
15
|
+
|
16
|
+
module Bio
|
17
|
+
module BaseSpace
|
18
|
+
|
19
|
+
# Returned from GET purchases.
|
20
|
+
class AppSessionCompact < Model
|
21
|
+
|
22
|
+
# Create a new object.
|
23
|
+
def initialize
|
24
|
+
@swagger_types = {
|
25
|
+
'Id' => 'str',
|
26
|
+
'Name' => 'str',
|
27
|
+
}
|
28
|
+
@attributes = {
|
29
|
+
'Id' => nil,
|
30
|
+
'Name' => nil,
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# Return the name of the object.
|
35
|
+
def to_s
|
36
|
+
return get_attr('Name').to_s
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end # module BaseSpace
|
42
|
+
end # module Bio
|
43
|
+
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# Copyright 2013 Toshiaki Katayama, Joachim Baran
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
# See the License for the specific language governing permissions and
|
12
|
+
# limitations under the License.
|
13
|
+
|
14
|
+
require 'basespace/model'
|
15
|
+
|
16
|
+
module Bio
|
17
|
+
module BaseSpace
|
18
|
+
|
19
|
+
# Records the launch as part of an AppSession.
|
20
|
+
class AppSessionLaunchObject < Model
|
21
|
+
|
22
|
+
# Create a new instance.
|
23
|
+
def initialize
|
24
|
+
@swagger_types = {
|
25
|
+
'Content' => 'dict',
|
26
|
+
'Href' => 'str',
|
27
|
+
'HrefContent' => 'str',
|
28
|
+
'Rel' => 'str',
|
29
|
+
'Type' => 'str',
|
30
|
+
}
|
31
|
+
@attributes = {
|
32
|
+
'Content' => nil,
|
33
|
+
'Href' => nil,
|
34
|
+
'HrefContent' => nil,
|
35
|
+
'Rel' => nil,
|
36
|
+
'Type' => nil,
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
# Returns the type of the object.
|
41
|
+
def to_s
|
42
|
+
return get_attr('Type').to_s
|
43
|
+
end
|
44
|
+
|
45
|
+
# Serializes the object.
|
46
|
+
#
|
47
|
+
# +api+:: BaseSpaceAPI instance.
|
48
|
+
def serialize_object(api)
|
49
|
+
res = api.serialize_object(get_attr('Content'), get_attr('Type'))
|
50
|
+
set_attr('Content', res)
|
51
|
+
return self
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
end # module BaseSpace
|
57
|
+
end # module Bio
|
58
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright 2013 Toshiaki Katayama, Joachim Baran
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
# See the License for the specific language governing permissions and
|
12
|
+
# limitations under the License.
|
13
|
+
|
14
|
+
require 'basespace/model'
|
15
|
+
|
16
|
+
module Bio
|
17
|
+
module BaseSpace
|
18
|
+
|
19
|
+
# Response of an AppSession.
|
20
|
+
class AppSessionResponse < Model
|
21
|
+
|
22
|
+
# Create a new instance.
|
23
|
+
def initialize
|
24
|
+
@swagger_types = {
|
25
|
+
'ResponseStatus' => 'ResponseStatus',
|
26
|
+
'Response' => 'AppSession',
|
27
|
+
'Notifications' => 'list<Str>',
|
28
|
+
}
|
29
|
+
@attributes = {
|
30
|
+
'ResponseStatus' => nil, # ResponseStatus
|
31
|
+
'Response' => nil, # Coverage
|
32
|
+
'Notifications' => nil, # list<Str>'
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end # module BaseSpace
|
39
|
+
end # module Bio
|
40
|
+
|
41
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Copyright 2013 Toshiaki Katayama, Joachim Baran
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
# See the License for the specific language governing permissions and
|
12
|
+
# limitations under the License.
|
13
|
+
|
14
|
+
require 'basespace/model'
|
15
|
+
|
16
|
+
module Bio
|
17
|
+
module BaseSpace
|
18
|
+
|
19
|
+
# An App representation, which contains data such as name, homepage URI, a short
|
20
|
+
# description and the data the App was created.
|
21
|
+
class Application < Model
|
22
|
+
|
23
|
+
# Create a new instance.
|
24
|
+
def initialize
|
25
|
+
@swagger_types = {
|
26
|
+
'Id' => 'str',
|
27
|
+
'Href' => 'str',
|
28
|
+
'Name' => 'str',
|
29
|
+
'HomepageUri' => 'str',
|
30
|
+
'ShortDescription' => 'str',
|
31
|
+
'DateCreated' => 'datetime',
|
32
|
+
}
|
33
|
+
@attributes = {
|
34
|
+
'Id' => nil,
|
35
|
+
'Href' => nil,
|
36
|
+
'Name' => nil,
|
37
|
+
'HomepageUri' => nil,
|
38
|
+
'ShortDescription' => nil,
|
39
|
+
'DateCreated' => nil,
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
end # module BaseSpace
|
46
|
+
end # module Bio
|
47
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Copyright 2013 Toshiaki Katayama, Joachim Baran
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
# See the License for the specific language governing permissions and
|
12
|
+
# limitations under the License.
|
13
|
+
|
14
|
+
require 'basespace/model'
|
15
|
+
|
16
|
+
module Bio
|
17
|
+
module BaseSpace
|
18
|
+
|
19
|
+
# Application data returned by GET purchase.
|
20
|
+
class ApplicationCompact < Model
|
21
|
+
|
22
|
+
# Create a new instance.
|
23
|
+
def initialize
|
24
|
+
@swagger_types = {
|
25
|
+
'Id' => 'str',
|
26
|
+
'Name' => 'str',
|
27
|
+
'CompanyName' => 'str',
|
28
|
+
}
|
29
|
+
@attributes = {
|
30
|
+
'Id' => nil,
|
31
|
+
'Name' => nil,
|
32
|
+
'CompanyName' => nil,
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# Return the name of the App data returned by a GET purchase.
|
37
|
+
def to_s
|
38
|
+
return get_attr('Name').to_s
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end # module BaseSpace
|
44
|
+
end # module Bio
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# Copyright 2013 Toshiaki Katayama, Joachim Baran
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
# See the License for the specific language governing permissions and
|
12
|
+
# limitations under the License.
|
13
|
+
|
14
|
+
require 'basespace/model'
|
15
|
+
|
16
|
+
module Bio
|
17
|
+
module BaseSpace
|
18
|
+
|
19
|
+
# Basic representation of a BaseSpace model.
|
20
|
+
class BaseSpaceModel < Model
|
21
|
+
attr_accessor :api
|
22
|
+
|
23
|
+
# Create a new BaseSpaceModel instance.
|
24
|
+
def initialize
|
25
|
+
# [TODO] This class is not similar to other modles. Need to check if this port is OK.
|
26
|
+
@swagger_types = {
|
27
|
+
'Id' => 'str',
|
28
|
+
}
|
29
|
+
@attributes = {
|
30
|
+
'Id' => nil,
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# Returns the ID of the model.
|
35
|
+
def id
|
36
|
+
get_attr('Id')
|
37
|
+
end
|
38
|
+
|
39
|
+
# Returns the ID of the model.
|
40
|
+
def to_s
|
41
|
+
is_init
|
42
|
+
return get_attr('Id')
|
43
|
+
end
|
44
|
+
|
45
|
+
# Returns whether this object has been initialized, which is always the case (i.e., true).
|
46
|
+
def is_init
|
47
|
+
return true
|
48
|
+
end
|
49
|
+
|
50
|
+
# Set a BaseSpaceAPI object for this BaseSpaceModel.
|
51
|
+
#
|
52
|
+
# +api+:: BaseSpaceAPI instance.
|
53
|
+
def set_api(api)
|
54
|
+
@api = api
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end # module BaseSpace
|
59
|
+
end # module Bio
|
60
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# Copyright 2013 Toshiaki Katayama, Joachim Baran
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
# See the License for the specific language governing permissions and
|
12
|
+
# limitations under the License.
|
13
|
+
|
14
|
+
require 'basespace/model'
|
15
|
+
|
16
|
+
module Bio
|
17
|
+
module BaseSpace
|
18
|
+
|
19
|
+
# Representation of coverage.
|
20
|
+
class Coverage < Model
|
21
|
+
|
22
|
+
# Create a new Coverage instance.
|
23
|
+
def initialize
|
24
|
+
@swagger_types = {
|
25
|
+
'Chrom' => 'str',
|
26
|
+
'BucketSize' => 'int',
|
27
|
+
'MeanCoverage' => 'list<int>',
|
28
|
+
'EndPos' => 'int',
|
29
|
+
'StartPos' => 'int',
|
30
|
+
}
|
31
|
+
@attributes = {
|
32
|
+
'Chrom' => nil, # str
|
33
|
+
'BucketSize' => nil, # int Each returned number will represent coverage of this many bases.
|
34
|
+
'MeanCoverage' => nil, # list<Str>
|
35
|
+
'EndPos' => nil, # int End position, possibly adjusted to match zoom boundaries
|
36
|
+
'StartPos' => nil, # int Start position, possibly adjusted to match zoom boundaries
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
# Return the genomic position and bucket size of the object.
|
41
|
+
def to_s
|
42
|
+
return "Chrom #{get_attr('Chrom')}: #{get_attr('StartPos')}-#{get_attr('EndPos')}, BucketSize=#{get_attr('BucketSize')}"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end # module BaseSpace
|
47
|
+
end # module Bio
|
48
|
+
|