Class: PSM

Inherits:
Object
  • Object
show all
Defined in:
lib/protk/psm.rb

Overview

<spectrum_query spectrum=“mr176-BSA100fmole_BA3_01_8167.00003.00003.2” start_scan=“3” end_scan=“3” precursor_neutral_mass=“1398.7082” assumed_charge=“2” index=“2” experiment_label=“mr176”> <search_result> <search_hit hit_rank=“1” peptide=“SQVFQLESTFDV” peptide_prev_aa=“R” peptide_next_aa=“K” protein=“tr|Q90853|Q90853_CHICK” protein_descr=“Homeobox protein OS=Gallus gallus GN=GH6 PE=2 SV=1” num_tot_proteins=“1” num_matched_ions=“9” tot_num_ions=“22” calc_neutral_pep_mass=“1380.6557” massdiff=“18.053” num_tol_term=“1” num_missed_cleavages=“0” is_rejected=“0”> <search_score name=“hyperscore” value=“23.9”/> <search_score name=“nextscore” value=“19.3”/> <search_score name=“bscore” value=“9.6”/> <search_score name=“yscore” value=“7.6”/> <search_score name=“cscore” value=“0”/> <search_score name=“zscore” value=“0”/> <search_score name=“ascore” value=“0”/> <search_score name=“xscore” value=“0”/> <search_score name=“expect” value=“0.099”/> <analysis_result analysis=“peptideprophet”> <peptideprophet_result probability=“0.9997” all_ntt_prob=“(0.0000,0.9997,0.9999)”> <search_score_summary> <parameter name=“fval” value=“2.3571”/> <parameter name=“ntt” value=“1”/> <parameter name=“nmc” value=“0”/> <parameter name=“massd” value=“18.053”/> </search_score_summary> </peptideprophet_result> </analysis_result> </search_hit> </search_result> </spectrum_query>

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePSM

Returns a new instance of PSM.



183
184
185
# File 'lib/protk/psm.rb', line 183

def initialize()

end

Instance Attribute Details

#calculated_mzObject

Returns the value of attribute calculated_mz.



115
116
117
# File 'lib/protk/psm.rb', line 115

def calculated_mz
  @calculated_mz
end

#chargeObject

Returns the value of attribute charge.



117
118
119
# File 'lib/protk/psm.rb', line 117

def charge
  @charge
end

#experimental_mzObject

Returns the value of attribute experimental_mz.



116
117
118
# File 'lib/protk/psm.rb', line 116

def experimental_mz
  @experimental_mz
end

#peptideObject

Returns the value of attribute peptide.



114
115
116
# File 'lib/protk/psm.rb', line 114

def peptide
  @peptide
end

#peptide_evidenceObject

Returns the value of attribute peptide_evidence.



120
121
122
# File 'lib/protk/psm.rb', line 120

def peptide_evidence
  @peptide_evidence
end

#scoresObject

Returns the value of attribute scores.



119
120
121
# File 'lib/protk/psm.rb', line 119

def scores
  @scores
end

Class Method Details

.from_mzid(psm_node, mzid_doc) ⇒ Object



166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/protk/psm.rb', line 166

def from_mzid(psm_node,mzid_doc)
  psm = new()
  psm.peptide = mzid_doc.get_sequence_for_psm(psm_node)
  peptide_evidence_nodes = mzid_doc.get_peptide_evidence_from_psm(psm_node)
  psm.peptide_evidence = peptide_evidence_nodes.collect { |pe| PeptideEvidence.from_mzid(pe,mzid_doc) }

  psm.calculated_mz = psm_node.attributes['calculatedMassToCharge'].to_f
  psm.experimental_mz = psm_node.attributes['experimentalMassToCharge'].to_f
  psm.charge = psm_node.attributes['chargeState'].to_i

  psm
end

Instance Method Details

#as_pepxmlObject

From what I can tell, search_hit is always trivially wrapped in search_result 1:1



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/protk/psm.rb', line 199

def as_pepxml()
  hit_node = XML::Node.new('search_hit')
  hit_node['peptide']=self.peptide.to_s

  # require 'byebug';byebug
  first_evidence = self.peptide_evidence.first

  hit_node['peptide_prev_aa']=first_evidence.peptide_prev_aa
  hit_node['peptide_next_aa']=first_evidence.peptide_next_aa
  hit_node['protein']=first_evidence.protein
  hit_node['protein_descr']=first_evidence.protein_descr

  hit_node['num_tot_proteins']=self.peptide_evidence.length.to_s

  alt_evidence = peptide_evidence.drop(1)
  alt_evidence.each { |ae| hit_node << ae.as_pepxml }

  result_node = XML::Node.new('search_result')
  result_node << hit_node
  result_node
end