mspire 0.3.1 → 0.3.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/Rakefile +2 -2
  2. data/bin/bioworks_to_pepxml.rb +15 -3
  3. data/bin/ms_to_lmat.rb +2 -1
  4. data/bin/sqt_group.rb +26 -0
  5. data/changelog.txt +36 -0
  6. data/lib/ms/msrun.rb +3 -1
  7. data/lib/ms/parser/mzdata/dom.rb +14 -14
  8. data/lib/ms/scan.rb +3 -3
  9. data/lib/mspire.rb +1 -1
  10. data/lib/sample_enzyme.rb +39 -0
  11. data/lib/spec_id.rb +18 -0
  12. data/lib/spec_id/aa_freqs.rb +6 -9
  13. data/lib/spec_id/digestor.rb +16 -17
  14. data/lib/spec_id/mass.rb +63 -1
  15. data/lib/spec_id/parser/proph.rb +101 -2
  16. data/lib/spec_id/precision/filter.rb +3 -2
  17. data/lib/spec_id/precision/filter/cmdline.rb +3 -1
  18. data/lib/spec_id/precision/filter/output.rb +1 -0
  19. data/lib/spec_id/precision/prob.rb +88 -21
  20. data/lib/spec_id/precision/prob/cmdline.rb +28 -16
  21. data/lib/spec_id/precision/prob/output.rb +8 -2
  22. data/lib/spec_id/proph/pep_summary.rb +25 -12
  23. data/lib/spec_id/sequest.rb +28 -0
  24. data/lib/spec_id/sequest/pepxml.rb +142 -197
  25. data/lib/spec_id/sqt.rb +349 -0
  26. data/lib/spec_id/srf.rb +33 -23
  27. data/lib/validator.rb +40 -57
  28. data/lib/validator/aa.rb +3 -90
  29. data/lib/validator/aa_est.rb +112 -0
  30. data/lib/validator/cmdline.rb +163 -31
  31. data/lib/validator/decoy.rb +15 -7
  32. data/lib/validator/digestion_based.rb +5 -4
  33. data/lib/validator/q_value.rb +32 -0
  34. data/script/peps_per_bin.rb +67 -0
  35. data/script/sqt_to_meta.rb +24 -0
  36. data/specs/bin/bioworks_to_pepxml_spec.rb +3 -3
  37. data/specs/bin/fasta_shaker_spec.rb +2 -2
  38. data/specs/bin/filter_and_validate__multiple_vals_helper.yaml +7 -10
  39. data/specs/bin/filter_and_validate_spec.rb +25 -6
  40. data/specs/bin/ms_to_lmat_spec.rb +2 -2
  41. data/specs/bin/prob_validate_spec.rb +5 -3
  42. data/specs/sample_enzyme_spec.rb +86 -1
  43. data/specs/spec_helper.rb +11 -9
  44. data/specs/spec_id/bioworks_spec.rb +2 -1
  45. data/specs/spec_id/precision/filter_spec.rb +5 -5
  46. data/specs/spec_id/precision/prob_spec.rb +0 -67
  47. data/specs/spec_id/proph/pep_summary_spec.rb +42 -87
  48. data/specs/spec_id/protein_summary_spec.rb +4 -4
  49. data/specs/spec_id/sequest/pepxml_spec.rb +1 -79
  50. data/specs/spec_id/sequest_spec.rb +38 -0
  51. data/specs/spec_id/sqt_spec.rb +111 -3
  52. data/specs/spec_id_spec.rb +2 -0
  53. data/specs/transmem/phobius_spec.rb +3 -1
  54. data/specs/transmem/toppred_spec.rb +1 -1
  55. data/specs/validator/aa_est_spec.rb +66 -0
  56. data/specs/validator/aa_spec.rb +1 -68
  57. data/specs/validator/background_spec.rb +2 -0
  58. data/specs/validator/bias_spec.rb +3 -27
  59. data/specs/validator/decoy_spec.rb +2 -2
  60. data/specs/validator/transmem_spec.rb +2 -1
  61. data/test_files/small.sqt +87 -0
  62. metadata +312 -293
@@ -8,6 +8,20 @@ module SpecID::Parser ; end
8
8
 
9
9
  class SpecID::Parser::PepProph
10
10
  include XMLStyleParser
