ms-sequest 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +26 -10
- data/Gemfile +4 -1
- data/Gemfile.lock +17 -2
- data/VERSION +1 -1
- data/bin/srf_to_pepxml.rb +7 -0
- data/bin/srf_to_search.rb +1 -1
- data/lib/ms/sequest/bioworks.rb +2 -2
- data/lib/ms/sequest/params.rb +0 -20
- data/lib/ms/sequest/pepxml.rb +7 -245
- data/lib/ms/sequest/pepxml/modifications.rb +247 -0
- data/lib/ms/sequest/pepxml/params.rb +32 -0
- data/lib/ms/sequest/sqt.rb +17 -17
- data/lib/ms/sequest/srf.rb +64 -54
- data/lib/ms/sequest/srf/pepxml.rb +316 -0
- data/lib/ms/sequest/srf/pepxml/sequest.rb +21 -0
- data/lib/ms/sequest/srf/sqt.rb +1 -1
- data/spec/ms/sequest/bioworks_spec.rb +11 -11
- data/spec/ms/sequest/pepxml/modifications_spec.rb +50 -0
- data/spec/ms/sequest/pepxml_spec.rb +0 -65
- data/spec/ms/sequest/srf/pepxml_spec.rb +84 -0
- data/spec/ms/sequest/srf_spec.rb +3 -3
- data/spec/ms/sequest/srf_spec_helper.rb +2 -2
- data/spec/spec_helper.rb +17 -18
- metadata +73 -19
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
module Ms ; end
|
3
|
+
module Ms::Sequest ; end
|
4
|
+
|
5
|
+
class Ms::Sequest::Params
|
6
|
+
|
7
|
+
# returns a Ms::Ident::Pepxml::SampleEnzyme object
|
8
|
+
def sample_enzyme
|
9
|
+
Ms::Ident::Pepxml::SampleEnzyme.new(sample_enzyme_hash)
|
10
|
+
end
|
11
|
+
|
12
|
+
# returns a hash suitable for setting a Ms::Ident::Pepxml::SampleEnzyme object
|
13
|
+
def sample_enzyme_hash
|
14
|
+
(offset, cleave_at, except_if_after) = enzyme_specificity.map do |v|
|
15
|
+
if v == '' ; nil ; else v end
|
16
|
+
end
|
17
|
+
hash = {}
|
18
|
+
hash[:name] = self.enzyme
|
19
|
+
hash[:cut] = cleave_at
|
20
|
+
hash[:no_cut] = except_if_after
|
21
|
+
hash[:sense] =
|
22
|
+
if hash[:name] == "No_Enzyme"
|
23
|
+
nil
|
24
|
+
elsif offset == 1
|
25
|
+
'C'
|
26
|
+
elsif offset == 0
|
27
|
+
'N'
|
28
|
+
end
|
29
|
+
hash
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
data/lib/ms/sequest/sqt.rb
CHANGED
@@ -6,13 +6,13 @@ require 'ms/fasta'
|
|
6
6
|
require 'digest/md5'
|
7
7
|
|
8
8
|
|
9
|
-
require 'ms/
|
10
|
-
require 'ms/
|
9
|
+
require 'ms/ident/peptide'
|
10
|
+
require 'ms/ident/search'
|
11
11
|
|
12
12
|
module Ms
|
13
13
|
module Sequest
|
14
14
|
class SqtGroup
|
15
|
-
include Ms::
|
15
|
+
include Ms::Ident::SearchGroup
|
16
16
|
|
17
17
|
#attr_accessor :sqts, :filenames
|
18
18
|
|
@@ -28,7 +28,7 @@ module Ms
|
|
28
28
|
super(arg, opts.merge(indiv_opts)) do
|
29
29
|
unless orig_opts[:link_protein_hits] == false
|
30
30
|
puts "MERGING GROUP!"
|
31
|
-
(@
|
31
|
+
(@peptides, @proteins) = merge!(@searches.map {|v| v.peptides }, &Ms::Sequest::Sqt::NEW_PROT)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
block.call(self) if block_given?
|
@@ -56,7 +56,7 @@ module Ms
|
|
56
56
|
|
57
57
|
|
58
58
|
class Sqt
|
59
|
-
include Ms::
|
59
|
+
include Ms::Ident::Search
|
60
60
|
PercolatorHeaderMatch = /^Percolator v/
|
61
61
|
Delimiter = "\t"
|
62
62
|
attr_accessor :header
|
@@ -108,15 +108,15 @@ module Ms
|
|
108
108
|
# :percolator_results => false | true (default false)
|
109
109
|
# :link_protein_hits => true | false (default true)
|
110
110
|
def initialize(filename=nil, opts={})
|
111
|
-
@
|
112
|
-
@
|
111
|
+
@peptides = []
|
112
|
+
@proteins = []
|
113
113
|
if filename
|
114
114
|
from_file(filename, opts)
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
|
-
NEW_PROT = lambda do |_prot,
|
119
|
-
Ms::Sequest::Sqt::Locus.new([_prot.locus, _prot.description,
|
118
|
+
NEW_PROT = lambda do |_prot, _peptides|
|
119
|
+
Ms::Sequest::Sqt::Locus.new([_prot.locus, _prot.description, _peptides])
|
120
120
|
end
|
121
121
|
|
122
122
|
# if the file contains the header key '/$Percolator v/' then the results
|
@@ -131,10 +131,10 @@ module Ms
|
|
131
131
|
if @header.keys.any? {|v| v =~ PercolatorHeaderMatch }
|
132
132
|
@percolator_results = true
|
133
133
|
end
|
134
|
-
(@spectra, @
|
134
|
+
(@spectra, @peptides) = Ms::Sequest::Sqt::Spectrum.spectra_from_handle(fh, @base_name, @percolator_results)
|
135
135
|
end
|
136
136
|
if opts[:link_protein_hits]
|
137
|
-
(@
|
137
|
+
(@peptides, @proteins) = merge!([@peptides], &NEW_PROT)
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
@@ -238,7 +238,7 @@ class Ms::Sequest::Sqt::Spectrum
|
|
238
238
|
|
239
239
|
# assumes the first line starts with an 'S'
|
240
240
|
def self.spectra_from_handle(fh, base_name, percolator_results=false)
|
241
|
-
|
241
|
+
peptides = []
|
242
242
|
spectra = []
|
243
243
|
|
244
244
|
while line = fh.gets
|
@@ -258,7 +258,7 @@ class Ms::Sequest::Sqt::Spectrum
|
|
258
258
|
match[10,3] = spectrum[0,3]
|
259
259
|
match[15] = base_name
|
260
260
|
matches << match
|
261
|
-
|
261
|
+
peptides << match
|
262
262
|
loci = []
|
263
263
|
match.loci = loci
|
264
264
|
matches << match
|
@@ -271,7 +271,7 @@ class Ms::Sequest::Sqt::Spectrum
|
|
271
271
|
end
|
272
272
|
# set the deltacn:
|
273
273
|
set_deltacn(spectra)
|
274
|
-
[spectra,
|
274
|
+
[spectra, peptides]
|
275
275
|
end
|
276
276
|
|
277
277
|
def self.set_deltacn(spectra)
|
@@ -322,7 +322,7 @@ class Ms::Sequest::Sqt::Match
|
|
322
322
|
Leader = 'M'
|
323
323
|
|
324
324
|
# same as 'loci'
|
325
|
-
def
|
325
|
+
def proteins
|
326
326
|
self[16]
|
327
327
|
end
|
328
328
|
|
@@ -339,7 +339,7 @@ class Ms::Sequest::Sqt::Match
|
|
339
339
|
self[7] = ar[8].to_i
|
340
340
|
self[8] = ar[9]
|
341
341
|
self[9] = ar[10]
|
342
|
-
self[14] = Ms::
|
342
|
+
self[14] = Ms::Ident::Peptide.sequence_to_aaseq(self[8])
|
343
343
|
self
|
344
344
|
end
|
345
345
|
end
|
@@ -374,7 +374,7 @@ class Ms::Sequest::Sqt::Match::Percolator < Ms::Sequest::Sqt::Match
|
|
374
374
|
end
|
375
375
|
end
|
376
376
|
|
377
|
-
Ms::Sequest::Sqt::Locus = Arrayclass.new(%w[locus description
|
377
|
+
Ms::Sequest::Sqt::Locus = Arrayclass.new(%w[locus description peptides])
|
378
378
|
|
379
379
|
class Ms::Sequest::Sqt::Locus
|
380
380
|
Leader = 'L'
|
data/lib/ms/sequest/srf.rb
CHANGED
@@ -8,24 +8,23 @@ require 'scanf'
|
|
8
8
|
require 'arrayclass'
|
9
9
|
|
10
10
|
# in library
|
11
|
-
require 'ms/
|
12
|
-
require 'ms/
|
13
|
-
require 'ms/
|
11
|
+
require 'ms/ident/search'
|
12
|
+
require 'ms/ident/peptide'
|
13
|
+
require 'ms/ident/protein'
|
14
14
|
require 'ms/sequest/params'
|
15
15
|
|
16
16
|
|
17
17
|
module Ms ; end
|
18
18
|
module Ms::Sequest ; end
|
19
19
|
|
20
|
-
|
21
20
|
class Ms::Sequest::Srf
|
21
|
+
include Ms::Ident::Search
|
22
22
|
|
23
23
|
class NoSequestParamsError < ArgumentError
|
24
24
|
end
|
25
25
|
|
26
|
-
include Ms::Id::Search
|
27
26
|
|
28
|
-
# inherits
|
27
|
+
# inherits peptides and proteins from Search
|
29
28
|
|
30
29
|
# a String: 3.5, 3.3 or 3.2
|
31
30
|
attr_accessor :version
|
@@ -37,14 +36,23 @@ class Ms::Sequest::Srf
|
|
37
36
|
# a parallel array to dta_files and out_files where each entry is:
|
38
37
|
# [first_scan, last_scan, charge]
|
39
38
|
attr_accessor :index
|
39
|
+
|
40
|
+
# the base name of the file with no extension
|
40
41
|
attr_accessor :base_name
|
41
42
|
|
43
|
+
alias_method :base_name_noext, :base_name
|
44
|
+
alias_method :base_name_noext=, :base_name=
|
45
|
+
|
46
|
+
# the directory the srf file was residing in when the filename was passed
|
47
|
+
# in. May not be available.
|
48
|
+
attr_accessor :resident_dir
|
49
|
+
|
42
50
|
# a boolean to indicate if the results have been filtered by the
|
43
51
|
# sequest.params precursor mass tolerance
|
44
52
|
attr_accessor :filtered_by_precursor_mass_tolerance
|
45
53
|
|
46
54
|
def protein_class
|
47
|
-
Ms::Sequest::Srf::Out::
|
55
|
+
Ms::Sequest::Srf::Out::Protein
|
48
56
|
end
|
49
57
|
|
50
58
|
# returns a Sequest::Params object or nil if none
|
@@ -85,11 +93,11 @@ class Ms::Sequest::Srf
|
|
85
93
|
# # typically done by Bioworks.
|
86
94
|
#
|
87
95
|
# :link_protein_hits => true | false (default true)
|
88
|
-
# # if true, generates the @
|
96
|
+
# # if true, generates the @protein attribute for the :protein method
|
89
97
|
# # and creates one protein per reference that is linked to each
|
90
98
|
# # relevant peptide hit.
|
91
99
|
# # if false, each protein for each peptide hit is a unique object
|
92
|
-
# # and the :
|
100
|
+
# # and the :proteins method returns nil. If you are merging multiple
|
93
101
|
# # searches then you probably want to set this to false to avoid
|
94
102
|
# # recalculation.
|
95
103
|
#
|
@@ -97,7 +105,7 @@ class Ms::Sequest::Srf
|
|
97
105
|
# # will attempt to read peptide hit information (equivalent to .out
|
98
106
|
# # files), otherwise, just reads the dta information.
|
99
107
|
def initialize(filename=nil, opts={})
|
100
|
-
@
|
108
|
+
@peptides = []
|
101
109
|
|
102
110
|
@dta_files = []
|
103
111
|
@out_files = []
|
@@ -147,7 +155,7 @@ class Ms::Sequest::Srf
|
|
147
155
|
end
|
148
156
|
if hits.size != before
|
149
157
|
out_file.hits = hits # <- is this necessary
|
150
|
-
Ms::Sequest::Srf::Out::
|
158
|
+
Ms::Sequest::Srf::Out::Peptide.update_deltacns_from_xcorr(hits)
|
151
159
|
out_file.num_hits = hits.size
|
152
160
|
end
|
153
161
|
end
|
@@ -161,7 +169,7 @@ class Ms::Sequest::Srf
|
|
161
169
|
fh.pos = start
|
162
170
|
|
163
171
|
num_files.times do |i|
|
164
|
-
dta_files[i] = Ms::Sequest::Srf::
|
172
|
+
dta_files[i] = Ms::Sequest::Srf::Dta.new.from_io(fh, unpack_35)
|
165
173
|
#p dta_files[i]
|
166
174
|
out_files[i] = Ms::Sequest::Srf::Out.new.from_io(fh, unpack_35, dup_refs_gt_0)
|
167
175
|
#p out_files[i]
|
@@ -172,6 +180,7 @@ class Ms::Sequest::Srf
|
|
172
180
|
# returns self
|
173
181
|
# opts are the same as for 'new'
|
174
182
|
def from_file(filename, opts)
|
183
|
+
@resident_dir = File.dirname(File.expand_path(filename))
|
175
184
|
opts = { :filter_by_precursor_mass_tolerance => true, :link_protein_hits => true, :read_pephits => true}.merge(opts)
|
176
185
|
|
177
186
|
(@params, after_params_io_pos) = Ms::Sequest::Srf.get_sequest_params_and_finish_pos(filename)
|
@@ -260,7 +269,7 @@ class Ms::Sequest::Srf
|
|
260
269
|
mass_measured = @dta_files[i][0]
|
261
270
|
@out_files[i][0,3] = *ind
|
262
271
|
pep_hits = @out_files[i][6]
|
263
|
-
@
|
272
|
+
@peptides.push( *pep_hits )
|
264
273
|
pep_hits.each do |pep_hit|
|
265
274
|
pep_hit[15,4] = @base_name, *ind
|
266
275
|
# add the deltamass
|
@@ -273,8 +282,8 @@ class Ms::Sequest::Srf
|
|
273
282
|
filter_by_precursor_mass_tolerance! if params
|
274
283
|
|
275
284
|
if opts[:link_protein_hits]
|
276
|
-
(@
|
277
|
-
|
285
|
+
(@peptides, @proteins) = merge!([self.peptides]) do |_protein, _peptides|
|
286
|
+
Ms::Sequest::Srf::Out::Protein.new(_protein.reference, _peptides)
|
278
287
|
end
|
279
288
|
end
|
280
289
|
|
@@ -311,7 +320,7 @@ class Ms::Sequest::Srf
|
|
311
320
|
fh.pos = start
|
312
321
|
|
313
322
|
header.num_dta_files.times do |i|
|
314
|
-
dta_files[i] = Ms::Sequest::Srf::
|
323
|
+
dta_files[i] = Ms::Sequest::Srf::Dta.new.from_io(fh, unpack_35)
|
315
324
|
end
|
316
325
|
dta_files
|
317
326
|
end
|
@@ -357,7 +366,7 @@ class Ms::Sequest::Srf::Header
|
|
357
366
|
}
|
358
367
|
|
359
368
|
attr_accessor :version
|
360
|
-
# a Ms::Sequest::Srf::
|
369
|
+
# a Ms::Sequest::Srf::DtaGen object
|
361
370
|
attr_accessor :dta_gen
|
362
371
|
attr_accessor :enzyme
|
363
372
|
attr_accessor :ion_series
|
@@ -371,7 +380,7 @@ class Ms::Sequest::Srf::Header
|
|
371
380
|
|
372
381
|
|
373
382
|
# true if this is a combined file, false if represents a single file
|
374
|
-
# this is set by examining the
|
383
|
+
# this is set by examining the DtaGen object for signs of a single file
|
375
384
|
attr_reader :combined
|
376
385
|
|
377
386
|
__chars_re = Regexp.escape( "\r\0" )
|
@@ -385,7 +394,7 @@ class Ms::Sequest::Srf::Header
|
|
385
394
|
def from_io(fh)
|
386
395
|
st = fh.read(4)
|
387
396
|
@version = '3.' + st.unpack('I').first.to_s
|
388
|
-
@dta_gen = Ms::Sequest::Srf::
|
397
|
+
@dta_gen = Ms::Sequest::Srf::DtaGen.new.from_io(fh)
|
389
398
|
# if the start_mass end_mass start_scan and end_scan are all zero, its a
|
390
399
|
# combined srf file:
|
391
400
|
@combined = [0.0, 0.0, 0, 0].zip(%w(start_mass end_mass start_scan end_scan)).all? do |one,two|
|
@@ -421,8 +430,8 @@ class Ms::Sequest::Srf::Header
|
|
421
430
|
|
422
431
|
end
|
423
432
|
|
424
|
-
# the
|
425
|
-
class Ms::Sequest::Srf::
|
433
|
+
# the Dta Generation Params
|
434
|
+
class Ms::Sequest::Srf::DtaGen
|
426
435
|
|
427
436
|
## not sure if this is correct
|
428
437
|
# Float
|
@@ -459,9 +468,9 @@ end
|
|
459
468
|
# total_num_possible_charge_states is not correct under 3.5 (Bioworks 3.3.1)
|
460
469
|
# unknown is, well unknown...
|
461
470
|
|
462
|
-
Ms::Sequest::Srf::
|
471
|
+
Ms::Sequest::Srf::Dta = Arrayclass.new( %w(mh dta_tic num_peaks charge ms_level unknown total_num_possible_charge_states peaks) )
|
463
472
|
|
464
|
-
class Ms::Sequest::Srf::
|
473
|
+
class Ms::Sequest::Srf::Dta
|
465
474
|
# original
|
466
475
|
# Unpack = "EeIvvvv"
|
467
476
|
Unpack_32 = "EeIvvvv"
|
@@ -476,7 +485,7 @@ class Ms::Sequest::Srf::DTA
|
|
476
485
|
def inspect
|
477
486
|
peaks_st = 'nil'
|
478
487
|
if self[7] ; peaks_st = "[#{self[7].size} bytes]" end
|
479
|
-
"<Ms::Sequest::Srf::
|
488
|
+
"<Ms::Sequest::Srf::Dta @mh=#{mh} @dta_tic=#{dta_tic} @num_peaks=#{num_peaks} @charge=#{charge} @ms_level=#{ms_level} @total_num_possible_charge_states=#{total_num_possible_charge_states} @peaks=#{peaks_st} >"
|
480
489
|
end
|
481
490
|
|
482
491
|
def from_io(fh, unpack_35)
|
@@ -519,6 +528,8 @@ class Ms::Sequest::Srf::DTA
|
|
519
528
|
io.print to_dta_file_data
|
520
529
|
end
|
521
530
|
|
531
|
+
# returns a string where the float has been rounded to the specified number
|
532
|
+
# of decimal places
|
522
533
|
def round(float, decimal_places)
|
523
534
|
sprintf("%.#{decimal_places}f", float)
|
524
535
|
end
|
@@ -559,16 +570,16 @@ class Ms::Sequest::Srf::Out
|
|
559
570
|
if ar.size > 0
|
560
571
|
num_extra_references = 0
|
561
572
|
num_hits.times do |i|
|
562
|
-
ar[i] = Ms::Sequest::Srf::Out::
|
573
|
+
ar[i] = Ms::Sequest::Srf::Out::Peptide.new.from_io(fh, unpack_35)
|
563
574
|
num_extra_references += ar[i].num_other_loci
|
564
575
|
end
|
565
576
|
if dup_refs_gt_0
|
566
|
-
Ms::Sequest::Srf::Out::
|
577
|
+
Ms::Sequest::Srf::Out::Peptide.read_extra_references(fh, num_extra_references, ar)
|
567
578
|
end
|
568
579
|
## The xcorrs are already ordered by best to worst hit
|
569
580
|
## ADJUST the deltacn's to be meaningful for the top hit:
|
570
581
|
## (the same as bioworks and prophet)
|
571
|
-
Ms::Sequest::Srf::Out::
|
582
|
+
Ms::Sequest::Srf::Out::Peptide.set_deltacn_from_deltacn_orig(ar)
|
572
583
|
end
|
573
584
|
self[6] = ar
|
574
585
|
self[4].chomp!
|
@@ -580,6 +591,7 @@ class Ms::Sequest::Srf::Out
|
|
580
591
|
end
|
581
592
|
|
582
593
|
|
594
|
+
|
583
595
|
# deltacn_orig - the one that sequest originally reports (top hit gets 0.0)
|
584
596
|
# deltacn - modified to be that of the next best hit (by xcorr) and the last
|
585
597
|
# hit takes 1.1. This is what is called deltacn by bioworks and pepprophet
|
@@ -591,20 +603,17 @@ end
|
|
591
603
|
# match.srf.filtered_by_precursor_mass_tolerance. If this is changed, then
|
592
604
|
# deltacn should also be changed to reflect it.
|
593
605
|
# mh - the theoretical mass + h
|
594
|
-
#
|
606
|
+
# proteins are created as SRF prot objects with a reference and linked to their
|
595
607
|
# peptides (from global hash by reference)
|
596
608
|
# ppm = 10^6 * ∆m_accuracy / mass_measured [ where ∆m_accuracy = mass_real – mass_measured ]
|
597
609
|
# This is calculated for the M+H mass!
|
598
610
|
# num_other_loci is the number of other loci that the peptide matches beyond
|
599
611
|
# the first one listed
|
600
612
|
# srf = the srf object this scan came from
|
613
|
+
Ms::Sequest::Srf::Out::Peptide = Arrayclass.new( %w(mh deltacn_orig sf sp xcorr id num_other_loci rsp ions_matched ions_total sequence proteins deltamass ppm aaseq base_name first_scan last_scan charge srf deltacn deltacn_orig_updated) )
|
614
|
+
# 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
|
601
615
|
|
602
|
-
|
603
|
-
Ms::Sequest::Srf::Out::Pep = Arrayclass.new( %w(mh deltacn_orig sf sp xcorr id num_other_loci rsp ions_matched ions_total sequence prots deltamass ppm aaseq base_name first_scan last_scan charge srf deltacn deltacn_orig_updated) )
|
604
|
-
# 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
|
605
|
-
|
606
|
-
class Ms::Sequest::Srf::Out::Pep
|
607
|
-
#include SpecID::Pep
|
616
|
+
class Ms::Sequest::Srf::Out::Peptide
|
608
617
|
|
609
618
|
# creates the deltacn that is meaningful for the top hit (the deltacn_orig
|
610
619
|
# or the second best hit and so on).
|
@@ -637,7 +646,7 @@ class Ms::Sequest::Srf::Out::Pep
|
|
637
646
|
pep = pep_hits[fh.read(8).unpack('x4I').first - 1]
|
638
647
|
|
639
648
|
ref = fh.read(80).unpack('A*').first
|
640
|
-
pep[11] << Ms::Sequest::Srf::Out::
|
649
|
+
pep[11] << Ms::Sequest::Srf::Out::Protein.new(ref[0,38])
|
641
650
|
end
|
642
651
|
# fh.read(6) if unpack_35
|
643
652
|
end
|
@@ -661,8 +670,8 @@ class Ms::Sequest::Srf::Out::Pep
|
|
661
670
|
|
662
671
|
undef_method :inspect
|
663
672
|
def inspect
|
664
|
-
st = %w(aaseq sequence mh deltacn_orig sf sp xcorr id rsp ions_matched ions_total
|
665
|
-
if v == '
|
673
|
+
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|
|
674
|
+
if v == 'proteins'
|
666
675
|
"#{v}(#)=#{send(v.to_sym).size}"
|
667
676
|
elsif v.is_a? Array
|
668
677
|
"##{v}=#{send(v.to_sym).size}"
|
@@ -676,7 +685,7 @@ class Ms::Sequest::Srf::Out::Pep
|
|
676
685
|
end
|
677
686
|
st.push('>')
|
678
687
|
st.join(' ')
|
679
|
-
#"<Ms::Sequest::Srf::Out::
|
688
|
+
#"<Ms::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}>"
|
680
689
|
end
|
681
690
|
# extra_references_array is an array that grows with peptides as extra
|
682
691
|
# references are discovered.
|
@@ -697,9 +706,9 @@ class Ms::Sequest::Srf::Out::Pep
|
|
697
706
|
|
698
707
|
# we are slicing the reference to 38 chars to be the same length as
|
699
708
|
# duplicate references
|
700
|
-
self[11] = [Ms::Sequest::Srf::Out::
|
709
|
+
self[11] = [Ms::Sequest::Srf::Out::Protein.new(self[11][0,38])]
|
701
710
|
|
702
|
-
self[14] = Ms::
|
711
|
+
self[14] = Ms::Ident::Peptide.sequence_to_aaseq(self[10])
|
703
712
|
|
704
713
|
fh.read(6) if unpack_35
|
705
714
|
|
@@ -709,37 +718,38 @@ class Ms::Sequest::Srf::Out::Pep
|
|
709
718
|
end
|
710
719
|
|
711
720
|
|
712
|
-
Ms::Sequest::Srf::Out::
|
721
|
+
Ms::Sequest::Srf::Out::Protein = Arrayclass.new( %w(reference peptides) )
|
722
|
+
|
723
|
+
class Ms::Sequest::Srf::Out::Protein
|
724
|
+
include Ms::Ident::Protein
|
713
725
|
|
714
|
-
|
715
|
-
include Ms::Id::Protein
|
716
|
-
## we shouldn't have to do this because this is inlcuded in SpecID::Prot, but
|
726
|
+
## we shouldn't have to do this because this is inlcuded in SpecID::Protein, but
|
717
727
|
## under some circumstances it won't work without explicitly calling it.
|
718
728
|
#include ProteinReferenceable
|
719
729
|
|
720
730
|
tmp = $VERBOSE ; $VERBOSE = nil
|
721
|
-
def initialize(reference=nil,
|
731
|
+
def initialize(reference=nil, peptides=[])
|
722
732
|
#super(@@arr_size)
|
723
733
|
super(self.class.size)
|
724
734
|
#@reference = reference
|
725
|
-
#@
|
726
|
-
self[0,2] = reference,
|
735
|
+
#@peptides = peptides
|
736
|
+
self[0,2] = reference, peptides
|
727
737
|
end
|
728
738
|
$VERBOSE = tmp
|
729
739
|
|
730
|
-
# "<Ms::Sequest::Srf::Out::
|
740
|
+
# "<Ms::Sequest::Srf::Out::Protein reference=\"#{@reference}\">"
|
731
741
|
|
732
742
|
undef_method :inspect
|
733
743
|
def inspect
|
734
|
-
"<Ms::Sequest::Srf::Out::
|
744
|
+
"<Ms::Sequest::Srf::Out::Protein @reference=#{reference}, @peptides(#)=#{peptides.size}>"
|
735
745
|
end
|
736
746
|
end
|
737
747
|
|
738
748
|
class Ms::Sequest::SrfGroup
|
739
|
-
include Ms::
|
749
|
+
include Ms::Ident::SearchGroup
|
740
750
|
|
741
|
-
# inherits an array of Ms::Sequest::Srf::Out::
|
742
|
-
# inherits an array of Ms::Sequest::Srf::Out::
|
751
|
+
# inherits an array of Ms::Sequest::Srf::Out::Peptide objects
|
752
|
+
# inherits an array of Ms::Sequest::Srf::Out::Protein objects
|
743
753
|
|
744
754
|
# see Ms::Id::Search for acceptable arguments
|
745
755
|
# (filename, filenames, array of objects)
|
@@ -750,8 +760,8 @@ class Ms::Sequest::SrfGroup
|
|
750
760
|
indiv_opts = { :link_protein_hits => false }
|
751
761
|
super(arg, opts.merge(indiv_opts)) do
|
752
762
|
unless orig_opts[:link_protein_hits] == false
|
753
|
-
(@
|
754
|
-
Ms::Sequest::Srf::Out::
|
763
|
+
(@peptides, @proteins) = merge!(@searches.map {|v| v.peptides }) do |_prot, _peps|
|
764
|
+
Ms::Sequest::Srf::Out::Protein.new(_prot.reference, _peps)
|
755
765
|
end
|
756
766
|
end
|
757
767
|
end
|