In a rare move, I’m going to largely copy across a post from my work blog, because I hope it contains useful information. For background, I’m trying to write a simple python script that extracts particular metadata from a .RAW file, produced by a Thermo Finnigan mass spectrometer. Tools that exist for parsing these files require access to proprietary XCalibur libraries, which I do not have.
Thermo provided a link to MSFileReader, a ‘freeware’ COM object that should allow interaction with RAW files without an XCalibur installation. They also sent a PDF guide to the COM object. Although this will allow XCalibur to be avoided, the work is still Windows-bound.
Python and COM objects
Python can talk to COM objects, through the win32com.client package. As a test, I installed Python and MSFileReader and the pywin32 libs on my netbook (which is a Windows 7 machine). Can import the required Python module, but need to extent the PATH somewhat:
-
>>> sys.path.append('C:\\Python26\\Lib\\site-packages\\win32')
-
>>> sys.path.append('C:\\Python26\\Lib\\site-packages\\win32\\lib')
-
>>> from win32com.client import Dispatch
-
>>> x = Dispatch("NAME")
The key thing here is “NAME”:
The provided PDF gives C snippets for each method available in the COM object. This only provides one clue as to the possible name of the COM object
-
// example for Open
-
TCHAR* szPathName[] = _T(“c:\\xcalibur\\examples\\data\\steroids15.raw”);
-
long nRet = XRawfileCtrl.Open( szPathName );
-
if( nRet != 0 ) {
-
::MessageBox( NULL, _T(“Error opening file”), _T(“Error”), MB_OK );
-
…
-
}
XRawfileCtrl is used to call the Open() method. However, this and MSFileReader as “NAME” both fail (Invalid class string).
Found ‘multiplierz‘ which seems to use MSFileReader to create mzAPI – which focusses on access to the actual data, rather than the metadata. The code gives some good clues as to how to use the COM object. [doi:10.1186/1471-2105-10-364]
MSFileReader.XRawfile is used as “NAME” in this code.
So:
-
>>> sys.path.append('C:\\Python26\\Lib\\site-packages\\win32')
-
>>> sys.path.append('C:\\Python26\\Lib\\site-packages\\win32\\lib')
-
>>> from win32com.client import Dispatch
-
>>> x = Dispatch("MSFileReader.XRawfile")
-
>>> x.Open("C:\\Users\\path\\to\\file\\msfile.RAW")
-
>>>
To be continued…
One Response to Parsing Thermo Finnigan RAW files
Leave a Reply Cancel reply
Archives
Categories
Tags
About Me Astronomy badscience BBC biosysbio Blog citations Conference creative-commons doom friendfeed kblog knowledgeblog lifefeed microblog MMR naming netbook news obama open-data Open Access personal politics posterous president protein-protein interactions proteomics Radio referencing Research Blogging Review science scienceisvital Software solo10 space statistics telescopes testing trivia twitter wiki wordle workTwitter
- Why Nikola Tesla was the greatest geek who ever lived http://t.co/ic6IodmQ #greader
- and it all started out so simply⦠#nclswc #conflictathon http://t.co/ub3TdjER
- Glad #nclswc is teaching Mercuial, best of all the DVCSs (IMHO). About to have a BitBucket conflict-a-thon.
- folks new to bash at #nclswc - man files are your new best friend, use them wisely :)
- Greycite: Citing the Web http://t.co/MxUx9PJ8 #greader
On Fuzzier Logic






Hi,
I’m trying too to parse the Thermo .raw files, did you continue this quest any further ? I would be very glad to hear from this ! Thanks and keep going