11
+
12
+ # gets the protein (and adds the pephit to the protein)
13
+ def get_protein(search_hit, name, description, global_prot_hash)
14
+ prot =
15
+ if global_prot_hash.key?(name)
16
+ global_prot_hash[name]
17
+ else
18
+ prt = Proph::PepSummary::Prot.new([name, description, []])
19
+ global_prot_hash[name] = prt
20
+ end
21
+ prot.peps << search_hit
22
+ prot
23
+ end
24
+
11
25
  def initialize(parse_type=:spec_id, version='3.0')
12
26
  @method = parse_type
13
27
  @version = version
@@ -29,7 +43,10 @@ class SpecID::Parser::PepProph
29
43
  end
30
44
 
31
45
  # returns the spec_id object
46
+ # :global_prot_hash is a hash if you have multiple of these files to be
47
+ # combined
32
48
  def spec_id(file, opts={})
49
+
33
50
  raise NotImplementedError, "cannot do #{@version} yet" if @version.nil? or @version < '3.0'
34
51
  spec_id_obj =
35
52
  if x = opts[:spec_id]
@@ -37,11 +54,93 @@ class SpecID::Parser::PepProph
37
54
  else
38
55
  Proph::PepSummary.new
39
56
  end
57
+ global_prot_hash =
58
+ if y = opts[:global_prot_hash]
59
+ y
60
+ else
61
+ {}
62
+ end
40
63
  msms_pipeline_analysis_n = @get_root_node_from_file.call(file)
41
64
  spec_id_obj.peptideprophet_summary = msms_pipeline_analysis_n.find_first("descendant::peptideprophet_summary")
42
65
 
43
- msms_run_summary_n = msms_pipeline_analysis_n.find_first('child::msms_run_summary')
44
- spec_id_obj.from_pepxml_node(msms_run_summary_n)
66
+
67
+ spec_id_obj.msms_run_summaries = msms_pipeline_analysis_n.find('child::msms_run_summary').map do |msms_run_summary_n|
68
+ parse_msms_run_summary(msms_run_summary_n, global_prot_hash)
69
+ end
70
+
71
+ peps = []
72
+ spec_id_obj.msms_run_summaries.each do |mrs|
73
+ mrs.spectrum_queries.each do |sq|
74
+ sq.search_results.each do |sr|
75
+ peps.push( *(sr.search_hits) )
76
+ end
77
+ end
78
+ end
79
+ spec_id_obj.peps = peps
80
+ spec_id_obj.prots = global_prot_hash.values
81
+ spec_id_obj
82
+ end
83
+
84
+ # returns an msms_run_summary object
85
+ def parse_msms_run_summary(msms_run_summary_n, global_prot_hash)
86
+ msms_run_summary_obj = Sequest::PepXML::MSMSRunSummary.new
87
+
88
+ msms_run_summary_obj.from_pepxml_node(msms_run_summary_n)
89
+ sample_enzyme_n = msms_run_summary_n.find_first("child::sample_enzyme")
90
+ msms_run_summary_obj.sample_enzyme = SampleEnzyme.from_pepxml_node( sample_enzyme_n )
91
+
92
+ search_summary_n = sample_enzyme_n.find_first("following-sibling::search_summary")
93
+ spectrum_queries_nds = search_summary_n.find("following-sibling::spectrum_query")
94
+
95
+ msms_run_summary_obj.spectrum_queries = spectrum_queries_nds.map do |sq_n|
96
+
97
+ sq = Sequest::PepXML::SpectrumQuery.from_pepxml_node(sq_n)
98
+ sq.search_results = sq_n.children.map do |sr_n|
99
+ sr = Sequest::PepXML::SearchResult.new
100
+ sr.search_hits = sr_n.children.map do |sh_n|
101
+ sh = Proph::PepSummary::Pep.new # descended from SearchHit
102
+ sh.from_pepxml_node(sh_n)
103
+ sh.spectrum_query = sq
104
+ prots = [ get_protein(sh, sh_n['protein'], sh_n['protein_descr'], global_prot_hash) ]
105
+ ## alternative proteins:
106
+ if sh.num_tot_proteins > 1
107
+ sh_n.find('child::alternative_protein').each do |alt_prot_n|
108
+ prots << get_protein(sh, alt_prot_n['protein'], alt_prot_n['protein_descr'], global_prot_hash)
109
+ end
110
+ end
111
+ sh.prots = prots
112
+
113
+ if modinfo_node = sh_n.find_first("child::modification_info")
114
+ sh.modification_info = Sequest::PepXML::SearchHit::ModificationInfo.from_pepxml_node(modinfo_node)
115
+ end
116
+
117
+
118
+ ## search scores:
119
+ sh_n.find("child::search_score").each do |ss_n|
120
+ case ss_n['name']
121
+ when 'deltacnstar'
122
+ sh.deltacnstar = ss_n['value'].to_i
123
+ when 'xcorr'
124
+ sh.xcorr = ss_n['value'].to_f
125
+ when 'deltacn'
126
+ sh.deltacn = ss_n['value'].to_f
127
+ when 'spscore'
128
+ sh.spscore = ss_n['value'].to_f
129
+ when 'sprank'
130
+ sh.sprank = ss_n['value'].to_i
131
+ end
132
+ end
133
+ sh
134
+ end
135
+ sr
136
+ end
137
+ sq
138
+ end
139
+
140
+ ## NOTE: this is currently just the xml node!!!! TODO: wrap everything up
141
+ #into a better search summary object (to eventually depracate the params object)
142
+ msms_run_summary_obj.search_summary = msms_run_summary_n
143
+ msms_run_summary_obj
45
144
  end
