Module: Ms::Mascot::Dat::Summary::Utils

Included in:
Ms::Mascot::Dat::Summary
Defined in:
lib/ms/mascot/dat/summary.rb

Class Method Summary collapse

Class Method Details

.parse_protein_hit(str, desc, query_hits) ⇒ Object

Parses a ProteinHit from the hit string.



139
140
141
142
143
144
145
146
147
148
# File 'lib/ms/mascot/dat/summary.rb', line 139

def parse_protein_hit(str, desc, query_hits)
  data = str.split(",")
  ProteinHitFloatIndicies.each do |index|
    data[index] = data[index].to_f
  end
  data << desc
  data << query_hits
  
  ProteinHit.new(*data)
end

.parse_query_hit(str, terms) ⇒ Object

Parses a QueryHit from the hit-query string.



151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/ms/mascot/dat/summary.rb', line 151

def parse_query_hit(str, terms)
  return nil if str == nil || str == "-1"
  
  data = str.split(",") + terms.split(",")
  QueryHitFloatIndicies.each do |index|
    data[index] = data[index].to_f
  end
  QueryHitIntIndicies.each do |index|
    data[index] = data[index].to_i
  end
  
  QueryHit.new(*data)
end