class Mspire::Sequest::Srf::Out::Peptide

0=mh 1=deltacn_orig 2=sp 3=xcorr 4=id 5=num_other_loci 6=rsp 7=ions_matched 8=ions_total 9=sequence 10=proteins 11=deltamass 12=ppm 13=aaseq 14=base_name 15=first_scan 16=last_scan 17=charge 18=srf 19=deltacn 20=deltacn_orig_updated

Constants

FourNullBytes_as_string
NewRecordStart

NewRecordStart = “00” + 0x3a.chr + 0x1a.chr + “00”

Read_32
Read_35
Sequest_record_start
Unpack_32
translation: @64=(64 bytes in to the record), E=mH, x8=8unknown bytes, e=deltacn,
x8=8unknown bytes, e=sf, e=sp, e=xcorr, I=ID#, x18=18 unknown bytes, v=rsp,
v=ions_matched, v=ions_total, x8=8unknown bytes, Z*=sequence, 240Z*=at
byte 240 grab the string (which is proteins).

Unpack_32 = ‘@64Ex8ex12eeIx18vvvx8Z*@240Z*’

Unpack_35
Unpack_Zstar
Unpack_four_null_bytes

Public Class Methods

from_io(fh, unpack_35) click to toggle source

extra_references_array is an array that grows with peptide_hits as extra references are discovered.

# File lib/mspire/sequest/srf.rb, line 683
def self.from_io(fh, unpack_35)
  ## get the first part of the info
  st = fh.read( unpack_35 ? Read_35 : Read_32 ) ## read all the hit data

  
  # sets the the first 11 attributes
  peptide = self.new( *st.unpack( unpack_35 ? Unpack_35 : Unpack_32 ) )

  # set deltacn_orig_updated
  peptide[21] = peptide[1]

  # we are slicing the reference to 38 chars to be the same length as
  # duplicate references
  peptide[11] = [Mspire::Sequest::Srf::Out::Protein.new(peptide[11][0,38])]

  peptide[14] = Mspire::Ident::Peptide.sequence_to_aaseq(peptide[10])

  fh.read(6) if unpack_35

  peptide
end
read_extra_references(fh, num_extra_references, pep_hits) click to toggle source
# File lib/mspire/sequest/srf.rb, line 634
def self.read_extra_references(fh, num_extra_references, pep_hits)
  num_extra_references.times do
    # 80 bytes total (with index number)
    pep = pep_hits[fh.read(8).unpack('x4I').first - 1]

    ref = fh.read(80).unpack('A*').first
    pep[11] << Mspire::Sequest::Srf::Out::Protein.new(ref[0,38])
  end
  #  fh.read(6) if unpack_35
end
set_deltacn_from_deltacn_orig(ar) click to toggle source

creates the deltacn that is meaningful for the top hit (the deltacn_orig or the second best hit and so on). assumes sorted

# File lib/mspire/sequest/srf.rb, line 612
def self.set_deltacn_from_deltacn_orig(ar)
  (1...ar.size).each {|i| ar[i-1].deltacn = ar[i].deltacn_orig }
  ar[-1].deltacn = 1.1
end
update_deltacns_from_xcorr(ar) click to toggle source

(assumes sorted) recalculates deltacn from xcorrs and sets deltacn_orig_updated and deltacn

# File lib/mspire/sequest/srf.rb, line 619
def self.update_deltacns_from_xcorr(ar)
  if ar.size > 0
    top_score = ar.first[4]
    other_scores = (1...(ar.size)).to_a.map do |i|
      1.0 - (ar[i][4]/top_score)
    end
    ar.first[21] = 0.0
    (0...(ar.size-1)).each do |i|
      ar[i][20] = other_scores[i]    # deltacn
      ar[i+1][21] = other_scores[i]  # deltacn_orig_updated
    end
    ar.last[20] = 1.1
  end
end

Public Instance Methods

inspect() click to toggle source
# File lib/mspire/sequest/srf.rb, line 663
def inspect
  st = %w(aaseq sequence mh deltacn_orig sf sp xcorr id rsp ions_matched ions_total proteins deltamass ppm base_name first_scan last_scan charge deltacn).map do |v| 
    if v == 'proteins'
      "#{v}(#)=#{send(v.to_sym).size}"
    elsif v.is_a? Array
      "##{v}=#{send(v.to_sym).size}"
    else
      "#{v}=#{send(v.to_sym).inspect}"
    end
  end
  st.unshift("<#{self.class}")
  if srf
    st.push("srf(base_name)=#{srf.base_name.inspect}")
  end
  st.push('>')
  st.join(' ')
  #"<Mspire::Sequest::Srf::Out::Peptide @mh=#{mh}, @deltacn=#{deltacn}, @sp=#{sp}, @xcorr=#{xcorr}, @id=#{id}, @rsp=#{rsp}, @ions_matched=#{ions_matched}, @ions_total=#{ions_total}, @sequence=#{sequence}, @proteins(count)=#{proteins.size}, @deltamass=#{deltamass}, @ppm=#{ppm} @aaseq=#{aaseq}, @base_name=#{base_name}, @first_scan=#{first_scan}, @last_scan=#{last_scan}, @charge=#{charge}, @srf(base_name)=#{srf.base_name}>"
end