46
145
 
47
146
  end
@@ -295,7 +295,7 @@ class SpecID::Precision::Filter
295
295
 
296
296
  if opts[:hits_together]
297
297
  # we fake that the protein sets are together
298
- decoy_validator_to_split_with = Validator::Decoy.new(unmerge_regexp)
298
+ decoy_validator_to_split_with = Validator::Decoy.new(:constraint => unmerge_regexp)
299
299
  decoy_peps.each do |pep|
300
300
  pep.prots.each {|prt| prt.reference = merge_prefix + prt.reference }
301
301
  end
@@ -599,13 +599,14 @@ class SpecID::Precision::Filter::Peps < Filter
599
599
  end
600
600
 
601
601
  # returns self for chaining
602
+ # ( >= +3 charge for the x3)
602
603
  def standard_sequest_filter(peps, x1,x2,x3,deltacn,ppm,include_deltacnstar=true)
603
604
  peps.select do |pep|
604
605
  pep_deltacn = pep.deltacn
605
606
  pep_charge = pep.charge
606
607
 
607
608
  ## The outer parentheses are critical to getting the correct answer!
608
- _passing = ( (pep_deltacn >= deltacn) and ((pep_charge == 1 && pep.xcorr >= x1) or (pep_charge == 2 && pep.xcorr >= x2) or (pep_charge == 3 && pep.xcorr >= x3)) and ( pep.ppm <= ppm ))
609
+ _passing = ( (pep_deltacn >= deltacn) and ((pep_charge == 1 && pep.xcorr >= x1) or (pep_charge == 2 && pep.xcorr >= x2) or (pep_charge >= 3 && pep.xcorr >= x3)) and ( pep.ppm <= ppm ))
609
610
 
610
611
  if _passing
611
612
  if ((!include_deltacnstar) && (pep_deltacn > 1.0))
@@ -131,8 +131,10 @@ module SpecID
131
131
  op.val_opt(:digestion, opts)
132
132
  op.val_opt(:bias, opts)
133
133
  op.val_opt(:bad_aa, opts)
134
+ op.val_opt(:bad_aa_est, opts)
134
135
 
135
136
  op.val_opt(:tmm, opts)
137
+ op.val_opt(:fasta, opts)
136
138
  op.val_opt(:tps, opts)
137
139
 
138
140
  op.separator ""
@@ -187,7 +189,7 @@ module SpecID
187
189
  if opts[:ties] == nil # will be nil or false
188
190
  opts[:ties] = Validator::Cmdline::DEFAULTS[:ties]
189
191
  end
190
- opts[:validators] = Validator::Cmdline.prepare_validators(opts, !opts[:ties], opts[:interactive], spec_id_obj)
192
+ opts[:validators] = Validator::Cmdline.prepare_validators(opts, !opts[:ties], opts[:interactive], opts[:postfilter], spec_id_obj)
191
193
 
192
194
  if opts[:output].size == 0
193
195
  opts[:output] = DEFAULTS[:output]
@@ -1,3 +1,4 @@
1
+ require 'yaml'
1
2
  require 'table'
2
3
  require 'spec_id/precision/output'
3
4
 
@@ -34,11 +34,11 @@ class SpecID::Precision::Prob
34
34
  # opts may include:
35
35
  # :proteins => true|*false
36
36
  # :validators => array of Validator objects
