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
- pymzML - Python module for high throughput bioinformatics on mass spectrometry data. http://t.co/HJRqKHO5 #citeulike
- Return to work being hampered by return to work form, which is impossible to fill in on a Mac.
- Not the ideal end to the week. Blood tests and X-rays all for basically nothing. Still at least I'm home in time to have a proper weekend.
- @d_swan mine too! I assume we got the same email :)
- @jonoble I can't imagine the situation in which you would discover that...
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