Class: Mspire::Mzml::DataProcessing

Inherits:
Object
  • Object
show all
Extended by:
List
Defined in:
lib/mspire/mzml/data_processing.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from List

list_xml, list_xml_element

Constructor Details

#initialize(id, processing_methods = []) {|_self| ... } ⇒ DataProcessing

yields self if given a block

Yields:

  • (_self)

Yield Parameters:



12
13
14
15
# File 'lib/mspire/mzml/data_processing.rb', line 12

def initialize(id, processing_methods=[])
  @id, @processing_methods = id, processing_methods
  yield(self) if block_given?
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



9
10
11
# File 'lib/mspire/mzml/data_processing.rb', line 9

def id
  @id
end

#processing_methodsObject

Returns the value of attribute processing_methods.



9
10
11
# File 'lib/mspire/mzml/data_processing.rb', line 9

def processing_methods
  @processing_methods
end

Class Method Details

.from_xml(xml, link) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/mspire/mzml/data_processing.rb', line 31

def self.from_xml(xml, link)
  processing_methods = xml.children.map do |pm_n| 
    ProcessingMethod.new(link[:software_hash][pm_n[:softwareRef]])
      .describe_self_from_xml!(pm_n, link[:ref_hash])
  end
  self.new(xml[:id], processing_methods)
end

Instance Method Details

#order(processing_method) ⇒ Object

returns the order of the processing method



27
28
29
# File 'lib/mspire/mzml/data_processing.rb', line 27

def order(processing_method)
  processing_methods.index(processing_method)
end

#to_xml(builder) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/mspire/mzml/data_processing.rb', line 17

def to_xml(builder)
  builder.dataProcessing( id: @id ) do |dp_n|
    processing_methods.each_with_index do |processing_method,order|
      processing_method.to_xml(dp_n, order)
    end
  end
  builder
end