37
+ # adjusts the precision in the *probability* validators ajdusted =
38
+ # (1+R)*prec / (R*precision +1) where R is the decoy_to_target ratio
39
+ # used in the decoy validator (R = 0.0 if no decoy validator)
37
40
  # NOTE: if you have decoy data, you MUST pass in a decoy validator for the
38
- # decoy pephits to be removed from other validator analyses!
39
- # (precision based on peptide probabilities are adjusted to account for
40
- # the decoy peptides being present: Precision(no_decoy) = (2*Prec)/(Prec+1)
41
- # which is derived from the 50/50 rule for decoy vs. embedded false hits
41
+ # decoy pephits to be removed from other validator analyses!
42
42
  #
43
43
  # returns a hash of data
44
44
  # :pephits_precision => [{validator => <name>, values => [<precision>,...]},... ]
@@ -49,6 +49,8 @@ class SpecID::Precision::Prob
49
49
  # :modified_peptides => array of modified sequence (only included if
50
50
  # applicable)
51
51
  #
52
+ # NOTE: For protein prophet, the results are given on a peptide+charge
53
+ # basis.
52
54
  #
53
55
  # TODO: implement tihs guy:
54
56
  # prothits_precision => {validator => <name>, values => {worst => ,
@@ -58,7 +60,7 @@ class SpecID::Precision::Prob
58
60
  opt = PN_DEFAULTS.merge(opts)
59
61
 
60
62
  out = {}
61
- num_pephits = [] # NOTE!: these are aaseq/aaseq_mod + charge (not really a pephit, but BEST)
63
+ num_pephits = [] # NOTE!: these are aaseq/aaseq_mod + charge for Prophet
62
64
  val_hash = Hash.new {|hash,key| hash[key] = [] }
63
65
  val_calc_bkg_hash = Hash.new {|hash,key| hash[key] = [] }
64
66
  pepstrings = []
@@ -67,16 +69,25 @@ class SpecID::Precision::Prob
67
69
  probabilities = []
68
70
  found_modified_peptide = false
69
71
 
72
+ check_precisions = []
73
+ check_precisions_decoy = []
70
74
 
71
75
  # do we need to deal with decoy peptides? (true/false)
72
76
  validators = opt[:validators].map
73
77
  decoy_vals = validators.select {|val| val.class == Validator::Decoy }
74
78
 
79
+
75
80
  if decoy_vals.size > 1
76
81
  raise(ArgumentError, "only one decoy validator allowed!")
77
82
  else
78
83
  decoy_val = decoy_vals.first
84
+ if decoy_val
85
+ decoy_to_target_ratio = decoy_val.decoy_to_target_ratio
86
+ end
79
87
  end
88
+
89
+
90
+
80
91
  validators.delete(decoy_val)
81
92
  other_validators = validators
82
93
 
@@ -89,17 +100,48 @@ class SpecID::Precision::Prob
89
100
 
90
101
  n_count = 0
91
102
  d_count = 0
103
+
104
+ # this is a peptide prophet
105
+ is_peptide_prophet =
106
+ if spec_id.peps.first.respond_to?(:fval) ; true
107
+ else ;false
108
+ end
109
+
110
+ use_q_value = spec_id.peps.first.respond_to?(:q_value)
111
+
112
+ ## ORDER THE PEPTIDE HITS:
92
113
  ordered_peps =
93
- if opt[:sort_by_init]
94
- spec_id.peps.sort_by{|v| [v.initial_probability, v.n_instances, ( v.is_nondegenerate_evidence ? 1 : 0 ), v.n_enzymatic_termini, ( v.is_contributing_evidence ? 1 : 0 ), v.n_sibling_peptides] }.reverse
114
+ if use_q_value
115
+ spec_id.peps.sort_by {|v| v.q_value }
116
+ elsif is_peptide_prophet
117
+ spec_id.peps.reject {|v| v.probability == -1.0}.sort_by {|v| v.probability }.reverse
95
118
  else
96
- spec_id.peps.sort_by{|v| [v.nsp_adjusted_probability, v.initial_probability, v.n_instances, ( v.is_nondegenerate_evidence ? 1 : 0 ), v.n_enzymatic_termini, ( v.is_contributing_evidence ? 1 : 0 ), v.n_sibling_peptides] }.reverse
119
+ if opt[:sort_by_init]
120
+ spec_id.peps.sort_by{|v| [v.initial_probability, v.n_instances, ( v.is_nondegenerate_evidence ? 1 : 0 ), v.n_enzymatic_termini, ( v.is_contributing_evidence ? 1 : 0 ), v.n_sibling_peptides] }.reverse
121
+ else
122
+ spec_id.peps.sort_by{|v| [v.nsp_adjusted_probability, v.initial_probability, v.n_instances, ( v.is_nondegenerate_evidence ? 1 : 0 ), v.n_enzymatic_termini, ( v.is_contributing_evidence ? 1 : 0 ), v.n_sibling_peptides] }.reverse
123
+ end
97
124
  end
