diff options
author | Alexander Kabui | 2021-06-14 00:54:02 +0300 |
---|---|---|
committer | zsloan | 2021-06-17 18:51:27 +0000 |
commit | 48e66dc230292a9c0b66da946106d8c9f611074f (patch) | |
tree | c57698540f4c39ea9565e8c06a7d8c146798ba2a | |
parent | 481b1fede3c815d5b9afbb07f0f69dcb7363143e (diff) | |
download | genenetwork2-48e66dc230292a9c0b66da946106d8c9f611074f.tar.gz |
sort sample name by sample_ids
-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 4d54cfae..991c9fee 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -705,6 +705,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 @@ -714,9 +717,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: |