Class: Sequest::PepXML::SearchHit
- Inherits:
-
Object
- Object
- Sequest::PepXML::SearchHit
- Includes:
- SpecID::Pep, SpecIDXML
- Defined in:
- lib/ms/sequest/pepxml.rb
Overview
0=hit_rank 1=peptide 2=peptide_prev_aa 3=peptide_next_aa 4=protein 5=num_tot_proteins 6=num_matched_ions 7=tot_num_ions 8=calc_neutral_pep_mass 9=massdiff 10=num_tol_term 11=num_missed_cleavages 12=is_rejected 13=deltacnstar 14=xcorr 15=deltacn 16=spscore 17=sprank 18=modification_info 19=spectrum_query
Defined Under Namespace
Classes: ModificationInfo
Constant Summary collapse
- Non_standard_amino_acid_char_re =
/[^A-Z\.\-]/
Class Method Summary collapse
-
.split_ions(ions) ⇒ Object
Takes ions in the form XX/YY and returns [XX.to_i, YY.to_i].
Instance Method Summary collapse
- #aaseq ⇒ Object
- #aaseq=(arg) ⇒ Object
- #from_pepxml_node(node) ⇒ Object
-
#initialize(hash = nil) ⇒ SearchHit
constructor
A new instance of SearchHit.
- #inspect ⇒ Object
- #search_score_xml(symbol) ⇒ Object
- #search_scores_xml(*symbol_list) ⇒ Object
- #to_pepxml ⇒ Object
Constructor Details
#initialize(hash = nil) ⇒ SearchHit
Returns a new instance of SearchHit.
1314 1315 1316 1317 1318 1319 1320 |
# File 'lib/ms/sequest/pepxml.rb', line 1314 def initialize(hash=nil) super(self.class.size) if hash self[0,20] = [hash[:hit_rank], hash[:peptide], hash[:peptide_prev_aa], hash[:peptide_next_aa], hash[:protein], hash[:num_tot_proteins], hash[:num_matched_ions], hash[:tot_num_ions], hash[:calc_neutral_pep_mass], hash[:massdiff], hash[:num_tol_term], hash[:num_missed_cleavages], hash[:is_rejected], hash[:deltacnstar], hash[:xcorr], hash[:deltacn], hash[:spscore], hash[:sprank], hash[:modification_info], hash[:spectrum_query]] end self end |
Class Method Details
.split_ions(ions) ⇒ Object
Takes ions in the form XX/YY and returns [XX.to_i, YY.to_i]
1330 1331 1332 |
# File 'lib/ms/sequest/pepxml.rb', line 1330 def self.split_ions(ions) ions.split("/").map {|ion| ion.to_i } end |
Instance Method Details
#aaseq ⇒ Object
1305 |
# File 'lib/ms/sequest/pepxml.rb', line 1305 def aaseq ; self[1] end |
#aaseq=(arg) ⇒ Object
1306 |
# File 'lib/ms/sequest/pepxml.rb', line 1306 def aaseq=(arg) ; self[1] = arg end |
#from_pepxml_node(node) ⇒ Object
1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 |
# File 'lib/ms/sequest/pepxml.rb', line 1362 def from_pepxml_node(node) 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 |
#inspect ⇒ Object
1324 1325 1326 1327 |
# File 'lib/ms/sequest/pepxml.rb', line 1324 def inspect var = @@attributes.map do |m| "#{m}:#{self.send(m)}" end.join(" ") "#<SearchHit #{var}>" end |
#search_score_xml(symbol) ⇒ Object
1334 1335 1336 |
# File 'lib/ms/sequest/pepxml.rb', line 1334 def search_score_xml(symbol) "#{tabs}<search_score name=\"#{symbol}\" value=\"#{send(symbol)}\"/>" end |
#search_scores_xml(*symbol_list) ⇒ Object
1338 1339 1340 1341 1342 |
# File 'lib/ms/sequest/pepxml.rb', line 1338 def search_scores_xml(*symbol_list) symbol_list.collect do |sy| search_score_xml(sy) end.join("\n") + "\n" end |
#to_pepxml ⇒ Object
1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 |
# File 'lib/ms/sequest/pepxml.rb', line 1344 def to_pepxml mod_pepxml = if self[18] self[18].to_pepxml else '' end #string = element_xml_and_att_string("search_hit", [:hit_rank, :peptide, :peptide_prev_aa, :peptide_next_aa, :protein, :num_tot_proteins, :num_matched_ions, :tot_num_ions, :calc_neutral_pep_mass, :massdiff_as_string, :num_tol_term, :num_missed_cleavages, :is_rejected]) do # note the to_plus_minus_string #puts "MASSDIFF:" #p massdiff element_xml_and_att_string("search_hit", "hit_rank=\"#{hit_rank}\" peptide=\"#{peptide}\" peptide_prev_aa=\"#{peptide_prev_aa}\" peptide_next_aa=\"#{peptide_next_aa}\" protein=\"#{protein}\" num_tot_proteins=\"#{num_tot_proteins}\" num_matched_ions=\"#{num_matched_ions}\" tot_num_ions=\"#{tot_num_ions}\" calc_neutral_pep_mass=\"#{calc_neutral_pep_mass}\" massdiff=\"#{massdiff.to_plus_minus_string}\" num_tol_term=\"#{num_tol_term}\" num_missed_cleavages=\"#{num_missed_cleavages}\" is_rejected=\"#{is_rejected}\"") do mod_pepxml + search_scores_xml(:xcorr, :deltacn, :deltacnstar, :spscore, :sprank) end end |