diff --git a/GUniDec.spec b/GUniDec.spec index c89a287a..bf2e8e60 100644 --- a/GUniDec.spec +++ b/GUniDec.spec @@ -10,6 +10,7 @@ from multiprocessing import freeze_support from os import listdir from PyInstaller import compat import matplotlib +import hashing freeze_support() @@ -148,5 +149,7 @@ for root, dirs, files in os.walk(outputdir): zipf.close() print("Zipped to", zipdirectory, "from", outputdir) +hashing.hashfile(zipdirectory) + tend = time.perf_counter() print("Build Time: %.2gm" % ((tend - tstart) / 60.0)) diff --git a/PublicScripts/MutantCycleAnalysis/Step1_ListExtractor.py b/PublicScripts/MutantCycleAnalysis/Step1_ListExtractor.py new file mode 100644 index 00000000..211aa3cb --- /dev/null +++ b/PublicScripts/MutantCycleAnalysis/Step1_ListExtractor.py @@ -0,0 +1,67 @@ +# Script to extract the peak areas from each deconvolved native mass spectrum +# Note, you must first run UniDec on all the raw data to generate the deconvolved spectra +# This can be done either individually or in batch + +import numpy as np +import os +import glob +from unidec.modules.Extract2D import * + +R = 8.31446261815324 / 1000. +units = "kJ/mol" + +#SpecifyingDirectory +globaldir = "Z:\\Group Share\\Hiruni Jayasekera\\HSJ_MAE AqpZ CL\\Final2\\" + +os.chdir(globaldir) + +#ListExtractorProcessingParameters +edges = [("WT", "W14A")] +temps = [15, 20, 25, 30, 35, 40] +width = 95 +method = 6 +params1 = [98590, 1400, 350, 0, 7, 0, 1, width, method] +params2 = [98260, 1400, 680, 0, 7, 0, 1, width, method] +params3 = [98260, 1400, 320, 0, 7, 0, 1, width, method] +params4 = [98415, 1400, 500, 0, 7, 0, 1, width, method] +params5 = [98706, 1400, 208, 0, 7, 0, 1, width, method] +params = [params4] + +#SpecifyingPath +app = wx.App(False) +for ed in range(0, 1): + e1 = edges[ed][0] + e2 = edges[ed][1] + #if e2 is "DM": + #e2 = "R224-75A" + dirname = e1 + "_" + e2 + " Titrations All" + pathtop = os.path.join(globaldir, dirname) + print(os.path.isdir(pathtop), pathtop) + out = True + + files = [] + paths = [] + datalist = [] + # Loop through temperatures + for t in temps: + newpath = os.path.join(pathtop, e1 + "_" + e2 + "_" + str(t) + "C") + os.chdir(newpath) + temp = t + for path in glob.glob(f'{newpath}/*/**/', recursive=True): + mass_file = [f for f in os.listdir(path) if "_mass.txt" in f] + if len(mass_file) > 0: + mass_file = os.path.join(path, mass_file[0]) + files.append(mass_file) + paths.append(path) + data = np.loadtxt(mass_file) + datalist.append(data) + print(files) + if len(files) < 0: + print("Failed at t=", t) + break + print(len(datalist)) + # Load all data into the Extraction GUI, it will automatically export the required text files for Step 2 while + # Allowing users to check with the window that everything looks good. Just click next through all. + frame = Extract2DPlot(None, datalist, params=params[ed], directory=paths) + frame.on_all_next() + app.MainLoop() diff --git a/PublicScripts/MutantCycleAnalysis/Step2_DeltaGToolWithErrorBars.py b/PublicScripts/MutantCycleAnalysis/Step2_DeltaGToolWithErrorBars.py new file mode 100644 index 00000000..11643ab3 --- /dev/null +++ b/PublicScripts/MutantCycleAnalysis/Step2_DeltaGToolWithErrorBars.py @@ -0,0 +1,131 @@ +# Script to calculate DDG values from each quartet of extracted peak areas + +import matplotlib.pyplot as plt +import numpy as np +import os +from matplotlib import rcParams +import glob + +# rcParams['ps.useafm']=True +rcParams['ps.fonttype'] = 42 +rcParams['pdf.fonttype'] = 42 +rcParams['lines.linewidth'] = 2 +rcParams['axes.linewidth'] = 1 + + +# rcParams['font.size']=8 + +#Definition of Kd and delta(deltaG) +def get_kd(mutant, wt, n=0, l=1, T=37): + a = wt[n] + al = wt[n + l] + b = mutant[n] + bl = mutant[n + l] + kd = a * bl / (al * b) + TK = T + 273.15 + deltag = -R * TK * np.log(kd) + return kd, deltag, n + + +R = 8.31446261815324 / 1000. +units = "kJ/mol" +# R = 1.98720425864083 / 1000. +# units = "kcal/mol" + +# Data info +temps = [15, 20, 25, 30, 35, 40] +globaldir = "Z:\\Group Share\\Hiruni Jayasekera\\HSJ_MAE AqpZ CL\\Final2\\WT_R224A Titrations All\\WT_R224A_" +fname = "Extract_grid_2D_Extract6.txt" # Sets the name of the file to be read in + +#Selecting txt files +for t in temps: + temp = t + topdir = globaldir+str(t)+"C" + print(topdir) + files = [] + for path in glob.glob(f'{topdir}/*/**/', recursive=True): + testpath = os.path.join(path,fname) + if os.path.isfile(testpath): + files.append(testpath) + print(files) + if len(files)<2: + print("Failed at t=", t) + break + kds = [] + wts = [] + mts = [] + maxl = 7 + +#Loading txt file data and normalization + fig, ax = plt.subplots() + for f in files: + data = np.loadtxt(f) + + bm = data[:, 1] == 0 + mutant = data[bm][:, 2] + wt = data[np.logical_not(bm)][:, 2] + + wt = wt[:maxl] + mutant = mutant[:maxl] + wt = wt / np.sum(wt) + mutant = mutant / np.sum(mutant) + wts.append(wt) + mts.append(mutant) + + ax.plot(np.arange(len(wt)) + 0.5, wt, color="g") + ax.plot(np.arange(len(mutant)), mutant, color="b") + + # Calculate the DDG for each + kdlist = [] + for n in range(0, maxl - 1): + for m in range(1, 2):# maxl - n): + value = get_kd(mutant, wt, n, m, T=temp) + kdlist.append(value) + kds.append(kdlist) + + kds = np.array(kds) + wts = np.array(wts) + mts = np.array(mts) + + # Get Mean and Std. Dev + wavg = np.mean(wts, axis=0) + mavg = np.mean(mts, axis=0) + + wstd = np.std(wts, axis=0) + mstd = np.std(mts, axis=0) + + #Printing Kd, ddG, ddG, n>n+1 + print(kds) + + # Make Plots + maxn = maxl + labels = ["0", "1", "2", "3", "4", "5", "6"] + ax.bar(np.arange(maxn), mavg[:maxn], 0.45, color="b", yerr=mstd[:maxn], capsize=3, label="Mutant") + ax.bar(np.arange(maxn) + 0.45, wavg[:maxn], 0.45, color="g", yerr=wstd[:maxn], capsize=3, label="WT") + ax.set_xticks(np.arange(maxn) + 0.225, labels=labels[:maxn]) + ax.set_yticks([0, 0.5, 1.0], labels=["0", "%", "100"]) + ax.spines['right'].set_visible(False) + ax.spines['top'].set_visible(False) + ax.set_ylim(0, 1.0) + ax.set_xlabel("Number of Bound Lipids") + ax.legend() + ax.set_title(str(t)) + + dgs = [] + + for n in range(0, maxn - 1): + avgdg = np.mean(kds[:, n, 1]) + sddg = np.std(kds[:, n, 1]) + + dgvals = list(kds[:, n, 1]) + dgvals.append(avgdg) + dgvals.append(sddg) + + dgs.append(dgvals) + #ddG labels + text = "\u0394\u0394G = " + str(round(avgdg, 2)) + " \u00B1 " + str(round(sddg, 2)) + " " + units + ax.text(n, wavg[0] + 0.1 + 0.15 * n, text) + # Save results + np.savetxt(os.path.join(topdir, "DG_resultsN2_Fixed.txt"), dgs) + plt.savefig(os.path.join(topdir, "PlotN2_Fixed.pdf")) +plt.show() diff --git a/PublicScripts/MutantCycleAnalysis/Step3_VantHoffAnalysis.py b/PublicScripts/MutantCycleAnalysis/Step3_VantHoffAnalysis.py new file mode 100644 index 00000000..3d5b09fd --- /dev/null +++ b/PublicScripts/MutantCycleAnalysis/Step3_VantHoffAnalysis.py @@ -0,0 +1,241 @@ +# Script to perform the Van't Hoff analysis on the extracted peak areas +# DDG values are calculated with confidence intervals based on the fit. + +import numpy as np +import matplotlib.pyplot as plt +import os +import matplotlib.cm as cm +import scipy.stats as stats +from matplotlib import rcParams +import statsmodels.api as sm +import scipy.optimize as opt +import scipy.stats as stats + +rcParams['ps.useafm'] = True +rcParams['ps.fonttype'] = 42 +rcParams['pdf.fonttype'] = 42 +rcParams['lines.linewidth'] = 0.75 +rcParams['errorbar.capsize'] = 3 +rcParams['patch.force_edgecolor'] = True +rcParams['patch.facecolor'] = 'b' +rcParams['lines.markersize'] = 7 +rcParams['font.size'] = 16 +rcParams['font.sans-serif'] = "Arial" + +# Some parameters and equations +R = 8.31446261815324 / 1000. +units = "kJ/mol" + + +def Kfunc(t, h, s): + return np.exp((-(h / (R * t)) + s / R)) + +#Selecting the file +topdir = "Z:\\Group Share\\Hiruni Jayasekera\\HSJ_MAE AqpZ CL\\Final2\\" + +os.chdir(topdir) +# Edges to consider +edges = [("WT", "W14A")] +for ed in range(0, 1): + e1 = edges[ed][0] + e2 = edges[ed][1] + # if e2 is "DM": + # e2 = "R224-75A" + dirname = e1 + "_" + e2 + " Titrations All" + path = os.path.join(topdir, dirname) + print(os.path.isdir(path), path) + out = True + + #Setting the Temperature + temps = [15, 20, 25, 30, 35, 40] + maxn = 6 + temp_val = 25 + + alldata = [] + avgstd = [] + # Read in the data + for t in temps: + newpath = os.path.join(path, e1 + "_" + e2 + "_" + str(t) + "C") + os.chdir(newpath) + data = np.loadtxt("DG_resultsN2_Fixed.txt") + + for i, d in enumerate(data): + avgstd.append([i, t, d[-2], d[-1], 0, 0, 0, 0, 0, 0, 0, 0]) + for j, x in enumerate(d[:-2]): + alldata.append([i, t, x, j]) + os.chdir(path) + alldata = np.array(alldata) + avgstd = np.array(avgstd) + + # Perform the fits + fig = plt.figure() + fig.suptitle(dirname) + for l in range(maxn): + plt.subplot(round(maxn / 2.) + 1, 2, l + 1) + lipidn = l + b1 = alldata[:, 0] == lipidn + data = alldata[b1] + b1 = avgstd[:, 0] == l + meanstd = avgstd[b1] + + # Put data in the right form + x = 1 / (data[:, 1] + 273.15) + y = -data[:, 2] * x / R + df = len(x) - 2 + tval = abs(stats.t.ppf(0.05 / 2, df)) + + # Actual fit here + lr = stats.linregress(x, y) + fit = [lr.slope, lr.intercept] + errors = np.array([lr.stderr, lr.intercept_stderr]) + print(fit, errors, errors * tval) + + # Make plots + plt.scatter(x, y) + plt.plot(x, x * fit[0] + fit[1]) + x2 = 1 / (meanstd[:, 1] + 273.15) + y2 = -meanstd[:, 2] * x2 / R + e2 = -meanstd[:, 3] * x2 / R + plt.errorbar(x2, y2, np.abs(e2)) + plt.xlabel("1/T (K)") + plt.ylabel("ln K") + # plt.ylim(-0.5, 0.5) + plt.title(str(l)) + + # Extract the DDH and DDS values + mH = -fit[0] * R + mS = fit[1] * R + sH = errors[0] * R * tval + sS = errors[1] * R * tval + + # Get confidence intervals + model = sm.OLS(y, sm.add_constant(x)) + results = model.fit() + # print(results.params[::-1]* R, results.bse[::-1]* R*tval) + #print(results.rsquared_adj) + #print(results.conf_int(0.05)* R) + #print(results.pvalues) + #print(results.t_test([0, 1])) + #print(results.t_test([1, 0])) + + # Find the closest temperature to the desired temperature + tk = temp_val + 273.15 + xk = 1 / tk + closeindex = np.argmin(np.abs(x - xk)) + t_number = closeindex + + preds = results.get_prediction().summary_frame(0.05) + diffs = (preds["mean_ci_upper"].to_numpy() - preds["mean_ci_lower"].to_numpy())[t_number] + dGAvg = (preds["mean"][t_number] * -R) / x[t_number] + dGStd = (diffs / 2. * -R) / x[t_number] + # print(dGAvg, dGStd) + # plt.scatter(x, y) + # plt.plot(x, preds["mean"]) + # plt.plot(x, preds["mean_ci_upper"]) + # plt.plot(x, preds["mean_ci_lower"]) + # plt.show() + # exit() + + mTS = -tk * mS + sTS = -tk * sS + # dGAvg = np.mean(data[:,2]) + # dGStd = np.std(data[:,2]) + print('L=', l, "H=", mH, "+/-", sH, "S=", mS, "+/-", sS, "TS=", mTS, "+/-", sTS) + + b1 = avgstd[:, 0] == lipidn + avgstd[b1, 4] = mH + avgstd[b1, 5] = mS + avgstd[b1, 6] = mTS + avgstd[b1, 7] = sH + avgstd[b1, 8] = sS + avgstd[b1, 9] = sTS + avgstd[b1, 10] = dGAvg + avgstd[b1, 11] = dGStd + + # Save Results + if out: + np.savetxt("AnalysisResults2.csv", avgstd, delimiter=",", header="Lnum,Temp,G,GE,H,S,TS,HE,SE,TSE,GA,GAE") + # plt.tight_layout() + # plt.show() + + # Make more plots + plt.figure() + + for l in range(maxn): + index = 0 + plt.subplot(round(maxn / 2.) + 1, 2, l + 1) + b1 = avgstd[:, 0] == l + meanstd = avgstd[b1] + + ts = meanstd[:, 1] + for i, t in enumerate(ts): + c = cm.spring((t - np.amin(ts)) / np.amax(ts)) + plt.bar(index, meanstd[i, 2], yerr=meanstd[i, 3], color=c, tick_label=str(t)) + index += 1 + plt.bar(index, meanstd[i, 4], yerr=meanstd[i, 7], color="g", tick_label="dH") + index += 1 + plt.bar(index, meanstd[i, 6], yerr=np.abs(meanstd[i, 9]), color="b", tick_label="dTS") + index += 1 + + plt.bar(index, meanstd[i, 10], yerr=np.abs(meanstd[i, 11]), color="y", tick_label="avgdG") + index += 1 + print("Avg dG=", meanstd[i, 10], "+/-", meanstd[i, 11]) + plt.title("Lipid " + str(l + 1)) + + plt.gca().set_ylim(-6, 6) + + if out: + np.savetxt("AnalysisResults.csv", meanstd, delimiter=",") + plt.savefig(os.path.join(topdir, "VH_Plot1.pdf")) + # plt.show() + + plt.figure() + x = [] + y = [] + e = [] + for l in range(maxn): + b1 = avgstd[:, 0] == l + b2 = avgstd[:, 1] == temp_val + b3 = np.logical_and(b1, b2) + meanstd = avgstd[b3][0] + x.append(l + 1) + y.append(meanstd[10]) # 10 # 2 means avg ddG from data and 10 means avg ddG from fit + e.append(meanstd[11]) # 11 # or 3 for std ddG from data and 11 for std ddG from fit + + plt.bar(x, y, yerr=np.abs(e)) # , tick_labels=x+1) + plt.gca().set_ylim(-0.5, 1.0) + plt.yticks([-0.5, 0, 0.5, 1.0]) + plt.xlabel("Number of Lipids") + plt.ylabel("Delta G") + if out: + plt.savefig(os.path.join(topdir, "VH_Plot2.pdf")) + # plt.show() + + x3 = [] + y3 = [] + plt.figure() + for i, t in enumerate(temps): + # plt.subplot(2, round(len(temps) / 2.), i + 1) + + b1 = avgstd[:, 1] == t + meanstd = avgstd[b1] + + x2 = meanstd[:, 0] + y2 = meanstd[:, 2] + e2 = meanstd[:, 3] + fit = np.polyfit(x2, y2, 1) + # plt.plot(x2, x2 * fit[0] + fit[1]) + plt.plot(x2, x2 * 0) + + x3.append(t) + y3.append(fit[0]) + plt.errorbar(x2, y2, e2, label=str(t)) + plt.xlabel("Number of Lipids") + plt.ylabel("Delta G") + # plt.ylim(-1.25, 0.5) + # plt.title(str(t)) + # plt.tight_layout() + plt.legend() + if out: + plt.savefig(os.path.join(topdir, "VH_Plot3.pdf")) +plt.show() diff --git a/PublicScripts/MutantCycleAnalysis/Step4_DoubleMutantCyclePlot.py b/PublicScripts/MutantCycleAnalysis/Step4_DoubleMutantCyclePlot.py new file mode 100644 index 00000000..ebb7e504 --- /dev/null +++ b/PublicScripts/MutantCycleAnalysis/Step4_DoubleMutantCyclePlot.py @@ -0,0 +1,108 @@ +# Script for plotting the final results of the double mutant cycle analysis + +import pandas as pd +import os +import networkx as nx +import numpy as np +import matplotlib.pyplot as plt +import matplotlib +from matplotlib import rcParams + +matplotlib.use('WxAgg') + +rcParams['ps.useafm'] = True +rcParams['ps.fonttype'] = 42 +rcParams['pdf.fonttype'] = 42 +rcParams['lines.linewidth'] = 0.75 +rcParams['errorbar.capsize'] = 3 +rcParams['patch.force_edgecolor'] = True +rcParams['patch.facecolor'] = 'b' +rcParams['lines.markersize'] = 7 +rcParams['font.size'] = 14 +rcParams['font.sans-serif'] = "Arial" + + +def make_graph(df, m_name="G", s_name=None): + if s_name is None: + s_name=m_name+"E" + if m_name == "S": + r = 4 + else: + r=2 + print(df) + els = {} + edges = [("WT", "R224A"), ("WT", "R75A"), ("WT", "DM"), ("R224A", "DM"), ("R75A", "DM")] + G = nx.Graph() + weights = [] + for i in range(0, 5): + e1 = edges[i][0] + e2 = edges[i][1] + mutant = e1 + "_" + e2 + row = df[df["Mutant"] == mutant] + m = float(row[m_name]) + s = np.abs(float(row[s_name])) + + G.add_edge(e1, e2, weight=m) + label = str(round(m, r)) + "\n± " + str(round(s, r)) + els.update({edges[i]: label}) + sm = np.sqrt(3) + t = 3.182 + cil = m - s #* t/sm + clh = m + s #* t/sm + if cil < 0 < clh: + weights.append(0) + else: + weights.append(m) + return G, els, weights + + +path = "Z:\\Group Share\\Hiruni Jayasekera\\HSJ_MAE AqpZ CL\\Final2\\" +os.chdir(path) +df = pd.read_excel("CombinedResults2.xlsx") +names=[ "H", "TS", "GA"]#["G", "GA", "S", "H", "TS"] +for name in names: + #name = "G" + outstring = "Square_"+name+"_" + if name == "S": + minmax = [-0.01, 0.01] + elif name == "H" or name == "TS": + minmax = [-3, 3] + else: + minmax=[-0.75, 0.75] + if name in ["H", "S", "GA", "TS"]: + temps = [35] + else: + temps = [15, 20, 25, 30, 35, 40] + for j in range(0, len(temps)): + fig = plt.figure(figsize=(6, 8)) + t = temps[j] + for i in range(0, 6): + df2 = df[df["# Lnum"] == i] + df2 = df2[df2["Temp"] == t] + + G, els, weights = make_graph(df2, m_name=name) + + p = {"WT": [0, 1], "DM": [1, 0], "R224A": [1, 1], "R75A": [0, 0]} + ax1 = plt.subplot(3, 2, i + 1, aspect="equal") + ax1.get_xaxis().set_visible(False) + ax1.get_yaxis().set_visible(False) + nx.draw(G, p) + ns = 1800 + fs = 12 + bbox = {"boxstyle": "round, pad=0.1", "ec": "None", "fc": "None", "alpha": 0.5} + # weights = list(nx.get_edge_attributes(G, 'weight').values()) + nx.draw_networkx_nodes(G, p, margins=0.15, node_color="w", node_shape="o", node_size=ns, edgecolors="k") + nx.draw_networkx_edges(G, p, width=32, edge_color="k") + nx.draw_networkx_edges(G, p, width=30, edge_color=weights, edge_cmap=plt.cm.bwr, + node_size=ns, edge_vmin=minmax[0], edge_vmax=minmax[1]) + nx.draw_networkx_labels(G, p, font_size=fs) + nx.draw_networkx_edge_labels(G, p, edge_labels=els, font_size=fs, bbox=bbox, font_color="k") + + plt.title("Lipid " + str(i) + "→" + str(i + 1)) + plt.tight_layout() + figfile = outstring + str(t) + fig.suptitle('ΔΔ' + name + " "+ str(t) + ' °C', fontsize=16) + plt.savefig(figfile + ".png") + plt.savefig(figfile + ".pdf") + +plt.show() diff --git a/unidec/DataCollector.py b/unidec/DataCollector.py index a5bed5f8..64553e57 100644 --- a/unidec/DataCollector.py +++ b/unidec/DataCollector.py @@ -1149,8 +1149,8 @@ def on_kd_fit(self, e): maxsites = int(self.maxsites) except (ValueError, TypeError): maxsites = 0 - model = UniFit.KDmodel(np.transpose(self.extract), self.yvals[:, 2].astype(np.float64), - self.yvals[:, 1].astype(np.float64), nodelist, os.path.join(self.directory, "fits"), + model = UniFit.KDmodel(np.transpose(self.extract), self.yvals[:, 2].astype(float), + self.yvals[:, 1].astype(float), nodelist, os.path.join(self.directory, "fits"), numtotprot=self.numprot, numtotlig=self.numlig, removeoutliers=outlierflag, plot1=self.plot2.subplot1, plot2=self.plot3.axes, plot3=self.plot3h, bootnum=self.bootstrap, maxsites=maxsites, @@ -1332,8 +1332,8 @@ def on_msms_norm(self, e): dlg.Destroy() print("Openening: ", path) msdat = np.loadtxt(path) - mids = np.array([y[1] for y in self.yvals]).astype(np.float) - wins = np.array([y[2] for y in self.yvals]).astype(np.float) + mids = np.array([y[1] for y in self.yvals]).astype(float) + wins = np.array([y[2] for y in self.yvals]).astype(float) vals = [] for i, m in enumerate(mids): diff --git a/unidec/GUniDec.py b/unidec/GUniDec.py index ec7e55e4..138ccab3 100644 --- a/unidec/GUniDec.py +++ b/unidec/GUniDec.py @@ -550,16 +550,16 @@ def make_im_plots(self): self.makeplot5(1) self.makeplot3(1) self.view.plot2ccs.plotrefreshtop(self.eng.data.ccsdata[:, 0], self.eng.data.ccsdata[:, 1], - title="CCS Distribution", xlabel="CCS (${\AA}$$^2$)", ylabel="Intensity", + title="CCS Distribution", xlabel="CCS (${\\AA}$$^2$)", ylabel="Intensity", label="CCS Summation", config=self.eng.config, nopaint=False) self.view.plot5mccs.contourplot(xvals=self.eng.data.massdat[:, 0], yvals=self.eng.data.ccsdata[:, 0], zgrid=np.ravel(self.eng.data.massccs), config=self.eng.config, - ylab="CCS (${\AA}$$^2$)", title="Mass vs. CCS", test_kda=True) + ylab="CCS (${\\AA}$$^2$)", title="Mass vs. CCS", test_kda=True) ccsgrid2, zgrid2 = np.meshgrid(self.eng.data.ztab, self.eng.data.ccsdata[:, 0], sparse=False, indexing='ij') self.view.plot5ccsz.contourplot( np.transpose([np.ravel(ccsgrid2), np.ravel(zgrid2), np.ravel(self.eng.data.ccsz)]), self.eng.config, - xlab="Charge", ylab="CCS (${\AA}$$^2$)", title="CCS vs. Charge") + xlab="Charge", ylab="CCS (${\\AA}$$^2$)", title="CCS vs. Charge") print("Made IM Plots") try: self.view.plot3color.make_color_plot(self.eng.data.mztgrid, np.unique(self.eng.data.data3[:, 0]), @@ -626,7 +626,7 @@ def make_cube_plot(self, event=None): self.eng.data.massccs, self.eng.data.massgrid.reshape( (len(self.eng.data.massdat), len(self.eng.data.ztab))), self.eng.data.ccsz.transpose(), xlab="Mass (Da)", - ylab="CCS (${\AA}$$^2$)", zlab="Charge", cmap=self.eng.config.cmap) + ylab="CCS (${\\AA}$$^2$)", zlab="Charge", cmap=self.eng.config.cmap) endtime = time.perf_counter() print("Finished Final Cube in: ", (endtime - starttime), " s") except Exception as ex: @@ -1099,7 +1099,7 @@ def on_calibrate(self, e=None): result = dialog.value if result != "None": coeff = np.array(result.split()) - coeff = coeff.astype(np.float) + coeff = coeff.astype(float) else: coeff = None self.eng.data.rawdata = ud.cal_data(self.eng.data.rawdata, coeff) diff --git a/unidec/bin/Example Data/BSA_unidecfiles/BSA_conf.dat b/unidec/bin/Example Data/BSA_unidecfiles/BSA_conf.dat index 143166c6..08894ea9 100644 --- a/unidec/bin/Example Data/BSA_unidecfiles/BSA_conf.dat +++ b/unidec/bin/Example Data/BSA_unidecfiles/BSA_conf.dat @@ -1,4 +1,4 @@ -version 6.0.4 +version 6.0.5 imflag 0 cdmsflag 0 input C:\Python\UniDec3\unidec\bin\Example Data\BSA_unidecfiles\BSA_input.dat diff --git a/unidec/bin/UniDec.exe b/unidec/bin/UniDec.exe index 62f38e8d..711cfd4c 100644 Binary files a/unidec/bin/UniDec.exe and b/unidec/bin/UniDec.exe differ diff --git a/unidec/engine.py b/unidec/engine.py index d508f4a6..b502093c 100644 --- a/unidec/engine.py +++ b/unidec/engine.py @@ -1285,8 +1285,8 @@ def dscore(self, xfwhm=2, power=2): ints = [] for p in self.pks.peaks: scores = np.array([p.mscore, p.uscore, p.fscore, p.cs_score]) # p.rsquared, - p.dscore = np.product(scores) - p.lscore = np.product(scores[:-1]) + p.dscore = np.prod(scores) + p.lscore = np.prod(scores[:-1]) dscores.append(p.dscore) ints.append(p.height) ''' diff --git a/unidec/metaunidec/gui_elements/ud_menu_meta.py b/unidec/metaunidec/gui_elements/ud_menu_meta.py index b2f09d84..e1765804 100644 --- a/unidec/metaunidec/gui_elements/ud_menu_meta.py +++ b/unidec/metaunidec/gui_elements/ud_menu_meta.py @@ -489,7 +489,7 @@ def on_custom_defaults(self, e): # print("Clicked", e) try: nid = e.GetId() - ids = self.masterd[:, 0].astype(np.float) + ids = self.masterd[:, 0].astype(float) pos = np.argmin(np.abs(ids - nid)) path = self.masterd[pos, 1] print("Opening Config:", path) @@ -502,7 +502,7 @@ def on_example_data(self, e): # print("Clicked", e) try: nid = e.GetId() - ids = self.masterd2[:, 0].astype(np.float) + ids = self.masterd2[:, 0].astype(float) pos = np.argmin(np.abs(ids - nid)) path = self.masterd2[pos, 1] print("Opening Path:", path) diff --git a/unidec/modules/CDEng.py b/unidec/modules/CDEng.py index cfcc3deb..6ffd1329 100644 --- a/unidec/modules/CDEng.py +++ b/unidec/modules/CDEng.py @@ -222,8 +222,8 @@ def open_file(self, path, refresh=False): intkey = "Charge" mzcol = np.argmax(data[0] == mzkey) intcol = np.argmax(data[0] == intkey) - mz = data[1:, mzcol].astype(np.float) - intensity = data[1:, intcol].astype(np.float) + mz = data[1:, mzcol].astype(float) + intensity = data[1:, intcol].astype(float) scans = np.arange(len(mz)) # Don't do post-processing for thermo data self.thermodata = False @@ -866,9 +866,9 @@ def setup_msmooth(self): indexoffsets = np.round(mzoffsets / self.config.mzbins) lmz = len(self.mz) indexes = np.arange(0, lmz) - upperindexes = np.array([indexes + i for i in indexoffsets]).astype(np.int) - lowerindexes = np.array([indexes - i for i in indexoffsets]).astype(np.int) - normindexes = np.array([indexes for i in indexoffsets]).astype(np.int) + upperindexes = np.array([indexes + i for i in indexoffsets]).astype(int) + lowerindexes = np.array([indexes - i for i in indexoffsets]).astype(int) + normindexes = np.array([indexes for i in indexoffsets]).astype(int) upperindexes[upperindexes < 0] = normindexes[upperindexes < 0] lowerindexes[lowerindexes < 0] = normindexes[lowerindexes < 0] diff --git a/unidec/modules/ChromEng.py b/unidec/modules/ChromEng.py index f0ec4302..62d36f7f 100644 --- a/unidec/modules/ChromEng.py +++ b/unidec/modules/ChromEng.py @@ -20,6 +20,7 @@ def __init__(self): self.outpath = None self.attrs = None self.scans = None + self.fullscans = None self.filename = None self.dirname = None self.path = None @@ -91,7 +92,7 @@ def load_mzml(self, path, load_hdf5=True, refresh=False, *args, **kwargs): self.auto_polarity(path, self.chromdat) self.tic = self.chromdat.get_tic() self.ticdat = np.array(self.tic) - + self.fullscans = self.chromdat.scans return hdf5 def get_data_from_scans(self, scan_range=None): @@ -119,6 +120,9 @@ def get_data_from_times(self, minval, maxval): self.get_data_from_scans([minscan, maxscan]) return self.mzdata + def get_minmax_times(self): + return np.amin(self.ticdat[:, 0]), np.amax(self.ticdat[:, 0]) + def get_times(self): starts = [] ends = [] diff --git a/unidec/modules/DoubleDec.py b/unidec/modules/DoubleDec.py index 1c507095..454ad571 100644 --- a/unidec/modules/DoubleDec.py +++ b/unidec/modules/DoubleDec.py @@ -152,7 +152,7 @@ def PlotPeaks(self): for i, p in enumerate(peaks): sticks = self.dec2[:, 0] == p[0] sticks = np.array(sticks) - sticks = sticks.astype(np.float) * p[1] + sticks = sticks.astype(float) * p[1] sticks = cconv2(sticks, self.kernel) simdat[:, 1] += sticks diff --git a/unidec/modules/Extract2D.py b/unidec/modules/Extract2D.py index 101aaebf..5bd26c47 100644 --- a/unidec/modules/Extract2D.py +++ b/unidec/modules/Extract2D.py @@ -567,7 +567,7 @@ def on_fit4(self, e): def run_multip(self, string): try: array = string.split(",") - array = np.array(array).astype(np.int) + array = np.array(array).astype(int) fits, fitdat, i1, i2 = ud.complex_poisson(self.data1d, array, background=True) print("Fits:", fits) self.plot1.plotadd(self.data1d[:, 0], fitdat, "green", nopaint=False) diff --git a/unidec/modules/UniFit.py b/unidec/modules/UniFit.py index e63677c7..751cd10e 100644 --- a/unidec/modules/UniFit.py +++ b/unidec/modules/UniFit.py @@ -190,7 +190,7 @@ def MakeGrid(pfree, lfree, ureact, prottab, ligtab, paths, kds, nfactors): for i in range(0, len(ureact)): nump = ureact[i, 2, 0] numl = ureact[i, 2, 1] - denom = np.product([kds[j] for j in paths[i]]) + denom = np.prod([kds[j] for j in paths[i]]) if denom != 0: intgrid[nump, numl] += (pfree ** nump) * (lfree ** (numl * h)) / denom if nfactors is not None: @@ -481,7 +481,7 @@ def __init__(self, data, pconc, lconc, nodelist=None, header=None, numtotprot=0, if nodelist is None: nprot = np.ones(numtotlig + 1) - nodelist = np.transpose([nprot, self.nlig]).astype(np.int) + nodelist = np.transpose([nprot, self.nlig]).astype(int) self.kdargs.nodelist = np.array(nodelist) # Getting in the experimenatl data diff --git a/unidec/modules/fitting.py b/unidec/modules/fitting.py index dba93ea3..c3873942 100644 --- a/unidec/modules/fitting.py +++ b/unidec/modules/fitting.py @@ -397,8 +397,8 @@ def poisson_mono_di(datatop): def multipoisson(array, datatop, oarray, background=False): l = len(oarray) fitdat = np.zeros_like(datatop[:, 1]) - integrals = np.empty_like(oarray).astype(np.float) - integrals2 = np.empty_like(oarray).astype(np.float) + integrals = np.empty_like(oarray).astype(float) + integrals2 = np.empty_like(oarray).astype(float) for i in range(0, l): oligomer = oarray[i] mu = array[i * 2] @@ -450,8 +450,8 @@ def complex_poisson(datatop, oarray=None, background=False): if __name__ == "__main__": - path = "C:\\UniDecPastedSpectra\PastedSpectrum_2017_Dec_11_09_02_49_unidecfiles\Extract_total_2D_Extract.txt" - path = "C:\\UniDecPastedSpectra\PastedSpectrum_2017_Dec_11_11_30_45_unidecfiles\Extract_total_2D_Extract.txt" + path = "C:\\UniDecPastedSpectra\\PastedSpectrum_2017_Dec_11_09_02_49_unidecfiles\\Extract_total_2D_Extract.txt" + path = "C:\\UniDecPastedSpectra\\PastedSpectrum_2017_Dec_11_11_30_45_unidecfiles\\Extract_total_2D_Extract.txt" data = np.loadtxt(path)[1:18] data[:, 1] -= np.amin(data[:, 1]) diff --git a/unidec/modules/gui_elements/CDMenu.py b/unidec/modules/gui_elements/CDMenu.py index 9cb19a8a..46fd06af 100644 --- a/unidec/modules/gui_elements/CDMenu.py +++ b/unidec/modules/gui_elements/CDMenu.py @@ -446,7 +446,7 @@ def on_custom_defaults(self, e): # print("Clicked", e) try: nid = e.GetId() - ids = self.masterd[:, 0].astype(np.float) + ids = self.masterd[:, 0].astype(float) pos = np.argmin(np.abs(ids - nid)) path = self.masterd[pos, 1] print("Opening Config:", path) @@ -459,7 +459,7 @@ def on_example_data(self, e): # print("Clicked", e) try: nid = e.GetId() - ids = self.masterd2[:, 0].astype(np.float) + ids = self.masterd2[:, 0].astype(float) pos = np.argmin(np.abs(ids - nid)) self.load_example_data(pos) except Exception as e: diff --git a/unidec/modules/gui_elements/ud_menu.py b/unidec/modules/gui_elements/ud_menu.py index 10a1f4e1..dabdf2ac 100644 --- a/unidec/modules/gui_elements/ud_menu.py +++ b/unidec/modules/gui_elements/ud_menu.py @@ -536,7 +536,7 @@ def on_custom_defaults(self, e): # print("Clicked", e) try: nid = e.GetId() - ids = self.masterd[:, 0].astype(np.float) + ids = self.masterd[:, 0].astype(float) pos = np.argmin(np.abs(ids - nid)) path = self.masterd[pos, 1] print("Opening Config:", path) @@ -549,7 +549,7 @@ def on_example_data(self, e): # print("Clicked", e) try: nid = e.GetId() - ids = self.masterd2[:, 0].astype(np.float) + ids = self.masterd2[:, 0].astype(float) pos = np.argmin(np.abs(ids - nid)) self.load_example_data(pos) except Exception as e: diff --git a/unidec/modules/hramtools.py b/unidec/modules/hramtools.py index 69037ea3..17e5ac26 100644 --- a/unidec/modules/hramtools.py +++ b/unidec/modules/hramtools.py @@ -88,7 +88,7 @@ def filter_indexes(self): def generate_masses(self): lens = self.ends - self.starts + 1 - print("Generating combinations:", lens, np.product(lens)) + print("Generating combinations:", lens, np.prod(lens)) self.indexes = np.array(list(np.ndindex(tuple(lens)))) self.massvals = np.array([np.sum(self.isomasses * (i + self.starts)) for i in self.indexes]) diff --git a/unidec/modules/isolated_packages/mql_tool.py b/unidec/modules/isolated_packages/mql_tool.py index e5036947..151e7b67 100644 --- a/unidec/modules/isolated_packages/mql_tool.py +++ b/unidec/modules/isolated_packages/mql_tool.py @@ -29,7 +29,7 @@ def __init__(self, file): def query(self, input_query, pks): self.input_query = input_query self.results_df = msql_engine.process_query(self.input_query, self.file, ms1_df=self.ms1_df, ms2_df=self.ms2_df) - mz = self.results_df["comment"].to_numpy(dtype=np.float) + mz = self.results_df["comment"].to_numpy(dtype=float) for p in pks.peaks: if np.any(p.mass == mz): p.ignore = False diff --git a/unidec/modules/isolated_packages/preset_manager.py b/unidec/modules/isolated_packages/preset_manager.py index 39d536ac..7f34c3f0 100644 --- a/unidec/modules/isolated_packages/preset_manager.py +++ b/unidec/modules/isolated_packages/preset_manager.py @@ -100,7 +100,7 @@ def __init__(self, parent=None): def on_defaults(self, e): try: nid = e.GetId() - ids = self.masterd[:, 0].astype(np.float) + ids = self.masterd[:, 0].astype(float) pos = np.argmin(np.abs(ids - nid)) path = self.masterd[pos, 1] print("Opening Path:", path) diff --git a/unidec/modules/matchtools.py b/unidec/modules/matchtools.py index ac16df44..43033aae 100644 --- a/unidec/modules/matchtools.py +++ b/unidec/modules/matchtools.py @@ -86,7 +86,7 @@ def get_sitematch_list(gdf, sites=None, probs_cutoff=0, inds = indexes[:, i] probs[i] = pvals[i][inds] masses[i] = mvals[i][inds] - probs = np.product(probs, axis=0) + probs = np.prod(probs, axis=0) masses = np.sum(masses, axis=0) if sort is not None: diff --git a/unidec/modules/mzMLimporter.py b/unidec/modules/mzMLimporter.py index 5ebc3dfa..c9f705cc 100644 --- a/unidec/modules/mzMLimporter.py +++ b/unidec/modules/mzMLimporter.py @@ -598,7 +598,7 @@ def get_polarity(self, scan=1): if __name__ == "__main__": - test = u"C:\Python\\UniDec3\TestSpectra\JAW.mzML" + test = u"C:\\Python\\UniDec3\\TestSpectra\\JAW.mzML" # test = "C:\Data\CytC_Intact_MMarty_Share\\221114_STD_Pro_CytC_2ug_r1.mzML.gz" # test = "C:\Data\CytC_Intact_MMarty_Share\\221114_STD_Pro_CytC_2ug_r1_2.mzML" #test = "C:\Data\IMS Example Data\imstest2.mzML" diff --git a/unidec/modules/mzXML_importer.py b/unidec/modules/mzXML_importer.py index 802670c2..4805c9cf 100644 --- a/unidec/modules/mzXML_importer.py +++ b/unidec/modules/mzXML_importer.py @@ -203,7 +203,7 @@ def get_polarity(self): if __name__ == "__main__": - test = u"C:\Data\Wilson_Genentech\Raw Files for Michael Marty\B4.mzXML" + test = u"C:\\Data\\Wilson_Genentech\\Raw Files for Michael Marty\\B4.mzXML" import time tstart = time.perf_counter() diff --git a/unidec/modules/plot1d.py b/unidec/modules/plot1d.py index f73cf2e4..41b6a165 100644 --- a/unidec/modules/plot1d.py +++ b/unidec/modules/plot1d.py @@ -432,7 +432,7 @@ def colorplotMD(self, xvals, yvals, cvals, title="", xlabel="", ylabel="", clabe self.cbar = colorbar.ColorbarBase(cax, cmap=cmap2, orientation="vertical", ticks=ticks) ticks = ticks * max if max > 10: - ticks = np.round(ticks).astype(np.int) + ticks = np.round(ticks).astype(int) else: ticks = np.round(ticks, 1) ticks = ticks.astype(str) diff --git a/unidec/modules/thermo_reader/RawFileReader.py b/unidec/modules/thermo_reader/RawFileReader.py index 7a1af735..720b188f 100644 --- a/unidec/modules/thermo_reader/RawFileReader.py +++ b/unidec/modules/thermo_reader/RawFileReader.py @@ -193,8 +193,10 @@ def __init__(self, filename, **kwargs): self.timerange = [self.StartTime, self.EndTime] self.get_scan_header() + self.get_status_log() + #self.get_tune_data() - def get_scan_header(self, scannumber=2): + def get_scan_header(self, scannumber=1): try: self.header = {} extra_header_info = self.source.GetTrailerExtraHeaderInformation() @@ -218,6 +220,42 @@ def get_scan_header(self, scannumber=2): print("Error getting header") return None, None, None, None + def get_status_log(self, scannumber=1): + try: + self.statuslog = {} + + status_log_info = self.source.GetStatusLogHeaderInformation() + status_log_values = self.source.GetStatusLogValues(int(scannumber), True).Values + status_log_values = DotNetArrayToNPArray(status_log_values, dtype=str) + + for i in range(len(status_log_info)): + item = status_log_info[i] + self.statuslog[item.Label] = status_log_values[i] + + try: + self.uhv_pressure = float(self.statuslog['UHV Sensor (mbar)']) + except: + self.uhv_pressure = None + + except: + self.statuslog = None + print("Error getting status log") + + def get_tune_data(self, scannumber=1): + try: + self.tunedata = {} + + tune_data_info = self.source.GetTuneDataHeaderInformation() + tune_data_values = self.source.GetTuneDataValues(int(scannumber)) + tune_data_values = DotNetArrayToNPArray(tune_data_values, dtype=str) + + for i in range(len(tune_data_info)): + item = tune_data_info[i] + self.tunedata[item.Label] = tune_data_values[i] + except: + self.tunedata = None + print("Error getting tune data") + def Get_Header_Item(self, item): return self.header[item] diff --git a/unidec/modules/thermo_reader/ThermoImporter.py b/unidec/modules/thermo_reader/ThermoImporter.py index 51ace83e..09d6ed91 100644 --- a/unidec/modules/thermo_reader/ThermoImporter.py +++ b/unidec/modules/thermo_reader/ThermoImporter.py @@ -26,7 +26,7 @@ def __init__(self, path, silent=False, *args, **kwargs): self.msrun = rr(path) self.scanrange = self.msrun.scan_range() # print(self.scanrange) - self.scans = np.arange(self.scanrange[0], self.scanrange[1]) + self.scans = np.arange(self.scanrange[0], self.scanrange[1]+1) self.times = [] self.data = None for s in self.scans: @@ -64,7 +64,7 @@ def get_data(self, scan_range=None, time_range=None): :return: merged data """ if scan_range is not None: - scan_range = np.array(scan_range, dtype=np.int) + scan_range = np.array(scan_range, dtype=int) scan_range = scan_range + 1 if time_range is not None: scan_range = self.get_scans_from_times(time_range) @@ -163,6 +163,23 @@ def get_analog_voltage2(self): vs.append(an2) return np.array(vs) + def get_sid_voltage(self, scan=1): + try: + scan_mode = self.msrun.source.GetScanEventStringForScanNumber(scan) + #Find where sid= is in the string + sid_index = scan_mode.find("sid=") + #Find the next space after sid= + space_index = scan_mode.find(" ", sid_index) + #Get the sid value + sid_value = scan_mode[sid_index+4:space_index] + #Convert to float + sid_value = float(sid_value) + except: + sid_value = 0 + + return sid_value + + def get_polarity(self, scan=1): #print(dir(self.msrun.source)) """ @@ -187,6 +204,7 @@ def get_polarity(self, scan=1): print("Polarity: Negative") return "Negative" print("Polarity: Unknown") + return None if __name__ == "__main__": diff --git a/unidec/modules/tims_import_wizard/data_importer.py b/unidec/modules/tims_import_wizard/data_importer.py index 6f30bdcb..4ff44311 100644 --- a/unidec/modules/tims_import_wizard/data_importer.py +++ b/unidec/modules/tims_import_wizard/data_importer.py @@ -490,7 +490,7 @@ def GetLines(InputFileName): def GetStartEndMass(RawFile): ce, s, e = None, None, None if platform.uname()[0] == 'Windows': - ParamFile = RawFile + "\_extern.inf" + ParamFile = RawFile + "\\_extern.inf" else: ParamFile = RawFile + "/_extern.inf" diff --git a/unidec/modules/unidec_enginebase.py b/unidec/modules/unidec_enginebase.py index 7425cb15..4ba8dd04 100644 --- a/unidec/modules/unidec_enginebase.py +++ b/unidec/modules/unidec_enginebase.py @@ -6,7 +6,7 @@ import webbrowser from unidec.modules.html_writer import * -version = "6.0.4" +version = "6.0.5" def copy_config(config): diff --git a/unidec/src/UniDec.c b/unidec/src/UniDec.c index f400bab4..a1d2888f 100644 --- a/unidec/src/UniDec.c +++ b/unidec/src/UniDec.c @@ -50,8 +50,6 @@ Config ImportConfig(int argc, char * argv[], Config config) int main(int argc, char *argv[]) { - - int result = 0; diff --git a/unidec/src/UniDec_Main.h b/unidec/src/UniDec_Main.h index 265cd5a0..212da2b3 100644 --- a/unidec/src/UniDec_Main.h +++ b/unidec/src/UniDec_Main.h @@ -34,6 +34,10 @@ Decon ExitToBlank(const Config config, Decon decon) Decon MainDeconvolution(const Config config, const Input inp, const int silent, const int verbose) { + //Insert time + time_t starttime; + starttime = clock(); + Decon decon = SetupDecon(); char* barr = NULL; @@ -574,6 +578,8 @@ Decon MainDeconvolution(const Config config, const Input inp, const int silent, decon.uniscore = score(config, &decon, inp, scorethreshold, silent); } + // Print out time + printf("Deconvolution Time: %f\n", (float)(clock() - starttime) / CLOCKS_PER_SEC); //Free Memory free(closeval); diff --git a/unidec/tools.py b/unidec/tools.py index 525020dc..918e48fc 100644 --- a/unidec/tools.py +++ b/unidec/tools.py @@ -2166,7 +2166,7 @@ def nonlinstickconv(xvals, mztab, fwhm, psfun): window = 15 * fwhm xlen = len(xvals) stick = np.zeros(xlen) - stick[np.array(mztab[:, 2]).astype(np.int)] = mztab[:, 1] + stick[np.array(mztab[:, 2]).astype(int)] = mztab[:, 1] bool1 = [np.abs(xvals - xvals[i]) < window for i in range(0, xlen)] kernels = np.array([make_peak_shape(-xvals[bool1[i]], psfun, fwhm, -xvals[i]) for i in range(0, xlen)], dtype=object) @@ -2183,7 +2183,7 @@ def stickconv(mztab, kernel): """ xlen = len(kernel) temp = np.zeros(xlen) - temp[np.array(mztab[:, 2]).astype(np.int)] = mztab[:, 1] + temp[np.array(mztab[:, 2]).astype(int)] = mztab[:, 1] return cconv(temp, kernel) @@ -2196,7 +2196,7 @@ def sticks_only(mztab, kernel): """ xlen = len(kernel) temp = np.zeros(xlen) - temp[np.array(mztab[:, 2]).astype(np.int)] = mztab[:, 1] + temp[np.array(mztab[:, 2]).astype(int)] = mztab[:, 1] return temp @@ -2255,11 +2255,11 @@ def combine(array2): lens = lengths(array2) tup = tuple(lens) startindex = array2[:, 2] - startindex = startindex.astype(np.int) + startindex = startindex.astype(int) basemass = array2[:, 0] - basemass = basemass.astype(np.float) + basemass = basemass.astype(float) omass = array2[:, 1] - omass = omass.astype(np.float) + omass = omass.astype(float) finlist = [] for index in np.ndindex(tup): total = np.sum((index + startindex) * omass + basemass) @@ -2284,13 +2284,13 @@ def index_to_oname(index, startindex, names): def combine_all(array2): lens = lengths(array2) tup = tuple(lens) - print("Starting combining all: ", np.product(lens)) + print("Starting combining all: ", np.prod(lens)) startindex = array2[:, 2] - startindex = startindex.astype(np.int) + startindex = startindex.astype(int) basemass = array2[:, 0] - basemass = basemass.astype(np.float) + basemass = basemass.astype(float) omass = array2[:, 1] - omass = omass.astype(np.float) + omass = omass.astype(float) # names = array2[:, 4] # namelist = np.array([index for index in np.ndindex(tup)]) @@ -2403,7 +2403,7 @@ def get_glyco_indexes(oligomerlist, printoutput=False): def pair_glyco_matches(oligomasslist, oligonames, oligomerlist): oligomerlist = np.array(oligomerlist) - startindex = oligomerlist[:, 2].astype(np.int) + startindex = oligomerlist[:, 2].astype(int) sindex, hindex, gindex, findex = get_glyco_indexes(oligomerlist) @@ -2439,7 +2439,7 @@ def match(pks, oligomasslist, oligonames, oligomerlist, tolerance=None, return_n numbers = [] oligomerlist = np.array(oligomerlist) - startindex = oligomerlist[:, 2].astype(np.int) + startindex = oligomerlist[:, 2].astype(int) onames = oligomerlist[:, 4] for i in range(0, pks.plen): @@ -2493,7 +2493,7 @@ def cconv(a, b): def FD_gauss_wavelet(length, width): - xvals = np.arange(0, length).astype(np.float) + xvals = np.arange(0, length).astype(float) mu = np.round(length / 2) sigma = width return [stats.norm.pdf(x, mu, sigma) * (mu - x) / sigma ** 2 for x in xvals]