Class: ProtXMLWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/protk/protxml_writer.rb

Constant Summary collapse

PROTXML_NS_PREFIX =
"protxml"
PROTXML_NS =
"http://regis-web.systemsbiology.net/protXML"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeProtXMLWriter

Returns a new instance of ProtXMLWriter.



11
12
13
14
15
16
# File 'lib/protk/protxml_writer.rb', line 11

def initialize
  template_path="#{File.dirname(__FILE__)}/data/template_prot.xml"
  template_parser=XML::Parser.file(template_path)
  @template_doc=template_parser.parse
  @protein_summary_node=@template_doc.root
end

Instance Attribute Details

#protein_summary_nodeObject (readonly)

Returns the value of attribute protein_summary_node.



9
10
11
# File 'lib/protk/protxml_writer.rb', line 9

def protein_summary_node
  @protein_summary_node
end

#template_docObject (readonly)

Returns the value of attribute template_doc.



8
9
10
# File 'lib/protk/protxml_writer.rb', line 8

def template_doc
  @template_doc
end

Instance Method Details

#append_protein_group(pg_node) ⇒ Object



18
19
20
21
# File 'lib/protk/protxml_writer.rb', line 18

def append_protein_group(pg_node)
  # require 'byebug';byebug
  @protein_summary_node << pg_node
end

#save(file_path) ⇒ Object



23
24
25
# File 'lib/protk/protxml_writer.rb', line 23

def save(file_path)
  @template_doc.save(file_path,:indent=>true,:encoding => XML::Encoding::UTF_8)
end