Class: Ms::Sequest::Srf::Out::Pep
- Inherits:
-
Object
- Object
- Ms::Sequest::Srf::Out::Pep
- Defined in:
- lib/ms/sequest/srf.rb
Overview
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=prots 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
Constant Summary collapse
- Unpack_35 =
'@64Ex8ex8eeeIx18Ivx2vvx8Z*@246Z*'
- 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*’
'@64Ex8ex8eeeIx14Ivvvx8Z*@240Z*'
- Unpack_four_null_bytes =
'a*'
- Unpack_Zstar =
'Z*'
- Read_35 =
426
- Read_32 =
320
- FourNullBytes_as_string =
"\0\0\0\0"
- NewRecordStart =
NewRecordStart = “00” + 0x3a.chr + 0x1a.chr + “00”
0x01.chr + 0x00.chr
- Sequest_record_start =
"[SEQUEST]"
Class Method Summary collapse
- .read_extra_references(fh, num_extra_references, pep_hits) ⇒ Object
-
.set_deltacn_from_deltacn_orig(ar) ⇒ Object
creates the deltacn that is meaningful for the top hit (the deltacn_orig or the second best hit and so on).
-
.update_deltacns_from_xcorr(ar) ⇒ Object
(assumes sorted) recalculates deltacn from xcorrs and sets deltacn_orig_updated and deltacn.
Instance Method Summary collapse
-
#from_io(fh, unpack_35) ⇒ Object
extra_references_array is an array that grows with peptides as extra references are discovered.
- #inspect ⇒ Object
Class Method Details
.read_extra_references(fh, num_extra_references, pep_hits) ⇒ Object
634 635 636 637 638 639 640 641 642 643 |
# File 'lib/ms/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] << Ms::Sequest::Srf::Out::Prot.new(ref[0,38]) end # fh.read(6) if unpack_35 end |
.set_deltacn_from_deltacn_orig(ar) ⇒ Object
creates the deltacn that is meaningful for the top hit (the deltacn_orig or the second best hit and so on). assumes sorted
612 613 614 615 |
# File 'lib/ms/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) ⇒ Object
(assumes sorted) recalculates deltacn from xcorrs and sets deltacn_orig_updated and deltacn
619 620 621 622 623 624 625 626 627 628 629 630 631 632 |
# File 'lib/ms/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 |
Instance Method Details
#from_io(fh, unpack_35) ⇒ Object
extra_references_array is an array that grows with peptides as extra references are discovered.
683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 |
# File 'lib/ms/sequest/srf.rb', line 683 def from_io(fh, unpack_35) unpack = if unpack_35 ; Unpack_35 else ; Unpack_32 end ## get the first part of the info st = fh.read(( unpack_35 ? Read_35 : Read_32) ) ## read all the hit data self[0,11] = st.unpack(unpack) # set deltacn_orig_updated self[21] = self[1] # we are slicing the reference to 38 chars to be the same length as # duplicate references self[11] = [Ms::Sequest::Srf::Out::Prot.new(self[11][0,38])] self[14] = Ms::Id::Peptide.sequence_to_aaseq(self[10]) fh.read(6) if unpack_35 self end |
#inspect ⇒ Object
663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 |
# File 'lib/ms/sequest/srf.rb', line 663 def inspect st = %w(aaseq sequence mh deltacn_orig sf sp xcorr id rsp ions_matched ions_total prots deltamass ppm base_name first_scan last_scan charge deltacn).map do |v| if v == 'prots' "#{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(' ') #"<Ms::Sequest::Srf::Out::Pep @mh=#{mh}, @deltacn=#{deltacn}, @sp=#{sp}, @xcorr=#{xcorr}, @id=#{id}, @rsp=#{rsp}, @ions_matched=#{ions_matched}, @ions_total=#{ions_total}, @sequence=#{sequence}, @prots(count)=#{prots.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 |