Re: [spctools-discuss] Using MSFileReader API to Extract Information from Thermo RAW files

1,168 views
Skip to first unread message

Mark Wingerd

unread,
Aug 27, 2012, 5:56:55 PM8/27/12
to spctools...@googlegroups.com
Hi Josh, / Group

Back=ground Questions:

- How do they report "Noise" ??

- WHAT are they reporting when they report "Noise" ????

Thanks,

MAkr


On Mon, Aug 27, 2012 at 2:43 PM, Joshua G <goldfor...@gmail.com> wrote:
> Hi! I am tying to write a C++ program to extract Mass, Intensity and Noise information for each m/z measurement for a collection of scans in a RAW file from an Orbitrap. The libraries and documentation are provided through the following link: http://sjsupport.thermofinnigan.com/public/detail.asp?id=703
>
> I was able to write code that could use various methods provided in the library (such as Open, Close, GetMassListfromScanNum), but when I try use the methods I need (GetLabelData & GetNoiseData for example), I receive a compile time error that says "[Insert_Method] is not a member of "MSFileReader::IXRawfile'."
>
> The only difference I have been able to distinguish between the methods recognized as members and those not is explained in the xrawfile2.tlh file. All methods that work are within the IXRawFile2:IDispach scope while those that do not are in IXRawfile2:IXRawfile scope.
>
> Because there seems to be little documentation on this type of troubleshooting with MSfileReader, I figured I would contact those who have actually worked with it. If anyone has any suggestions on what to do or who to contact I would greatly appreciate it! Additionally, if anyone would like to look at the code itself, I would be happy to pass that along as well per request.
>
> Thanks,
> Josh
>
> --
> You received this message because you are subscribed to the Google Groups "spctools-discuss" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/spctools-discuss/-/QpQjT3l5aPUJ.
> To post to this group, send email to spctools...@googlegroups.com.
> To unsubscribe from this group, send email to spctools-discu...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/spctools-discuss?hl=en.
>

Michael Hoopmann

unread,
Aug 27, 2012, 6:01:52 PM8/27/12
to spctools...@googlegroups.com
Hi Josh,
Not all the methods are in the old interface. You need to access the
latest methods from IXRawfile5. A good example of how to use this
interface is in
https://proteowizard.svn.sourceforge.net/svnroot/proteowizard/trunk/pwiz/pwiz_aux/msrc/utility/vendor_api/thermo/RawFile.cpp

check the method: RawFileImpl::RawFileImpl(const string& filename)

It shows you how to access the most recent IXRawfile that can be found
in your dll.

Cheers,
Mike

Joshua G

unread,
Aug 30, 2012, 6:30:30 PM8/30/12
to spctools...@googlegroups.com
Hi Mike,

Thanks for the quick reply.  I've tried to access the latest methods by creating an instance from the XRawfile class using the following syntax:

MSfileReaderLib::IXRawfile5Ptr rawFile(null);
hr = rawFile.CreateInstance("MSFileReader.XRawfile.1");

When I compile, I receive an error that IXRawfile5Ptr is not within my library. However, when I change the syntax to:

MSfileReaderLib::IXRawfileXPtr rawFile(null);
hr = rawFile.CreateInstance("MSFileReader.XRawfile.1");
(where X = 2-4),

I do not receive a compile time error.  However, when I do try to run the program using the "GetLabelData" method, the exe stops working and the program crashes.  The syntax I used is basically the same as in the MSfilereader reference manual for the given method. 

In parallel, I have tried to contact Thermo directly regarding this issue, but I have not heard back yet.  I have very little programming experience, so any troubleshooting suggestions are welcome.

Thanks!
Josh

Darryl Davis

unread,
Aug 31, 2012, 5:44:49 AM8/31/12
to spctools...@googlegroups.com
Its a bit off topic but anyone working on extracting data from Thermo files should check out  http://code.google.com/p/unfinnigan/ .  It does a great job of detailing Thermo binaries.  

Matthew Chambers

unread,
Aug 31, 2012, 11:30:43 AM8/31/12
to spctools...@googlegroups.com
GetLabelData and GetNoiseData are in IXRawfile2, so you don't need to go all the way up to 5 unless
you need the even newer functions. As for the crashes, you probably aren't initializing the
input/output parameters correctly or you haven't run SetController before the call. You'd need to
show your actual code for more help.

