diff options
author | Alexander Kabui | 2021-06-14 00:54:02 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-06-17 08:55:17 +0300 |
commit | 8418cf1554c664130a16b0b2030d1ca7680bf81c (patch) | |
tree | 76ffea38fbbd78db7af801e26f56fbfe047984d9 /wqflask | |
parent | cfc738303e7ddd213919a0a15885d1e846277848 (diff) | |
download | genenetwork2-8418cf1554c664130a16b0b2030d1ca7680bf81c.tar.gz |
sort sample name by sample_ids
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/base/data_set.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index d31161ec..181e83be 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -693,6 +693,9 @@ class DataSet: results = dict(g.db.execute(query).fetchall()) sample_ids = [results[item] for item in self.samplelist] + sorted_samplelist = [strain_name for strain_name, strain_id in sorted( + results.items(), key=lambda item: item[1])] + query = """SELECT * from ProbeSetData where StrainID in {} and id in (SELECT ProbeSetXRef.DataId @@ -702,9 +705,10 @@ class DataSet: and ProbeSet.Id = ProbeSetXRef.ProbeSetId)""".format(create_in_clause(sample_ids), self.name) query_results = list(g.db.execute(query).fetchall()) - data_results = self.chunk_dataset(query_results, len(sample_ids)) + self.samplelist = sorted_samplelist self.trait_data = data_results + def get_trait_data(self, sample_list=None): if sample_list: |