aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorBonfaceKilz2020-10-08 22:37:07 +0300
committerBonfaceKilz2020-10-09 01:04:47 +0300
commit65846e5b05841b7c31a37298b49b99bb77d48a31 (patch)
tree78df77ff6143ef31e9560aae3fed48b3b6d7f5ae /wqflask
parentef11f5e40ec0b8ef90a00b9d98d81cca2ff5d8d9 (diff)
downloadgenenetwork2-65846e5b05841b7c31a37298b49b99bb77d48a31.tar.gz
Update base64 conversion
* wqflask/wqflask/wgcna/wgcna_analysis.py (WGCNA.render_image): Use Python3's base64 library from the stdlib to perform conversion. * wqflask/wqflask/ctl/ctl_analysis.py (CTL.loadImage): Ditto.
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/ctl/ctl_analysis.py2
-rw-r--r--wqflask/wqflask/wgcna/wgcna_analysis.py3
2 files changed, 3 insertions, 2 deletions
diff --git a/wqflask/wqflask/ctl/ctl_analysis.py b/wqflask/wqflask/ctl/ctl_analysis.py
index e58a7b87..2a2124ca 100644
--- a/wqflask/wqflask/ctl/ctl_analysis.py
+++ b/wqflask/wqflask/ctl/ctl_analysis.py
@@ -194,7 +194,7 @@ class CTL(object):
def loadImage(self, path, name):
imgfile = open(self.results[path], 'rb')
imgdata = imgfile.read()
- imgB64 = imgdata.encode("base64")
+ imgB64 = base64.b64encode(imgdata)
bytesarray = array.array('B', imgB64)
self.results[name] = bytesarray
diff --git a/wqflask/wqflask/wgcna/wgcna_analysis.py b/wqflask/wqflask/wgcna/wgcna_analysis.py
index 0afe7e82..35fb3ec0 100644
--- a/wqflask/wqflask/wgcna/wgcna_analysis.py
+++ b/wqflask/wqflask/wgcna/wgcna_analysis.py
@@ -1,5 +1,6 @@
# WGCNA analysis for GN2
# Author / Maintainer: Danny Arends <Danny.Arends@gmail.com>
+import base64
import sys
import rpy2.robjects as ro # R Objects
import rpy2.rinterface as ri
@@ -163,8 +164,8 @@ class WGCNA(object):
print(("pre-loading imgage results:", self.results['imgloc']))
imgfile = open(self.results['imgloc'], 'rb')
imgdata = imgfile.read()
- imgB64 = imgdata.encode("base64")
bytesarray = array.array('B', imgB64)
+ imgB64 = base64.b64encode(imgdata)
self.results['imgdata'] = bytesarray
def process_results(self, results):