Class: MS::Parser::MzXML::XMLParser::PrecMzByNum

Inherits:
MS::Parser::MzXML::XMLParser show all
Defined in:
lib/ms/parser/mzxml/xmlparser.rb

Constant Summary

Constants included from MS::Parser::MzXML

Base_dir_for_parsers

Constants included from XMLStyleParser

XMLStyleParser::File_required, XMLStyleParser::Parser_precedence

Constants included from MS::Parser

MS::Parser::Mzdata_regexp, MS::Parser::Mzxml_regexp

Instance Attribute Summary collapse

Attributes included from XMLStyleParser

#method

Attributes included from MS::Parser

#version

Instance Method Summary collapse

Methods inherited from MS::Parser::MzXML::XMLParser

#msrun, #prec_mz_by_scan_num, #times_and_spectra

Methods included from XMLParserWrapper

#parse_and_report, #parse_and_report_io, #parse_and_report_string

Methods included from MS::Parser::MzXML

#_el, #basic_info, fix_bad_scan_tags, fix_bad_scan_tags_from_io, has_bad_scan_tag?, has_bad_scan_tag_from_io?, has_bad_scan_tag_from_string?, new, #precursor_mz_and_inten_by_scan, #precursor_mz_by_scan_for_path, #precursor_mz_by_scan_num, #scans_by_num, #start_and_end_mz

Methods included from XMLStyleParser

available_xml_parsers, choose_parser, #parse, require_parse_files, require_parsers

Methods included from MS::Parser

filetype_and_version, new

Constructor Details

#initializePrecMzByNum

Returns a new instance of PrecMzByNum.



129
130
131
# File 'lib/ms/parser/mzxml/xmlparser.rb', line 129

def initialize
  @prec_mz = [] 
end

Instance Attribute Details

#prec_mzObject Also known as: report

Returns the value of attribute prec_mz.



126
127
128
# File 'lib/ms/parser/mzxml/xmlparser.rb', line 126

def prec_mz
  @prec_mz
end

Instance Method Details

#character(data) ⇒ Object



149
150
151
152
153
# File 'lib/ms/parser/mzxml/xmlparser.rb', line 149

def character(data)
  if @get_data
    @current_prec_mz << data
  end
end

#endElement(name) ⇒ Object



142
143
144
145
146
147
# File 'lib/ms/parser/mzxml/xmlparser.rb', line 142

def endElement(name)
  if name == "precursorMz"
    @get_data = false
    @prec_mz[@scan_num] = @current_prec_mz.to_f
  end
end

#startElement(name, attrs) ⇒ Object



133
134
135
136
137
138
139
140
# File 'lib/ms/parser/mzxml/xmlparser.rb', line 133

def startElement(name,attrs)
  if name == "scan"
    @scan_num = attrs["num"].to_i
  elsif name == "precursorMz"
    @current_prec_mz = ""
    @get_data = true
  end
end