class Mspire::Ident::Pepxml::Mspire::Ident::Pepxml::Mspire::Ident::Pepxml::SearchHit

Constants

DEFAULT_MEMBERS
Non_standard_amino_acid_char_re
Required
Simple

Attributes

members[W]
aaseq[RW]

Peptide aminoacid sequence (with no indicated modifications) (required)

aaseq=[RW]

Peptide aminoacid sequence (with no indicated modifications) (required)

calc_neutral_pep_mass[RW]

(required)

calc_pI[RW]
hit_rank[RW]

rank of the peptide hit (required)

is_rejected[RW]

Potential use in future for user manual validation (true/false) by default, this will be set to false (the xml is expressed as a 0 or 1)

massdiff[RW]

Mass(precursor ion) - Mass(peptide) (required)

modification_info[RW]

a ModificationInfo object

num_matched_ions[RW]

Number of peptide fragment ions found in spectrum (Integer)

num_missed_cleavages[RW]

Number of sample enzyme cleavage sites internal to peptide<

num_tol_term[RW]

Number of peptide termini consistent with cleavage by sample enzyme

num_tot_proteins[RW]

Number of unique proteins in search database containing peptide (required)

peptide[RW]

Peptide aminoacid sequence (with no indicated modifications) (required)

peptide_next_aa[RW]

Aminoacid following peptide (- if none)

peptide_prev_aa[RW]

Aminoacid preceding peptide (‘-’ if none)

protein[RW]

a protein identifier string (required)

protein_desc[RW]

Extracted from search database

protein_mw[RW]
search_scores[RW]

a Hash with keys (the score type) and values (to_xml calls each_pair to generate the xml, so a Struct would also work)

spectrum_query[RW]

a link back to the spectrum_query object

tot_num_ions[RW]

Number of peptide fragment ions predicted for peptide (Integer)

Public Class Methods

members() click to toggle source
# File lib/mspire/ident/pepxml/search_hit.rb, line 20
def members
  @members || DEFAULT_MEMBERS
end
new(*args, &block) click to toggle source

takes either a hash or an ordered list of values to set. yeilds an empty search_scores hash if given a block. mind that you set the ModificationInfo object as needed.

# File lib/mspire/ident/pepxml/search_hit.rb, line 94
def initialize(*args, &block)
  @search_scores = {}
  if args.first.is_a?(Hash)
    merge!(args.first)
  else
    self.class.members.zip(args) do |k,v|
      send("#{k}=", v)
    end
  end
  block.call(@search_scores) if block
end

Public Instance Methods

from_pepxml_node(node) click to toggle source
# File lib/mspire/ident/pepxml/search_hit.rb, line 122
def from_pepxml_node(node)
  node.attributes
  self[0] = node['hit_rank'].to_i
  self[1] = node['peptide']
  self[2] = node['peptide_prev_aa']
  self[3] = node['peptide_next_aa']
  self[4] = node['protein']  ## will this be the string?? (yes, for now)
  self[5] = node['num_tot_proteins'].to_i
  self[6] = node['num_matched_ions'].to_i
  self[7] = node['tot_num_ions'].to_i
  self[8] = node['calc_neutral_pep_mass'].to_f
  self[9] = node['massdiff'].to_f
  self[10] = node['num_tol_term'].to_i
  self[11] = node['num_missed_cleavages'].to_i
  self[12] = node['is_rejected'].to_i
  self
end
members() click to toggle source
# File lib/mspire/ident/pepxml/search_hit.rb, line 106
def members
  self.class.members
end
to_xml(builder=nil) click to toggle source
# File lib/mspire/ident/pepxml/search_hit.rb, line 110
def to_xml(builder=nil)
  xmlb = builder || Nokogiri::XML::Builder.new
  attrs = members[0,14].map {|k| v=send(k) ; [k, v] if v }.compact
  hash_attrs = Hash[attrs]
  hash_attrs[:massdiff] = hash_attrs[:massdiff].to_plus_minus_string
  xmlb.search_hit(hash_attrs) do |xmlb|
    @modification_info.to_xml(xmlb) if @modification_info
    @search_scores.each_pair {|k,v| xmlb.search_score(:name => k, :value => v) }
  end
  builder || xmlb.doc.root.to_xml
end