aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/maintenance/QTL_Reaper_v6.py6
-rw-r--r--scripts/maintenance/Update_Case_Attributes_MySQL_tab.py2
-rwxr-xr-xscripts/maintenance/delete_genotypes.py14
-rwxr-xr-xscripts/maintenance/delete_phenotypes.py14
-rwxr-xr-xscripts/maintenance/load_genotypes.py16
-rwxr-xr-xscripts/maintenance/load_phenotypes.py30
-rwxr-xr-xscripts/maintenance/readProbeSetMean_v7.py40
-rwxr-xr-xscripts/maintenance/readProbeSetSE_v7.py22
-rw-r--r--wqflask/run_gunicorn.py2
-rw-r--r--wqflask/utility/startup_config.py4
-rw-r--r--wqflask/utility/svg.py10
-rw-r--r--wqflask/utility/tools.py8
-rw-r--r--wqflask/wqflask/marker_regression/rqtl_mapping.py2
-rw-r--r--wqflask/wqflask/pbkdf2.py16
-rw-r--r--wqflask/wqflask/views.py4
-rw-r--r--wqflask/wqflask/wgcna/wgcna_analysis.py12
16 files changed, 101 insertions, 101 deletions
diff --git a/scripts/maintenance/QTL_Reaper_v6.py b/scripts/maintenance/QTL_Reaper_v6.py
index e50dbd40..7fb56eca 100755
--- a/scripts/maintenance/QTL_Reaper_v6.py
+++ b/scripts/maintenance/QTL_Reaper_v6.py
@@ -53,7 +53,7 @@ for ProbeSetFreezeId in ProbeSetFreezeIds:
#if InbredSetId==12:
# InbredSetId=2
- print ProbeSetFreezeId, InbredSets[InbredSetId]
+ print((ProbeSetFreezeId, InbredSets[InbredSetId]))
genotype_1.read(InbredSets[InbredSetId])
locuses = []
@@ -102,7 +102,7 @@ for ProbeSetFreezeId in ProbeSetFreezeIds:
kj += 1
if kj%1000==0:
- print ProbeSetFreezeId, InbredSets[InbredSetId],kj
+ print((ProbeSetFreezeId, InbredSets[InbredSetId],kj))
- print ProbeSetFreezeIds
+ print(ProbeSetFreezeIds)
diff --git a/scripts/maintenance/Update_Case_Attributes_MySQL_tab.py b/scripts/maintenance/Update_Case_Attributes_MySQL_tab.py
index 0f8602c9..bf796df4 100644
--- a/scripts/maintenance/Update_Case_Attributes_MySQL_tab.py
+++ b/scripts/maintenance/Update_Case_Attributes_MySQL_tab.py
@@ -24,4 +24,4 @@ for row in csv_data:
#close the connection to the database.
mydb.commit()
cursor.close()
-print "Done" \ No newline at end of file
+print("Done") \ No newline at end of file
diff --git a/scripts/maintenance/delete_genotypes.py b/scripts/maintenance/delete_genotypes.py
index fa693f0f..060640e1 100755
--- a/scripts/maintenance/delete_genotypes.py
+++ b/scripts/maintenance/delete_genotypes.py
@@ -8,13 +8,13 @@ import genotypes
def main(argv):
# config
config = utilities.get_config(argv[1])
- print "config:"
+ print("config:")
for item in config.items('config'):
- print "\t%s" % (str(item))
+ print(("\t%s" % (str(item))))
# var
- print "variable:"
+ print("variable:")
inbredsetid = config.get('config', 'inbredsetid')
- print "\tinbredsetid: %s" % inbredsetid
+ print(("\tinbredsetid: %s" % inbredsetid))
# datafile
datafile = open(config.get('config', 'datafile'), 'r')
datafile = csv.reader(datafile, delimiter='\t', quotechar='"')
@@ -25,9 +25,9 @@ def main(argv):
continue
genoname = row[0]
delrowcount += genotypes.delete(genoname, inbredsetid)
- print "deleted %d genotypes" % (delrowcount)
+ print(("deleted %d genotypes" % (delrowcount)))
if __name__ == "__main__":
- print "command line arguments:\n\t%s" % sys.argv
+ print(("command line arguments:\n\t%s" % sys.argv))
main(sys.argv)
- print "exit successfully"
+ print("exit successfully")
diff --git a/scripts/maintenance/delete_phenotypes.py b/scripts/maintenance/delete_phenotypes.py
index 326c466e..60dbec61 100755
--- a/scripts/maintenance/delete_phenotypes.py
+++ b/scripts/maintenance/delete_phenotypes.py
@@ -8,13 +8,13 @@ import phenotypes
def main(argv):
# config
config = utilities.get_config(argv[1])
- print "config:"
+ print("config:")
for item in config.items('config'):
- print "\t%s" % (str(item))
+ print(("\t%s" % (str(item))))
# var
- print "variable:"
+ print("variable:")
inbredsetid = config.get('config', 'inbredsetid')
- print "\tinbredsetid: %s" % inbredsetid
+ print(("\tinbredsetid: %s" % inbredsetid))
# datafile
datafile = open(config.get('config', 'datafile'), 'r')
datafile = csv.reader(datafile, delimiter='\t', quotechar='"')
@@ -27,9 +27,9 @@ def main(argv):
except:
continue
delrowcount += phenotypes.delete(publishxrefid=publishxrefid, inbredsetid=inbredsetid)
- print "deleted %d phenotypes" % (delrowcount)
+ print(("deleted %d phenotypes" % (delrowcount)))
if __name__ == "__main__":
- print "command line arguments:\n\t%s" % sys.argv
+ print(("command line arguments:\n\t%s" % sys.argv))
main(sys.argv)
- print "exit successfully"
+ print("exit successfully")
diff --git a/scripts/maintenance/load_genotypes.py b/scripts/maintenance/load_genotypes.py
index 338483f4..c235a31f 100755
--- a/scripts/maintenance/load_genotypes.py
+++ b/scripts/maintenance/load_genotypes.py
@@ -8,7 +8,7 @@ def main(argv):
config = utilities.get_config(argv[1])
print("config file:")
for item in config.items('config'):
- print("\t%s" % str(item))
+ print(("\t%s" % str(item)))
parse_genofile(config, fetch_parameters(config))
def fetch_parameters(config):
@@ -20,7 +20,7 @@ def fetch_parameters(config):
config_dic['genofile'] = config.get('config', 'genofile')
print("config dictionary:")
for k, v in config_dic.items():
- print("\t%s: %s" % (k, v))
+ print(("\t%s: %s" % (k, v)))
return config_dic
def parse_genofile(config, config_dic):
@@ -43,9 +43,9 @@ def parse_genofile(config, config_dic):
#
print("geno file meta dictionary:")
for k, v in meta_dic.items():
- print("\t%s: %s" % (k, v))
+ print(("\t%s: %s" % (k, v)))
#
- print("geno file head:\n\t%s" % line)
+ print(("geno file head:\n\t%s" % line))
strainnames = line.split()[4:]
config_dic['strains'] = datastructure.get_strains_bynames(inbredsetid=config_dic['inbredsetid'], strainnames=strainnames, updatestrainxref="yes")
continue
@@ -81,7 +81,7 @@ def check_or_insert_geno(config_dic, marker_dic):
result = cursor.fetchone()
if result:
genoid = result[0]
- print("get geno record: %d" % genoid)
+ print(("get geno record: %d" % genoid))
else:
sql = """
INSERT INTO Geno
@@ -95,7 +95,7 @@ def check_or_insert_geno(config_dic, marker_dic):
cursor.execute(sql, (config_dic['speciesid'], marker_dic['locus'], marker_dic['locus'], marker_dic['chromosome'], marker_dic['mb']))
rowcount = cursor.rowcount
genoid = con.insert_id()
- print("INSERT INTO Geno: %d record: %d" % (rowcount, genoid))
+ print(("INSERT INTO Geno: %d record: %d" % (rowcount, genoid)))
return genoid
def check_genoxref(config_dic, marker_dic):
@@ -146,9 +146,9 @@ def insert_genoxref(config_dic, marker_dic):
"""
cursor.execute(sql, (config_dic['genofreezeid'], marker_dic['genoid'], config_dic['dataid'], marker_dic['cm'], 'N'))
rowcount = cursor.rowcount
- print("INSERT INTO GenoXRef: %d record" % (rowcount))
+ print(("INSERT INTO GenoXRef: %d record" % (rowcount)))
if __name__ == "__main__":
- print("command line arguments:\n\t%s" % sys.argv)
+ print(("command line arguments:\n\t%s" % sys.argv))
main(sys.argv)
print("exit successfully")
diff --git a/scripts/maintenance/load_phenotypes.py b/scripts/maintenance/load_phenotypes.py
index c3c6570b..61d527d4 100755
--- a/scripts/maintenance/load_phenotypes.py
+++ b/scripts/maintenance/load_phenotypes.py
@@ -7,31 +7,31 @@ import datastructure
def main(argv):
# config
config = utilities.get_config(argv[1])
- print "config:"
+ print("config:")
for item in config.items('config'):
- print "\t%s" % (str(item))
+ print(("\t%s" % (str(item))))
# var
inbredsetid = config.get('config', 'inbredsetid')
- print "inbredsetid: %s" % inbredsetid
+ print(("inbredsetid: %s" % inbredsetid))
species = datastructure.get_species(inbredsetid)
speciesid = species[0]
- print "speciesid: %s" % speciesid
+ print(("speciesid: %s" % speciesid))
dataid = datastructure.get_nextdataid_phenotype()
- print "next data id: %s" % dataid
+ print(("next data id: %s" % dataid))
cursor, con = utilities.get_cursor()
# datafile
datafile = open(config.get('config', 'datafile'), 'r')
phenotypedata = csv.reader(datafile, delimiter='\t', quotechar='"')
phenotypedata_head = phenotypedata.next()
- print "phenotypedata head:\n\t%s" % phenotypedata_head
+ print(("phenotypedata head:\n\t%s" % phenotypedata_head))
strainnames = phenotypedata_head[1:]
strains = datastructure.get_strains_bynames(inbredsetid=inbredsetid, strainnames=strainnames, updatestrainxref="yes")
# metafile
metafile = open(config.get('config', 'metafile'), 'r')
phenotypemeta = csv.reader(metafile, delimiter='\t', quotechar='"')
phenotypemeta_head = phenotypemeta.next()
- print "phenotypemeta head:\n\t%s" % phenotypemeta_head
- print
+ print(("phenotypemeta head:\n\t%s" % phenotypemeta_head))
+ print()
# load
for metarow in phenotypemeta:
#
@@ -67,7 +67,7 @@ def main(argv):
))
rowcount = cursor.rowcount
phenotypeid = con.insert_id()
- print "INSERT INTO Phenotype: %d record: %d" % (rowcount, phenotypeid)
+ print(("INSERT INTO Phenotype: %d record: %d" % (rowcount, phenotypeid)))
# Publication
publicationid = None # reset
pubmed_id = utilities.to_db_string(metarow[0], None)
@@ -81,7 +81,7 @@ def main(argv):
re = cursor.fetchone()
if re:
publicationid = re[0]
- print "get Publication record: %d" % publicationid
+ print(("get Publication record: %d" % publicationid))
if not publicationid:
sql = """
INSERT INTO Publication
@@ -109,7 +109,7 @@ def main(argv):
))
rowcount = cursor.rowcount
publicationid = con.insert_id()
- print "INSERT INTO Publication: %d record: %d" % (rowcount, publicationid)
+ print(("INSERT INTO Publication: %d record: %d" % (rowcount, publicationid)))
# data
for index, strain in enumerate(strains):
#
@@ -158,14 +158,14 @@ def main(argv):
cursor.execute(sql, (inbredsetid, phenotypeid, publicationid, dataid, ""))
rowcount = cursor.rowcount
publishxrefid = con.insert_id()
- print "INSERT INTO PublishXRef: %d record: %d" % (rowcount, publishxrefid)
+ print(("INSERT INTO PublishXRef: %d record: %d" % (rowcount, publishxrefid)))
# for loop next
dataid += 1
- print
+ print()
# release
con.close()
if __name__ == "__main__":
- print "command line arguments:\n\t%s" % sys.argv
+ print(("command line arguments:\n\t%s" % sys.argv))
main(sys.argv)
- print "exit successfully"
+ print("exit successfully")
diff --git a/scripts/maintenance/readProbeSetMean_v7.py b/scripts/maintenance/readProbeSetMean_v7.py
index e9c8f25c..e7a4c826 100755
--- a/scripts/maintenance/readProbeSetMean_v7.py
+++ b/scripts/maintenance/readProbeSetMean_v7.py
@@ -42,9 +42,9 @@ try:
con = MySQLdb.Connect(db='db_webqtl',host='localhost', user='username',passwd=passwd)
db = con.cursor()
- print "You have successfully connected to mysql.\n"
+ print("You have successfully connected to mysql.\n")
except:
- print "You entered incorrect password.\n"
+ print("You entered incorrect password.\n")
sys.exit(0)
time0 = time.time()
@@ -55,7 +55,7 @@ time0 = time.time()
# generate the gene list of expression data here
#
#########################################################################
-print 'Checking if each line have same number of members'
+print('Checking if each line have same number of members')
GeneList = []
isCont = 1
@@ -70,7 +70,7 @@ while line:
line2 = string.split(string.strip(line),'\t')
line2 = map(string.strip, line2)
if len(line2) != nfield:
- print "Error : " + line
+ print(("Error : " + line))
isCont = 0
GeneList.append(line2[0])
@@ -78,7 +78,7 @@ while line:
kj+=1
if kj%100000 == 0:
- print 'checked ',kj,' lines'
+ print(('checked ',kj,' lines'))
GeneList = map(string.lower, GeneList)
GeneList.sort()
@@ -87,14 +87,14 @@ if isCont==0:
sys.exit(0)
-print 'used ',time.time()-time0,' seconds'
+print(('used ',time.time()-time0,' seconds'))
#########################################################################
#
# Check if each strain exist in database
# generate the string id list of expression data here
#
#########################################################################
-print 'Checking if each strain exist in database'
+print('Checking if each strain exist in database')
isCont = 1
fp.seek(0)
@@ -109,20 +109,20 @@ for item in header:
db.execute('select Id from Strain where Name = "%s"' % item)
Ids.append(db.fetchall()[0][0])
except:
- print item,'does not exist, check the if the strain name is correct'
+ print((item,'does not exist, check the if the strain name is correct'))
isCont=0
if isCont==0:
sys.exit(0)
-print 'used ',time.time()-time0,' seconds'
+print(('used ',time.time()-time0,' seconds'))
########################################################################
#
# Check if each ProbeSet exist in database
#
########################################################################
-print 'Check if each ProbeSet exist in database'
+print('Check if each ProbeSet exist in database')
##---- find PID is name or target ----##
line = fp.readline()
@@ -146,7 +146,7 @@ Names = []
for item in results:
Names.append(item[0])
-print Names
+print(Names)
Names = map(string.lower, Names)
@@ -170,7 +170,7 @@ while x<len(GeneList) and y<len(Names):
y += 1
if x%100000==0:
- print 'check Name, checked %d lines'%x
+ print(('check Name, checked %d lines'%x))
while x<len(GeneList):
GeneList2.append(GeneList[x])
@@ -180,20 +180,20 @@ isCont=1
ferror = open("ProbeSetError.txt", "wb")
for item in GeneList2:
ferror.write(item + " doesn't exist \n")
- print item, " doesn't exist, check if the ProbeSet name is correct"
+ print((item, " doesn't exist, check if the ProbeSet name is correct"))
isCont = 0
if isCont==0:
sys.exit(0)
-print 'used ',time.time()-time0,' seconds'
+print(('used ',time.time()-time0,' seconds'))
#########################################################################
#
# Insert data into database
#
#########################################################################
-print 'getting ProbeSet/Id'
+print('getting ProbeSet/Id')
#---- get Name/Id map ----#
@@ -202,16 +202,16 @@ results = db.fetchall()
NameIds = {}
for item in results:
NameIds[item[0]] = item[1]
-print 'used ',time.time()-time0,' seconds'
+print(('used ',time.time()-time0,' seconds'))
-print 'inserting data'
+print('inserting data')
##---- get old max dataId ----##
db.execute('select max(Id) from ProbeSetData')
maxDataId = int(db.fetchall()[0][0])
bmax = maxDataId
-print "old_max = %d\n" % bmax
+print(("old_max = %d\n" % bmax))
##---- insert data ----##
fp.seek(0)
@@ -255,8 +255,8 @@ while line:
values1=[]
values2=[]
- print 'Inserted ', kj,' lines'
- print 'used ',time.time()-time0,' seconds'
+ print(('Inserted ', kj,' lines'))
+ print(('used ',time.time()-time0,' seconds'))
line = fp.readline()
diff --git a/scripts/maintenance/readProbeSetSE_v7.py b/scripts/maintenance/readProbeSetSE_v7.py
index 0b15ce09..79ed455f 100755
--- a/scripts/maintenance/readProbeSetSE_v7.py
+++ b/scripts/maintenance/readProbeSetSE_v7.py
@@ -82,14 +82,14 @@ while line:
line2 = map(string.strip, line2)
if len(line2) != nfield:
isCont = 0
- print("Error : " + line)
+ print(("Error : " + line))
GeneList.append(line2[0])
line = fp.readline()
kj += 1
if kj % 100000 == 0:
- print('checked ', kj, ' lines')
+ print(('checked ', kj, ' lines'))
GeneList = map(string.lower, GeneList)
GeneList.sort()
@@ -98,7 +98,7 @@ if isCont == 0:
sys.exit(0)
-print('used ', time.time()-time0, ' seconds')
+print(('used ', time.time()-time0, ' seconds'))
#########################################################################
#
# Check if each strain exist in database
@@ -121,13 +121,13 @@ for item in header:
Ids.append(db.fetchall()[0][0])
except:
isCont = 0
- print(item, 'does not exist, check the if the strain name is correct')
+ print((item, 'does not exist, check the if the strain name is correct'))
if isCont == 0:
sys.exit(0)
-print('used ', time.time()-time0, ' seconds')
+print(('used ', time.time()-time0, ' seconds'))
########################################################################
#
# Check if each ProbeSet exist in database
@@ -178,7 +178,7 @@ while x < len(GeneList) and y < len(Names):
y += 1
if x % 100000 == 0:
- print('check Name, checked %d lines' % x)
+ print(('check Name, checked %d lines' % x))
while x < len(GeneList):
GeneList2.append(GeneList[x])
@@ -190,12 +190,12 @@ for item in GeneList2:
ferror.write(item + " doesn't exist \n")
isCont = 0
- print(item, " doesn't exist")
+ print((item, " doesn't exist"))
if isCont == 0:
sys.exit(0)
-print('used ', time.time()-time0, ' seconds')
+print(('used ', time.time()-time0, ' seconds'))
#############################
# Insert new Data into SE
############################
@@ -244,9 +244,9 @@ while line:
DataValues = []
line = fp.readline()
- print(CellId, " doesn't exist")
- print('inserted ', kj, ' lines')
- print('used ', time.time()-time0, ' seconds')
+ print((CellId, " doesn't exist"))
+ print(('inserted ', kj, ' lines'))
+ print(('used ', time.time()-time0, ' seconds'))
if len(DataValues) > 0:
DataValues = ','.join(DataValues)
diff --git a/wqflask/run_gunicorn.py b/wqflask/run_gunicorn.py
index adffdca3..58108e03 100644
--- a/wqflask/run_gunicorn.py
+++ b/wqflask/run_gunicorn.py
@@ -7,7 +7,7 @@
# from flask import Flask
# application = Flask(__name__)
-print "===> Starting up Gunicorn process"
+print("===> Starting up Gunicorn process")
from wqflask import app
from utility.startup_config import app_config
diff --git a/wqflask/utility/startup_config.py b/wqflask/utility/startup_config.py
index 817284dd..42ead709 100644
--- a/wqflask/utility/startup_config.py
+++ b/wqflask/utility/startup_config.py
@@ -27,7 +27,7 @@ def app_config():
port = get_setting_int("SERVER_PORT")
if get_setting_bool("USE_GN_SERVER"):
- print("GN2 API server URL is ["+BLUE+get_setting("GN_SERVER_URL")+ENDC+"]")
+ print(("GN2 API server URL is ["+BLUE+get_setting("GN_SERVER_URL")+ENDC+"]"))
import requests
page = requests.get(get_setting("GN_SERVER_URL"))
if page.status_code != 200:
@@ -36,4 +36,4 @@ def app_config():
# import utility.elasticsearch_tools as es
# es.test_elasticsearch_connection()
- print("GN2 is running. Visit %s[http://localhost:%s/%s](%s)" % (BLUE,str(port),ENDC,get_setting("WEBSERVER_URL")))
+ print(("GN2 is running. Visit %s[http://localhost:%s/%s](%s)" % (BLUE,str(port),ENDC,get_setting("WEBSERVER_URL"))))
diff --git a/wqflask/utility/svg.py b/wqflask/utility/svg.py
index db13b9d1..6285ea63 100644
--- a/wqflask/utility/svg.py
+++ b/wqflask/utility/svg.py
@@ -102,7 +102,7 @@ if use_dom_implementation<>0:
from xml.dom import implementation
from xml.dom.ext import PrettyPrint
except:
- raise exceptions.ImportError, "PyXML is required for using the dom implementation"
+ raise exceptions.ImportError("PyXML is required for using the dom implementation")
#The implementation is used for the creating the XML document.
#The prettyprint module is used for converting the xml document object to a xml file
@@ -1018,12 +1018,12 @@ class drawing:
PrettyPrint(root,f)
f.close()
except:
- print "Cannot write SVG file: " + filename
+ print(("Cannot write SVG file: " + filename))
def validate(self):
try:
import xml.parsers.xmlproc.xmlval
except:
- raise exceptions.ImportError,'PyXml is required for validating SVG'
+ raise exceptions.ImportError('PyXml is required for validating SVG')
svg=self.toXml()
xv=xml.parsers.xmlproc.xmlval.XMLValidator()
try:
@@ -1031,7 +1031,7 @@ class drawing:
except:
raise Exception("SVG is not well formed, see messages above")
else:
- print "SVG well formed"
+ print("SVG well formed")
if __name__=='__main__':
@@ -1065,4 +1065,4 @@ if __name__=='__main__':
s.addElement(c)
d.setSVG(s)
- print d.toXml()
+ print((d.toXml()))
diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py
index 77db5d53..f790d424 100644
--- a/wqflask/utility/tools.py
+++ b/wqflask/utility/tools.py
@@ -214,20 +214,20 @@ ENDC = '\033[0m'
def show_settings():
from utility.tools import LOG_LEVEL
- print("Set global log level to "+BLUE+LOG_LEVEL+ENDC)
+ print(("Set global log level to "+BLUE+LOG_LEVEL+ENDC))
log_level = getattr(logging, LOG_LEVEL.upper())
logging.basicConfig(level=log_level)
logger.info(OVERRIDES)
logger.info(BLUE+"Mr. Mojo Risin 2"+ENDC)
- print "runserver.py: ****** Webserver configuration - k,v pairs from app.config ******"
keylist = app.config.keys()
+ print("runserver.py: ****** Webserver configuration - k,v pairs from app.config ******")
keylist.sort()
for k in keylist:
try:
- print("%s: %s%s%s%s" % (k,BLUE,BOLD,get_setting(k),ENDC))
+ print(("%s: %s%s%s%s" % (k,BLUE,BOLD,get_setting(k),ENDC)))
except:
- print("%s: %s%s%s%s" % (k,GREEN,BOLD,app.config[k],ENDC))
+ print(("%s: %s%s%s%s" % (k,GREEN,BOLD,app.config[k],ENDC)))
# Cached values
diff --git a/wqflask/wqflask/marker_regression/rqtl_mapping.py b/wqflask/wqflask/marker_regression/rqtl_mapping.py
index c5590a85..0a5758af 100644
--- a/wqflask/wqflask/marker_regression/rqtl_mapping.py
+++ b/wqflask/wqflask/marker_regression/rqtl_mapping.py
@@ -42,7 +42,7 @@ def run_rqtl_geno(vals, samples, dataset, mapping_scale, method, model, permChec
png = ro.r["png"] # Map the png function
dev_off = ro.r["dev.off"] # Map the device off function
- print(r_library("qtl")) # Load R/qtl
+ print((r_library("qtl"))) # Load R/qtl
logger.info("QTL library loaded");
diff --git a/wqflask/wqflask/pbkdf2.py b/wqflask/wqflask/pbkdf2.py
index f7f61a09..811c83b0 100644
--- a/wqflask/wqflask/pbkdf2.py
+++ b/wqflask/wqflask/pbkdf2.py
@@ -92,14 +92,14 @@ def test():
def check(data, salt, iterations, keylen, expected):
rv = pbkdf2_hex(data, salt, iterations, keylen)
if rv != expected:
- print 'Test failed:'
- print ' Expected: %s' % expected
- print ' Got: %s' % rv
- print ' Parameters:'
- print ' data=%s' % data
- print ' salt=%s' % salt
- print ' iterations=%d' % iterations
- print
+ print('Test failed:')
+ print((' Expected: %s' % expected))
+ print((' Got: %s' % rv))
+ print(' Parameters:')
+ print((' data=%s' % data))
+ print((' salt=%s' % salt))
+ print((' iterations=%d' % iterations))
+ print()
failed.append(1)
# From RFC 6070
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index dde22bf7..d67f1a2e 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -943,5 +943,5 @@ def json_default_handler(obj):
# logger.info("Not going to serialize Dataset")
# return None
else:
- raise TypeError, 'Object of type %s with value of %s is not JSON serializable' % (
- type(obj), repr(obj))
+ raise TypeError('Object of type %s with value of %s is not JSON serializable' % (
+ type(obj), repr(obj)))
diff --git a/wqflask/wqflask/wgcna/wgcna_analysis.py b/wqflask/wqflask/wgcna/wgcna_analysis.py
index 880a1cb2..d79ad6df 100644
--- a/wqflask/wqflask/wgcna/wgcna_analysis.py
+++ b/wqflask/wqflask/wgcna/wgcna_analysis.py
@@ -60,7 +60,7 @@ class WGCNA(object):
print("Starting WGCNA analysis on dataset")
self.r_enableWGCNAThreads() # Enable multi threading
self.trait_db_list = [trait.strip() for trait in requestform['trait_list'].split(',')]
- print("Retrieved phenotype data from database", requestform['trait_list'])
+ print(("Retrieved phenotype data from database", requestform['trait_list']))
helper_functions.get_trait_db_obs(self, self.trait_db_list)
self.input = {} # self.input contains the phenotype values we need to send to R
@@ -101,13 +101,13 @@ class WGCNA(object):
if requestform.get('SoftThresholds') is not None:
powers = [int(threshold.strip()) for threshold in requestform['SoftThresholds'].rstrip().split(",")]
rpow = r_unlist(r_c(powers))
- print "SoftThresholds: {} == {}".format(powers, rpow)
+ print(("SoftThresholds: {} == {}".format(powers, rpow)))
self.sft = self.r_pickSoftThreshold(rM, powerVector = rpow, verbose = 5)
- print "PowerEstimate: {}".format(self.sft[0])
+ print(("PowerEstimate: {}".format(self.sft[0])))
self.results['PowerEstimate'] = self.sft[0]
if self.sft[0][0] is ri.NA_Integer:
- print "No power is suitable for the analysis, just use 1"
+ print("No power is suitable for the analysis, just use 1")
self.results['Power'] = 1 # No power could be estimated
else:
self.results['Power'] = self.sft[0][0] # Use the estimated power
@@ -122,7 +122,7 @@ class WGCNA(object):
self.results['network'] = network
# How many modules and how many gene per module ?
- print "WGCNA found {} modules".format(r_table(network[1]))
+ print(("WGCNA found {} modules".format(r_table(network[1]))))
self.results['nmod'] = r_length(r_table(network[1]))[0]
# The iconic WCGNA plot of the modules in the hanging tree
@@ -135,7 +135,7 @@ class WGCNA(object):
sys.stdout.flush()
def render_image(self, results):
- print("pre-loading imgage results:", self.results['imgloc'])
+ print(("pre-loading imgage results:", self.results['imgloc']))
imgfile = open(self.results['imgloc'], 'rb')
imgdata = imgfile.read()
imgB64 = imgdata.encode("base64")