ms-sequest 0.0.11 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,78 @@
1
+ require File.expand_path( File.dirname(__FILE__) + '/../../spec_helper' )
2
+
3
+ require File.dirname(__FILE__) + '/sqt_spec_helper'
4
+
5
+ require 'ms/sequest/sqt'
6
+
7
+ describe 'reading a small sqt file' do
8
+
9
+ before do
10
+ file = TESTFILES + '/small.sqt'
11
+ @sqt = Ms::Sequest::Sqt.new(file)
12
+ end
13
+
14
+ it 'can access header entries like a hash' do
15
+ header = @sqt.header
16
+ HeaderHash.each do |k,v|
17
+ header[k].is v
18
+ end
19
+ end
20
+
21
+ it 'can access header entries with methods' do
22
+ header = @sqt.header
23
+ # for example:
24
+ header.database.is HeaderHash['Database']
25
+ # all working:
26
+ HeaderHash.each do |k,v|
27
+ header.send(Ms::Sequest::Sqt::Header::KeysToAtts[k]).is v
28
+ end
29
+
30
+ end
31
+
32
+ it 'has spectra, matches, and loci' do
33
+ svt = @sqt.spectra[16]
34
+ reply = {:first => @sqt.spectra.first, :last => @sqt.spectra.last, :seventeenth => svt, :first_match_17 => svt.matches.first, :last_match_17 => svt.matches.last, :last_match_17_last_loci => svt.matches.last.loci.last}
35
+ [:first, :last, :seventeenth, :first_match_17, :last_match_17, :last_match_17_last_loci].each do |key|
36
+ TestSpectra[key].each do |k,v|
37
+ if v.is_a? Float
38
+ reply[key].send(k).should.be.close(v, 0.0000000001)
39
+ else
40
+ next if key == :last_match_17_last_loci
41
+ #p k
42
+ #p v
43
+ reply[key].send(k).is v
44
+ end
45
+ end
46
+ end
47
+ @sqt.spectra[16].matches.first.loci.size.is 1
48
+ @sqt.spectra[16].matches.last.loci.size.is 1
49
+ end
50
+
51
+ end
52
+
53
+ #class SqtGroup_ReadingFiles < MiniTest::Spec
54
+ #before(:each) do
55
+ #file1 = TESTFILES + '/small.sqt'
56
+ #file2 = TESTFILES + '/small2.sqt'
57
+ #@sqg = Ms::Sequest::SqtGroup.new([file1, file2])
58
+ #end
59
+
60
+ #it 'has peptide hits' do
61
+ #peps = @sqg.peps
62
+ #peps.size.is 86
63
+ ## first hit in 020
64
+ #peps.first.sequence.is 'R.Y#RLGGS#T#K.K'
65
+ #peps.first.base_name.is 'small'
66
+ ## last hit in 040
67
+ #peps.last.sequence.is 'K.T#IS#S#QK.K'
68
+ #peps.last.base_name.is 'small2'
69
+ #end
70
+
71
+ #it 'has prots' do
72
+ ### FROZEN:
73
+ #@sqg.prots.size.is 72
74
+ #sorted = @sqg.prots.sort_by {|v| v.reference }
75
+ #sorted.first.reference.is 'gi|16127996|ref|NP_414543.1|'
76
+ #sorted.first.peps.size.is 33
77
+ #end
78
+ #end
@@ -0,0 +1,34 @@
1
+
2
+
3
+ HeaderHash = {}
4
+ header_doublets = [
5
+ %w(SQTGenerator mspire),
6
+ %w(SQTGeneratorVersion 0.3.1),
7
+ %w(Database C:\Xcalibur\database\ecoli_K12_ncbi_20060321.fasta),
8
+ %w(FragmentMasses AVG),
9
+ %w(PrecursorMasses AVG),
10
+ ['StartTime', ''],
11
+ ['Alg-MSModel', 'LCQ Deca XP'],
12
+ %w(DBLocusCount 4237),
13
+ %w(Alg-FragMassTol 1.0000),
14
+ %w(Alg-PreMassTol 25.0000),
15
+ ['Alg-IonSeries', '0 1 1 0.0 1.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0'],
16
+ %w(Alg-PreMassUnits ppm),
17
+ ['Alg-Enzyme', 'Trypsin(KR/P) (2)'],
18
+
19
+ ['Comment', ['ultra small file created for testing', 'Created from Bioworks .srf file']],
20
+ ['DynamicMod', ['M*=+15.99940', 'STY#=+79.97990']],
21
+ ['StaticMod', []],
22
+ ].each do |double|
23
+ HeaderHash[double[0]] = double[1]
24
+ end
25
+
26
+ TestSpectra = {
27
+ :first => { :first_scan=>2, :last_scan=>2, :charge=>1, :time_to_process=>0.0, :node=>"TESLA", :mh=>390.92919921875, :total_intensity=>2653.90307617188, :lowest_sp=>0.0, :num_matched_peptides=>0, :matches=>[]},
28
+ :last => { :first_scan=>27, :last_scan=>27, :charge=>1, :time_to_process=>0.0, :node=>"TESLA", :mh=>393.008056640625, :total_intensity=>2896.16967773438, :lowest_sp=>0.0, :num_matched_peptides=>0, :matches=>[] },
29
+ :seventeenth => {:first_scan=>23, :last_scan=>23, :charge=>1, :time_to_process=>0.0, :node=>"TESLA", :mh=>1022.10571289062, :total_intensity=>3637.86059570312, :lowest_sp=>0.0, :num_matched_peptides=>41},
30
+ :first_match_17 => { :rxcorr=>1, :rsp=>5, :mh=>1022.11662242, :deltacn_orig=>0.0, :xcorr=>0.725152492523193, :sp=>73.9527359008789, :ions_matched=>6, :ions_total=>24, :sequence=>"-.MGT#TTM*GVK.L", :manual_validation_status=>"U", :first_scan=>23, :last_scan=>23, :charge=>1, :deltacn=>0.0672458708286285, :aaseq => 'MGTTTMGVK' },
31
+ :last_match_17 => {:rxcorr=>10, :rsp=>16, :mh=>1022.09807242, :deltacn_orig=>0.398330867290497, :xcorr=>0.436301857233047, :sp=>49.735767364502, :ions_matched=>5, :ions_total=>21, :sequence=>"-.MRT#TSFAK.V", :manual_validation_status=>"U", :first_scan=>23, :last_scan=>23, :charge=>1, :deltacn=>1.1, :aaseq => 'MRTTSFAK'},
32
+ :last_match_17_last_loci => {:reference =>'gi|16129390|ref|NP_415948.1|', :first_entry =>'gi|16129390|ref|NP_415948.1|', :locus =>'gi|16129390|ref|NP_415948.1|', :description => 'Fake description' }
33
+ }
34
+
@@ -0,0 +1,53 @@
1
+ require File.expand_path( File.dirname(__FILE__) + '/../../../spec_helper' )
2
+ require File.expand_path( File.dirname(__FILE__) + '/search_spec_helper' )
3
+
4
+ require 'fileutils'
5
+
6
+ require 'ms/sequest/srf'
7
+ require 'ms/sequest/srf/search'
8
+
9
+ describe 'converting a large srf to an ms search format' do
10
+
11
+ @file = Ms::TESTDATA + '/sequest/opd1_static_diff_mods/000.srf'
12
+ @srf = Ms::Sequest::Srf.new(@file)
13
+
14
+ def del(file)
15
+ if File.exist?(file)
16
+ if File.directory?(file)
17
+ FileUtils.rm_rf(file)
18
+ else
19
+ File.unlink(file)
20
+ end
21
+ end
22
+ end
23
+
24
+ it 'converts to mgf' do
25
+ @output = Ms::TESTDATA + '/sequest/opd1_static_diff_mods/000.mgf.tmp'
26
+ @srf.to_mgf(@output)
27
+ ok File.exist?(@output)
28
+ output = IO.read(@output)
29
+ # tests are just frozen right now, not checked for accuracy
30
+ ok output.include?(SRF_TO_MGF_HELPER::FIRST_MSMS)
31
+ ok output[1000..-1].include?(SRF_TO_MGF_HELPER::LAST_MSMS)
32
+ del(@output)
33
+ end
34
+
35
+ it 'generates .dta files' do
36
+ @output = Ms::TESTDATA + '/sequest/opd1_static_diff_mods/000.dta.tmp'
37
+ @srf.to_dta(@output)
38
+ ok File.exist?(@output)
39
+ ok File.directory?(@output)
40
+ # frozen (not verified):
41
+ Dir[@output + "/*.*"].size.is 3893 # the correct number files
42
+
43
+ first_file = @output + '/000.2.2.1.dta'
44
+ ok File.exist?(first_file)
45
+ IO.read(first_file).is SRF_TO_DTA_HELPER::FIRST_SCAN.gsub("\n", "\r\n")
46
+ last_file = @output + '/000.3748.3748.3.dta'
47
+ IO.read(last_file).is SRF_TO_DTA_HELPER::LAST_SCAN.gsub("\n", "\r\n")
48
+
49
+ del(@output)
50
+ end
51
+
52
+ end
53
+
@@ -0,0 +1,341 @@
1
+ class SRF_TO_MGF_HELPER
2
+ FIRST_MSMS = <<FINISH
3
+ BEGIN IONS
4
+ TITLE=000.2.2.1.dta
5
+ CHARGE=1+
6
+ PEPMASS=391.04541015625
7
+ 111.976043701172 41418.0
8
+ 112.733383178711 88292.0
9
+ 113.536590576172 26129.0
10
+ 149.049530029297 2852380.0
11
+ 149.960266113281 110104.0
12
+ 150.578399658203 4607.0
13
+ 155.026885986328 16524.0
14
+ 160.48388671875 17154.0
15
+ 161.9013671875 6562.0
16
+ 164.386596679688 76498.0
17
+ 166.8427734375 1663866.0
18
+ 167.719482421875 72010.0
19
+ 168.693237304688 57081.0
20
+ 197.131774902344 7933.0
21
+ 217.975738525391 20193.0
22
+ 218.799468994141 15350.0
23
+ 222.215576171875 21254.0
24
+ 223.027404785156 27495.0
25
+ 224.90771484375 16117.0
26
+ 225.895538330078 25061.0
27
+ 253.583435058594 7431.0
28
+ 255.372528076172 25846.0
29
+ 257.151245117188 5435.0
30
+ 258.856323242188 26408.0
31
+ 260.166259765625 261245.0
32
+ 260.812072753906 639646.0
33
+ 261.715698242188 82724.0
34
+ 262.366638183594 4.0
35
+ 272.052124023438 43365.0
36
+ 277.773315429688 159994.0
37
+ 278.856872558594 2140713.0
38
+ 279.935546875 397598.0
39
+ 280.699951171875 4.0
40
+ 289.641723632812 32978.0
41
+ 290.385864257812 31836.0
42
+ 291.786682128906 15850.0
43
+ 296.626831054688 54212.0
44
+ 298.6279296875 22051.0
45
+ 300.035766601562 156183.0
46
+ 301.489501953125 10696.0
47
+ 307.485473632812 37712.0
48
+ 326.803100585938 18038.0
49
+ 351.965393066406 6909.0
50
+ 359.648010253906 10347.0
51
+ 361.146850585938 21067.0
52
+ 364.831176757812 22587.0
53
+ 370.079040527344 9646.0
54
+ 371.641967773438 57566.0
55
+ 372.577087402344 40545.0
56
+ 373.967895507812 76673.0
57
+ 374.671997070312 70584.0
58
+ 388.660583496094 22746.0
59
+ 405.444030761719 23893.0
60
+ 406.481384277344 27502.0
61
+ 407.412780761719 18959.0
62
+ 781.085327148438 10104.0
63
+ END IONS
64
+
65
+ FINISH
66
+
67
+ LAST_MSMS = <<FINISH
68
+ BEGIN IONS
69
+ TITLE=000.3748.3748.3.dta
70
+ CHARGE=3+
71
+ PEPMASS=433.56494098625
72
+ 143.466918945312 2110.0
73
+ 151.173095703125 4134.0
74
+ 158.817443847656 2565.0
75
+ 178.629333496094 6114.0
76
+ 180.065307617188 879.0
77
+ 185.164703369141 2364.0
78
+ 206.865417480469 7925.0
79
+ 210.208190917969 1242.0
80
+ 212.763122558594 893.0
81
+ 217.749298095703 2202.0
82
+ 227.912048339844 4343.0
83
+ 235.973571777344 2485.0
84
+ 236.941436767578 679.0
85
+ 251.645324707031 4690.0
86
+ 252.677307128906 7145.0
87
+ 271.46435546875 1504.0
88
+ 275.466674804688 5912.0
89
+ 276.738586425781 1819.0
90
+ 278.331237792969 775.0
91
+ 282.728149414062 963.0
92
+ 287.679931640625 1749.0
93
+ 288.412719726562 2603.0
94
+ 291.451843261719 3082.0
95
+ 292.405212402344 8303.0
96
+ 299.569091796875 5620.0
97
+ 302.3056640625 2007.0
98
+ 306.021362304688 1564.0
99
+ 308.79541015625 3738.0
100
+ 312.496154785156 3964.0
101
+ 313.62890625 11383.0
102
+ 318.949340820312 1945.0
103
+ 319.691772460938 2781.0
104
+ 326.534423828125 4564.0
105
+ 331.253601074219 7761.0
106
+ 334.9482421875 4798.0
107
+ 336.904418945312 5597.0
108
+ 338.891174316406 5830.0
109
+ 342.512817382812 8324.0
110
+ 343.478881835938 12579.0
111
+ 344.843627929688 3118.0
112
+ 347.899291992188 7021.0
113
+ 348.722778320312 2224.0
114
+ 350.681274414062 2440.0
115
+ 357.763061523438 14220.0
116
+ 359.35986328125 11427.0
117
+ 360.3603515625 23882.0
118
+ 361.486633300781 18834.0
119
+ 362.540954589844 10546.0
120
+ 363.612121582031 2031.0
121
+ 364.794799804688 5664.0
122
+ 368.715576171875 3888.0
123
+ 372.091003417969 7189.0
124
+ 372.73583984375 3329.0
125
+ 376.572204589844 7716.0
126
+ 378.099853515625 11617.0
127
+ 378.795227050781 1641.0
128
+ 380.755065917969 7448.0
129
+ 386.034118652344 12462.0
130
+ 389.507751464844 15551.0
131
+ 390.844665527344 10268.0
132
+ 391.481140136719 500.0
133
+ 392.773742675781 2896.0
134
+ 396.465515136719 3636.0
135
+ 397.885864257812 1616.0
136
+ 400.766723632812 1113.0
137
+ 403.266967773438 8535.0
138
+ 404.394714355469 1578.0
139
+ 406.269592285156 7361.0
140
+ 407.214721679688 919.0
141
+ 408.305969238281 11683.0
142
+ 409.64501953125 14506.0
143
+ 410.707946777344 6735.0
144
+ 411.557250976562 6330.0
145
+ 414.049255371094 2606.0
146
+ 414.9775390625 25274.0
147
+ 415.742065429688 5809.0
148
+ 418.659118652344 2842.0
149
+ 420.640441894531 4050.0
150
+ 421.357604980469 4565.0
151
+ 424.955871582031 4801.0
152
+ 425.623840332031 1578.0
153
+ 427.966552734375 5836.0
154
+ 431.106018066406 4433.0
155
+ 431.956970214844 2428.0
156
+ 432.5595703125 7390.0
157
+ 433.419677734375 2093.0
158
+ 441.233154296875 3196.0
159
+ 441.985717773438 2048.0
160
+ 448.181823730469 3643.0
161
+ 449.430480957031 11621.0
162
+ 450.174560546875 4437.0
163
+ 450.84521484375 3907.0
164
+ 451.573608398438 6557.0
165
+ 452.447204589844 1461.0
166
+ 453.993347167969 3555.0
167
+ 465.704284667969 6213.0
168
+ 466.320739746094 1146.0
169
+ 468.420104980469 3492.0
170
+ 482.678771972656 3357.0
171
+ 610.4111328125 8968.0
172
+ END IONS
173
+ FINISH
174
+ end
175
+
176
+ # these have been checked against Bioworks .dta output
177
+ class SRF_TO_DTA_HELPER
178
+ FIRST_SCAN = <<FINISH
179
+ 391.045410 1
180
+ 111.9760 41418
181
+ 112.7334 88292
182
+ 113.5366 26129
183
+ 149.0495 2852380
184
+ 149.9603 110104
185
+ 150.5784 4607
186
+ 155.0269 16524
187
+ 160.4839 17154
188
+ 161.9014 6562
189
+ 164.3866 76498
190
+ 166.8428 1663866
191
+ 167.7195 72010
192
+ 168.6932 57081
193
+ 197.1318 7933
194
+ 217.9757 20193
195
+ 218.7995 15350
196
+ 222.2156 21254
197
+ 223.0274 27495
198
+ 224.9077 16117
199
+ 225.8955 25061
200
+ 253.5834 7431
201
+ 255.3725 25846
202
+ 257.1512 5435
203
+ 258.8563 26408
204
+ 260.1663 261245
205
+ 260.8121 639646
206
+ 261.7157 82724
207
+ 262.3666 4
208
+ 272.0521 43365
209
+ 277.7733 159994
210
+ 278.8569 2140713
211
+ 279.9355 397598
212
+ 280.7000 4
213
+ 289.6417 32978
214
+ 290.3859 31836
215
+ 291.7867 15850
216
+ 296.6268 54212
217
+ 298.6279 22051
218
+ 300.0358 156183
219
+ 301.4895 10696
220
+ 307.4855 37712
221
+ 326.8031 18038
222
+ 351.9654 6909
223
+ 359.6480 10347
224
+ 361.1469 21067
225
+ 364.8312 22587
226
+ 370.0790 9646
227
+ 371.6420 57566
228
+ 372.5771 40545
229
+ 373.9679 76673
230
+ 374.6720 70584
231
+ 388.6606 22746
232
+ 405.4440 23893
233
+ 406.4814 27502
234
+ 407.4128 18959
235
+ 781.0853 10104
236
+ FINISH
237
+
238
+ LAST_SCAN = <<FINISH
239
+ 1298.680271 3
240
+ 143.4669 2110
241
+ 151.1731 4134
242
+ 158.8174 2565
243
+ 178.6293 6114
244
+ 180.0653 879
245
+ 185.1647 2364
246
+ 206.8654 7925
247
+ 210.2082 1242
248
+ 212.7631 893
249
+ 217.7493 2202
250
+ 227.9120 4343
251
+ 235.9736 2485
252
+ 236.9414 679
253
+ 251.6453 4690
254
+ 252.6773 7145
255
+ 271.4644 1504
256
+ 275.4667 5912
257
+ 276.7386 1819
258
+ 278.3312 775
259
+ 282.7281 963
260
+ 287.6799 1749
261
+ 288.4127 2603
262
+ 291.4518 3082
263
+ 292.4052 8303
264
+ 299.5691 5620
265
+ 302.3057 2007
266
+ 306.0214 1564
267
+ 308.7954 3738
268
+ 312.4962 3964
269
+ 313.6289 11383
270
+ 318.9493 1945
271
+ 319.6918 2781
272
+ 326.5344 4564
273
+ 331.2536 7761
274
+ 334.9482 4798
275
+ 336.9044 5597
276
+ 338.8912 5830
277
+ 342.5128 8324
278
+ 343.4789 12579
279
+ 344.8436 3118
280
+ 347.8993 7021
281
+ 348.7228 2224
282
+ 350.6813 2440
283
+ 357.7631 14220
284
+ 359.3599 11427
285
+ 360.3604 23882
286
+ 361.4866 18834
287
+ 362.5410 10546
288
+ 363.6121 2031
289
+ 364.7948 5664
290
+ 368.7156 3888
291
+ 372.0910 7189
292
+ 372.7358 3329
293
+ 376.5722 7716
294
+ 378.0999 11617
295
+ 378.7952 1641
296
+ 380.7551 7448
297
+ 386.0341 12462
298
+ 389.5078 15551
299
+ 390.8447 10268
300
+ 391.4811 500
301
+ 392.7737 2896
302
+ 396.4655 3636
303
+ 397.8859 1616
304
+ 400.7667 1113
305
+ 403.2670 8535
306
+ 404.3947 1578
307
+ 406.2696 7361
308
+ 407.2147 919
309
+ 408.3060 11683
310
+ 409.6450 14506
311
+ 410.7079 6735
312
+ 411.5573 6330
313
+ 414.0493 2606
314
+ 414.9775 25274
315
+ 415.7421 5809
316
+ 418.6591 2842
317
+ 420.6404 4050
318
+ 421.3576 4565
319
+ 424.9559 4801
320
+ 425.6238 1578
321
+ 427.9666 5836
322
+ 431.1060 4433
323
+ 431.9570 2428
324
+ 432.5596 7390
325
+ 433.4197 2093
326
+ 441.2332 3196
327
+ 441.9857 2048
328
+ 448.1818 3643
329
+ 449.4305 11621
330
+ 450.1746 4437
331
+ 450.8452 3907
332
+ 451.5736 6557
333
+ 452.4472 1461
334
+ 453.9933 3555
335
+ 465.7043 6213
336
+ 466.3207 1146
337
+ 468.4201 3492
338
+ 482.6788 3357
339
+ 610.4111 8968
340
+ FINISH
341
+ end