git: dab6c99caa2b - main - biology/groopm: Fix build with setuptools 58.0.0+
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 25 Mar 2022 13:49:37 UTC
The branch main has been updated by sunpoet: URL: https://cgit.FreeBSD.org/ports/commit/?id=dab6c99caa2bdec4e6b38453068a7120e7208af9 commit dab6c99caa2bdec4e6b38453068a7120e7208af9 Author: Po-Chuan Hsieh <sunpoet@FreeBSD.org> AuthorDate: 2022-03-25 13:32:01 +0000 Commit: Po-Chuan Hsieh <sunpoet@FreeBSD.org> CommitDate: 2022-03-25 13:38:04 +0000 biology/groopm: Fix build with setuptools 58.0.0+ With hat: python --- biology/groopm/files/patch-2to3 | 3414 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 3414 insertions(+) diff --git a/biology/groopm/files/patch-2to3 b/biology/groopm/files/patch-2to3 new file mode 100644 index 000000000000..365000a5d096 --- /dev/null +++ b/biology/groopm/files/patch-2to3 @@ -0,0 +1,3414 @@ +--- groopm/PCA.py.orig 2014-11-26 01:01:33 UTC ++++ groopm/PCA.py +@@ -79,7 +79,7 @@ class PCA: + try: + self.sumvariance /= self.sumvariance[-1] + except: +- print len(A), len(self.sumvariance), len(self.eigen) ++ print(len(A), len(self.sumvariance), len(self.eigen)) + raise + + self.npc = np.searchsorted( self.sumvariance, fraction ) + 1 +@@ -127,13 +127,13 @@ class Center: + def __init__( self, A, axis=0, scale=True, verbose=1 ): + self.mean = A.mean(axis=axis) + if verbose: +- print "Center -= A.mean:", self.mean ++ print("Center -= A.mean:", self.mean) + A -= self.mean + if scale: + std = A.std(axis=axis) + self.std = np.where( std, std, 1. ) + if verbose: +- print "Center /= A.std:", self.std ++ print("Center /= A.std:", self.std) + A /= self.std + else: + self.std = np.ones( A.shape[-1] ) +--- groopm/bin.py.orig 2015-03-06 07:01:36 UTC ++++ groopm/bin.py +@@ -59,8 +59,8 @@ from numpy import (around as np_around, + median as np_median, + std as np_std) + +-from ellipsoid import EllipsoidTool +-from groopmExceptions import ModeNotAppropriateException ++from .ellipsoid import EllipsoidTool ++from .groopmExceptions import ModeNotAppropriateException + + np.seterr(all='raise') + +@@ -155,7 +155,7 @@ class Bin: + """Combine the contigs of another bin with this one""" + # consume all the other bins rowIndices + if(verbose): +- print " BIN:",deadBin.id,"will be consumed by BIN:",self.id ++ print(" BIN:",deadBin.id,"will be consumed by BIN:",self.id) + self.rowIndices = np.concatenate([self.rowIndices, deadBin.rowIndices]) + self.binSize = self.rowIndices.shape[0] + +@@ -326,7 +326,7 @@ class Bin: + try: + return ET.getMinVolEllipse(bin_points, retA=retA) + except: +- print bin_points ++ print(bin_points) + raise + else: # minimum bounding ellipse of a point is 0 + if retA: +@@ -474,13 +474,13 @@ class Bin: + fig.set_size_inches(10,4) + plt.savefig(fileName,dpi=300) + except: +- print "Error saving image:", fileName, sys.exc_info()[0] ++ print("Error saving image:", fileName, sys.exc_info()[0]) + raise + else: + try: + plt.show() + except: +- print "Error showing image:", sys.exc_info()[0] ++ print("Error showing image:", sys.exc_info()[0]) + raise + del fig + +@@ -504,13 +504,13 @@ class Bin: + fig.set_size_inches(6,6) + plt.savefig(fileName+".png",dpi=300) + except: +- print "Error saving image:", fileName, sys.exc_info()[0] ++ print("Error saving image:", fileName, sys.exc_info()[0]) + raise + elif(show): + try: + plt.show() + except: +- print "Error showing image:", sys.exc_info()[0] ++ print("Error showing image:", sys.exc_info()[0]) + raise + plt.close(fig) + del fig +@@ -636,8 +636,8 @@ class Bin: + + If you pass through an EllipsoidTool then it will plot the minimum bounding ellipse as well! + """ +- disp_vals = np.array(zip([kPCA1[i] for i in self.rowIndices], +- [kPCA2[i] for i in self.rowIndices])) ++ disp_vals = np.array(list(zip([kPCA1[i] for i in self.rowIndices], ++ [kPCA2[i] for i in self.rowIndices]))) + disp_lens = np.array([np.sqrt(contigLengths[i]) for i in self.rowIndices]) + + # reshape +@@ -695,7 +695,7 @@ class Bin: + data = [str(self.id), str(isLikelyChimeric[self.id]), str(self.totalBP), str(self.binSize), gcm_str, gcs_str] + cov_mean = np.mean(covProfiles[self.rowIndices], axis=0) + cov_std = np.std(covProfiles[self.rowIndices], axis=0) +- for i in xrange(0, len(cov_mean)): ++ for i in range(0, len(cov_mean)): + data.append('%.4f' % cov_mean[i]) + data.append('%.4f' % cov_std[i]) + stream.write(separator.join(data)+"\n") +--- groopm/binManager.py.orig 2015-03-06 07:02:49 UTC ++++ groopm/binManager.py +@@ -85,11 +85,11 @@ from scipy.stats import f_oneway, distributions + from scipy.cluster.vq import kmeans,vq + + # GroopM imports +-from profileManager import ProfileManager +-from bin import Bin, mungeCbar +-import groopmExceptions as ge +-from groopmUtils import makeSurePathExists +-from ellipsoid import EllipsoidTool ++from .profileManager import ProfileManager ++from .bin import Bin, mungeCbar ++from . import groopmExceptions as ge ++from .groopmUtils import makeSurePathExists ++from .ellipsoid import EllipsoidTool + + np_seterr(all='raise') + +@@ -182,15 +182,15 @@ class BinManager: + if self.PM.numStoits == 3: + self.PM.transformedCP = self.PM.covProfiles + else: +- print "Number of stoits != 3. You need to transform" ++ print("Number of stoits != 3. You need to transform") + self.PM.transformCP(timer, silent=silent) + if not silent: +- print " Making bin objects" ++ print(" Making bin objects") + self.makeBins(self.getBinMembers()) + if not silent: +- print " Loaded %d bins from database" % len(self.bins) ++ print(" Loaded %d bins from database" % len(self.bins)) + if not silent: +- print " %s" % timer.getTimeStamp() ++ print(" %s" % timer.getTimeStamp()) + sys_stdout.flush() + + def getBinMembers(self): +@@ -210,7 +210,7 @@ class BinManager: + + # we need to get the largest BinId in use + if len(bin_members) > 0: +- self.nextFreeBinId = np_max(bin_members.keys()) ++ self.nextFreeBinId = np_max(list(bin_members.keys())) + return bin_members + + def makeBins(self, binMembers, zeroIsBin=False): +@@ -224,8 +224,8 @@ class BinManager: + self.bins[bid] = Bin(np_array(binMembers[bid]), bid, self.PM.scaleFactor-1) + self.bins[bid].makeBinDist(self.PM.transformedCP, self.PM.averageCoverages, self.PM.kmerNormPC1, self.PM.kmerPCs, self.PM.contigGCs, self.PM.contigLengths) + if len(invalid_bids) != 0: +- print "MT bins!" +- print invalid_bids ++ print("MT bins!") ++ print(invalid_bids) + exit(-1) + + def saveBins(self, binAssignments={}, nuke=False): +@@ -384,7 +384,7 @@ class BinManager: + all_links[key] = links[link] + + # sort and return +- return sorted(all_links.iteritems(), key=itemgetter(1), reverse=True) ++ return sorted(iter(all_links.items()), key=itemgetter(1), reverse=True) + + def getWithinLinkProfiles(self): + """Determine the average number of links between contigs for all bins""" +@@ -468,7 +468,7 @@ class BinManager: + (bin_assignment_update, bids) = self.getSplitties(bid, n, mode) + + if(auto and saveBins): +- print 'here!!!!' ++ print('here!!!!') + # charge on through + self.deleteBins([bids[0]], force=True) # delete the combined bin + # save new bins +@@ -536,12 +536,12 @@ class BinManager: + parts = 0 + while(not_got_parts): + try: +- parts = int(raw_input("Enter new number of parts:")) ++ parts = int(input("Enter new number of parts:")) + except ValueError: +- print "You need to enter an integer value!" ++ print("You need to enter an integer value!") + parts = 0 + if(1 == parts): +- print "Don't be a silly sausage!" ++ print("Don't be a silly sausage!") + elif(0 != parts): + not_got_parts = False + self.split(bid, +@@ -664,7 +664,7 @@ class BinManager: + F_cutoff = distributions.f.ppf(confidence, 2, len(dist1)+len(dist2)-2) + F_value = f_oneway(dist1,dist2)[0] + if tag != "": +- print "%s [V: %f, C: %f]" % (tag, F_value, F_cutoff) ++ print("%s [V: %f, C: %f]" % (tag, F_value, F_cutoff)) + return F_value < F_cutoff + + def merge(self, bids, auto=False, manual=False, newBid=False, saveBins=False, verbose=False, printInstructions=True, use_elipses=True): +@@ -715,11 +715,11 @@ class BinManager: + self.deleteBins([tmp_bin.id], force=True) + user_option = self.promptOnMerge(bids=[parent_bin.id,dead_bin.id]) + if(user_option == "N"): +- print "Merge skipped" ++ print("Merge skipped") + ret_val = 1 + continue_merge=False + elif(user_option == "Q"): +- print "All mergers skipped" ++ print("All mergers skipped") + return 0 + else: + ret_val = 2 +@@ -799,7 +799,7 @@ class BinManager: + try: + del self.PM.binnedRowIndices[row_index] + except KeyError: +- print bid, row_index, "FUNG" ++ print(bid, row_index, "FUNG") + self.PM.binIds[row_index] = 0 + + bin_assignment_update[row_index] = 0 +@@ -826,7 +826,7 @@ class BinManager: + # UI + + def printMergeInstructions(self): +- raw_input( "****************************************************************\n" ++ input( "****************************************************************\n" + " MERGING INSTRUCTIONS - PLEASE READ CAREFULLY\n" + "****************************************************************\n" + " The computer cannot always be trusted to perform bin mergers\n" +@@ -836,10 +836,10 @@ class BinManager: + " to continue with the merging operation.\n" + " The image on the far right shows the bins after merging\n" + " Press any key to produce plots...") +- print "****************************************************************" ++ print("****************************************************************") + + def printSplitInstructions(self): +- raw_input( "****************************************************************\n" ++ input( "****************************************************************\n" + " SPLITTING INSTRUCTIONS - PLEASE READ CAREFULLY\n" + "****************************************************************\n" + " The computer cannot always be trusted to perform bin splits\n" +@@ -848,7 +848,7 @@ class BinManager: + " be split. Look carefully at each plot and then close the plot\n" + " to continue with the splitting operation.\n\n" + " Press any key to produce plots...") +- print "****************************************************************" ++ print("****************************************************************") + + def getPlotterMergeIds(self): + """Prompt the user for ids to be merged and check that it's all good""" +@@ -856,7 +856,7 @@ class BinManager: + ret_bids = [] + while(input_not_ok): + ret_bids = [] +- option = raw_input("Please enter 'space' separated bin Ids or 'q' to quit: ") ++ option = input("Please enter 'space' separated bin Ids or 'q' to quit: ") + if(option.upper() == 'Q'): + return [] + bids = option.split(" ") +@@ -866,13 +866,13 @@ class BinManager: + i_bid = int(bid) + # check that it's in the bins list + if(i_bid not in self.bins): +- print "**Error: bin",bid,"not found" ++ print("**Error: bin",bid,"not found") + input_not_ok = True + break + input_not_ok = False + ret_bids.append(i_bid) + except ValueError: +- print "**Error: invalid value:", bid ++ print("**Error: invalid value:", bid) + input_not_ok = True + break + return ret_bids +@@ -889,19 +889,19 @@ class BinManager: + bin_str += " and "+str(bids[i]) + while(input_not_ok): + if(minimal): +- option = raw_input(" Merge? ("+vrs+") : ") ++ option = input(" Merge? ("+vrs+") : ") + else: +- option = raw_input(" ****WARNING**** About to merge bins"+bin_str+"\n" \ ++ option = input(" ****WARNING**** About to merge bins"+bin_str+"\n" \ + " If you continue you *WILL* overwrite existing bins!\n" \ + " You have been shown a 3d plot of the bins to be merged.\n" \ + " Continue only if you're sure this is what you want to do!\n" \ + " y = yes, n = no, q = no and quit merging\n" \ + " Merge? ("+vrs+") : ") + if(option.upper() in valid_responses): +- print "****************************************************************" ++ print("****************************************************************") + return option.upper() + else: +- print "Error, unrecognised choice '"+option.upper()+"'" ++ print("Error, unrecognised choice '"+option.upper()+"'") + minimal = True + + def promptOnSplit(self, parts, mode, minimal=False): +@@ -911,9 +911,9 @@ class BinManager: + vrs = ",".join([str.lower(str(x)) for x in valid_responses]) + while(input_not_ok): + if(minimal): +- option = raw_input(" Split? ("+vrs+") : ") ++ option = input(" Split? ("+vrs+") : ") + else: +- option = raw_input(" ****WARNING**** About to split bin into "+str(parts)+" parts\n" \ ++ option = input(" ****WARNING**** About to split bin into "+str(parts)+" parts\n" \ + " If you continue you *WILL* overwrite existing bins!\n" \ + " You have been shown a 3d plot of the bin after splitting.\n" \ + " Continue only if you're sure this is what you want to do!\n" \ +@@ -923,13 +923,13 @@ class BinManager: + " Split? ("+vrs+") : ") + if(option.upper() in valid_responses): + if(option.upper() == 'K' and mode.upper() == 'KMER' or option.upper() == 'C' and mode.upper() == 'COV' or option.upper() == 'L' and mode.upper() == 'LEN'): +- print "Error, you are already using that profile to split!" ++ print("Error, you are already using that profile to split!") + minimal=True + else: +- print "****************************************************************" ++ print("****************************************************************") + return option.upper() + else: +- print "Error, unrecognised choice '"+option.upper()+"'" ++ print("Error, unrecognised choice '"+option.upper()+"'") + minimal = True + + def promptOnDelete(self, bids, minimal=False): +@@ -940,19 +940,19 @@ class BinManager: + bids_str = ",".join([str.lower(str(x)) for x in bids]) + while(input_not_ok): + if(minimal): +- option = raw_input(" Delete? ("+vrs+") : ") ++ option = input(" Delete? ("+vrs+") : ") + else: +- option = raw_input(" ****WARNING**** About to delete bin(s):\n" \ ++ option = input(" ****WARNING**** About to delete bin(s):\n" \ + " "+bids_str+"\n" \ + " If you continue you *WILL* overwrite existing bins!\n" \ + " Continue only if you're sure this is what you want to do!\n" \ + " y = yes, n = no\n"\ + " Delete? ("+vrs+") : ") + if(option.upper() in valid_responses): +- print "****************************************************************" ++ print("****************************************************************") + return option.upper() + else: +- print "Error, unrecognised choice '"+option.upper()+"'" ++ print("Error, unrecognised choice '"+option.upper()+"'") + minimal = True + + #------------------------------------------------------------------------------ +@@ -1039,10 +1039,10 @@ class BinManager: + + # find the mean and stdev + if(not makeKillList): +- return (np_mean(np_array(Ms.values())), np_std(np_array(Ms.values())), np_median(np_array(Ss.values())), np_std(np_array(Ss.values()))) ++ return (np_mean(np_array(list(Ms.values()))), np_std(np_array(list(Ms.values()))), np_median(np_array(list(Ss.values()))), np_std(np_array(list(Ss.values())))) + + else: +- cutoff = np_mean(np_array(Ms.values())) + tolerance * np_std(np_array(Ms.values())) ++ cutoff = np_mean(np_array(list(Ms.values()))) + tolerance * np_std(np_array(list(Ms.values()))) + kill_list = [] + for bid in Ms: + if(Ms[bid] > cutoff): +@@ -1054,7 +1054,7 @@ class BinManager: + + return a list of potentially confounding kmer indices + """ +- print " Measuring kmer type variances" ++ print(" Measuring kmer type variances") + means = np_array([]) + stdevs = np_array([]) + bids = np_array([]) +@@ -1094,12 +1094,12 @@ class BinManager: + return_indices.append(sort_within_indices[i]) + + if(plot): +- print "BETWEEN" ++ print("BETWEEN") + for i in range(0,number_to_trim): +- print names[sort_between_indices[i]] +- print "WITHIN" ++ print(names[sort_between_indices[i]]) ++ print("WITHIN") + for i in range(0,number_to_trim): +- print names[sort_within_indices[i]] ++ print(names[sort_within_indices[i]]) + + plt.figure(1) + plt.subplot(211) +@@ -1126,7 +1126,7 @@ class BinManager: + stdout = open(fileName, 'w') + self.printInner(outFormat, stdout) + except: +- print "Error diverting stout to file:", fileName, exc_info()[0] ++ print("Error diverting stout to file:", fileName, exc_info()[0]) + raise + else: + self.printInner(outFormat) +@@ -1139,14 +1139,14 @@ class BinManager: + stream.write(separator.join(["#\"bid\"","\"cid\"","\"length\"","\"GC\""])+"\n") + elif(outFormat == 'bins'): + header = ["\"bin id\"","\"Likely chimeric\"","\"length (bp)\"","\"# seqs\"","\"GC mean\"","\"GC std\""] +- for i in xrange(0, len(self.PM.covProfiles[0])): ++ for i in range(0, len(self.PM.covProfiles[0])): + header.append("\"Coverage " + str(i+1) + " mean\"") + header.append("\"Coverage " + str(i+1) + " std\"") + stream.write(separator.join(header) + "\n") + elif(outFormat == 'full'): + pass + else: +- print "Error: Unrecognised format:", outFormat ++ print("Error: Unrecognised format:", outFormat) + return + + for bid in self.getBids(): +@@ -1224,13 +1224,13 @@ class BinManager: + try: + plt.savefig(fileName,dpi=300) + except: +- print "Error saving image:", fileName, exc_info()[0] ++ print("Error saving image:", fileName, exc_info()[0]) + raise + else: + try: + plt.show() + except: +- print "Error showing image:", exc_info()[0] ++ print("Error showing image:", exc_info()[0]) + raise + + plt.close(fig) +@@ -1344,7 +1344,7 @@ class BinManager: + try: + plt.show() + except: +- print "Error showing image:", exc_info()[0] ++ print("Error showing image:", exc_info()[0]) + raise + + plt.close(fig) +@@ -1369,10 +1369,10 @@ class BinManager: + self.bins[bid].makeBinDist(self.PM.transformedCP, self.PM.averageCoverages, self.PM.kmerNormPC1, self.PM.kmerPCs, self.PM.contigGCs, self.PM.contigLengths) + + if(sideBySide): +- print "Plotting side by side" +- self.plotSideBySide(self.bins.keys(), tag=FNPrefix, ignoreContigLengths=ignoreContigLengths) ++ print("Plotting side by side") ++ self.plotSideBySide(list(self.bins.keys()), tag=FNPrefix, ignoreContigLengths=ignoreContigLengths) + else: +- print "Plotting bins" ++ print("Plotting bins") + for bid in self.getBids(): + if folder != '': + self.bins[bid].plotBin(self.PM.transformedCP, self.PM.contigGCs, self.PM.kmerNormPC1, +@@ -1387,7 +1387,7 @@ class BinManager: + def plotBinCoverage(self, plotEllipses=False, plotContigLengs=False, printID=False): + """Make plots of all the bins""" + +- print "Plotting first 3 stoits in untransformed coverage space" ++ print("Plotting first 3 stoits in untransformed coverage space") + + # plot contigs in coverage space + fig = plt.figure() +@@ -1452,7 +1452,7 @@ class BinManager: + plt.show() + plt.close(fig) + except: +- print "Error showing image", exc_info()[0] ++ print("Error showing image", exc_info()[0]) + raise + + del fig +@@ -1504,13 +1504,13 @@ class BinManager: + fig.set_size_inches(12,6) + plt.savefig(fileName,dpi=300) + except: +- print "Error saving image:", fileName, exc_info()[0] ++ print("Error saving image:", fileName, exc_info()[0]) + raise + elif(show): + try: + plt.show() + except: +- print "Error showing image:", exc_info()[0] ++ print("Error showing image:", exc_info()[0]) + raise + plt.close(fig) + del fig +@@ -1554,7 +1554,7 @@ class BinManager: + plt.show() + plt.close(fig) + except: +- print "Error showing image", exc_info()[0] ++ print("Error showing image", exc_info()[0]) + raise + del fig + +@@ -1563,7 +1563,7 @@ class BinManager: + (bin_centroid_points, _bin_centroid_colors, bin_centroid_gc, _bids) = self.findCoreCentres(processChimeric=showChimeric) + fig = plt.figure() + ax = fig.add_subplot(111, projection='3d') +- print bin_centroid_gc ++ print(bin_centroid_gc) + sc = ax.scatter(bin_centroid_points[:,0], bin_centroid_points[:,1], bin_centroid_points[:,2], edgecolors='k', c=bin_centroid_gc, cmap=self.PM.colorMapGC, vmin=0.0, vmax=1.0) + sc.set_edgecolors = sc.set_facecolors = lambda *args:None # disable depth transparency effect + +@@ -1588,7 +1588,7 @@ class BinManager: + plt.show() + plt.close(fig) + except: +- print "Error showing image", exc_info()[0] ++ print("Error showing image", exc_info()[0]) + raise + del fig + +--- groopm/cluster.py.orig 2015-03-06 04:42:51 UTC ++++ groopm/cluster.py +@@ -95,11 +95,11 @@ from scipy.spatial.distance import pdist, squareform, + from scipy.misc import imsave + + # GroopM imports +-from profileManager import ProfileManager +-from binManager import BinManager +-from refine import GrubbsTester, RefineEngine +-from PCA import PCA, Center +-from groopmExceptions import BinNotFoundException ++from .profileManager import ProfileManager ++from .binManager import BinManager ++from .refine import GrubbsTester, RefineEngine ++from .PCA import PCA, Center ++from .groopmExceptions import BinNotFoundException + + np_seterr(all='raise') + +@@ -160,22 +160,22 @@ class ClusterEngine: + vrs = ",".join([str.lower(str(x)) for x in valid_responses]) + while(input_not_ok): + if(minimal): +- option = raw_input(" Overwrite? ("+vrs+") : ") ++ option = input(" Overwrite? ("+vrs+") : ") + else: +- option = raw_input(" ****WARNING**** Database: '"+self.PM.dbFileName+"' has already been clustered.\n" \ ++ option = input(" ****WARNING**** Database: '"+self.PM.dbFileName+"' has already been clustered.\n" \ + " If you continue you *MAY* overwrite existing bins!\n" \ + " Overwrite? ("+vrs+") : ") + if(option.upper() in valid_responses): +- print "****************************************************************" ++ print("****************************************************************") + if(option.upper() == "N"): +- print "Operation cancelled" ++ print("Operation cancelled") + return False + else: + break + else: +- print "Error, unrecognised choice '"+option.upper()+"'" ++ print("Error, unrecognised choice '"+option.upper()+"'") + minimal = True +- print "Will Overwrite database",self.PM.dbFileName ++ print("Will Overwrite database",self.PM.dbFileName) + return True + + #------------------------------------------------------------------------------ +@@ -189,10 +189,10 @@ class ClusterEngine: + + # get some data + self.PM.loadData(self.timer, "length >= "+str(coreCut)) +- print " %s" % self.timer.getTimeStamp() ++ print(" %s" % self.timer.getTimeStamp()) + + # transform the data +- print " Loading transformed data" ++ print(" Loading transformed data") + self.PM.transformCP(self.timer) + # plot the transformed space (if we've been asked to...) + #if(self.debugPlots >= 3): +@@ -201,15 +201,15 @@ class ClusterEngine: + # now we can make this guy + self.TSpan = np_mean([np_norm(self.PM.corners[i] - self.PM.TCentre) for i in range(self.PM.numStoits)]) + +- print " %s" % self.timer.getTimeStamp() ++ print(" %s" % self.timer.getTimeStamp()) + + # cluster and bin! +- print "Create cores" ++ print("Create cores") + self.initialiseCores(kmerThreshold, coverageThreshold) +- print " %s" % self.timer.getTimeStamp() ++ print(" %s" % self.timer.getTimeStamp()) + + # condense cores +- print "Refine cores [begin: %d]" % len(self.BM.bins) ++ print("Refine cores [begin: %d]" % len(self.BM.bins)) + if self.finalPlot: + prfx = "CORE" + else: +@@ -217,9 +217,9 @@ class ClusterEngine: + self.RE.refineBins(self.timer, auto=True, saveBins=False, plotFinal=prfx, gf=gf) + + # Now save all the stuff to disk! +- print "Saving bins" ++ print("Saving bins") + self.BM.saveBins(nuke=True) +- print " %s" % self.timer.getTimeStamp() ++ print(" %s" % self.timer.getTimeStamp()) + + def initialiseCores(self, kmerThreshold, coverageThreshold): + """Process contigs and form CORE bins""" +@@ -230,8 +230,8 @@ class ClusterEngine: + # We can make a heat map and look for hot spots + self.populateImageMaps() + sub_counter = 0 +- print " .... .... .... .... .... .... .... .... .... ...." +- print "%4d" % sub_counter, ++ print(" .... .... .... .... .... .... .... .... .... ....") ++ print("%4d" % sub_counter, end=' ') + new_line_counter = 0 + num_bins = 0 + +@@ -303,13 +303,13 @@ class ClusterEngine: + self.updatePostBin(bin) + + new_line_counter += 1 +- print "% 4d" % bin.binSize, ++ print("% 4d" % bin.binSize, end=' ') + + # make the printing prettier + if(new_line_counter > 9): + new_line_counter = 0 + sub_counter += 10 +- print "\n%4d" % sub_counter, ++ print("\n%4d" % sub_counter, end=' ') + + if(self.debugPlots >= 1): + #***slow plot! +@@ -317,7 +317,7 @@ class ClusterEngine: + + except BinNotFoundException: pass + +- print "\n .... .... .... .... .... .... .... .... .... ...." ++ print("\n .... .... .... .... .... .... .... .... .... ....") + + def findNewClusterCenters(self, kmerThreshold, coverageThreshold): + """Find a putative cluster""" +@@ -498,32 +498,32 @@ class ClusterEngine: + k_dist_matrix = squareform(pdist(k_dat, 'cityblock')) + k_radius = np_median(np_sort(k_dist_matrix)[:,eps_neighbours]) + except MemoryError: +- print "\n" +- print '*******************************************************************************' +- print '********************************* ERROR *********************************' +- print '*******************************************************************************' +- print 'GroopM is attempting to do some maths on a putative bin which contains:' +- print +- print '\t\t%d contigs' % (len(rowIndices)) +- print +- print 'This has caused your machine to run out of memory.' +- print 'The most likely cause is that your samples are very different from each other.' +- print 'You can confirm this by running:' +- print +- print '\t\tgroopm explore -m allcontigs %s' % self.PM.dbFileName +- print +- print 'If you notice only vertical "spears" of contigs at the corners of the plot then' +- print 'this means that your samples are very different and you are not getting a good' +- print 'mapping from all samples to all contigs. You may get more mileage by assembling' +- print 'and binning your samples separately.' +- print +- print 'If you notice "clouds" of contigs then congratulations! You have found a bug.' +- print 'Please let me know at "%s or via github.com/minillinim/GroopM' % __email__ +- print +- print 'GroopM is aborting... sorry' +- print +- print '*******************************************************************************' +- print "\n" ++ print("\n") ++ print('*******************************************************************************') ++ print('********************************* ERROR *********************************') ++ print('*******************************************************************************') ++ print('GroopM is attempting to do some maths on a putative bin which contains:') ++ print() ++ print('\t\t%d contigs' % (len(rowIndices))) ++ print() ++ print('This has caused your machine to run out of memory.') ++ print('The most likely cause is that your samples are very different from each other.') ++ print('You can confirm this by running:') ++ print() ++ print('\t\tgroopm explore -m allcontigs %s' % self.PM.dbFileName) ++ print() ++ print('If you notice only vertical "spears" of contigs at the corners of the plot then') ++ print('this means that your samples are very different and you are not getting a good') ++ print('mapping from all samples to all contigs. You may get more mileage by assembling') ++ print('and binning your samples separately.') ++ print() ++ print('If you notice "clouds" of contigs then congratulations! You have found a bug.') ++ print('Please let me know at "%s or via github.com/minillinim/GroopM' % __email__) ++ print() ++ print('GroopM is aborting... sorry') ++ print() ++ print('*******************************************************************************') ++ print("\n") + exit(-1) + + # find nearest neighbours to each point in whitened coverage space, +@@ -1341,7 +1341,7 @@ class HoughPartitioner: + diffs *= (len(diffs)-1) + + # make it 2D +- t_data = np_array(zip(diffs, np_arange(d_len))) ++ t_data = np_array(list(zip(diffs, np_arange(d_len)))) + ###MMM FIX + #im_shape = (int(np_max(t_data, axis=0)[0]+1), d_len) + im_shape = (d_len, d_len) +@@ -1532,7 +1532,7 @@ class HoughPartitioner: + if imgTag is not None: + # make a pretty picture + fff = np_ones(imShape) * 255 +- for p in found_line.keys(): ++ for p in list(found_line.keys()): + fff[p[0],p[1]] = 220 + for p in tData: + fff[p[0],p[1]] = 0 +@@ -1573,7 +1573,7 @@ class HoughPartitioner: + if real_index not in assigned: + tmp[real_index] = None + assigned[real_index] = None +- centre = np_array(tmp.keys()) ++ centre = np_array(list(tmp.keys())) + if len(centre) > 0: + return np_array([centre]) + # nuffin +@@ -1593,7 +1593,7 @@ class HoughPartitioner: + if real_index not in assigned: + tmp[real_index] = None + assigned[real_index] = None +- centre = np_array(tmp.keys()) ++ centre = np_array(list(tmp.keys())) + + rets = [] + +@@ -1609,8 +1609,8 @@ class HoughPartitioner: + tmp[real_index] = None + assigned[real_index] = None + +- if len(tmp.keys()) > 0: +- rets.append(np_array(tmp.keys())) ++ if len(list(tmp.keys())) > 0: ++ rets.append(np_array(list(tmp.keys()))) + + else: + # otherwise we keep working with ranges +@@ -1643,8 +1643,8 @@ class HoughPartitioner: + tmp[real_index] = None + assigned[real_index] = None + +- if len(tmp.keys()) > 0: +- rets.append(np_array(tmp.keys())) ++ if len(list(tmp.keys())) > 0: ++ rets.append(np_array(list(tmp.keys()))) + else: + right_p = self.recursiveSelect(tData, + imShape, +@@ -1723,40 +1723,40 @@ class HoughPartitioner: + iry = half_rows + int(r/dr) + accumulator[iry, theta_index] -= 1 + """ +- cos_sin_array = np_array(zip([np_sin(dth * theta_index) for theta_index in range(cols)], +- [np_cos(dth * theta_index) for theta_index in range(cols)])) ++ cos_sin_array = np_array(list(zip([np_sin(dth * theta_index) for theta_index in range(cols)], ++ [np_cos(dth * theta_index) for theta_index in range(cols)]))) + Rs = np_array(np_sum(np_reshape([p * cos_sin_array for p in data], (d_len*cols,2)), + axis=1)/dr).astype('int') + half_rows +- Cs = np_array(range(cols)*d_len) ++ Cs = np_array(list(range(cols))*d_len) + + try: + flat_indices = Rs * cols + Cs + except ValueError: +- print "\n" +- print '*******************************************************************************' +- print '********************************* ERROR *********************************' +- print '*******************************************************************************' +- print 'GroopM is attempting to do some maths on a putative bin which contains' +- print 'too many contigs.' +- print +- print 'This has resulted in a buffer overflow in the numpy library... oops.' +- print 'The most likely cause is that your samples are very different from each other.' +- print 'You can confirm this by running:' +- print +- print '\t\tgroopm explore -c 0 -m allcontigs <dbfilename>' +- print +- print 'If you notice only vertical "spears" of contigs at the corners of the plot then' +- print 'this means that your samples are very different and you are not getting a good' +- print 'mapping from all samples to all contigs. You may get more mileage by assembling' +- print 'and binning your samples separately.' +- print +- print 'If you notice "clouds" of contigs then congratulations! You have found a bug.' +- print 'Please let me know at "%s or via github.com/minillinim/GroopM' % __email__ +- print +- print 'GroopM is aborting... sorry' +- print +- print '*******************************************************************************' +- print "\n" ++ print("\n") ++ print('*******************************************************************************') ++ print('********************************* ERROR *********************************') ++ print('*******************************************************************************') ++ print('GroopM is attempting to do some maths on a putative bin which contains') ++ print('too many contigs.') ++ print() ++ print('This has resulted in a buffer overflow in the numpy library... oops.') ++ print('The most likely cause is that your samples are very different from each other.') ++ print('You can confirm this by running:') ++ print() ++ print('\t\tgroopm explore -c 0 -m allcontigs <dbfilename>') ++ print() ++ print('If you notice only vertical "spears" of contigs at the corners of the plot then') ++ print('this means that your samples are very different and you are not getting a good') ++ print('mapping from all samples to all contigs. You may get more mileage by assembling') ++ print('and binning your samples separately.') ++ print() ++ print('If you notice "clouds" of contigs then congratulations! You have found a bug.') ++ print('Please let me know at "%s or via github.com/minillinim/GroopM' % __email__) ++ print() ++ print('GroopM is aborting... sorry') ++ print() ++ print('*******************************************************************************') ++ print("\n") + exit(-1) + + # update the accumulator with integer decrements +--- groopm/groopm.py.orig 2014-11-26 01:01:33 UTC ++++ groopm/groopm.py +@@ -52,14 +52,14 @@ __status__ = "Released" + import matplotlib as mpl + + # GroopM imports +-import mstore +-import cluster +-import refine +-import binManager +-import groopmUtils +-import groopmTimekeeper as gtime +-from groopmExceptions import ExtractModeNotAppropriateException +-from mstore import GMDataManager ++from . import mstore ++from . import cluster ++from . import refine ++from . import binManager ++from . import groopmUtils ++from . import groopmTimekeeper as gtime ++from .groopmExceptions import ExtractModeNotAppropriateException ++from .mstore import GMDataManager + + ############################################################################### + ############################################################################### +@@ -100,12 +100,12 @@ class GroopMOptionsParser(): + timer = gtime.TimeKeeper() + if(options.subparser_name == 'parse'): + # parse raw input +- print "*******************************************************************************" +- print " [[GroopM %s]] Running in data parsing mode..." % self.GMVersion +- print "*******************************************************************************" ++ print("*******************************************************************************") ++ print(" [[GroopM %s]] Running in data parsing mode..." % self.GMVersion) ++ print("*******************************************************************************") + # check this here: + if len(options.bamfiles) < 3: +- print "Sorry, You must supply at least 3 bamFiles to use GroopM. (You supplied %d)\n Exiting..." % len(options.bamfiles) ++ print("Sorry, You must supply at least 3 bamFiles to use GroopM. (You supplied %d)\n Exiting..." % len(options.bamfiles)) + return + GMdata = mstore.GMDataManager() + success = GMdata.createDB(options.bamfiles, +@@ -116,13 +116,13 @@ class GroopMOptionsParser(): + force=options.force, + threads=options.threads) + if not success: +- print options.dbname,"not updated" ++ print(options.dbname,"not updated") + + elif(options.subparser_name == 'core'): + # make bin cores +- print "*******************************************************************************" +- print " [[GroopM %s]] Running in core creation mode..." % self.GMVersion +- print "*******************************************************************************" ++ print("*******************************************************************************") ++ print(" [[GroopM %s]] Running in core creation mode..." % self.GMVersion) ++ print("*******************************************************************************") + CE = cluster.ClusterEngine(options.dbname, + timer, + force=options.force, +@@ -139,9 +139,9 @@ class GroopMOptionsParser(): + + elif(options.subparser_name == 'refine'): + # refine bin cores +- print "*******************************************************************************" +- print " [[GroopM %s]] Running in core refining mode..." % self.GMVersion +- print "*******************************************************************************" ++ print("*******************************************************************************") ++ print(" [[GroopM %s]] Running in core refining mode..." % self.GMVersion) ++ print("*******************************************************************************") + bids = [] + #if options.bids is not None: + # bids = options.bids +@@ -158,7 +158,7 @@ class GroopMOptionsParser(): + pfx="REFINED" + else: + pfx="" +- print "Refine bins" ++ print("Refine bins") + + RE.refineBins(timer, + auto=auto, +@@ -167,9 +167,9 @@ class GroopMOptionsParser(): + + elif(options.subparser_name == 'recruit'): + # make bin cores +- print "*******************************************************************************" +- print " [[GroopM %s]] Running in bin expansion mode..." % self.GMVersion +- print "*******************************************************************************" ++ print("*******************************************************************************") ++ print(" [[GroopM %s]] Running in bin expansion mode..." % self.GMVersion) ++ print("*******************************************************************************") + RE = refine.RefineEngine(timer, + dbFileName=options.dbname, + getUnbinned=True, +@@ -183,9 +183,9 @@ class GroopMOptionsParser(): + + elif(options.subparser_name == 'extract'): + # Extract data +- print "*******************************************************************************" +- print " [[GroopM %s]] Running in '%s' extraction mode..." % (self.GMVersion, options.mode) +- print "*******************************************************************************" ++ print("*******************************************************************************") ++ print(" [[GroopM %s]] Running in '%s' extraction mode..." % (self.GMVersion, options.mode)) ++ print("*******************************************************************************") + bids = [] + if options.bids is not None: + bids = options.bids +@@ -220,35 +220,35 @@ class GroopMOptionsParser(): + raise ExtractModeNotAppropriateException("mode: "+ options.mode + " is unknown") + elif(options.subparser_name == 'merge'): + # make bin cores +- print "*******************************************************************************" +- print " [[GroopM %s]] Running in bin merging mode..." % self.GMVersion +- print "*******************************************************************************" ++ print("*******************************************************************************") *** 2450 LINES SKIPPED ***