sequenceserver 3.1.1 → 3.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.
- checksums.yaml +4 -4
- data/lib/sequenceserver/api_errors.rb +24 -0
- data/lib/sequenceserver/blast.rb +6 -0
- data/lib/sequenceserver/database.rb +13 -0
- data/lib/sequenceserver/sequence.rb +1 -2
- data/lib/sequenceserver/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1579fdcd4e8dc694025ccde8534ab3a48d935cfef4830a8de2c446657449aaf8
|
4
|
+
data.tar.gz: 25561e738f1511d4ee40730eec04c943148749313d29ccf362098b15a1e922c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 965a7ab34577a0180d8ac1ac830c84737118e4c3fe2997cc61886424929066a95d3df3869c01ca46ffceb3a9ef3d39b96676e87841bf57c0c4903cd99700fde0
|
7
|
+
data.tar.gz: 3a5fa2dce619076a5e0b626981c2bb95ffc544ae8b920942b2979cabe4869120e549f494cbd15a02bf10e265bb303f8988264824839ea934f80797e280b8045a
|
@@ -52,6 +52,30 @@ module SequenceServer
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
+
# InvalidParameterError is a more generic error class that can be
|
56
|
+
# raised when the frontend sends a request with an invalid parameter
|
57
|
+
class InvalidParameterError < ValidationError
|
58
|
+
attr_reader :more_info
|
59
|
+
|
60
|
+
def initialize(more_info)
|
61
|
+
super
|
62
|
+
@more_info = more_info
|
63
|
+
end
|
64
|
+
|
65
|
+
def http_status
|
66
|
+
422
|
67
|
+
end
|
68
|
+
|
69
|
+
def title
|
70
|
+
'Invalid parameter'
|
71
|
+
end
|
72
|
+
|
73
|
+
def message
|
74
|
+
"The action you're trying to perform is not possible because \
|
75
|
+
one of the provided parameters is invalid."
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
55
79
|
# API errors have an http status, title, message, and additional information
|
56
80
|
# like stacktrace or information from program output.
|
57
81
|
APIError = Class.new(Error)
|
data/lib/sequenceserver/blast.rb
CHANGED
@@ -37,8 +37,19 @@ module SequenceServer
|
|
37
37
|
alias path name
|
38
38
|
|
39
39
|
def retrieve(accession, coords = nil)
|
40
|
+
fail(
|
41
|
+
InvalidSequenceIdError,
|
42
|
+
"Invalid sequence id: #{accession}"
|
43
|
+
) unless accession =~ SequenceServer::BLAST::VALID_SEQUENCE_ID
|
44
|
+
|
40
45
|
cmd = "blastdbcmd -db #{name} -entry '#{accession}'"
|
46
|
+
|
41
47
|
if coords
|
48
|
+
fail(
|
49
|
+
InvalidParameterError,
|
50
|
+
"Invalid range coordinates: #{coords}"
|
51
|
+
) unless coords =~ /[0-9]+-[0-9]*/
|
52
|
+
|
42
53
|
cmd << " -range #{coords}"
|
43
54
|
end
|
44
55
|
out, = sys(cmd, path: config[:bin])
|
@@ -52,6 +63,8 @@ module SequenceServer
|
|
52
63
|
# Returns true if the database contains the given sequence id.
|
53
64
|
# Returns false otherwise.
|
54
65
|
def include?(id)
|
66
|
+
fail ArgumentError, "Invalid sequence id: #{id}" unless id =~ SequenceServer::BLAST::VALID_SEQUENCE_ID
|
67
|
+
|
55
68
|
cmd = "blastdbcmd -entry '#{id}' -db #{name}"
|
56
69
|
sys(cmd, path: config[:bin]) rescue false
|
57
70
|
end
|
@@ -232,9 +232,8 @@ module SequenceServer
|
|
232
232
|
)
|
233
233
|
end
|
234
234
|
|
235
|
-
valid_id_regex = /\A[a-zA-Z0-9-_.:*#|\[\]]+\z/
|
236
235
|
invalid_sequence_ids = sequence_ids.reject do |id|
|
237
|
-
id =~
|
236
|
+
id =~ SequenceServer::BLAST::VALID_SEQUENCE_ID
|
238
237
|
end
|
239
238
|
|
240
239
|
unless invalid_sequence_ids.empty?
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequenceserver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Queen Mary University of London
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-07-
|
12
|
+
date: 2024-07-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json_pure
|