Class: Ms::Mascot::Dat::Summary

Inherits:
Section
  • Object
show all
Includes:
Utils
Defined in:
lib/ms/mascot/dat/summary.rb,
lib/ms/mascot/dat/summary/id.rb

Overview

Summary represent summary identification information in a dat file. Summaries differ in their meaning depending on the type of search but the content is in the same format. Currently the APIs for each of these distinct searches are mashed together although a saner approach would be to separate them.

Content-Type: application/x-Mascot; name="summary"

qmass1=497.265612
qexp1=498.272888,1+
qmatch1=5360
qplughole1=0.000000
qmass2=499.248736
qexp2=500.256012,1+
qmatch2=5759
qplughole2=16.873721
...
h1=CH60_HUMAN,1.40e+03,0.48,61016.38
h1_text=60 kDa heat shock protein, mitochondrial precursor (Hsp60) (60 kDa chaperonin) (CPN60) (Heat shock 
h1_q1=-1
h1_q2=-1
...
h1_q11=0,832.382767,-0.032939,302,309,6.00,APGFGDNR,16,0000000000,45.35,1,0000002000000000000,0,0,3481.990000
h1_q11_terms=K,K
h1_q12=0,843.506577,-0.034557,345,352,7.00,VGEVIVTK,24,0000000000,45.74,2,0001002000000000000,0,0,1662.450000
h1_q12_terms=K,D
...

Summary is a standard Section and simply defines methods for convenient access. See Section for parsing details.

Interpretation

Deciphering the protein hit information requires some cross-referencing with online results. Note that each hit references each query.

hN=protein                       # protein hit N
hN_text=description              # description for hit N
hN_qM=-1                         # no peptide from query
hN_qM=query                      # match for hit N from query M
hN_qM=A,B:C,D                    # n and c-termini residues for each protein match

See the ProteinHit and QueryHit structures for interpretation of the specific hit data. –

Direct Known Subclasses

Id

Defined Under Namespace

Modules: Utils Classes: Id, ProteinHit, QueryHit

Constant Summary collapse

ProteinHitFloatIndicies =

Indicies of ProteinHit terms that will be cast to floats.

[1,2,3]
QueryHitFloatIndicies =

Indicies of QueryHit terms that will be cast to floats.

[1,2,5,9,14]
QueryHitIntIndicies =

Indicies of QueryHit terms that will be cast to integers.

[0,3,4,7,10,12,13]

Constants inherited from Section

Ms::Mascot::Dat::Section::CONTENT_TYPE_REGEXP, Ms::Mascot::Dat::Section::TO_S_FORMAT

Instance Attribute Summary

Attributes inherited from Section

#dat, #data, #section_name

Instance Method Summary collapse

Methods included from Utils

parse_protein_hit, parse_query_hit

Methods inherited from Section

parse, section_name, #to_s

Constructor Details

#initialize(data = {}, section_name = self.class.section_name, dat = nil) ⇒ Summary

Returns a new instance of Summary.



168
169
170
171
172
# File 'lib/ms/mascot/dat/summary.rb', line 168

def initialize(data={}, section_name=self.class.section_name, dat=nil)
  super(data, section_name, dat)
  @protein_hits = []
  @query_hits = []
end

Instance Method Details

#protein_hit(hit) ⇒ Object

Returns a ProteinHit at the hit index, or nil if no such hit exists.



189
190
191
192
193
# File 'lib/ms/mascot/dat/summary.rb', line 189

def protein_hit(hit)
  key = "h#{hit}"
  return nil unless str = data[key]
  @protein_hits[hit] ||= parse_protein_hit(str, data["#{key}_text"], query_hits(hit))
end

#protein_hits(resolve = true) ⇒ Object

An array of protein hits. Specify resolve=false to return just the currently parsed hits.

Note that the hits array is indexed the same as in Mascot, ie the ProteinHit for h1 is located at hits, meaning there is always an empty cell at hits.



180
181
182
183
184
185
186
# File 'lib/ms/mascot/dat/summary.rb', line 180

def protein_hits(resolve=true)
  return @protein_hits unless resolve
  
  hit = 1
  hit += 1 while protein_hit(hit)
  @protein_hits
end

#query_hit(hit, query) ⇒ Object

Returns the QueryHit at the hit and query index, or nil if no such query exists.



209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/ms/mascot/dat/summary.rb', line 209

def query_hit(hit, query)
  key = "h#{hit}_q#{query}"
  return nil unless data.has_key?(key)
  
  queries = @query_hits[hit] ||= []
  if existing_query = queries[query]
    return existing_query
  end
  
  if parsed_query = parse_query_hit(data[key], data["#{key}_terms"])
    queries[query] = parsed_query
    return parsed_query
  end
  
  nil
end

#query_hits(hit) ⇒ Object

Returns an array of QueryHits for the specified hit, or nil if no such hit exists.



197
198
199
200
201
202
203
204
205
# File 'lib/ms/mascot/dat/summary.rb', line 197

def query_hits(hit)
  query = 1
  while data.has_key?("h#{hit}_q#{query}")
    query_hit(hit, query)
    query += 1 
  end
  
  @query_hits[hit]
end