From 65846e5b05841b7c31a37298b49b99bb77d48a31 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Thu, 8 Oct 2020 22:37:07 +0300 Subject: 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. --- wqflask/wqflask/ctl/ctl_analysis.py | 2 +- wqflask/wqflask/wgcna/wgcna_analysis.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'wqflask') 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 +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): -- cgit v1.2.3