diff options
author | Munyoki Kilyungi | 2022-09-07 12:47:45 +0300 |
---|---|---|
committer | BonfaceKilz | 2022-09-08 14:26:19 +0300 |
commit | 07c0d05abbe378fd93fe5f7ddaf8922546d7ba22 (patch) | |
tree | 9dceb036397b63a5c510b4e284fc74ddd051087c | |
parent | b69e6944b45ed1c59e43c7b75571777711b8a30d (diff) | |
download | genenetwork2-07c0d05abbe378fd93fe5f7ddaf8922546d7ba22.tar.gz |
Removing object notation after a cursor fetch
* wqflask/wqflask/show_trait/SampleList.py
(SampleList.get_attributes): Remove object notation.
(SampleList.get_extra_attribute_values): Ditto.
-rw-r--r-- | wqflask/wqflask/show_trait/SampleList.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/wqflask/wqflask/show_trait/SampleList.py b/wqflask/wqflask/show_trait/SampleList.py index cc6b8e23..dc45a954 100644 --- a/wqflask/wqflask/show_trait/SampleList.py +++ b/wqflask/wqflask/show_trait/SampleList.py @@ -135,7 +135,7 @@ class SampleList: ) self.attributes = {} for attr, values in itertools.groupby( - cursor.fetchall(), lambda row: (row.Id, row.Name, row.Description) + cursor.fetchall(), lambda row: (row[0], row[1], row[2]) ): key, name, description = attr self.attributes[key] = Bunch() @@ -176,14 +176,15 @@ class SampleList: ) for sample_name, items in itertools.groupby( - cursor.fetchall(), lambda row: row.SampleName + cursor.fetchall(), lambda row: row[0] ): attribute_values = {} # Make a list of attr IDs without values (that have values for other samples) valueless_attr_ids = [self.attributes[key].id for key in self.attributes.keys()] for item in items: - valueless_attr_ids.remove(item.Id) - attribute_value = item.Value + sample_name, _id, value = item + valueless_attr_ids.remove(_id) + attribute_value = value # If it's an int, turn it into one for sorting # (for example, 101 would be lower than 80 if @@ -193,7 +194,7 @@ class SampleList: except ValueError: pass - attribute_values[str(item.Id)] = attribute_value + attribute_values[str(_id)] = attribute_value for attr_id in valueless_attr_ids: attribute_values[str(attr_id)] = "" |