Skip to content

Commit

Permalink
Merge pull request #35 from michaelmarty/v3
Browse files Browse the repository at this point in the history
Version 4.1.0. Added biopolymer calculator. Updates to score. Various…
  • Loading branch information
michaelmarty authored Nov 20, 2019
2 parents 50dbdaa + c0cc5df commit 99c2046
Show file tree
Hide file tree
Showing 26 changed files with 1,760 additions and 1,043 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ unidec_bin/Example Data/BSA_unidecfiles/BSA_chargedata.dat
unidec_bin/Example Data/BSA_unidecfiles/BSA_chargedata_areas.dat
unidec_bin/Example Data/BSA_unidecfiles/BSA_peakparam.dat
/__pycache__/
__pycache__/
unidec_bin/Example Data/GroEL HCD UniDec_unidecfiles/GroEL HCD UniDec_peak_areas.dat
unidec_bin/mkl_intel_thread.dll


49 changes: 40 additions & 9 deletions GUniDec.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,19 +159,19 @@ def on_open_file(self, filename, directory, skipengine=False, **kwargs):
if self.eng.config.batchflag == 0:
self.view.plot1im.contourplot(self.eng.data.rawdata3, self.eng.config, xlab="m/z (Th)",
ylab="Arrival Time (ms)", title="IM-MS Data")
#tstart = time.perf_counter()
# tstart = time.perf_counter()
# Load Config to GUI
self.import_config()
self.view.SetStatusText("Ready", number=5)
#print("ImportConfig: %.2gs" % (time.perf_counter() - tstart))
# print("ImportConfig: %.2gs" % (time.perf_counter() - tstart))
if False:
try:
self.eng.unidec_imports(everything=False)
self.after_unidec_run()
except:
pass

#print("ImportData: %.2gs" % (time.perf_counter() - tstart))
# print("ImportData: %.2gs" % (time.perf_counter() - tstart))

def on_save_state(self, e=None, filenew=None):
"""
Expand Down Expand Up @@ -425,7 +425,7 @@ def on_pick_peaks(self, e=None):
self.makeplot4(1)

self.view.SetStatusText("Peak Pick Done", number=5)
#self.on_score()
self.on_score()
pass

def on_plot_peaks(self, e=None):
Expand Down Expand Up @@ -764,7 +764,7 @@ def on_delete(self, e=None):
self.makeplot6(1)
self.view.SetStatusText("Peak Change Done", number=5)

def on_charge_states(self, e=None):
def on_charge_states(self, e=None, mass=None):
"""
Triggered by right click "plot charge states" on self.view.peakpanel.
Plots a line with text listing the charge states of a specific peak.
Expand All @@ -776,7 +776,10 @@ def on_charge_states(self, e=None):
else:
sign = "-"
charges = np.arange(self.eng.config.startz, self.eng.config.endz + 1)
peaksel = self.view.peakpanel.selection2[0]
if mass is None:
peaksel = self.view.peakpanel.selection2[0]
else:
peaksel = mass
peakpos = (peaksel + charges * self.eng.config.adductmass) / charges
boo1 = np.all([peakpos < self.eng.config.maxmz, peakpos > self.eng.config.minmz], axis=0)
peakpos = peakpos[boo1]
Expand Down Expand Up @@ -1654,12 +1657,29 @@ def on_plot_isotope_distribution(self, e=0):
def on_score(self, e=0):
self.eng.dscore()
self.view.peakpanel.add_data(self.eng.pks, show="dscore")
self.view.SetStatusText("Average Peaks Score: " + str(round(self.eng.pks.aps * 100, 2)), number=3)
self.view.SetStatusText("UniScore: " + str(round(self.eng.pks.uniscore * 100, 2)), number=3)

def on_score2(self, e=0):
self.eng.filter_peaks()
defaultvalue = "40"
try:
defaultvalue = str(self.eng.fdrs[0, 1] * 100)
except:
pass
dialog = miscwindows.SingleInputDialog(self.view)
dialog.initialize_interface(title="Minimum DScore", message="Set Minimum DScore Value (%): ",
defaultvalue=defaultvalue)
dialog.ShowModal()

try:
minval = float(dialog.value)/100.
except:
print("Error with Score Input:", dialog.value)
minval = 0.4

print("Using DScore Cutoff (%): ", minval*100)
self.eng.filter_peaks(minscore=minval)
self.view.peakpanel.add_data(self.eng.pks, show="dscore")
self.view.SetStatusText("Average Peaks Score: " + str(round(self.eng.pks.aps * 100, 2)), number=3)
self.view.SetStatusText("UniScore: " + str(round(self.eng.pks.uniscore * 100, 2)), number=3)
self.makeplot2()
self.makeplot4()
self.makeplot6()
Expand All @@ -1671,9 +1691,20 @@ def on_score_window(self, e=0):
sw.populate(self.eng.pks)
pass

def on_score_label(self, e=0):
self.on_score()
offset = 0.08 * np.amax(self.eng.data.massdat[:, 1])
for p in self.eng.pks.peaks:
text = str(int(round(p.dscore * 100)))
self.view.plot2.addtext(text, p.mass, p.height + offset, vlines=False)

# def on_remove_noise_points(self, e=0):
# self.on_dataprep_button(removenoise=True)

def on_score_FDR(self, e=0):
self.eng.estimate_FDR()


def on_flip_mode(self, e=None):
"""
Flips between MS and IM-MS mode
Expand Down
21 changes: 15 additions & 6 deletions GUniDec.spec
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ import comtypes
import encodings
import zipimport
from PyInstaller.utils.hooks import collect_data_files
from sklearn.decomposition import PCA
import sklearn.decomposition
import sklearn
from multiprocessing import freeze_support

freeze_support()
Expand Down Expand Up @@ -55,11 +52,11 @@ zipdirectory = outputdir + "_" + date + ".zip"
# Analysis of packages
a = Analysis(['Launcher.py'],
pathex=[os.getcwd()],
excludes=['pandas', 'IPython', 'Cython', 'statsmodels', 'pyopenms',
excludes=['pandas', 'IPython', 'Cython', 'statsmodels', 'pyopenms', 'sklearn',
'GdkPixbuf', 'PIL', 'pyQT4', 'pygobject', 'pygtk', 'pyside', 'PySide2', 'shiboken2', 'PyQt5'],
hiddenimports=[ # 'plotly','
'sklearn', 'sklearn.decomposition', 'sklearn.preprocessing', 'sklearn.utils', 'pytest', 'pluggy',
'sklearn.utils.testing', 'sklearn.utils._cython_blas',
# 'sklearn', 'sklearn.decomposition', 'sklearn.preprocessing', 'sklearn.utils', 'pytest', 'pluggy',
# 'sklearn.utils.testing', 'sklearn.utils._cython_blas',
'scipy.special._ufuncs_cxx', 'scipy.linalg.cython_blas', 'scipy.linalg.cython_lapack',
'scipy._lib.messagestream',
'FileDialog', 'Dialog', 'encodings', 'encodings.__init__',
Expand All @@ -85,6 +82,7 @@ if system == "Windows":
a.datas += [('readme.md', 'readme.md', 'DATA')]
a.datas += [('LICENSE', 'LICENSE', 'DATA')]
a.datas += [('libiomp5md.dll', 'unidec_bin\\libiomp5md.dll', 'DATA')]
a.datas += [('mkl_intel_thread.dll', 'unidec_bin\\mkl_intel_thread.dll', 'DATA')]
a.datas += [('ucrtbase.dll', 'unidec_bin\\ucrtbase.dll', 'DATA')]
a.datas += [('vcruntime140.dll', 'unidec_bin\\vcruntime140.dll', 'DATA')]
a.datas += [('libmypfunc.dll', 'unidec_bin\\libmypfunc.dll', 'DATA')]
Expand Down Expand Up @@ -132,6 +130,15 @@ a.datas.extend(dir_files("unidec_bin\\Example Data", 'Example Data'))
# grammar=os.path.join(os.path.dirname(lib2to3.__file__),'PatternGrammar.txt')
# a.datas.extend([(os.path.join('lib2to3','PatternGrammar.txt'),grammar,'DATA')])

from os import listdir
from PyInstaller import compat

mkldir = compat.base_prefix + "/Lib/site-packages/numpy/DLLs"
# a.datas.extend(dir_files(mkldir, ''))
#a.datas.extend(
# [(mkldir + "/" + mkl, '', 'DATA') for mkl in listdir(mkldir) if mkl.startswith('mkl_') or mkl.startswith('libio')])
# for b in binaries:
# a.datas += b

# Assemble and build
pyz = PYZ(a.pure)
Expand All @@ -154,6 +161,8 @@ coll = COLLECT(exe,
path = "C:\\Python\\UniDec3\\dist\\UniDec_Windows\\GUI_UniDec.exe"
import subprocess

print("Testing Software...", path)

out = subprocess.call(path)

if out != 0:
Expand Down
23 changes: 22 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ we have provided the source code for the GUI and API.

### Python

UniDec is currently compatible only with Python 2.7. There are several Python libraries that UniDec will depend on.
UniDec is currently compatible only with Python 3. There are several Python libraries that UniDec will depend on.

matplotlib
numpy
Expand All @@ -124,6 +124,7 @@ networkx
h5py
multiplierz (Windows only, for Thermo RAW imports)
pypubsub
tornado

All of these can be installed from the command line with (for example):

Expand Down Expand Up @@ -193,6 +194,26 @@ The main GUI class is GUniDec.UniDecApp.

## Change Log

v.4.1.0

Introduced **UniScore**. This will automatically score the quality of your peaks and the overall deconvolution. Various experimental features were also added with this to visualize and filter the scores. Some updates to the scoring algorithm from Version 4.0.2 to improve it.

A good heuristic for UniScore and DScore values is:

80-100: A (Excellent)

60-80: B (Good)

40-60: C (Fair)

20-40: D (Poor)

0-20: F (Almost certainly noise)

Added **Calculator for getting masses from Protein/Peptide or RNA sequences**. This can be launched stand alone from the Experimental Menu or by right clicking on the Oligomer and Mass Tools Oligomer Builder box.

Fixed bug to now allow protein-protein oligomerization KD values to be measured with the Data Collector. Find out more on the [UniDec Wiki Page](https://github.com/michaelmarty/UniDec/wiki/Fitting-KDs-with-Data-Collector).

v.4.0.2

Switched UniDec to load processed data if it already exists.
Expand Down
Loading

0 comments on commit 99c2046

Please sign in to comment.