[IC:SymbolHash{ :MzXml::Scan#parse_peakso:$YARD::CodeObjects::MethodObject:@signature"{def parse_peaks @mz = [] @mzi = [] return if @e[:peaksCount] == 0 if (!@isMzData) then pkelm = @e.at('peaks') sym = Rampy::BYTEORDER[pkelm[:byteOrder]] sym.upcase! if (pkelm[:precision].to_i > 32) data = Base64.decode64(pkelm.inner_text()) if (pkelm[:compressionType] == 'zlib') data = Zlib::Inflate.inflate(data) end tmp = data.unpack("#{sym}") tmp.each_index do |idx| if (idx % 2 == 0 ) then @mz.push(tmp[idx]) else @mzi.push(tmp[idx]) end end else # first, get mz array data tmp = scan.search('mzArrayBinary/data') sym = Rampy::BYTEORDER[tmp.attr('endian')] sym.upcase! if (tmp.attr('precision').to_i > 32) @mz = Base64.decode64(tmp.text()).unpack(sym) #now for the intensity array tmp = scan.search('intenArrayBinary/data') sym = Rampy::BYTEORDER[tmp.attr('endian')] sym.upcase! if (tmp.attr('precision').to_i > 32) @mzi = Base64.decode64(tmp.text()).unpack(sym) end return 1 end:@parameters[: @lineiB: @files[["lib/mzml.rbiB: @scope: instance: @source"def parse_peaks @mz = [] @mzi = [] return if @e[:peaksCount] == 0 if (!@isMzData) then pkelm = @e.at('peaks') sym = Rampy::BYTEORDER[pkelm[:byteOrder]] sym.upcase! if (pkelm[:precision].to_i > 32) data = Base64.decode64(pkelm.inner_text()) if (pkelm[:compressionType] == 'zlib') data = Zlib::Inflate.inflate(data) end tmp = data.unpack("#{sym}") tmp.each_index do |idx| if (idx % 2 == 0 ) then @mz.push(tmp[idx]) else @mzi.push(tmp[idx]) end end else # first, get mz array data tmp = scan.search('mzArrayBinary/data') sym = Rampy::BYTEORDER[tmp.attr('endian')] sym.upcase! if (tmp.attr('precision').to_i > 32) @mz = Base64.decode64(tmp.text()).unpack(sym) #now for the intensity array tmp = scan.search('intenArrayBinary/data') sym = Rampy::BYTEORDER[tmp.attr('endian')] sym.upcase! if (tmp.attr('precision').to_i > 32) @mzi = Base64.decode64(tmp.text()).unpack(sym) end return 1 end: @name:parse_peaks:@namespaceo:#YARD::CodeObjects::ClassObject:@class_mixinsIC:&YARD::CodeObjects::CodeObjectList[: @owner@:@superclasso:YARD::CodeObjects::Proxy;: Object: @obj0;o:$YARD::CodeObjects::ModuleObject;IC;[;@; [[@ i1;: MzXml:@childrenIC;[ o:&YARD::CodeObjects::ConstantObject;"@BYTEORDER = {"little" =>"e*", "network"=>"g*", "big"=>"g*"}; i2: @value"4{"little" =>"e*", "network"=>"g*", "big"=>"g*"}; [[@ i2;"@BYTEORDER = {"little" =>"e*", "network"=>"g*", "big"=>"g*"};:BYTEORDER;@:@docstringIC:YARD::Docstring" :@tag_factoryo:YARD::Tags::Library: @factoryo:YARD::Tags::DefaultFactory: @object@: @all":@line_range0: @tags[:@ref_tags[;)[:@current_file_has_commentsFo;;"3def parse(xml) Hpricot.xml(xml).root end; [["xml0; i3; [[@ i3; ; ;"/def parse(xml) Hpricot.xml(xml).root end;: parse;@; IC;!" ;"o;#;$@;&@#;'";(0;)[;*[:@visibility: public;)[;+F:@explicitT@o;;IC;[;@1;o;;;;0;@; [[@ i;: MzFile;IC;[o;;"Zdef initialize (mzXmlFile ) @file = File.open(mzXmlFile, "r") @file.readline if (@file.readline =~ /mzData/) then @isMzData = true else @isMzData = false end @offset = parse_index_offset @index = parse_index @header = parse_header @basepeak = nil @file.pos = 0 end; [["mzXmlFile0; i}; [[@ i}; ; ;"&def initialize (mzXmlFile ) @file = File.open(mzXmlFile, "r") @file.readline if (@file.readline =~ /mzData/) then @isMzData = true else @isMzData = false end @offset = parse_index_offset @index = parse_index @header = parse_header @basepeak = nil @file.pos = 0 end;:initialize;@1; IC;!" ;"o;#;$@;&@7;'";(0;)[o:YARD::Tags::Tag : @types[" MzFile;0: @text"a new instance of +MzFile+;&@7:@tag_name" return;*[;-;.;)[;+F;/To;;"def isMzData; [; [[@ i; ; ;"!def isMzData @isMzData end;: isMzData;@1; IC;!"UBoolean determining whether the opened file is an mzData file, rather than mzXML ;"o;#;$@;&@J;'["UBoolean determining whether the opened file is an mzData file, rather than mzXML;(o: Range: begini: exclF:endi;)[;*[;-;.;)[;+To;;"def index; [; [[@ i; ; ;"def index @index end;: index;@1; IC;!"The scan index read (or computed) from the mzXML/mzData file. A Hash of {scanNum => file_position} -- should work on both file types ;"o;#;$@;&@X;'["gThe scan index read (or computed) from the mzXML/mzData file. A Hash of {scanNum => file_position}"-- "#should work on both file types;(o;7;8i;9F;:i;)[;*[;-;.;)[;+To;;"def header; [; [[@ i; ; ;"def header @header end;: header;@1; IC;!"kThe mzXML/mzData header annotations (should have some useful information in it ;-) ) as REXML::Element ;"o;#;$@;&@h;'["kThe mzXML/mzData header annotations (should have some useful information in it ;-) ) as REXML::Element;(o;7;8i;9F;:i;)[;*[;-;.;)[;+To;;"Tdef basePeak return @basepeak if @basepeak parse_base_peak end; [; i=; [[@ i[@ i=; ; ;"Hdef basePeak return @basepeak if @basepeak parse_base_peak end;: basePeak;@1; IC;!"sThe base peak chromatograph (*WARNING* Calculated the first time it is accessed, which may take a bit of time) ;"o;#;$@;&@v;'["sThe base peak chromatograph (*WARNING* Calculated the first time it is accessed, which may take a bit of time);(0;)[;*[;-:protected;)[;+T;/To;;"]def parse_index_offset return -1 if @isMzData r = %r{\(\d+)\<\/indexOffset\>} seekoffset = -120 while true self.seek(seekoffset, IO::SEEK_END) if (r.match(self.read)) then return $1.to_i end seekoffset -= 10 return -1 if seekoffset <= -1000 end end; [; i; [[@ i; ; ;"-def parse_index_offset return -1 if @isMzData r = %r{\(\d+)\<\/indexOffset\>} seekoffset = -120 while true self.seek(seekoffset, IO::SEEK_END) if (r.match(self.read)) then return $1.to_i end seekoffset -= 10 return -1 if seekoffset <= -1000 end end;:parse_index_offset;@1; IC;!",Parses the indexOffset from mzXML files ;"o;#;$@;&@;'["-Parses the indexOffset from mzXML files ;(o;7;8i;9F;:i;)[;*[;-: private;)[;+T;/To;;"def parse_index if (@offset < 0) then return compute_index end r= %r{\(\d+)\<\/offset\>} @file.pos = @offset index = {} while (!@file.eof?) next unless (r.match(@file.readline)) index[$1.to_i] = $2.to_i end ## now check the index, otherwise recompute it!!! # beginning return compute_index if index.empty? r =/\(\d+)\<\/offset\>} @file.pos = @offset index = {} while (!@file.eof?) next unless (r.match(@file.readline)) index[$1.to_i] = $2.to_i end ## now check the index, otherwise recompute it!!! # beginning return compute_index if index.empty? r =/\Return a hash of scans, where {scan number} = file offset ;"o;#;$@;&@;'[">Return a hash of scans, where {scan number} = file offset;(o;7;8i;9F;:i;)[;*[;-;@;)[;+T;/To;;"adef parse_header @file.pos = 0 r = %r{\" else xml << "" end xml.empty? ? nil : parse(xml) end; [; i; [[@ i; ; ;"%def parse_header @file.pos = 0 r = %r{\" else xml << "" end xml.empty? ? nil : parse(xml) end;:parse_header;@1; IC;!"'Parses the file header information ;"o;#;$@;&@;'["'Parses the file header information;(o;7;8i;9F;:i;)[;*[;-;@;)[;+T;/To;;"2def compute_index @file.rewind r = %r{\ max_int end @basepeak[0].push(p[0][bp_idx]) @basepeak[0].push(p[1][bp_idx]) end else numr= %r{\ max_int end @basepeak[0].push(p[0][bp_idx]) @basepeak[0].push(p[1][bp_idx]) end else numr= %r{\;)[;+F;/To;;"4def get_scan_from_curr_pos return nil if (@file.eof) xml = "" while (!@file.eof ) l = @file.readline if (l =~ /\<\/scan\>|\<\/spectrum\>/) then xml.concat(l) break end xml.concat(l) end xml.empty? ? nil : parse(xml) end; [; i; [[@ i; ; ;"def get_scan_from_curr_pos return nil if (@file.eof) xml = "" while (!@file.eof ) l = @file.readline if (l =~ /\<\/scan\>|\<\/spectrum\>/) then xml.concat(l) break end xml.concat(l) end xml.empty? ? nil : parse(xml) end;:get_scan_from_curr_pos;@1; IC;!" ;"o;#;$@;&@;'";(0;)[;*[;-;>;)[;+F;/To;;"fdef scan scanNum @file.pos = @index[scanNum] Scan.new(get_scan_from_curr_pos) end; [[" scanNum0; i'; [[@ i'; ; ;"Zdef scan scanNum @file.pos = @index[scanNum] Scan.new(get_scan_from_curr_pos) end;: scan;@1; IC;!"*Return a Scan for a given scan number ;"o;#;$@;&@;'["*Return a Scan for a given scan number"",@param [Fixnum] the scan number to grab;(o;7;8i$;9F;:i&;)[o;2 ;3[" Fixnum;"the;4"scan number to grab;&@;5" param;*[;-;>;)[;+T;/To;;"def next_scan lastPos = @file.pos while (!@file.eof ) l = @file.readline break if l =~ /\;)[;+T;/T;@1;@; IC;!" ;"o;#;$@;&@1;'";(0;)[;*[: @aliases{:@attributesIC;{: classIC;{:@symbolize_valueT; IC;{ ;;)[;+F;/To;;"_def retention_time_sec @e[:retentionTime] =~ /^PT(\d+\.\d+)S$/ $1.to_f end; [; ik; [[@ ik; ; ;"Sdef retention_time_sec @e[:retentionTime] =~ /^PT(\d+\.\d+)S$/ $1.to_f end;:retention_time_sec;@; IC;!")return the retention time in seconds ;"o;#;$@;&@q;'[")return the retention time in seconds;(o;7;8ij;9F;:ij;)[;*[;-;>;)[;+T;/To;;"1def mz(x=nil) x ? @mz[x] : @mz end; [["x"nil; iq; [[@ iq; ; ;")def mz(x=nil) x ? @mz[x] : @mz end;:mz;@; IC;!"OReturn m/z array. If an index is given, it will return that particular m/z ;"o;#;$@;&@;'["OReturn m/z array. If an index is given, it will return that particular m/z;(o;7;8ip;9F;:ip;)[;*[;-;>;)[;+T;/To;;"4def mzi(x=nil) x ? @mzi[x] : @mzi end; [["x"nil; iv; [[@ iv; ; ;",def mzi(x=nil) x ? @mzi[x] : @mzi end;:mzi;@; IC;!"[Return intensity array. If an index is given, it will return that particular intensity ;"o;#;$@;&@;'["[Return intensity array. If an index is given, it will return that particular intensity;(o;7;8iu;9F;:iu;)[;*[;-;>;)[;+T;/To;;"/def attributes @e.attributes end; [; iz; [[@ iz; ; ;"'def attributes @e.attributes end;:attributes;@; IC;!" ;"o;#;$@;&@;'";(0;)[;*[;-;>;)[;+F;/T;@;@; IC;!" ;"o;#;$@;&@;'";(0;)[;*[;H{;IIC;{;JIC;{;KT; IC;{;RIC;{;L0;M@W;KT;KT;KT;)[;+F;NIC;[o;;;;@;@ ;@; IC;!" ;"o;#;$@;&@;'";(0;)[;*[;-;>;)[;+F;/T:MzXml::MzFile#header@h:MzXml::MzFile#next_scan@:MzXml::MzFile#parse_index@:MzXml::Scan#method_missing@c:"MzXml::MzFile#parse_base_peak@:MzXml::Scan#mzi@:MzXml::MzFile#initialize@7:MzXml::MzFile#basePeak@v:MzXml::Scan#attributes@:MzXml::Scan#initialize@D:MzXml::MzFile#parse_header@:#MzXml::Scan#retention_time_sec@q:MzXml::BYTEORDER@;P@ :)MzXml::MzFile#get_scan_from_curr_pos@:MzXml::Scan#e@W;@:MzXml::MzFile#isMzData@J:MzXml#parse@#:MzXml::MzFile#scan@:%MzXml::MzFile#parse_index_offset@:MzXml::MzFile@1:MzXml::Scan@: MzXml::MzFile#compute_index@:MzXml::MzFile#index@X:MzXml::Scan#mz@;KT{" Object;J