ms-sequest 0.1.2 → 0.2.1
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.
- data/History +2 -2
- data/README.rdoc +20 -21
- data/Rakefile +5 -5
- data/VERSION +1 -1
- data/lib/ms/sequest.rb +1 -1
- data/lib/ms/sequest/params.rb +8 -8
- data/lib/ms/sequest/pepxml/modifications.rb +10 -10
- data/lib/ms/sequest/pepxml/params.rb +6 -6
- data/lib/ms/sequest/sqt.rb +36 -38
- data/lib/ms/sequest/srf.rb +46 -134
- data/lib/ms/sequest/srf/pepxml.rb +23 -23
- data/lib/ms/sequest/srf/pepxml/sequest.rb +3 -3
- data/lib/ms/sequest/srf/search.rb +5 -5
- data/lib/ms/sequest/srf/sqt.rb +13 -15
- data/spec/ms/sequest/params_spec.rb +1 -1
- data/spec/ms/sequest/pepxml/modifications_spec.rb +4 -4
- data/spec/ms/sequest/sqt_spec.rb +2 -28
- data/spec/ms/sequest/srf/pepxml_spec.rb +2 -2
- data/spec/ms/sequest/srf/search_spec.rb +5 -5
- data/spec/ms/sequest/srf/sqt_spec.rb +7 -8
- data/spec/ms/sequest/srf_spec.rb +7 -7
- data/spec/spec_helper.rb +1 -1
- metadata +28 -33
- data/lib/ms/sequest/bioworks.rb +0 -498
- data/spec/ms/sequest/bioworks_spec.rb +0 -153
@@ -1,153 +0,0 @@
|
|
1
|
-
|
2
|
-
# TODO work on this guy!
|
3
|
-
=begin
|
4
|
-
|
5
|
-
require File.expand_path( File.dirname(__FILE__) + '/../tap_spec_helper' )
|
6
|
-
|
7
|
-
require 'spec_id'
|
8
|
-
require 'spec_id/bioworks'
|
9
|
-
#require 'benchmark'
|
10
|
-
|
11
|
-
describe Bioworks, 'set from an xml file' do
|
12
|
-
# NEED TO DEBUG THIS PROB!
|
13
|
-
it 'can set one with labeled proteins' do
|
14
|
-
file = Tfiles + "/bioworks_with_INV_small.xml"
|
15
|
-
obj = Bioworks.new(file)
|
16
|
-
obj.proteins.size.should == 19
|
17
|
-
file = Tfiles + '/bioworks_small.xml'
|
18
|
-
obj = Bioworks.new(file)
|
19
|
-
obj.proteins.size.should == 106
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'can parse an xml file NOT derived from multi-concensus' do
|
23
|
-
tf_bioworks_single_xml_small = Tfiles + '/bioworks_single_run_small.xml'
|
24
|
-
obj = Bioworks.new(tf_bioworks_single_xml_small)
|
25
|
-
gfn = '5prot_mix_michrom_20fmol_200pmol'
|
26
|
-
origfilename = '5prot_mix_michrom_20fmol_200pmol.RAW'
|
27
|
-
origfilepath = 'C:\Xcalibur\sequest'
|
28
|
-
obj.global_filename.should == gfn
|
29
|
-
obj.origfilename.should == origfilename
|
30
|
-
obj.origfilepath.should == origfilepath
|
31
|
-
obj.proteins.size.should == 7
|
32
|
-
obj.proteins.first.peptides.first.base_name.should == gfn
|
33
|
-
obj.proteins.first.peptides.first.file.should == "152"
|
34
|
-
obj.proteins.first.peptides.first.charge.should == 2
|
35
|
-
# @TODO: add more tests here
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'can output in excel format (**semi-verified right now)' do
|
39
|
-
tf_bioworks_to_excel = Tfiles + '/tf_bioworks2excel.bioXML'
|
40
|
-
tf_bioworks_to_excel_actual = Tfiles + '/tf_bioworks2excel.txt.actual'
|
41
|
-
tmpfile = Tfiles + "/tf_bioworks_to_excel.tmp"
|
42
|
-
bio = Bioworks.new(tf_bioworks_to_excel)
|
43
|
-
bio.to_excel(tmpfile)
|
44
|
-
tmpfile.exist_as_a_file?.should be_true
|
45
|
-
#File.should exist_as_a_file(tmpfile)
|
46
|
-
exp = _arr_of_arrs(tf_bioworks_to_excel_actual)
|
47
|
-
act = _arr_of_arrs(tmpfile)
|
48
|
-
exp.each_index do |i|
|
49
|
-
break if i == 23 ## this is where the ordering becomes arbitrary between guys with the same scans, but different filenames
|
50
|
-
_assert_equal_pieces(exp[i], act[i], exp[i][0] =~ /\d/)
|
51
|
-
end
|
52
|
-
|
53
|
-
File.unlink tmpfile
|
54
|
-
end
|
55
|
-
|
56
|
-
# prot is boolean if this is a protein line!
|
57
|
-
def _assert_equal_pieces(exp, act, prot)
|
58
|
-
# equal as floats (by delta)
|
59
|
-
exp.each_index do |i|
|
60
|
-
if i == 5 # both proteins and peptides
|
61
|
-
act[i].to_f.should be_close(exp[i].to_f, 0.1)
|
62
|
-
elsif i == 3 && !prot
|
63
|
-
act[i].to_f.should be_close(exp[i].to_f, 0.01)
|
64
|
-
elsif i == 6 && !prot
|
65
|
-
act[i].to_f.should be_close(exp[i].to_f, 0.01)
|
66
|
-
elsif i == 9 && prot
|
67
|
-
## NEED TO GET THESE BACK (for consistency):
|
68
|
-
#act[i].split(" ")[0].should =~ exp[i].split(" ")[0]
|
69
|
-
else
|
70
|
-
## NEED TO GET THESE BACK (for consistency):
|
71
|
-
#act[i].should == exp[i]
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
# takes a bioworks excel (in txt format) and outputs an arr of arrs
|
77
|
-
def _arr_of_arrs(file)
|
78
|
-
IO.readlines(file).collect do |line|
|
79
|
-
line.chomp!
|
80
|
-
line.split("\t")
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
it 'can return unique peptides and proteins by sequence+charge (private)' do
|
85
|
-
cnt = 0
|
86
|
-
answer = [%w(2 PEPTIDE), %w(3 PEPTIDE), %w(3 PEPY), %w(2 PEPY)]
|
87
|
-
exp_peps = answer.collect! do |arr|
|
88
|
-
pep = Bioworks::Pep.new
|
89
|
-
pep.charge = arr[0]
|
90
|
-
pep.sequence = arr[1]
|
91
|
-
pep
|
92
|
-
end
|
93
|
-
exp_prots = [[0,2],[1,4,5],[3],[6]].collect do |arr|
|
94
|
-
arr.collect do |num|
|
95
|
-
prot = Bioworks::Prot.new
|
96
|
-
prot.reference = "#{num}"
|
97
|
-
prot
|
98
|
-
end
|
99
|
-
end
|
100
|
-
exp_peps = exp_peps.zip(exp_prots)
|
101
|
-
exp_peps.collect! do |both|
|
102
|
-
both[0].proteins = [both[1]]
|
103
|
-
both[0]
|
104
|
-
end
|
105
|
-
|
106
|
-
peptides = [%w(2 PEPTIDE), %w(3 PEPTIDE), %w(2 PEPTIDE), %w(3 PEPY), %w(3 PEPTIDE), %w(3 PEPTIDE), %w(2 PEPY)].collect do |arr|
|
107
|
-
pep = Bioworks::Pep.new
|
108
|
-
pep.charge = arr[0]
|
109
|
-
pep.sequence = arr[1]
|
110
|
-
pep.proteins = [Bioworks::Prot.new]
|
111
|
-
pep.proteins.first.reference = "#{cnt}"
|
112
|
-
cnt += 1
|
113
|
-
pep
|
114
|
-
end
|
115
|
-
peptides, proteins = Bioworks.new._uniq_peps_by_sequence_charge(peptides)
|
116
|
-
proteins.size.should == peptides.size
|
117
|
-
exp_peps.each_with_index do |pep, i|
|
118
|
-
peptides[i].charge.should == pep.charge
|
119
|
-
peptides[i].sequence.should == pep.sequence
|
120
|
-
end
|
121
|
-
|
122
|
-
exp_prots.each_index do |i|
|
123
|
-
exp_prots[i].each_index do |j|
|
124
|
-
proteins[i][j].reference.should == exp_prots[i][j].reference
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
end
|
130
|
-
|
131
|
-
describe Bioworks::Pep do
|
132
|
-
it 'can be initialized from a hash' do
|
133
|
-
hash = {:sequence => 0, :mass => 1, :deltamass => 2, :charge => 3, :xcorr => 4, :deltacn => 5, :sp => 6, :rsp => 7, :ions => 8, :count => 9, :tic => 10, :proteins => 11, :base_name => 12, :first_scan => 13, :last_scan => 14, :peptide_probability => 15, :file => 16, :_num_proteins => 17, :_first_prot => 18}
|
134
|
-
pep = Bioworks::Pep.new(hash)
|
135
|
-
hash.each do |k,v|
|
136
|
-
pep.send(k).should == v
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
it 'correctly extracts file information' do
|
141
|
-
pep = Bioworks::Pep.new
|
142
|
-
testing = ['005a, 1131', '005b, 1131 - 1133', '1131', '1131 - 1133']
|
143
|
-
answers = [%w(005a 1131 1131), %w(005b 1131 1133), [nil, '1131', '1131'], [nil, '1131', '1133']]
|
144
|
-
testing.zip(answers) do |ar|
|
145
|
-
ans = pep.class.extract_file_info(ar[0])
|
146
|
-
ans.join(" ").should == ar[1].join(" ")
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
end
|
151
|
-
|
152
|
-
|
153
|
-
=end
|