125
+
126
+ # for probability based precision with decoy database (not using prophet's
127
+ # -d flag) we do this:
128
+ # foreach peptide.sorted_by_probability
129
+ # 1. update the running precision of the validator REGARDLESS of
130
+ # decoy/target status of peptide. the internal hit counts are
131
+ # incremented.
132
+ # 2. only increment reported HIT COUNTS on a non-decoy hit and record
133
+ # the precision as (1+R)*prec / (R*precision +1) where R is the ratio of
134
+ # decoy hits to target hits. If it is 1:1 (R = 1) then this becomes:
135
+ # 2*prec / (prec + 1)
136
+
137
+ ## WORK THROUGH EACH PEPTIDE:
98
138
  ordered_peps.each_with_index do |pep,i|
99
139
  # probability validators must work on the entire set of normal and decoy
100
140
 
101
141
  last_prob_values = probability_validators.map do |val|
102
- val.increment_pephits_precision(pep)
142
+ reply = val.increment_pephits_precision(pep)
143
+ check_precisions << reply
144
+ reply
103
145
  end
104
146
 
105
147
  it_is_a_normal_pep =
@@ -113,13 +155,23 @@ class SpecID::Precision::Prob
113
155
  true
114
156
  end
115
157
 
158
+ if it_is_a_normal_pep
159
+ check_precisions_decoy << false
160
+ else
161
+ check_precisions_decoy << true
162
+ end
163
+
116
164
  if it_is_a_normal_pep
117
165
  n_count += 1
118
166
 
119
167
  # UPDATE validators:
120
- val_hash[decoy_val] << decoy_precision
168
+ val_hash[decoy_val].push(decoy_precision) if decoy_val
121
169
  probability_validators.zip(last_prob_values) do |val,prec|
122
- val_hash[val] << ( (prec * 2.0) / (prec + 1.0) )
170
+ if decoy_val
171
+ val_hash[val].push( ((decoy_to_target_ratio+1.0)*prec) / ((decoy_to_target_ratio*prec) + 1.0) )
172
+ else
173
+ val_hash[val] << prec
174
+ end
123
175
  end
124
176
  other_validators.each do |val|
125
177
  val_hash[val] << val.increment_pephits_precision(pep)
@@ -129,17 +181,28 @@ class SpecID::Precision::Prob
129
181
  end
130
182
 
131
183
  # UPDATE other basic useful information:
132
- modified_pep_string =
133
- if pep.mod_info
134
- found_modified_peptide = true
135
- pep.mod_info.modified_peptide
136
- else
137
- nil
138
- end
139
- modified_peptides << modified_pep_string
184
+ if pep.respond_to?(:mod_info)
185
+ modified_pep_string =
186
+ if pep.mod_info
187
+ found_modified_peptide = true
188
+ pep.mod_info.modified_peptide
189
+ else
190
+ nil
191
+ end
192
+ modified_peptides << modified_pep_string
193
+ else
194
+ modified_pep_string =
195
+ if pep.sequence =~ /[^A-Z\-\.]/
196
+ found_modified_peptide = true
197
+ pep.sequence
198
+ else
199
+ nil
200
+ end
201
+ modified_peptides << modified_pep_string
202
+ end
140
203
  pepcharges << pep.charge
141
204
  pepstrings << pep.aaseq
142
- probabilities << pep.probability
205
+ probabilities << pep.probability # this is the q_value if percolator
143
206
  num_pephits << (i+1)
144
207
  else
145
208
  d_count += 1
@@ -148,7 +211,11 @@ class SpecID::Precision::Prob
148
211
  if found_modified_peptide
149
212
  out[:modified_peptides] = modified_peptides
150
213
  end
151
- out[:probabilities] = probabilities
214
+ if use_q_value
215
+ out[:q_values] = probabilities
216
+ else
217
+ out[:probabilities] = probabilities
218
+ end
152
219
  out[:count] = num_pephits
153
220
  out[:aaseqs] = pepstrings
154
221
  out[:charges] = pepcharges
@@ -12,8 +12,13 @@ module SpecID
12
12
 