-Matt


On 8/30/2012 5:30 PM, Joshua G wrote:
> Hi Mike,
>
> Thanks for the quick reply. I've tried to access the latest methods by creating an instance from
> the XRawfile class using the following syntax:
>
> MSfileReaderLib::IXRawfile5Ptr rawFile(null);
> hr = rawFile.CreateInstance("MSFileReader.XRawfile.1");
>
> When I compile, I receive an error that IXRawfile5Ptr is not within my library. However, when I
> change the syntax to:
>
> MSfileReaderLib::IXRawfile*X*Ptr rawFile(null);
> hr = rawFile.CreateInstance("MSFileReader.XRawfile.1");
> (where *X *= 2-4),
> --
> You received this message because you are subscribed to the Google Groups "spctools-discuss" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/spctools-discuss/-/nCp3Sx4LcvoJ.

Michael Hoopmann

unread,
Aug 31, 2012, 1:33:52 PM8/31/12
to spctools...@googlegroups.com
Josh,
This works for me. I think the documentation is a bit
confusing/convoluted. Rather than try to figure out what is wrong on
your end, it's just easier for me to show you what works on my end. Matt
is right that IXRawfile2 will work, but I know older versions are buggy
(from talking with the developers in Bremen). If IXRawfile4 works for
you, I suggest using it.

#include <iostream>
#import "XRawfile2.dll"
using namespace std;

int main(int argc, char* argv[]){

HRESULT lRet;
TCHAR pth[MAX_PATH];
XRAWFILE2Lib::IXRawfile4Ptr m_Raw;

CoInitialize( NULL );
HRESULT hr = m_Raw.CreateInstance("XRawfile.XRawfile.1");
if (FAILED(hr)) {
cout << "Cannot access XRawfile.dll" << endl;
return -1;
}

MultiByteToWideChar(CP_ACP,0,argv[1],-1,(LPWSTR)pth,MAX_PATH);
lRet = m_Raw->Open((LPWSTR)pth);

long nRet;
long i=1;
VARIANT varLabels;
VARIANT varFlags;
VariantInit(&varLabels);
VariantInit(&varFlags);
nRet = m_Raw->GetLabelData(&varLabels, &varFlags, &i);
cout << "GetLabelData: " << nRet << endl; //should be 0 if successful

int n;
int sz=varLabels.parray->rgsabound[0].cElements;
cout << "Array size: " << sz << endl;

double* pdval;
pdval=(double*)varLabels.parray->pvData;
for(n=0;n<sz;n++){
cout << pdval[n*6] << " " << pdval[n*6+1] << endl;
}

VariantClear(&varLabels);
VariantClear(&varFlags);

return 0;

Joshua G

unread,
Aug 31, 2012, 2:49:49 PM8/31/12
to spctools...@googlegroups.com
Mike,

It worked for me!  Thank you so much for sharing!  

-Josh


On Monday, August 27, 2012 4:43:33 PM UTC-5, Joshua G wrote:
Hi! I am tying to write a C++ program to extract Mass, Intensity and Noise information for each m/z measurement for a collection of scans in a RAW file from an Orbitrap.  The libraries and documentation are provided through the following link: http://sjsupport.thermofinnigan.com/public/detail.asp?id=703

I was able to write code that could use various methods provided in the library (such as Open, Close, GetMassListfromScanNum), but when I try use the methods I need (GetLabelData & GetNoiseData for example), I receive a compile time error that says "[Insert_Method] is not a member of "MSFileReader::IXRawfile'."  

Nathan Wamsley

unread,
Jan 4, 2016, 1:40:30 AM1/4/16
to spctools-discuss, mark.w...@gmail.com

Josh,

    I am a C++ newbie and have been asked to use MSFileReader. Would you be able to email me your code as you offered? Just learning how to use the files would be extremely helpful, and if by looking at your code I could probably do that.

Thanks,
Nathan

Nathan Wamsley

unread,
Jan 4, 2016, 1:40:31 AM1/4/16
to spctools-discuss, mark.w...@gmail.com

Josh,
     I am a C++ newbie and have been asked to use MSFileReader. Would you be able to share you code with me as you offered. It would be extremely helpful. My adress is wamsle...@gmail.com
Thanks,
Nathan
Reply all
Reply to author
Forward
0 new messages