Class: Ms::Ident::Pepxml::SearchHit
- Inherits:
-
Object
- Object
- Ms::Ident::Pepxml::SearchHit
- Includes:
- Merge
- Defined in:
- lib/ms/ident/pepxml/search_hit.rb,
lib/ms/ident/pepxml/search_hit/modification_info.rb
Defined Under Namespace
Classes: Simple
Constant Summary collapse
- DEFAULT_MEMBERS =
[:hit_rank, :peptide, :peptide_prev_aa, :peptide_next_aa, :num_matched_ions, :tot_num_ions, :calc_neutral_pep_mass, :massdiff, :num_tol_term, :num_missed_cleavages, :is_rejected, :protein, :num_tot_proteins, :protein_desc, :calc_pI, :protein_mw, :modification_info, :search_scores, :spectrum_query]
- Required =
Set.new([:hit_rank, :peptide, :protein, :num_tot_proteins, :calc_neutral_pep_mass, :massdiff])
- Non_standard_amino_acid_char_re =
%r{[^A-Z\.\-]}
Class Attribute Summary collapse
Instance Attribute Summary collapse
-
#calc_neutral_pep_mass ⇒ Object
(required).
-
#calc_pI ⇒ Object
Returns the value of attribute calc_pI.
-
#hit_rank ⇒ Object
rank of the peptide hit (required).
-
#is_rejected ⇒ Object
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 ⇒ Object
Mass(precursor ion) - Mass(peptide) (required).
-
#modification_info ⇒ Object
a ModificationInfo object.
-
#num_matched_ions ⇒ Object
Number of peptide fragment ions found in spectrum (Integer).
-
#num_missed_cleavages ⇒ Object
Number of sample enzyme cleavage sites internal to peptide<.
-
#num_tol_term ⇒ Object
Number of peptide termini consistent with cleavage by sample enzyme.
-
#num_tot_proteins ⇒ Object
Number of unique proteins in search database containing peptide (required).
-
#peptide ⇒ Object
(also: #aaseq)
Peptide aminoacid sequence (with no indicated modifications) (required).
-
#peptide_next_aa ⇒ Object
Aminoacid following peptide (- if none).
-
#peptide_prev_aa ⇒ Object
Aminoacid preceding peptide (‘-’ if none).
-
#protein ⇒ Object
a protein identifier string (required).
-
#protein_desc ⇒ Object
Extracted from search database.
-
#protein_mw ⇒ Object
Returns the value of attribute protein_mw.
-
#search_scores ⇒ Object
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 ⇒ Object
a link back to the spectrum_query object.
-
#tot_num_ions ⇒ Object
Number of peptide fragment ions predicted for peptide (Integer).
Instance Method Summary collapse
- #from_pepxml_node(node) ⇒ Object
-
#initialize(*args, &block) ⇒ SearchHit
constructor
takes either a hash or an ordered list of values to set.
- #members ⇒ Object
- #to_xml(builder = nil) ⇒ Object
Methods included from Merge
Constructor Details
#initialize(*args, &block) ⇒ SearchHit
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.
94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/ms/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 |
Class Attribute Details
.members ⇒ Object
20 21 22 |
# File 'lib/ms/ident/pepxml/search_hit.rb', line 20 def members @members || DEFAULT_MEMBERS end |
Instance Attribute Details
#calc_neutral_pep_mass ⇒ Object
(required)
45 46 47 |
# File 'lib/ms/ident/pepxml/search_hit.rb', line 45 def calc_neutral_pep_mass @calc_neutral_pep_mass end |
#calc_pI ⇒ Object
Returns the value of attribute calc_pI.
71 72 73 |
# File 'lib/ms/ident/pepxml/search_hit.rb', line 71 def calc_pI @calc_pI end |
#hit_rank ⇒ Object
rank of the peptide hit (required)
28 29 30 |
# File 'lib/ms/ident/pepxml/search_hit.rb', line 28 def hit_rank @hit_rank end |
#is_rejected ⇒ Object
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)
59 60 61 |
# File 'lib/ms/ident/pepxml/search_hit.rb', line 59 def is_rejected @is_rejected end |
#massdiff ⇒ Object
Mass(precursor ion) - Mass(peptide) (required)
48 49 50 |
# File 'lib/ms/ident/pepxml/search_hit.rb', line 48 def massdiff @massdiff end |
#modification_info ⇒ Object
a ModificationInfo object
75 76 77 |
# File 'lib/ms/ident/pepxml/search_hit.rb', line 75 def modification_info @modification_info end |
#num_matched_ions ⇒ Object
Number of peptide fragment ions found in spectrum (Integer)
39 40 41 |
# File 'lib/ms/ident/pepxml/search_hit.rb', line 39 def num_matched_ions @num_matched_ions end |
#num_missed_cleavages ⇒ Object
Number of sample enzyme cleavage sites internal to peptide<
54 55 56 |
# File 'lib/ms/ident/pepxml/search_hit.rb', line 54 def num_missed_cleavages @num_missed_cleavages end |
#num_tol_term ⇒ Object
Number of peptide termini consistent with cleavage by sample enzyme
51 52 53 |
# File 'lib/ms/ident/pepxml/search_hit.rb', line 51 def num_tol_term @num_tol_term end |
#num_tot_proteins ⇒ Object
Number of unique proteins in search database containing peptide (required)
66 67 68 |
# File 'lib/ms/ident/pepxml/search_hit.rb', line 66 def num_tot_proteins @num_tot_proteins end |
#peptide ⇒ Object Also known as: aaseq
Peptide aminoacid sequence (with no indicated modifications) (required)
30 31 32 |
# File 'lib/ms/ident/pepxml/search_hit.rb', line 30 def peptide @peptide end |
#peptide_next_aa ⇒ Object
Aminoacid following peptide (- if none)
36 37 38 |
# File 'lib/ms/ident/pepxml/search_hit.rb', line 36 def peptide_next_aa @peptide_next_aa end |
#peptide_prev_aa ⇒ Object
Aminoacid preceding peptide (‘-’ if none)
33 34 35 |
# File 'lib/ms/ident/pepxml/search_hit.rb', line 33 def peptide_prev_aa @peptide_prev_aa end |
#protein ⇒ Object
a protein identifier string (required)
62 63 64 |
# File 'lib/ms/ident/pepxml/search_hit.rb', line 62 def protein @protein end |
#protein_desc ⇒ Object
Extracted from search database
69 70 71 |
# File 'lib/ms/ident/pepxml/search_hit.rb', line 69 def protein_desc @protein_desc end |
#protein_mw ⇒ Object
Returns the value of attribute protein_mw.
72 73 74 |
# File 'lib/ms/ident/pepxml/search_hit.rb', line 72 def protein_mw @protein_mw end |
#search_scores ⇒ Object
a Hash with keys (the score type) and values (to_xml calls each_pair to generate the xml, so a Struct would also work)
80 81 82 |
# File 'lib/ms/ident/pepxml/search_hit.rb', line 80 def search_scores @search_scores end |
#spectrum_query ⇒ Object
a link back to the spectrum_query object
83 84 85 |
# File 'lib/ms/ident/pepxml/search_hit.rb', line 83 def spectrum_query @spectrum_query end |
#tot_num_ions ⇒ Object
Number of peptide fragment ions predicted for peptide (Integer)
42 43 44 |
# File 'lib/ms/ident/pepxml/search_hit.rb', line 42 def tot_num_ions @tot_num_ions end |
Instance Method Details
#from_pepxml_node(node) ⇒ Object
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/ms/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 ⇒ Object
106 107 108 |
# File 'lib/ms/ident/pepxml/search_hit.rb', line 106 def members self.class.members end |
#to_xml(builder = nil) ⇒ Object
110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/ms/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 |