Commit a93b02af authored by Mikaël Salson's avatar Mikaël Salson

Merge branch 'feature-s/2933-tags-in-clonedb' into 'dev'

Tags in clonedb

Closes #2933

See merge request !292
parents 2a263ddf c6730089
Pipeline #41179 passed with stages
in 4 minutes and 31 seconds
......@@ -335,7 +335,7 @@ Database.prototype = {
self.connected = false;
} else {
for (var i = 0; i < kept_clones.length; i++) {
self.m.clones[kept_clones[i]].seg.clonedb = processCloneDBContents(result[i]);
self.m.clones[kept_clones[i]].seg.clonedb = processCloneDBContents(result[i], self.m);
}
m.shouldRefresh()
m.update()
......
......@@ -51,18 +51,22 @@ def search_clonedb(sequences, sample_set_id):
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_name'] = info['name']
occ['tags']['sample_tags'] = info['sample_tags']
config_db = db.config[occ['tags']['config_id'][0]]
occ['tags']['config_name'] = [config_db.name if config_db else None]
results.append(occurrences)
return response.json(results)
def get_info_of_viewable_sample_set(sample_sets, config):
info = {'viewable': [], 'name': []}
info = {'viewable': [], 'name': [], 'sample_tags': []}
for sample_id in sample_sets:
viewable = auth.can_view_sample_set(sample_id, auth.user)
info['viewable'].append(viewable)
if viewable:
info['name'].append(get_sample_name(sample_id))
tags = get_sample_set_tags(sample_id)
for row in tags:
info['sample_tags'].append("#" + row.name)
else:
info['name'].append(None)
return info
......@@ -138,3 +138,13 @@ def get_public_group_id(group_ids):
if (len(public_group) > 0 and public_group[0].id not in group_ids):
return public_group[0].id
return -1
def get_sample_set_tags(sample_id):
sample_set = db.sample_set[sample_id]
sample_type = sample_set.sample_type
table = db(db[sample_type].sample_set_id == sample_id).select()
for row in table:
tag_ref = db((row.id == db.tag_ref.record_id)
& (db.tag_ref.table_name == sample_type)
& (db.tag_ref.tag_id == db.tag.id)).select(db.tag.name)
return tag_ref
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