Class: Mspire::Mzml::Scan
- Inherits:
-
Object
- Object
- Mspire::Mzml::Scan
- Includes:
- CV::Paramable
- Defined in:
- lib/mspire/mzml/scan.rb
Instance Attribute Summary collapse
-
#from_external_source_file ⇒ Object
a boolean indicating the spectrum is from an external source file.
-
#instrument_configuration ⇒ Object
an InstrumentConfiguration object.
-
#scan_windows ⇒ Object
ScanWindow objects.
-
#spectrum ⇒ Object
(optional) the Mspire::Mzml::Spectrum object from which the precursor is derived.
Attributes included from CV::Paramable
#cv_params, #ref_param_groups, #user_params
Class Method Summary collapse
-
.from_xml(xml) ⇒ Object
takes a nokogiri node def self.from_xml(xml) end.
Instance Method Summary collapse
-
#initialize(opts = {params: []}, &block) ⇒ Scan
constructor
A new instance of Scan.
- #to_xml(builder) ⇒ Object
Methods included from CV::Paramable
#accessionable_params, #describe!, #describe_many!, #fetch, #fetch_by_accession, #param?, #param_by_accession, #params, #params?
Constructor Details
#initialize(opts = {params: []}, &block) ⇒ Scan
Returns a new instance of Scan.
23 24 25 26 |
# File 'lib/mspire/mzml/scan.rb', line 23 def initialize(opts={params: []}, &block) super(opts) block.call(self) if block end |
Instance Attribute Details
#from_external_source_file ⇒ Object
a boolean indicating the spectrum is from an external source file
15 16 17 |
# File 'lib/mspire/mzml/scan.rb', line 15 def from_external_source_file @from_external_source_file end |
#instrument_configuration ⇒ Object
an InstrumentConfiguration object
18 19 20 |
# File 'lib/mspire/mzml/scan.rb', line 18 def instrument_configuration @instrument_configuration end |
#scan_windows ⇒ Object
ScanWindow objects
21 22 23 |
# File 'lib/mspire/mzml/scan.rb', line 21 def scan_windows @scan_windows end |
#spectrum ⇒ Object
(optional) the Mspire::Mzml::Spectrum object from which the precursor is derived. (the sourceFileRef is derived from this spectrum object if from_external_source_file == true)
12 13 14 |
# File 'lib/mspire/mzml/scan.rb', line 12 def spectrum @spectrum end |
Class Method Details
.from_xml(xml) ⇒ Object
takes a nokogiri node def self.from_xml(xml) end
32 33 34 35 36 37 38 39 |
# File 'lib/mspire/mzml/scan.rb', line 32 def self.from_xml(xml) scan = self.new [:cvParam, :userParam].each {|v| scan.describe! xml.xpath("./#{v}") } scan.scan_windows = xml.xpath('./scanWindowList/scanWindow').map do |scan_window_n| Mspire::Mzml::ScanWindow.from_xml(scan_window_n) end scan end |
Instance Method Details
#to_xml(builder) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/mspire/mzml/scan.rb', line 41 def to_xml(builder) atts = {} if @from_external_source_file atts[:sourceFileRef] = @spectrum.source_file.id atts[:externalSpectrumRef] = @spectrum.id else atts[:spectrumRef] = @spectrum.id if @spectrum end atts[:instrumentConfigurationRef] = @instrument_configuration.id if @instrument_configuration builder.scan(atts) do |prec_n| super(prec_n) # description ScanWindow.list_xml(@scan_windows, prec_n) if @scan_windows end end |