Class: Ms::Mascot::Dat::Peptides

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

Overview

Peptides represent peptide identification information in a dat file.

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

q1_p1=-1
q2_p1=0,499.300598,-0.051862,2,LAVPT,10,0000000,3.87,0001002000000000000,0,0;"Y1319_MYCTU":0:531:535:1,"Y1353_MYCBO":0:531:535:1
q2_p1_terms=R,-:R,-
q2_p2=0,499.300598,-0.051862,2,LAVTP,10,0000000,3.87,0001002000000000000,0,0;"RLPA_RICCN":0:316:320:1
q2_p2_terms=K,-
q2_p3=0,499.336990,-0.088254,2,LAVVV,10,0000000,3.87,0001002000000000000,0,0;"DYNA_NEUCR":0:1296:1300:1
q2_p3_terms=R,-

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

Interpretation

Deciphering the peptide information requires some cross-referencing with online results. Note that a single query can match multiple peptides.

qN_pM=-1                         # no matches
qN_pM=peptide;protein_maps       # query N peptide hit M
qN_pM_terms=A,B:C,D              # n and c-termini residues for each protein match

See the Peptide and ProteinMap structures for interpretation of the specific query data.

Defined Under Namespace

Modules: Utils Classes: PeptideHit, ProteinMap

Constant Summary collapse

PeptideHitFloatIndicies =

Indicies of PeptideHit terms that will be cast to floats.

[1,2,7]
PeptideHitIntIndicies =

Indicies of PeptideHit terms that will be cast to integers.

[0,3,5,9,10]
ProteinMapIntIndicies =

Indicies of ProteinMap terms that will be cast to integers.

[1,2,3,4]

Constants inherited from Section

Section::CONTENT_TYPE_REGEXP, Section::TO_S_FORMAT

Instance Attribute Summary

Attributes inherited from Section

#dat, #data, #section_name

Instance Method Summary collapse

Methods included from Utils

parse_peptide_hit

Methods inherited from Section

parse, section_name, #to_s

Constructor Details

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

Returns a new instance of Peptides.



165
166
167
168
# File 'lib/ms/mascot/dat/peptides.rb', line 165

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

Instance Method Details

#peptide_hit(query, hit = 1) ⇒ Object

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



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/ms/mascot/dat/peptides.rb', line 194

def peptide_hit(query, hit=1)
  key = "q#{query}_p#{hit}"
  return nil unless data.has_key?(key)
  
  hits = @queries[query] ||= []
  if existing_hit = hits[hit]
    return existing_hit
  end
  
  if parsed_hit = parse_peptide_hit(data[key], data["#{key}_terms"])
    parsed_hit.query_num = query
    parsed_hit.hit_num = hit
    hits[hit] = parsed_hit
    return parsed_hit
  end
  
  nil
end

#peptide_hits(query) ⇒ Object

Returns an array of PeptideHits for the specified query, or nil if no such query exists.



186
187
188
189
190
# File 'lib/ms/mascot/dat/peptides.rb', line 186

def peptide_hits(query)
  hit = 1
  hit += 1 while peptide_hit(query, hit)
  @queries[query]
end

#queries(resolve = true) ⇒ Object

An array of peptides hits per query. Specify resolve=false to return the currently parsed queries.

Note that the queries array is indexed the same as in Mascot, ie the PeptideHit for q1_p1 is located at queries[1], meaning there is always an empty cell at queries.



176
177
178
179
180
181
182
# File 'lib/ms/mascot/dat/peptides.rb', line 176

def queries(resolve=true)
  return @queries unless resolve
  
  query = 1
  query += 1 while peptide_hits(query)
  @queries
end