Class: Ms::Ident::Pepxml::MsmsPipelineAnalysis

Inherits:
Object
  • Object
show all
Includes:
Merge
Defined in:
lib/ms/ident/pepxml/msms_pipeline_analysis.rb

Constant Summary collapse

XMLNS =
"http://regis-web.systemsbiology.net/pepXML"
XMLNS_XSI =
"http://www.w3.org/2001/XMLSchema-instance"
XSI_SCHEMA_LOCATION_BASE =

(this doesn’t actually exist), also, the space is supposed to be there

"http://regis-web.systemsbiology.net/pepXML /tools/bin/TPP/tpp/schema/pepXML_v"
PEPXML_VERSION =

the only additions concerning a writer are from v18 are to the ‘spectrum’: retention_time_sec and activationMethodType

115

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Merge

#merge!

Constructor Details

#initialize(hash = {}, &block) ⇒ MsmsPipelineAnalysis

if block given, yields a new msms_run_summary to return value of block



39
40
41
42
43
44
45
# File 'lib/ms/ident/pepxml/msms_pipeline_analysis.rb', line 39

def initialize(hash={}, &block)
  @xmlns = XMLNS
  @xmlns_xsi = XMLNS_XSI
  @xsi_schema_location = xsi_schema_location
  @pepxml_version = PEPXML_VERSION
  merge!(hash, &block)
end

Instance Attribute Details

#dateObject

if no date string given, then it will set to Time.now



53
54
55
56
57
# File 'lib/ms/ident/pepxml/msms_pipeline_analysis.rb', line 53

def date
  return @date if @date
  tarr = Time.now.to_a 
  tarr[3..5].reverse.join('-') + "T#{tarr[0..2].reverse.join(':')}"
end

#msms_run_summaryObject

Returns the value of attribute msms_run_summary.



31
32
33
# File 'lib/ms/ident/pepxml/msms_pipeline_analysis.rb', line 31

def msms_run_summary
  @msms_run_summary
end

#pepxml_versionObject

an Integer



28
29
30
# File 'lib/ms/ident/pepxml/msms_pipeline_analysis.rb', line 28

def pepxml_version
  @pepxml_version
end

#summary_xmlObject

self referential path to the outputfile



30
31
32
# File 'lib/ms/ident/pepxml/msms_pipeline_analysis.rb', line 30

def summary_xml
  @summary_xml
end

#xmlnsObject

include SpecIDXML Version 1.2.3 attr_writer :date attr_writer :xmlns, :xmlns_xsi, :xsi_schemaLocation attr_accessor :summary_xml



24
25
26
# File 'lib/ms/ident/pepxml/msms_pipeline_analysis.rb', line 24

def xmlns
  @xmlns
end

#xmlns_xsiObject

Returns the value of attribute xmlns_xsi.



25
26
27
# File 'lib/ms/ident/pepxml/msms_pipeline_analysis.rb', line 25

def xmlns_xsi
  @xmlns_xsi
end

#xsi_schema_locationObject

returns the location based on the pepxml version number



48
49
50
# File 'lib/ms/ident/pepxml/msms_pipeline_analysis.rb', line 48

def xsi_schema_location
  @xsi_schema_location
end

Instance Method Details

#block_argObject



34
35
36
# File 'lib/ms/ident/pepxml/msms_pipeline_analysis.rb', line 34

def block_arg 
  @msms_run_summary = Ms::Ident::Pepxml::MsmsRunSummary.new
end

#to_xml(builder) ⇒ Object

uses the filename as summary_xml (if it is nil) attribute and builds a complete, valid xml document, writing it to the filename



61
62
63
64
65
66
67
# File 'lib/ms/ident/pepxml/msms_pipeline_analysis.rb', line 61

def to_xml(builder)
  xmlb = builder || Nokogiri::XML::Builder.new
  xmlb.msms_pipeline_analysis(:date => date, :xmlns => xmlns, 'xsi:schemaLocation'.to_sym => xsi_schema_location, :summary_xml => summary_xml) do |xmlb|
    msms_run_summary.to_xml(xmlb) if msms_run_summary
  end
  builder || xmlb.doc.root.to_xml
end