class Proph::ProtSummary::Parser

Attributes

prot_groups[RW]

Public Class Methods

new(file=nil, with_peps=false, tp='axml') click to toggle source
# File lib/ms/ident/pepxml/prot_summary.rb, line 74
def initialize(file=nil, with_peps=false, tp='axml')
  if file
    @prot_groups = parse_file(file, with_peps, tp)
  end
end

Public Instance Methods

_parse_for_prot_groups(stream, with_peps=false, tp='axml') click to toggle source

returns an array of ProtGroup objects

# File lib/ms/ident/pepxml/prot_summary.rb, line 89
def _parse_for_prot_groups(stream, with_peps=false, tp='axml')
  prtgrps = []
  case tp
  when 'axml'
    root = AXML.parse(stream)
    root.protein_group.each do |protein_group|
      pg = ProtGroup.new(protein_group.attrs) do 
        protein_group.map do |protein|
          Prot.new(protein.attrs)
        end
      end
      prtgrps << pg 
    end
  end
  prtgrps
end
parse_file(file, with_peps=false, tp='axml') click to toggle source

returns an array of protein_groups

# File lib/ms/ident/pepxml/prot_summary.rb, line 81
def parse_file(file, with_peps=false, tp='axml')
  File.open(file) do |fh|
    @prot_groups = _parse_for_prot_groups(fh, with_peps, tp)
  end
  @prot_groups
end