Commit 259aaee4 authored by Mikaël Salson's avatar Mikaël Salson

clonedb.py: Launch grep clones just once

With clonedb#4 we can now launch grep clones just once with several sequences.
parent f8986338
...@@ -38,17 +38,16 @@ def search_clonedb(sequences, sample_set_id): ...@@ -38,17 +38,16 @@ def search_clonedb(sequences, sample_set_id):
parent_group = get_default_creation_group(auth)[1] parent_group = get_default_creation_group(auth)[1]
auth.load_permissions(PermissionEnum.read.value, 'sample_set') auth.load_permissions(PermissionEnum.read.value, 'sample_set')
auth.load_permissions(PermissionEnum.anon.value, 'sample_set') auth.load_permissions(PermissionEnum.anon.value, 'sample_set')
for sequence in sequences: options = clonedb.build_grep_clones_options({'sequence': sequences[0]+' -sample_set:%d' % sample_set_id,
options = clonedb.build_grep_clones_options({'sequence': sequence+' -sample_set:%d' % sample_set_id,
'index': 'clonedb_{}'.format(parent_group)}) 'index': 'clonedb_{}'.format(parent_group)})
args = grep_clones.parser.parse_args(options) options += sequences[1:]
try: args = grep_clones.parser.parse_args(options)
occurrences = grep_clones.launch_search(args) try:
except ValueError: occurrences = grep_clones.launch_search(args)
return error_message('Are you sure your account has an enabled CloneDB?') except ValueError:
except Exception as e: return error_message('Are you sure your account has an enabled CloneDB?')
return error_message(e.message) except Exception as e:
for occ in occurrences: return error_message(e.message)
if 'tags' in occ and 'sample_set' in occ['tags']: if 'tags' in occ and 'sample_set' in occ['tags']:
info = get_info_of_viewable_sample_set([int(sample_id) for sample_id in occ['tags']['sample_set']], int(occ['tags']['config_id'][0])) info = get_info_of_viewable_sample_set([int(sample_id) for sample_id in occ['tags']['sample_set']], int(occ['tags']['config_id'][0]))
occ['tags']['sample_set_viewable'] = info['viewable'] occ['tags']['sample_set_viewable'] = info['viewable']
......
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