13
13
  COMMAND_LINE = {
14
14
  :sort_by_init => ['--sort_by_init', "sort the proteins based on init probability"],
15
+ :qval => ['--qval', "use percolator q-values to calculate precision"],
15
16
  :prob => ['--prob [TYPE]', "use prophet probabilites to calculate precision",
16
- "TYPE = *nsp|init"],
17
+ "TYPE = nsp [default] prophet nsp",
18
+ " (nsp also should be used for PeptideProphet results)",
19
+ " = init (for ProteinProphet results) use initial",
20
+ "probability instead of nsp probability",
21
+ ],
17
22
  # OUTPUT
18
23
  :proteins => ["--proteins", "includes proteins (and validation)"],
19
24
  :output => ["-o", "--output format[:FILENAME]", "format to output filtering results.",
@@ -29,12 +34,11 @@ module SpecID
29
34
  ],
30
35
 
31
36
  # VALIDATION MODIFIERS:
32
- :hits_separate => ["--hits_separate", "target/decoy hits are normally together when choosing",
33
- "the top hit per peptide (in prefilter and postfilter)",
34
- "in BOTH catenated and separate searches. This flag",
35
- "separates them when finding the top hit per scan.",
36
- "[This option modifies behavior of --decoy options]"],
37
-
37
+ :pephits => ["--pephits <file>.srg", "an srg file pointing to the srf files for",
38
+ "the given -prot.xml run",
39
+ "[this or --digestion must be used for applicable]",
40
+ "validators (validators depending on a",
41
+ "false/total ratio)]"],
38
42
  }.merge( Validator::Cmdline::COMMAND_LINE )
39
43
 
40
44
 
@@ -60,9 +64,10 @@ module SpecID
60
64
  on(*COMMAND_LINE[arg]) {|v| opts[arg] = v}
61
65
  end
62
66
 
63
- op.banner = "USAGE: #{File.basename($0)} [OPTS] <file>-prot.xml"
67
+ op.banner = "USAGE: #{File.basename($0)} [OPTS] <file>-prot.xml | <file>.sqg"
64
68
  op.separator ""
65
- op.separator " RETURNS: precision across the number of hits (based on probability)"
69
+ op.separator " RETURNS: precision across the number of hits"
70
+ op.separator " (based on probability or q-value)"
66
71
  op.separator " (optional) other validation of the results."
67
72
  op.separator ""
68
73
 
@@ -90,12 +95,16 @@ module SpecID
90
95
  op.separator ""
91
96
 
92
97
  op.val_opt(:prob, opts)
98
+ op.val_opt(:qval, opts)
93
99
  op.val_opt(:decoy, opts)
100
+ op.val_opt(:pephits, opts) # sets opts[:ties] = false
94
101
  op.val_opt(:digestion, opts)
95
102
  op.val_opt(:bias, opts)
96
103
  op.val_opt(:bad_aa, opts)
104
+ op.val_opt(:bad_aa_est, opts)
97
105
 
98
106
  op.val_opt(:tmm, opts)
107
+ op.val_opt(:fasta, opts)
99
108
  op.val_opt(:tps, opts)
100
109
 
101
110
  op.separator ""
@@ -108,16 +117,19 @@ module SpecID
108
117
  # prepare validators
109
118
 
110
119
  if args.size > 0
111
- spec_id_obj =
112
- if args[0] =~ /\.srf$/i
113
- ::SpecID.new(args)
114
- else
115
- ::SpecID.new(args[0])
116
- end
120
+ spec_id_obj = ::SpecID.new(args[0])
117
121
  if opts[:ties] == nil # will be nil or false
118
122
  opts[:ties] = Validator::Cmdline::DEFAULTS[:ties]
119
123
  end
120
- opts[:validators] = Validator::Cmdline.prepare_validators(opts, !opts[:ties], opts[:interactive], spec_id_obj)
124
+ postfilter =
125
+ if spec_id_obj.class == SQTGroup or spec_id_obj.class == Proph::PepSummary
126
+ puts 'making background estimates with: top_per_scan'
127
+ :top_per_scan
128
+ else
129
+ puts 'making background estimates with: top_per_aaseq_charge'
130
+ :top_per_aaseq_charge
131
+ end
132
+ opts[:validators] = Validator::Cmdline.prepare_validators(opts, !opts[:ties], opts[:interactive], postfilter, spec_id_obj)
121
133
 
122
134
  if opts[:output].size == 0
123
135
  opts[:output] = DEFAULTS[:output]