Topic: Automatically import bruker spectra on linux
mMass imports bruker spectra automatically when compassxport is installed. Unfortunately this functionality isn't available on linux. Since compassxport works perfectly via wine, the conversion can be done automatically
Quick guide
1. install compassxport (do not modify default installation location)
2. install vc runtime 2008 (winetricks vcrun2008)
3. Put mfc90.dll and vcomp90.dll near Compassxport.exe
4. apply this patch (Note: python 2.7+ is required)
diff -ru mMass/gui/dlg_preferences.py mMass_lin/gui/dlg_preferences.py
--- mMass/gui/dlg_preferences.py 2013-06-30 14:23:36.000000000 +0400
+++ mMass_lin/gui/dlg_preferences.py 2014-11-01 20:07:27.704541770 +0300
@@ -54,8 +54,7 @@
self.notebook = wx.Notebook(self, -1)
# add pages
- if wx.Platform == '__WXMSW__':
- self.notebook.AddPage(self.makeCompassPanel(), 'CompassXport')
+ self.notebook.AddPage(self.makeCompassPanel(), 'CompassXport')
self.notebook.AddPage(self.makeUpdatesPage(), 'Software Updates')
# pack elements
diff -ru mMass/gui/main_frame.py mMass_lin/gui/main_frame.py
--- mMass/gui/main_frame.py 2013-06-30 14:23:36.000000000 +0400
+++ mMass_lin/gui/main_frame.py 2014-11-02 21:32:56.081757649 +0300
@@ -3572,7 +3572,7 @@
self.tmpCompassXport = False
# check platform
- if not wx.Platform == '__WXMSW__':
+ if not wx.Platform in ('__WXMSW__', '__WXGTK__'):
wx.Bell()
dlg = mwx.dlgMessage(self, title="Unable to convert data.", message="Unfortunately, it is not possible to use Bruker's CompassXport tool\non this platform.")
dlg.ShowModal()
@@ -3634,14 +3634,32 @@
mode = choices[config.main['compassFormat']]
# convert data
- try:
- output = os.path.join(os.path.dirname(path), 'Analysis.'+config.main['compassFormat'])
- retcode = subprocess.call(['CompassXport.exe', '-a', path, '-o', output, '-raw', str(raw), '-mode', str(mode)], shell=True)
- if retcode == 0:
- self.tmpCompassXport = output
+ output = os.path.join(os.path.dirname(path), 'Analysis.'+config.main['compassFormat'])
+ if wx.Platform == '__WXMSW__':
+ try:
+ retcode = subprocess.call(['CompassXport.exe', '-a', path, '-o', output, '-raw', str(raw), '-mode', str(mode)], shell=True)
+ if retcode == 0:
+ self.tmpCompassXport = output
+ return
+ except:
return
- except:
- return
+ else:
+ try:
+ # python 2.7+ required
+ # winepath appends \n to output
+ path_wine = subprocess.check_output(['winepath', '-w', path]).strip()
+ output_wine = subprocess.check_output(['winepath', '-w', output]).strip()
+ except:
+ print sys.stderr, "Wine can't reach input file", path
+ return
+ try:
+ retcode = subprocess.call(['wine', 'c:/Program Files/Bruker Daltonik/CompassXport/CompassXport.exe', '-a', path_wine, '-o', output_wine, '-raw', str(raw), '-mode', str(mode)], shell=False)
+ if retcode == 0:
+ self.tmpCompassXport = output
+ return
+ except:
+ return
+
# ----