Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
binfpy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
opensource
binfpy
Commits
0f8a8558
Commit
0f8a8558
authored
Aug 02, 2018
by
Mikael Boden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EDITOR=emacsclient
parent
f396eeed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
webservice.py
webservice.py
+4
-3
No files found.
webservice.py
View file @
0f8a8558
...
@@ -42,7 +42,7 @@ def fetch(entryId, dbName='uniprotkb', format='fasta'):
...
@@ -42,7 +42,7 @@ def fetch(entryId, dbName='uniprotkb', format='fasta'):
except
urllib
.
error
.
HTTPError
as
ex
:
except
urllib
.
error
.
HTTPError
as
ex
:
raise
RuntimeError
(
ex
.
read
())
raise
RuntimeError
(
ex
.
read
())
def
search
(
query
,
dbName
=
'uniprot'
,
format
=
'list'
,
limit
=
100
):
def
search
(
query
,
dbName
=
'uniprot'
,
format
=
'list'
,
limit
=
100
,
columns
=
""
):
"""
"""
Retrieve multiple entries matching query from a database currently only via UniProtKB
Retrieve multiple entries matching query from a database currently only via UniProtKB
query: search term(s) e.g. 'organism:9606+AND+antigen'
query: search term(s) e.g. 'organism:9606+AND+antigen'
...
@@ -55,10 +55,11 @@ def search(query, dbName='uniprot', format='list', limit=100):
...
@@ -55,10 +55,11 @@ def search(query, dbName='uniprot', format='list', limit=100):
if
dbName
.
startswith
(
'uniprot'
):
if
dbName
.
startswith
(
'uniprot'
):
# Construct URL
# Construct URL
if
limit
==
None
:
# no limit to number of results returned
if
limit
==
None
:
# no limit to number of results returned
url
=
__uniprotUrl__
+
dbName
+
'/?format='
+
format
+
'&query='
+
query
url
=
__uniprotUrl__
+
dbName
+
'/?format='
+
format
+
'&query='
+
query
+
'&columns='
+
columns
else
:
else
:
url
=
__uniprotUrl__
+
dbName
+
'/?format='
+
format
+
'&limit='
+
str
(
limit
)
+
'&query='
+
query
url
=
__uniprotUrl__
+
dbName
+
'/?format='
+
format
+
'&limit='
+
str
(
limit
)
+
'&query='
+
query
+
'&columns='
+
columns
# Get the entries
# Get the entries
try
:
try
:
data
=
urllib
.
request
.
urlopen
(
url
)
.
read
()
.
decode
(
"utf-8"
)
data
=
urllib
.
request
.
urlopen
(
url
)
.
read
()
.
decode
(
"utf-8"
)
if
format
==
'list'
:
if
format
==
'list'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment