...
 
Commits (9)
......@@ -13,7 +13,7 @@ from . import zcetools_help
from . import reactivitytools
__version__ = "0.0.25"
__version__ = "0.0.32"
__all__ = ['config', 'datatools', 'docks', 'drltools', 'drltoos_gui', 'filetools',
......
......@@ -49,11 +49,15 @@ def show_exception_and_exit(exc_type, exc_value, tb):
return
import traceback
traceback.print_exception(exc_type, exc_value, tb)
errmsg = "\n".join(traceback.format_exception(exc_type, exc_value, tb))\
details = "\n".join(traceback.format_exception(exc_type, exc_value, tb))
errmsg = "\n".join(traceback.format_exception_only(exc_type, exc_value))\
+ ("\n The program might misbehave, do you want to continue?")
outmsg = QtWidgets.QMessageBox.critical(None, "Exception!", errmsg,
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
if outmsg != QtWidgets.QMessageBox.Yes:
msgbox = QtWidgets.QMessageBox(
3, "Exception!", errmsg,
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
msgbox.setDetailedText(details)
outvalue = msgbox.exec_()
if outvalue != QtWidgets.QMessageBox.Yes:
sys.exit(-1)
......@@ -277,10 +281,12 @@ def main():
p_logger = logging.getLogger('parseLogger')
params_logger = logging.getLogger('acqLogLogger')
drl_logger = logging.getLogger('drlLogger')
zce_logger = logging.getLogger('zceLogger')
zce_logger = logging.getLogger('zcelogger')
rxn_logger = logging.getLogger('reactivityLogger')
logging.basicConfig()
# p_logger.setLevel("WARN")
p_logger.setLevel("DEBUG")
rxn_logger.setLevel("DEBUG")
# drl_logger.setLevel("INFO")
drl_logger.setLevel("DEBUG")
zce_logger.setLevel("DEBUG")
......@@ -437,8 +443,8 @@ def main():
load_file(main_window, augCanvas, update, config, loadthread,
filename=sys.argv[1])
else:
gt.pop_plot(0, 0, augCanvas.spectplot, augCanvas.ms)
gt.pop_plot(0, 0, augCanvas.chromplot, augCanvas.chrom)
gt.pop_plot([], [], augCanvas.spectplot, augCanvas.ms)
gt.pop_plot([], [], augCanvas.chromplot, augCanvas.chrom)
main_window.show()
sys.exit(app.exec_())
......
......@@ -22,10 +22,6 @@ def settings():
("imggen/xtics", 5),
("imggen/onlymanann", False),
("reactivity/index", 0),
("reactivity/coef1", 0),
("reactivity/coef2", 0),
("reactivity/transparency", 200),
("reactivity/markersize", 10),
("recents", "")}
[settings.setValue(*i)
for i in defvals if not settings.contains(i[0])]
......
......@@ -15,21 +15,19 @@ def argsubselect(array, minimum, maximum):
return args
def specttostr(augCanvas, delim=" "):
lines = augCanvas.spectplot.get_lines()
def specttostr(augCanvas, delim=" ", names=["mass","ion_count"], units=["m/z",""], description = ""):
lines = augCanvas.get_lines()
setnum = len(lines)
names = delim.join(["mass ion_count" for i in range(setnum)])
units = (delim+delim).join(["m/z" for i in range(setnum)])
description = ("{}_{:.4}-{:.4}_minutes_of_the_aquisition\n".format(
os.path.basename(augCanvas.filename),
augCanvas.chrom['t_start'], augCanvas.chrom['t_end']))
header = "\n".join([names, units, description])
formnames = delim.join([delim.join(names) for i in range(setnum)])
formunits = (delim).join([delim.join(units) for i in range(setnum)])
header = "\n".join([formnames, formunits, description])+"\n"
strdata = []
for i in range(np.max([len(line.get_xdata()) for line in lines])):
pairs = [("{}"+delim+"{}").format(
line.get_xdata()[i], line.get_ydata()[i]) if
i < len(line.get_xdata()) else delim for line in lines]
i < len(line.get_xdata()) else "--"+delim+"--"
for line in lines]
strline = delim.join(pairs)+"\n"
strdata.append(strline)
strdata = "".join(strdata)
......@@ -37,7 +35,10 @@ def specttostr(augCanvas, delim=" "):
def clip_spectstr(augCanvas):
string = specttostr(augCanvas, delim="\t")
description = ("{}_{:.4}-{:.4}_minutes_of_the_aquisition".format(
os.path.basename(augCanvas.filename),
augCanvas.chrom['t_start'], augCanvas.chrom['t_end']))
string = specttostr(augCanvas.spectplot, delim="\t", description=description)
QtWidgets.QApplication.clipboard().clear()
[QtWidgets.QApplication.clipboard().setText(string, i) for i in range(2)]
......
......@@ -66,7 +66,7 @@ def update_drlspectrum(ds, drls, drlspectrum):
names, times, intensities = drl.get_daughterset(ds, drls)
drlspectrum.clear()
gt.pop_plot(0, 0, drlspectrum, drls['graphlabels'])
gt.pop_plot([], [], drlspectrum, drls['graphlabels'])
drlspectrum.axvline(0, 0, 0.9, color="#FF000088", linestyle=":")
if drls['cutoff'].value() != 0:
......@@ -416,7 +416,7 @@ def print_graph(ds, drls):
printfig = Figure(figsize=(5, 2), dpi=100)
printplot = printfig.add_subplot(111)
printcanvas = FigureCanvas(printfig)
gt.pop_plot(0, 0, printplot, drls['graphlabels'])
gt.pop_plot([], [], printplot, drls['graphlabels'])
update_drlspectrum(ds, drls, printplot)
widget = QtWidgets.QDialog(None, windowTitle='Print preview')
layout = QtWidgets.QVBoxLayout(widget)
......@@ -572,7 +572,7 @@ def main_window(parent, augCanvas, update_signal):
graph_canvas.setAutoFillBackground(False)
gt.pan_factory(chromplot)
gt.zoom_factory(chromplot, 1.15)
gt.pop_plot(0, 0, chromplot, drls['graphlabels'])
gt.pop_plot([], [], chromplot, drls['graphlabels'])
dcolums = ["Name"]
for i in range(drls['cors'].value()):
......
......@@ -37,6 +37,9 @@ def export_dial(augCanvas, main_window):
exp_f_name = get_save_filename(
"Export spectrum", "dat table (*.dat)", "dat", main_window)
if exp_f_name != '':
description = ("{}_{:.4}-{:.4}_minutes_of_the_aquisition".format(
os.path.basename(augCanvas.filename),
augCanvas.chrom['t_start'], augCanvas.chrom['t_end']))
expf = open(exp_f_name, 'w')
expf.write(dt.specttostr(augCanvas))
expf.write(dt.specttostr(augCanvas.spectplot, description=description))
expf.close
......@@ -401,11 +401,6 @@ def ann_spec(ms_spec, msdata, ann_limit=0.01):
peakline = np.empty([len(maxargs)], dtype=[('x', np.float32), ('y', np.float32)])
peakline['x'], peakline['y'] = xdata[maxargs], ydata[maxargs]
peaks.append(peakline)
peaks = np.concatenate(peaks)
s_peaks = sub_peaks(peaks, msdata['texts'],
np.diff(ms_spec.get_xlim()),
np.diff(ms_spec.get_ylim()))
# delete objects from the spectra
for intensity in msdata['annotation']:
......@@ -413,6 +408,14 @@ def ann_spec(ms_spec, msdata, ann_limit=0.01):
# remove them from tracking
msdata['annotation'].clear()
if len(peaks) == 0:
return
peaks = np.concatenate(peaks)
s_peaks = sub_peaks(peaks, msdata['texts'],
np.diff(ms_spec.get_xlim()),
np.diff(ms_spec.get_ylim()))
dispints = cf.settings().value("view/intensities", type=bool)
for peak in s_peaks:
annotation = '{0:.2f}\n{1: .2e}'.format(peak[0], peak[1])\
......@@ -425,8 +428,9 @@ def ann_spec(ms_spec, msdata, ann_limit=0.01):
def pop_plot(xdata, ydata, plot, plot_data, colornum=0, legend=None, annotate=True):
"""Define and populate plot"""
plot.plot(xdata, ydata, linewidth=1, color=(
colors[colornum % len(colors)]/255), label=legend)
if len(xdata):
plot.plot(xdata, ydata, linewidth=1, color=(
colors[colornum % len(colors)]/255), label=legend)
plot.set_title(plot_data['name'], loc="right")
plot.set_xlabel(plot_data['xlabel'])
plot.set_ylabel(plot_data['ylabel'])
......
This diff is collapsed.