diff options
author | zsloan | 2020-11-10 14:24:26 -0600 |
---|---|---|
committer | zsloan | 2020-11-10 14:24:26 -0600 |
commit | 25f7d30b9f052ec5d812bfe3bf9713df850cc267 (patch) | |
tree | 5199d80c5febc473d6c7a87e9aad20ee3bd7f2ec /wqflask | |
parent | 61280ad47d8c0486b776011391deadcf7df39819 (diff) | |
download | genenetwork2-25f7d30b9f052ec5d812bfe3bf9713df850cc267.tar.gz |
Changed logic for creating temp trait SampleList to account for both traits encoded as bytes and traits encoded as strings, since temp traits created before and after the Python 3 switchover will have different encoding
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/show_trait/SampleList.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/wqflask/wqflask/show_trait/SampleList.py b/wqflask/wqflask/show_trait/SampleList.py index 99ca7f88..a535c493 100644 --- a/wqflask/wqflask/show_trait/SampleList.py +++ b/wqflask/wqflask/show_trait/SampleList.py @@ -34,13 +34,18 @@ class SampleList(object): # ZS: self.this_trait will be a list if it is a Temp trait if isinstance(self.this_trait, list): - if (counter <= len(self.this_trait) and - self.this_trait[counter-1].decode("utf-8").lower() != 'x'): - sample = webqtlCaseData.webqtlCaseData( - name=sample_name, - value=float(self.this_trait[counter-1])) - else: - sample = webqtlCaseData.webqtlCaseData(name=sample_name) + sample = webqtlCaseData.webqtlCaseData(name=sample_name) + if counter <= len(self.this_trait): + if isinstance(self.this_trait[counter-1], (bytes, bytearray)): + if (self.this_trait[counter-1].decode("utf-8").lower() != 'x'): + sample = webqtlCaseData.webqtlCaseData( + name=sample_name, + value=float(self.this_trait[counter-1])) + else: + if (self.this_trait[counter-1].lower() != 'x'): + sample = webqtlCaseData.webqtlCaseData( + name=sample_name, + value=float(self.this_trait[counter-1])) else: # ZS - If there's no value for the sample/strain, # create the sample object (so samples with no value |