line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Xcalibur::Rawfile; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
require 5.8.0; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
2182
|
use Win32::OLE; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Win32::OLE::Variant; |
7
|
|
|
|
|
|
|
use Exporter; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @EXPORT_OK = qw( contains_ms2 ); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = 0.1; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub contains_ms2{ |
14
|
|
|
|
|
|
|
my $rawfile = shift; |
15
|
|
|
|
|
|
|
Win32::OLE->Option( Warn => 3 ); |
16
|
|
|
|
|
|
|
# type comes from c:\Xcalibur\system\programs\XRawfile2.dll |
17
|
|
|
|
|
|
|
my $x = eval{ |
18
|
|
|
|
|
|
|
Win32::OLE->new('XRawfile.XRawfile.1', sub{ $_[0]->Close } ); |
19
|
|
|
|
|
|
|
}; |
20
|
|
|
|
|
|
|
if($@){ |
21
|
|
|
|
|
|
|
die "Could not create XRawfile object.\nDo you have the Xcalibur Development Kit installed?\nWin32::OLE error was: $@\n"; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
$x->Open( $rawfile ); |
24
|
|
|
|
|
|
|
$x->SetCurrentController( 0, 1 ); # mass spec device, first MS device |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# print $x->GetFilters( $var, $lng ); |
27
|
|
|
|
|
|
|
# $var needs to be initialized to VT_EMPTY and VT_BYREF with VT_ARRAY returned |
28
|
|
|
|
|
|
|
# Win32::OLE::Variant doesn't let us do that |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# my $i = Win32::OLE::Variant->new(VT_I4|VT_BYREF, 0); |
31
|
|
|
|
|
|
|
# $x->GetNumSpectra($i); |
32
|
|
|
|
|
|
|
# print $i; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $first = Win32::OLE::Variant->new(VT_I4|VT_BYREF,0); |
35
|
|
|
|
|
|
|
my $last = Win32::OLE::Variant->new(VT_I4|VT_BYREF,0); |
36
|
|
|
|
|
|
|
$x->GetFirstSpectrumNumber($first); |
37
|
|
|
|
|
|
|
$x->GetLastSpectrumNumber($last); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
for my $i ( $first .. $last ){ |
40
|
|
|
|
|
|
|
# do not pass an initialization value to new or it won't work |
41
|
|
|
|
|
|
|
# this requires Activestate perl 5.8.* |
42
|
|
|
|
|
|
|
my $filter = Win32::OLE::Variant->new(VT_BSTR|VT_BYREF); |
43
|
|
|
|
|
|
|
$x->GetFilterForScanNum($i,$filter); |
44
|
|
|
|
|
|
|
return 1 if $filter =~ /\sms2\s/i; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
return 0; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |