class MzID::ParserSax::PeptideEventHandler

handler for PeptideEvent elements

Constants

ATTR
ATTR_MAP

Attributes

pbar[RW]
pep_ev_h[RW]

Public Class Methods

new(dbseq_h, num_pepev=nil) click to toggle source
# File lib/mzid/parser_sax.rb, line 122
def initialize(dbseq_h, num_pepev=nil)
  @dbseq_h = dbseq_h
  @pep_ev_h = Hash.new
  @pbar = num_pepev.nil? ? nil : ProgressBar.new("PepEv", num_pepev)
end

Public Instance Methods

attr(name, value) click to toggle source
# File lib/mzid/parser_sax.rb, line 135
def attr(name, value)
  return unless ATTR.include?(@curr_node)
  @h[name] = value if ATTR_MAP.include?(name)
end
end_element(name) click to toggle source
# File lib/mzid/parser_sax.rb, line 140
def end_element(name)
  return unless name == :PeptideEvidence
  @pbar.inc if !@pbar.nil?
  @pep_ev_h[@h[:id].to_sym] =  
    PeptideEvidence.new(:db_seq_ref => @h[:dBSequence_ref].to_sym,
                        :pep_id => @h[:peptide_ref].to_sym,
                        :start_pos => @h[:start],
                        :end_pos => @h[:end],
                        :prot_id => @dbseq_h[@h[:dBSequence_ref].to_sym],
                        :is_decoy => @h[:isDecoy])
end
start_element(name) click to toggle source
# File lib/mzid/parser_sax.rb, line 130
def start_element(name)
  @h = {} if name == :PeptideEvidence
  @curr_node = name
end