Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mutalyzer
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirrors
mutalyzer
Commits
a9cb95f4
Commit
a9cb95f4
authored
10 years ago
by
Vermaat
Browse files
Options
Downloads
Patches
Plain Diff
Upload a genbank file using the SOAP webservice
parent
363c0fcb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mutalyzer/services/rpc.py
+38
-5
38 additions, 5 deletions
mutalyzer/services/rpc.py
tests/test_services_soap.py
+19
-0
19 additions, 0 deletions
tests/test_services_soap.py
with
57 additions
and
5 deletions
mutalyzer/services/rpc.py
+
38
−
5
View file @
a9cb95f4
...
...
@@ -1039,16 +1039,49 @@ class MutalyzerService(ServiceBase):
return
transcripts
#getTranscriptsAndInfo
@srpc
(
Mandatory
.
String
,
_returns
=
Mandatory
.
String
)
def
upLoadGenBankLocalFile
(
content
)
:
@srpc
(
Mandatory
.
ByteArray
,
_returns
=
Mandatory
.
String
)
def
upLoadGenBankLocalFile
(
data
)
:
"""
Not implemented yet.
Upload a genbank file.
@arg data: Genbank file.
@return: UD accession number for the uploaded genbank file.
"""
raise
Fault
(
'
ENOTIMPLEMENTED
'
,
'
Not implemented yet
'
)
output
=
Output
(
__file__
)
retriever
=
Retriever
.
GenBankRetriever
(
output
)
output
.
addMessage
(
__file__
,
-
1
,
'
INFO
'
,
'
Received request uploadGenBankLocalFile()
'
)
# Note that the max file size check below might be bogus, since Spyne
# first checks the total request size, which by default has a maximum
# of 2 megabytes.
# In that case, a senv:Client.RequestTooLong faultstring is returned.
# Todo: Set maximum request size by specifying the max_content_length
# argument for spyne.server.wsgi.WsgiApplication in all webservice
# instantiations.
if
sum
(
len
(
s
)
for
s
in
data
)
>
settings
.
MAX_FILE_SIZE
:
raise
Fault
(
'
EMAXSIZE
'
,
'
Only files up to %d megabytes are accepted.
'
%
(
settings
.
MAX_FILE_SIZE
//
1048576
))
ud
=
retriever
.
uploadrecord
(
''
.
join
(
data
))
output
.
addMessage
(
__file__
,
-
1
,
'
INFO
'
,
'
Finished processing uploadGenBankLocalFile()
'
)
# Todo: use SOAP Fault object here (see Trac issue #41).
if
not
ud
:
error
=
'
The request could not be completed
\n
'
\
+
'
\n
'
.
join
(
map
(
lambda
m
:
str
(
m
),
output
.
getMessages
()))
raise
Exception
(
error
)
return
ud
#upLoadGenBankLocalFile
@srpc
(
Mandatory
.
String
,
_returns
=
Mandatory
.
String
)
def
up
L
oadGenBankRemoteFile
(
url
)
:
def
up
l
oadGenBankRemoteFile
(
url
)
:
"""
Not implemented yet.
"""
...
...
This diff is collapsed.
Click to expand it.
tests/test_services_soap.py
+
19
−
0
View file @
a9cb95f4
...
...
@@ -648,3 +648,22 @@ facilisi."""
# - EMAXSIZE: Raised by Mutalyzer, depending on the
# batchInputMaxSize configuration setting.
assert
e
.
faultcode
in
(
'
senv:Client.RequestTooLong
'
,
'
EMAXSIZE
'
)
@fix
(
database
)
def
test_upload_local_genbank
(
self
):
"""
Upload local genbank file.
"""
path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
'
data
'
,
'
AB026906.1.gb.bz2
'
)
with
bz2
.
BZ2File
(
path
)
as
f
:
data
=
f
.
read
()
result
=
self
.
_call
(
'
upLoadGenBankLocalFile
'
,
data
)
ud
=
str
(
result
)
r
=
self
.
_call
(
'
runMutalyzer
'
,
ud
+
'
(SDHD):g.7872G>T
'
)
assert
r
.
errors
==
0
assert
r
.
genomicDescription
==
ud
+
'
:g.7872G>T
'
assert
ud
+
'
(SDHD_v001):c.274G>T
'
in
r
.
transcriptDescriptions
.
string
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment