class ProtXMLWriter

Constants

PROTXML_NS
PROTXML_NS_PREFIX

Attributes

protein_summary_node[R]
template_doc[R]

Public Class Methods

new() click to toggle source
# File lib/protk/protxml_writer.rb, line 12
def initialize
        template_path="#{File.dirname(__FILE__)}/data/template_prot.xml"
        template_parser=XML::Parser.file(template_path)#,:options => XML::Parser::Options::NOBLANKS)
        @template_doc=template_parser.parse
        @protein_summary_node=@template_doc.root
        # @protein_summary_node.space_preserve=true
        @protein_summary_node.content=""
        puts @template_doc

end

Public Instance Methods

append_dataset_derivation() click to toggle source
# File lib/protk/protxml_writer.rb, line 33
def append_dataset_derivation()
        ddnode = XML::Node.new('dataset_derivation')
        ddnode["generation_no"]="0"
        @protein_summary_node << ddnode
end
append_header(header_node) click to toggle source
# File lib/protk/protxml_writer.rb, line 23
def append_header(header_node)
        # require 'byebug';byebug
        @protein_summary_node << header_node.as_protxml
end
append_protein_group(pg_node) click to toggle source
# File lib/protk/protxml_writer.rb, line 28
def append_protein_group(pg_node)
        # require 'byebug';byebug
        @protein_summary_node << pg_node
end
save(file_path) click to toggle source
# File lib/protk/protxml_writer.rb, line 39
def save(file_path)
        # puts XML.indent_tree_output
        # puts "|#{XML.default_tree_indent_string}|"
        XML.indent_tree_output = true
        # puts @template_doc.to_s
        @template_doc.save(file_path,:indent=>true,:encoding => XML::Encoding::UTF_8)
end