Commit 0f8a8558 authored by Mikael Boden's avatar Mikael Boden

EDITOR=emacsclient

parent f396eeed
......@@ -42,7 +42,7 @@ def fetch(entryId, dbName='uniprotkb', format='fasta'):
except urllib.error.HTTPError as ex:
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
query: search term(s) e.g. 'organism:9606+AND+antigen'
......@@ -55,10 +55,11 @@ def search(query, dbName='uniprot', format='list', limit=100):
if dbName.startswith('uniprot'):
# Construct URL
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:
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
try:
data = urllib.request.urlopen(url).read().decode("utf-8")
if format == 'list':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment