Commit 99e95416 authored by Mikaël Salson's avatar Mikaël Salson

controllers/, models/

controllers/, models/ get_associated_sample_sets: Don't select the original sample set

Doing so, we don't have to discard it afterwards and this allows us to know
if we have associated sample sets, just by looking at the number of results
parent 24254b47
......@@ -127,20 +127,19 @@ def index():
all_sequence_files = [r.sample_set_membership.sequence_file_id for r in query]
(shared_sets, sample_sets) = get_associated_sample_sets(all_sequence_files)
(shared_sets, sample_sets) = get_associated_sample_sets(all_sequence_files, [sample_set_id])
samplesets = SampleSets(sample_sets.keys())
sets_names = samplesets.get_names()
## assign set to each rows
for row in query:
row.list_share_set = []
if in shared_sets:
for elt in shared_sets[]:
if elt != sample_set_id:
values = {"title": sets_names[elt],
"sample_type": sample_sets[elt].sample_type, "id":elt}
values = {"title": sets_names[elt],
"sample_type": sample_sets[elt].sample_type, "id":elt}
tag_decorator = TagDecorator(get_tag_prefix())
query_pre_process = db( >0 ).select()
......@@ -127,7 +127,7 @@ def get_sequence_file_sample_sets(sequence_file_id):
return sample_set_ids
def get_associated_sample_sets(sequence_file_ids):
def get_associated_sample_sets(sequence_file_ids, forbidden_ids = []):
From a list of sequence_file IDs return a tuple.
The first component of the tuple is a dictionary whose keys are
......@@ -136,9 +136,12 @@ def get_associated_sample_sets(sequence_file_ids):
The second component of the tuple is a dictionary whose keys are sample set IDs
and the values are the corresponding sample sets. The sample sets in this dictionary
are the sample sets which share a sequence file whose ID is in sequence_file_ids.
forbidden_ids: list of the sample sets IDs that must not be retrieved.
shared_sequences = db(
& ~(db.sample_set_membership.sample_set_id.belongs(forbidden_ids))
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment