mspire 0.4.9 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +27 -17
- data/changelog.txt +31 -62
- data/lib/ms/calc.rb +32 -0
- data/lib/ms/data/interleaved.rb +60 -0
- data/lib/ms/data/lazy_io.rb +73 -0
- data/lib/ms/data/lazy_string.rb +15 -0
- data/lib/ms/data/simple.rb +59 -0
- data/lib/ms/data/transposed.rb +41 -0
- data/lib/ms/data.rb +57 -0
- data/lib/ms/format/format_error.rb +12 -0
- data/lib/ms/spectrum.rb +25 -384
- data/lib/ms/support/binary_search.rb +126 -0
- data/lib/ms.rb +10 -10
- metadata +38 -350
- data/INSTALL +0 -58
- data/README.rdoc +0 -18
- data/Rakefile +0 -330
- data/bin/aafreqs.rb +0 -23
- data/bin/bioworks2excel.rb +0 -14
- data/bin/bioworks_to_pepxml.rb +0 -148
- data/bin/bioworks_to_pepxml_gui.rb +0 -225
- data/bin/fasta_shaker.rb +0 -5
- data/bin/filter_and_validate.rb +0 -5
- data/bin/gi2annot.rb +0 -14
- data/bin/id_class_anal.rb +0 -112
- data/bin/id_precision.rb +0 -172
- data/bin/ms_to_lmat.rb +0 -67
- data/bin/pepproph_filter.rb +0 -16
- data/bin/prob_validate.rb +0 -6
- data/bin/protein_summary.rb +0 -6
- data/bin/protxml2prots_peps.rb +0 -32
- data/bin/raw_to_mzXML.rb +0 -55
- data/bin/run_percolator.rb +0 -122
- data/bin/sqt_group.rb +0 -26
- data/bin/srf_group.rb +0 -27
- data/bin/srf_to_sqt.rb +0 -40
- data/lib/align/chams.rb +0 -78
- data/lib/align.rb +0 -154
- data/lib/archive/targz.rb +0 -94
- data/lib/bsearch.rb +0 -120
- data/lib/core_extensions.rb +0 -16
- data/lib/fasta.rb +0 -626
- data/lib/gi.rb +0 -124
- data/lib/group_by.rb +0 -10
- data/lib/index_by.rb +0 -11
- data/lib/merge_deep.rb +0 -21
- data/lib/ms/converter/mzxml.rb +0 -77
- data/lib/ms/gradient_program.rb +0 -170
- data/lib/ms/msrun.rb +0 -244
- data/lib/ms/msrun_index.rb +0 -108
- data/lib/ms/parser/mzdata/axml.rb +0 -67
- data/lib/ms/parser/mzdata/dom.rb +0 -175
- data/lib/ms/parser/mzdata/libxml.rb +0 -7
- data/lib/ms/parser/mzdata.rb +0 -31
- data/lib/ms/parser/mzxml/axml.rb +0 -70
- data/lib/ms/parser/mzxml/dom.rb +0 -182
- data/lib/ms/parser/mzxml/hpricot.rb +0 -253
- data/lib/ms/parser/mzxml/libxml.rb +0 -19
- data/lib/ms/parser/mzxml/regexp.rb +0 -122
- data/lib/ms/parser/mzxml/rexml.rb +0 -72
- data/lib/ms/parser/mzxml/xmlparser.rb +0 -248
- data/lib/ms/parser/mzxml.rb +0 -282
- data/lib/ms/parser.rb +0 -108
- data/lib/ms/precursor.rb +0 -25
- data/lib/ms/scan.rb +0 -81
- data/lib/mspire.rb +0 -4
- data/lib/pi_zero.rb +0 -244
- data/lib/qvalue.rb +0 -161
- data/lib/roc.rb +0 -187
- data/lib/sample_enzyme.rb +0 -160
- data/lib/scan_i.rb +0 -21
- data/lib/spec_id/aa_freqs.rb +0 -170
- data/lib/spec_id/bioworks.rb +0 -497
- data/lib/spec_id/digestor.rb +0 -138
- data/lib/spec_id/mass.rb +0 -179
- data/lib/spec_id/parser/proph.rb +0 -335
- data/lib/spec_id/precision/filter/cmdline.rb +0 -218
- data/lib/spec_id/precision/filter/interactive.rb +0 -134
- data/lib/spec_id/precision/filter/output.rb +0 -148
- data/lib/spec_id/precision/filter.rb +0 -637
- data/lib/spec_id/precision/output.rb +0 -60
- data/lib/spec_id/precision/prob/cmdline.rb +0 -160
- data/lib/spec_id/precision/prob/output.rb +0 -94
- data/lib/spec_id/precision/prob.rb +0 -249
- data/lib/spec_id/proph/pep_summary.rb +0 -104
- data/lib/spec_id/proph/prot_summary.rb +0 -484
- data/lib/spec_id/proph.rb +0 -4
- data/lib/spec_id/protein_summary.rb +0 -489
- data/lib/spec_id/sequest/params.rb +0 -316
- data/lib/spec_id/sequest/pepxml.rb +0 -1458
- data/lib/spec_id/sequest.rb +0 -33
- data/lib/spec_id/sqt.rb +0 -349
- data/lib/spec_id/srf.rb +0 -973
- data/lib/spec_id.rb +0 -778
- data/lib/spec_id_xml.rb +0 -99
- data/lib/transmem/phobius.rb +0 -147
- data/lib/transmem/toppred.rb +0 -368
- data/lib/transmem.rb +0 -157
- data/lib/validator/aa.rb +0 -48
- data/lib/validator/aa_est.rb +0 -112
- data/lib/validator/background.rb +0 -77
- data/lib/validator/bias.rb +0 -95
- data/lib/validator/cmdline.rb +0 -431
- data/lib/validator/decoy.rb +0 -107
- data/lib/validator/digestion_based.rb +0 -70
- data/lib/validator/probability.rb +0 -51
- data/lib/validator/prot_from_pep.rb +0 -234
- data/lib/validator/q_value.rb +0 -32
- data/lib/validator/transmem.rb +0 -272
- data/lib/validator/true_pos.rb +0 -46
- data/lib/validator.rb +0 -197
- data/lib/xml.rb +0 -38
- data/lib/xml_style_parser.rb +0 -119
- data/lib/xmlparser_wrapper.rb +0 -19
- data/release_notes.txt +0 -2
- data/script/compile_and_plot_smriti_final.rb +0 -97
- data/script/create_little_pepxml.rb +0 -61
- data/script/degenerate_peptides.rb +0 -47
- data/script/estimate_fpr_by_cysteine.rb +0 -226
- data/script/extract_gradient_programs.rb +0 -56
- data/script/find_cysteine_background.rb +0 -137
- data/script/genuine_tps_and_probs.rb +0 -136
- data/script/get_apex_values_rexml.rb +0 -44
- data/script/histogram_probs.rb +0 -61
- data/script/mascot_fix_pepxml.rb +0 -123
- data/script/msvis.rb +0 -42
- data/script/mzXML2timeIndex.rb +0 -25
- data/script/peps_per_bin.rb +0 -67
- data/script/prep_dir.rb +0 -121
- data/script/simple_protein_digestion.rb +0 -27
- data/script/smriti_final_analysis.rb +0 -103
- data/script/sqt_to_meta.rb +0 -24
- data/script/top_hit_per_scan.rb +0 -67
- data/script/toppred_to_yaml.rb +0 -47
- data/script/tpp_installer.rb +0 -249
- data/specs/align_spec.rb +0 -79
- data/specs/bin/bioworks_to_pepxml_spec.rb +0 -79
- data/specs/bin/fasta_shaker_spec.rb +0 -259
- data/specs/bin/filter_and_validate__multiple_vals_helper.yaml +0 -199
- data/specs/bin/filter_and_validate_spec.rb +0 -180
- data/specs/bin/ms_to_lmat_spec.rb +0 -34
- data/specs/bin/prob_validate_spec.rb +0 -86
- data/specs/bin/protein_summary_spec.rb +0 -14
- data/specs/fasta_spec.rb +0 -354
- data/specs/gi_spec.rb +0 -22
- data/specs/load_bin_path.rb +0 -7
- data/specs/merge_deep_spec.rb +0 -13
- data/specs/ms/gradient_program_spec.rb +0 -77
- data/specs/ms/msrun_spec.rb +0 -498
- data/specs/ms/parser_spec.rb +0 -92
- data/specs/ms/spectrum_spec.rb +0 -87
- data/specs/pi_zero_spec.rb +0 -115
- data/specs/qvalue_spec.rb +0 -39
- data/specs/roc_spec.rb +0 -251
- data/specs/rspec_autotest.rb +0 -149
- data/specs/sample_enzyme_spec.rb +0 -126
- data/specs/spec_helper.rb +0 -135
- data/specs/spec_id/aa_freqs_spec.rb +0 -52
- data/specs/spec_id/bioworks_spec.rb +0 -148
- data/specs/spec_id/digestor_spec.rb +0 -75
- data/specs/spec_id/precision/filter/cmdline_spec.rb +0 -20
- data/specs/spec_id/precision/filter/output_spec.rb +0 -31
- data/specs/spec_id/precision/filter_spec.rb +0 -246
- data/specs/spec_id/precision/prob_spec.rb +0 -44
- data/specs/spec_id/precision/prob_spec_helper.rb +0 -0
- data/specs/spec_id/proph/pep_summary_spec.rb +0 -98
- data/specs/spec_id/proph/prot_summary_spec.rb +0 -128
- data/specs/spec_id/protein_summary_spec.rb +0 -189
- data/specs/spec_id/sequest/params_spec.rb +0 -68
- data/specs/spec_id/sequest/pepxml_spec.rb +0 -374
- data/specs/spec_id/sequest_spec.rb +0 -38
- data/specs/spec_id/sqt_spec.rb +0 -246
- data/specs/spec_id/srf_spec.rb +0 -172
- data/specs/spec_id/srf_spec_helper.rb +0 -139
- data/specs/spec_id_helper.rb +0 -33
- data/specs/spec_id_spec.rb +0 -366
- data/specs/spec_id_xml_spec.rb +0 -33
- data/specs/transmem/phobius_spec.rb +0 -425
- data/specs/transmem/toppred_spec.rb +0 -298
- data/specs/transmem_spec.rb +0 -60
- data/specs/transmem_spec_shared.rb +0 -64
- data/specs/validator/aa_est_spec.rb +0 -66
- data/specs/validator/aa_spec.rb +0 -40
- data/specs/validator/background_spec.rb +0 -67
- data/specs/validator/bias_spec.rb +0 -122
- data/specs/validator/decoy_spec.rb +0 -51
- data/specs/validator/fasta_helper.rb +0 -26
- data/specs/validator/prot_from_pep_spec.rb +0 -141
- data/specs/validator/transmem_spec.rb +0 -146
- data/specs/validator/true_pos_spec.rb +0 -58
- data/specs/validator_helper.rb +0 -33
- data/specs/xml_spec.rb +0 -12
- data/test_files/000_pepxml18_small.xml +0 -206
- data/test_files/020a.mzXML.timeIndex +0 -4710
- data/test_files/4-03-03_mzXML/000.mzXML.timeIndex +0 -3973
- data/test_files/4-03-03_mzXML/020.mzXML.timeIndex +0 -3872
- data/test_files/4-03-03_small-prot.xml +0 -321
- data/test_files/4-03-03_small.xml +0 -3876
- data/test_files/7MIX_STD_110802_1.sequest_params_fragment.srf +0 -0
- data/test_files/bioworks-3.3_10prots.xml +0 -5999
- data/test_files/bioworks31.params +0 -77
- data/test_files/bioworks32.params +0 -62
- data/test_files/bioworks33.params +0 -63
- data/test_files/bioworks_single_run_small.xml +0 -7237
- data/test_files/bioworks_small.fasta +0 -212
- data/test_files/bioworks_small.params +0 -63
- data/test_files/bioworks_small.phobius +0 -109
- data/test_files/bioworks_small.toppred.out +0 -2847
- data/test_files/bioworks_small.xml +0 -5610
- data/test_files/bioworks_with_INV_small.xml +0 -3753
- data/test_files/bioworks_with_SHUFF_small.xml +0 -2503
- data/test_files/corrupted_900.srf +0 -0
- data/test_files/head_of_7MIX.srf +0 -0
- data/test_files/interact-opd1_mods_small-prot.xml +0 -304
- data/test_files/messups.fasta +0 -297
- data/test_files/opd1/000.my_answer.100lines.xml +0 -101
- data/test_files/opd1/000.tpp_1.2.3.first10.xml +0 -115
- data/test_files/opd1/000.tpp_2.9.2.first10.xml +0 -126
- data/test_files/opd1/000.v2.1.mzXML.timeIndex +0 -3748
- data/test_files/opd1/000_020-prot.png +0 -0
- data/test_files/opd1/000_020_3prots-prot.mod_initprob.xml +0 -62
- data/test_files/opd1/000_020_3prots-prot.xml +0 -62
- data/test_files/opd1/opd1_cat_inv_small-prot.xml +0 -139
- data/test_files/opd1/sequest.3.1.params +0 -77
- data/test_files/opd1/sequest.3.2.params +0 -62
- data/test_files/opd1/twenty_scans.mzXML +0 -418
- data/test_files/opd1/twenty_scans.v2.1.mzXML +0 -382
- data/test_files/opd1/twenty_scans_answ.lmat +0 -0
- data/test_files/opd1/twenty_scans_answ.lmata +0 -9
- data/test_files/opd1_020_beginning.RAW +0 -0
- data/test_files/opd1_2runs_2mods/data/020.mzData.xml +0 -683
- data/test_files/opd1_2runs_2mods/data/020.readw.mzXML +0 -382
- data/test_files/opd1_2runs_2mods/data/040.mzData.xml +0 -683
- data/test_files/opd1_2runs_2mods/data/040.readw.mzXML +0 -382
- data/test_files/opd1_2runs_2mods/data/README.txt +0 -6
- data/test_files/opd1_2runs_2mods/interact-opd1_mods__small.xml +0 -753
- data/test_files/orbitrap_mzData/000_cut.xml +0 -1920
- data/test_files/pepproph_small.xml +0 -4691
- data/test_files/phobius.small.noheader.txt +0 -50
- data/test_files/phobius.small.small.txt +0 -53
- data/test_files/s01_anC1_ld020mM.key.txt +0 -25
- data/test_files/s01_anC1_ld020mM.meth +0 -0
- data/test_files/small.fasta +0 -297
- data/test_files/small.sqt +0 -87
- data/test_files/smallraw.RAW +0 -0
- data/test_files/tf_bioworks2excel.bioXML +0 -14340
- data/test_files/tf_bioworks2excel.txt.actual +0 -1035
- data/test_files/toppred.small.out +0 -416
- data/test_files/toppred.xml.out +0 -318
- data/test_files/validator_hits_separate/bias_bioworks_small_HS.fasta +0 -7
- data/test_files/validator_hits_separate/bioworks_small_HS.xml +0 -5651
- data/test_files/yeast_gly_small-prot.xml +0 -265
- data/test_files/yeast_gly_small.1.0_1.0_1.0.parentTimes +0 -6
- data/test_files/yeast_gly_small.xml +0 -3807
- data/test_files/yeast_gly_small2.parentTimes +0 -6
@@ -1,218 +0,0 @@
|
|
1
|
-
require 'validator/cmdline'
|
2
|
-
require 'spec_id'
|
3
|
-
|
4
|
-
|
5
|
-
module SpecID
|
6
|
-
module Precision
|
7
|
-
class Filter
|
8
|
-
class CmdlineParser
|
9
|
-
|
10
|
-
DEFAULTS = SpecID::Precision::Filter::FV_DEFAULTS.merge( { :output => [[:text_table,nil]], } )
|
11
|
-
|
12
|
-
|
13
|
-
COMMAND_LINE = {
|
14
|
-
# SEQUEST
|
15
|
-
:xcorr1 => ["-1", "--xcorr1 N", Float, "xcorr at +1 charge default: #{DEFAULTS[:sequest][:xcorr1]}"],
|
16
|
-
:xcorr2 => ["-2", "--xcorr2 N", Float, "xcorr at +2 charge default: #{DEFAULTS[:sequest][:xcorr2]}"],
|
17
|
-
:xcorr3 => ["-3", "--xcorr3 N", Float, "xcorr at +3 charge default: #{DEFAULTS[:sequest][:xcorr3]}"],
|
18
|
-
|
19
|
-
:deltacn => ["-d", "--deltacn N", Float, ">= deltacn default: #{DEFAULTS[:sequest][:deltacn]}"],
|
20
|
-
:ppm => ["-p", "--ppm N", Float, "<= ppm default: #{DEFAULTS[:sequest][:ppm]}",
|
21
|
-
"if bioworks.xml, then ppm = deltamass*10^6/mass"],
|
22
|
-
:no_deltacnstar => ["--no_deltacnstar", "Do not pass deltacn of top hit with no 2nd hit",
|
23
|
-
"(these are set at 1.1 by bioworks)"],
|
24
|
-
|
25
|
-
# OUTPUT
|
26
|
-
:proteins => ["--proteins", "includes proteins (and validation)"],
|
27
|
-
:output => ["-o", "--output format[:FILENAME]", "format to output filtering results.",
|
28
|
-
"can be used multiple times",
|
29
|
-
":FILENAME is the filename to use (defaults to STDOUT)",
|
30
|
-
"valid formats are:",
|
31
|
-
" text_table (default)",
|
32
|
-
" yaml",
|
33
|
-
#" protein_summary (need to implement)",
|
34
|
-
#" html_table (need to implement)"
|
35
|
-
],
|
36
|
-
|
37
|
-
# VALIDATION MODIFIERS:
|
38
|
-
:hits_separate => ["--hits_separate", "target/decoy hits are normally together when choosing",
|
39
|
-
"the top hit per peptide (in prefilter and postfilter)",
|
40
|
-
"in BOTH catenated and separate searches. This flag",
|
41
|
-
"separates them when finding the top hit per scan.",
|
42
|
-
"[This option modifies behavior of --decoy options]"],
|
43
|
-
|
44
|
-
# OTHER:
|
45
|
-
:prefilter => ["--prefilter", "finds the top hit per file+scan+charge and removes",
|
46
|
-
"others. Speeds up filtering with '--interactive'."],
|
47
|
-
:postfilter => ["--postfilter ARG", "ARG = top_per_scan | top_per_aaseq[_charge]",
|
48
|
-
"'top_per_scan' hashes on filename+scan.",
|
49
|
-
"'top_per_aaseq' hashes only on aaseq",
|
50
|
-
"'top_per_aaseq_charge' hashes on aaseq+charge."],
|
51
|
-
:top_hit_by => ["--top_hit_by ARG", "ARG = xcorr | probability (xcorr default)"],
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
:interactive => ["-i", "--interactive [FILENAME]", "interactive filtering",
|
56
|
-
"FILENAME given, then the interactive commands are",
|
57
|
-
"read out of that file. NOTE: The flag without the",
|
58
|
-
"filename must not be placed in front of an input",
|
59
|
-
"file argument! e.g., -i bioworks.xml # -> bad!",
|
60
|
-
"e.g., bioworks.xml -i # -> ok!"],
|
61
|
-
|
62
|
-
:interactive_verbose => ["--interactive_verbose", "give help and hints in interactive mode"],
|
63
|
-
|
64
|
-
}.merge( Validator::Cmdline::COMMAND_LINE )
|
65
|
-
|
66
|
-
|
67
|
-
# returns (spec_id_obj, options, option_parser_obj)
|
68
|
-
def parse(args)
|
69
|
-
opts = {}
|
70
|
-
opts[:output] = []
|
71
|
-
@out_used = false
|
72
|
-
opts[:sequest] = {}
|
73
|
-
opts[:validators] = []
|
74
|
-
# defaults
|
75
|
-
|
76
|
-
option_parser = OptionParser.new do |op|
|
77
|
-
def op.opt(arg, &block)
|
78
|
-
on(*COMMAND_LINE[arg], &block)
|
79
|
-
end
|
80
|
-
|
81
|
-
def op.val_opt(arg, opts)
|
82
|
-
on(*COMMAND_LINE[arg]) {|ar| Validator::Cmdline::PrepArgs[arg].call(ar, opts) }
|
83
|
-
end
|
84
|
-
|
85
|
-
def op.exact_opt(opts, arg)
|
86
|
-
on(*COMMAND_LINE[arg]) {|v| opts[arg] = v}
|
87
|
-
end
|
88
|
-
|
89
|
-
op.banner = "USAGE: #{File.basename($0)} [OPTS] <bioworks.xml | bioworks.srg | .srf ....srf>"
|
90
|
-
op.separator ""
|
91
|
-
op.separator " EXPECTS: the multiconsensus XML export of Bioworks 3.X (bioworks.xml) -or- *.srf files"
|
92
|
-
op.separator " grouped together (bioworks.srg) [type 'srf_group.rb' at the cmd line]"
|
93
|
-
|
94
|
-
op.separator " multiple .srf files may also be entered."
|
95
|
-
op.separator " RETURNS: the number of peptides/proteins ID'd at given thresholds with"
|
96
|
-
op.separator " (optional) validation of the results."
|
97
|
-
op.separator ""
|
98
|
-
|
99
|
-
#op.separator("** 'dcn*' is the number of peptides with deltacn == 1.1")
|
100
|
-
#op.separator(" (these are peptides who are the only hit with xcorr > 0)")
|
101
|
-
op.separator "SEQUEST OPTIONS: "
|
102
|
-
op.exact_opt(opts[:sequest], :xcorr1)
|
103
|
-
op.exact_opt(opts[:sequest], :xcorr2)
|
104
|
-
op.exact_opt(opts[:sequest], :xcorr3)
|
105
|
-
op.exact_opt(opts[:sequest], :deltacn)
|
106
|
-
op.exact_opt(opts[:sequest], :ppm)
|
107
|
-
op.opt(:no_deltacnstar) {|v| opts[:sequest][:include_deltacnstar] = false}
|
108
|
-
op.separator ""
|
109
|
-
op.separator "OUTPUT OPTIONS: "
|
110
|
-
op.opt(:proteins) {|v| opts[:proteins] = true }
|
111
|
-
op.opt(:output) do |output|
|
112
|
-
# copied from rspec:
|
113
|
-
# This funky regexp checks whether we have a FILE_NAME or not
|
114
|
-
where = nil
|
115
|
-
if (output =~ /([a-zA-Z_]+(?:::[a-zA-Z_]+)*):?(.*)/) && ($2 != '')
|
116
|
-
output = $1
|
117
|
-
where = $2
|
118
|
-
else
|
119
|
-
raise "When using several --output options only one of them can be without a file" if @out_used
|
120
|
-
@out_used = true
|
121
|
-
end
|
122
|
-
opts[:output] << [output, where]
|
123
|
-
end
|
124
|
-
|
125
|
-
op.separator ""
|
126
|
-
op.separator "VALIDATION OPTIONS: "
|
127
|
-
op.separator " each option will calculate the precision"
|
128
|
-
op.separator ""
|
129
|
-
|
130
|
-
op.val_opt(:decoy, opts)
|
131
|
-
op.val_opt(:digestion, opts)
|
132
|
-
op.val_opt(:bias, opts)
|
133
|
-
op.val_opt(:bad_aa, opts)
|
134
|
-
op.val_opt(:bad_aa_est, opts)
|
135
|
-
|
136
|
-
op.val_opt(:tmm, opts)
|
137
|
-
op.val_opt(:fasta, opts)
|
138
|
-
op.val_opt(:tps, opts)
|
139
|
-
|
140
|
-
op.separator ""
|
141
|
-
op.separator "VALIDATION MODIFIERS: "
|
142
|
-
op.val_opt(:false_on_tie, opts) # sets opts[:ties] = false
|
143
|
-
|
144
|
-
op.opt(:hits_separate) { opts[:hits_together] = false } # :top_hits_together
|
145
|
-
|
146
|
-
op.separator ""
|
147
|
-
op.separator "OTHER OPTIONS: "
|
148
|
-
op.opt(:interactive) do |v|
|
149
|
-
opts[:interactive] =
|
150
|
-
if v
|
151
|
-
v
|
152
|
-
else
|
153
|
-
true
|
154
|
-
end
|
155
|
-
end
|
156
|
-
op.opt(:interactive_verbose) {|v| opts[:interactive_verbose] = v }
|
157
|
-
|
158
|
-
op.opt(:top_hit_by) {|v| opts[:top_hit_by] = v.to_sym}
|
159
|
-
op.opt(:postfilter) {|v| opts[:postfilter] = v.to_sym}
|
160
|
-
op.opt(:prefilter) {|v| opts[:prefilter] = true }
|
161
|
-
|
162
|
-
|
163
|
-
#op.on("--yaml", "spits out yaml-ized data") {|v| opts[:tabulate = v }
|
164
|
-
#op.on("--combined_score", "shows the combined score") {|v| opts[:combined_score = v }
|
165
|
-
#op.on("--marshal", "will write marshaled data or read existing") {|v| opts[:marshal = v }
|
166
|
-
#op.on("--log <file>", "also writes all output to file") {|v| opts[:log = v }
|
167
|
-
### NEED TO IMPLEMENT THIS:
|
168
|
-
##op.on("--protein_summary", "writes passing proteins to .summary.html files") {|v| opts[:protein_summary = v }
|
169
|
-
#op.on("-z", "--occams_razor", "will show minimal set of proteins") {|v| opts[:occams_razor = v }
|
170
|
-
|
171
|
-
end
|
172
|
-
option_parser.parse!(args)
|
173
|
-
|
174
|
-
# prepare interactive object if necessary:
|
175
|
-
if v = opts[:interactive]
|
176
|
-
klass = SpecID::Precision::Filter::Interactive
|
177
|
-
if v.is_a? String
|
178
|
-
opts[:interactive] = klass.new(v, opts[:interactive_verbose])
|
179
|
-
else
|
180
|
-
opts[:interactive] = klass.new(nil, opts[:interactive_verbose])
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
|
185
|
-
opts[:sequest] = DEFAULTS[:sequest].merge(opts[:sequest])
|
186
|
-
|
187
|
-
# prepare validators
|
188
|
-
|
189
|
-
if args.size > 0
|
190
|
-
spec_id_obj =
|
191
|
-
if args[0] =~ /\.srf$/i
|
192
|
-
::SpecID.new(args)
|
193
|
-
else
|
194
|
-
::SpecID.new(args[0])
|
195
|
-
end
|
196
|
-
if opts[:ties] == nil # will be nil or false
|
197
|
-
opts[:ties] = Validator::Cmdline::DEFAULTS[:ties]
|
198
|
-
end
|
199
|
-
opts[:validators] = Validator::Cmdline.prepare_validators(opts, !opts[:ties], opts[:interactive], opts[:postfilter], spec_id_obj)
|
200
|
-
|
201
|
-
if opts[:output].size == 0
|
202
|
-
opts[:output] = DEFAULTS[:output]
|
203
|
-
end
|
204
|
-
else
|
205
|
-
spec_id_obj = nil
|
206
|
-
end
|
207
|
-
|
208
|
-
[spec_id_obj, opts, option_parser]
|
209
|
-
end # parse
|
210
|
-
end # CmdlineParser
|
211
|
-
end # Filter
|
212
|
-
end # Precision
|
213
|
-
end # SpecID
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
@@ -1,134 +0,0 @@
|
|
1
|
-
|
2
|
-
module SpecID ; end
|
3
|
-
module SpecID::Precision ; end
|
4
|
-
|
5
|
-
class SpecID::Precision::Filter
|
6
|
-
class Interactive
|
7
|
-
attr_accessor :file
|
8
|
-
attr_accessor :verbose
|
9
|
-
|
10
|
-
# the file contains the interactive commands
|
11
|
-
def initialize(file=nil, verbose=false)
|
12
|
-
@verbose = verbose
|
13
|
-
if file
|
14
|
-
@file = file
|
15
|
-
@lines = IO.readlines(file)
|
16
|
-
else
|
17
|
-
@lines = nil
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def passing(opts, answer)
|
22
|
-
puts "****************************************************" if @verbose
|
23
|
-
end
|
24
|
-
# takes opts and modifies the keys in question, or returns nil
|
25
|
-
# shortcut map takes each proper key and designates a shortcut (if any)
|
26
|
-
|
27
|
-
def filter_args(opts_to_change, changing_keys, shortcut_map, casting_map)
|
28
|
-
shortcut_order = changing_keys.map {|k| shortcut_map[k] }
|
29
|
-
casting_array = changing_keys.map {|k| casting_map[k] }
|
30
|
-
return_val = true
|
31
|
-
reply = nil
|
32
|
-
base_args = opts_to_change.values_at( *changing_keys )
|
33
|
-
#b = base_args
|
34
|
-
current_values = changing_keys.map {|v| "#{shortcut_map[v]}:#{opts_to_change[v]}" }
|
35
|
-
out(current_values.join(" ")) if @verbose
|
36
|
-
#out "#{b[0]} #{b[1]} #{b[2]} dcn:#{b[3]} ppm:#{b[4]}"
|
37
|
-
loop do
|
38
|
-
reply =
|
39
|
-
if @lines
|
40
|
-
if @lines.size > 0
|
41
|
-
@lines.shift.chomp
|
42
|
-
else
|
43
|
-
'q'
|
44
|
-
end
|
45
|
-
else
|
46
|
-
gets.chomp
|
47
|
-
end
|
48
|
-
answer = prep_reply(reply, base_args, shortcut_order, casting_array)
|
49
|
-
if answer == false
|
50
|
-
out(interactive_help(changing_keys, shortcut_map)) if @verbose
|
51
|
-
elsif answer == nil
|
52
|
-
return nil
|
53
|
-
else
|
54
|
-
answer.zip(changing_keys) do |newval,changing_key|
|
55
|
-
opts_to_change[changing_key] = newval
|
56
|
-
end
|
57
|
-
return_val = true
|
58
|
-
break
|
59
|
-
end
|
60
|
-
end
|
61
|
-
return_val
|
62
|
-
end
|
63
|
-
|
64
|
-
def out(string)
|
65
|
-
puts string
|
66
|
-
end
|
67
|
-
|
68
|
-
def interactive_help(changing_keys, shortcut_map)
|
69
|
-
shortcuts = changing_keys.map {|v| shortcut_map[v] }
|
70
|
-
as_array = shortcuts.map {|v| "<#{v}>" }
|
71
|
-
as_hash = shortcuts.map {|v| "#{v}:<#{v}>" }
|
72
|
-
string = []
|
73
|
-
string << "******************************************************************************"
|
74
|
-
string << "INTERACTIVE FILTERING HELP:"
|
75
|
-
string << "enter as an array of values : #{as_array.join(' ')}"
|
76
|
-
string << "or as keys and values : #{as_hash.join(' ')}"
|
77
|
-
string << "or some of the keys and values : #{as_hash.last}"
|
78
|
-
if changing_keys.size >= 3
|
79
|
-
string << "or mix array and keys/values : #{as_array[0]} #{as_array[1]} #{as_hash.last}"
|
80
|
-
end
|
81
|
-
string << "etc..."
|
82
|
-
string << "<enter> to (re)run current values"
|
83
|
-
string << "'q' to quit"
|
84
|
-
string << "******************************************************************************"
|
85
|
-
string.join("\n")
|
86
|
-
end
|
87
|
-
|
88
|
-
# assumes its already chomped
|
89
|
-
# updates the 5 globals
|
90
|
-
# returns nil if 'q'
|
91
|
-
def prep_reply(reply, base, shortcut_order, casting_array)
|
92
|
-
if reply == 'q'
|
93
|
-
return nil
|
94
|
-
end
|
95
|
-
if reply =~ /^\s*$/
|
96
|
-
base
|
97
|
-
elsif reply
|
98
|
-
arr = reply.split(/\s+/)
|
99
|
-
to_change_ar = []
|
100
|
-
to_change_hash = {}
|
101
|
-
arr.each do |it|
|
102
|
-
if it.include? ':'
|
103
|
-
(k,v) = it.split(':')
|
104
|
-
to_change_hash[k] = v
|
105
|
-
else
|
106
|
-
to_change_ar << it
|
107
|
-
end
|
108
|
-
end
|
109
|
-
to_change_ar.each_with_index do |tc,i|
|
110
|
-
base[i] = tc
|
111
|
-
end
|
112
|
-
to_change_hash.each do |k,v|
|
113
|
-
index = shortcut_order.index(k)
|
114
|
-
if index.nil?
|
115
|
-
out("BAD ARG: #{k}:#{v}") if @verbose
|
116
|
-
end
|
117
|
-
base[index] = v
|
118
|
-
end
|
119
|
-
base.zip(casting_array).map do |v,cast_proc|
|
120
|
-
begin
|
121
|
-
cast_proc.call(v)
|
122
|
-
rescue NoMethodError
|
123
|
-
out "BAD ARG: #{tc}" if @verbose
|
124
|
-
return false
|
125
|
-
end
|
126
|
-
end
|
127
|
-
else
|
128
|
-
false
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
@@ -1,148 +0,0 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
require 'table'
|
3
|
-
require 'spec_id/precision/output'
|
4
|
-
|
5
|
-
module SpecID ; end
|
6
|
-
module SpecID::Precision ; end
|
7
|
-
class SpecID::Precision::Filter ; end
|
8
|
-
|
9
|
-
class SpecID::Precision::Filter::Output
|
10
|
-
include SpecID::Precision::Output
|
11
|
-
|
12
|
-
ProtPrecAbbr = {
|
13
|
-
:normal => 'nrm',
|
14
|
-
:normal_stdev => 'nrm_std',
|
15
|
-
:worst => 'worst',
|
16
|
-
}
|
17
|
-
|
18
|
-
GTE = '>='
|
19
|
-
LTE = '<='
|
20
|
-
MSial_operator = {
|
21
|
-
'xcorr1' => GTE,
|
22
|
-
'xcorr2' => GTE,
|
23
|
-
'xcorr3' => GTE,
|
24
|
-
'deltacn' => GTE,
|
25
|
-
'ppm' => LTE,
|
26
|
-
}
|
27
|
-
|
28
|
-
# takes a hash {:normal => x, :normal_stdev => y :worst => z }
|
29
|
-
# and returns a string
|
30
|
-
def protein_precision_to_s(hash)
|
31
|
-
"#{hash[:worst]}--#{hash[:normal]}+/-#{hash[:normal_stdev]}"
|
32
|
-
end
|
33
|
-
|
34
|
-
# num tps tmm badAA decoy
|
35
|
-
# pep
|
36
|
-
# prot
|
37
|
-
#
|
38
|
-
def params_as_string(params_hash)
|
39
|
-
hash = SpecID::Precision::Output.symbol_keys_to_string(params_hash)
|
40
|
-
cleanup_params_hash(hash)
|
41
|
-
hash_as_string(hash)
|
42
|
-
end
|
43
|
-
|
44
|
-
def text_table(fh, answer)
|
45
|
-
col_headings = ['num']
|
46
|
-
if answer[:params][:validators]
|
47
|
-
val_strings = answer[:params][:validators].map do |val|
|
48
|
-
Validator::Validator_to_string[val.class.to_s]
|
49
|
-
end
|
50
|
-
col_headings.push( *val_strings )
|
51
|
-
end
|
52
|
-
|
53
|
-
data_rows = []
|
54
|
-
# push on the peptide row
|
55
|
-
row_headings = ['peps']
|
56
|
-
pep_row = []
|
57
|
-
pep_row << answer[:pephits].size
|
58
|
-
if answer[:params][:validators]
|
59
|
-
answer[:params][:validators].zip( answer[:pephits_precision] ) do |val, precision|
|
60
|
-
pep_row << precision
|
61
|
-
end
|
62
|
-
end
|
63
|
-
data_rows << pep_row
|
64
|
-
|
65
|
-
# push on the protein row
|
66
|
-
if answer[:prothits]
|
67
|
-
[:worst, :normal, :normal_stdev].each do |guy|
|
68
|
-
prot_row = []
|
69
|
-
row_headings << "prots(#{ProtPrecAbbr[guy]})"
|
70
|
-
if guy == :worst
|
71
|
-
prot_row << answer[:prothits].size
|
72
|
-
else
|
73
|
-
prot_row << '"'
|
74
|
-
end
|
75
|
-
answer[:prothits_precision].each do |precision|
|
76
|
-
prot_row.push(precision[guy])
|
77
|
-
end
|
78
|
-
data_rows << prot_row
|
79
|
-
end
|
80
|
-
end
|
81
|
-
params_string = params_as_string(answer[:params])
|
82
|
-
table = Table.new( data_rows, row_headings, col_headings )
|
83
|
-
fh.puts params_string
|
84
|
-
fh.puts ""
|
85
|
-
fh.puts( table.to_formatted_string )
|
86
|
-
fh.puts ""
|
87
|
-
end
|
88
|
-
|
89
|
-
def yaml(fh, answer)
|
90
|
-
final_output = { :params => answer[:params].dup }
|
91
|
-
#"PEPHITS"
|
92
|
-
#answer[:pephits]
|
93
|
-
final_output[:pephits] = answer[:pephits].size
|
94
|
-
if answer[:prothits]
|
95
|
-
final_output[:prothits_precision] = answer[:params][:validators].zip( answer[:prothits_precision] ).map do |val, precision|
|
96
|
-
{'validator' => Validator::Validator_to_string[val.class.to_s], 'values' => precision }
|
97
|
-
end
|
98
|
-
final_output[:prothits] = answer[:prothits].size
|
99
|
-
|
100
|
-
#final_output[:prothits_precision] = {} if answer[:prothits_precision]
|
101
|
-
#final_output[:prothits] = answer[:prothits].size
|
102
|
-
#answer[:params][:validators].zip( answer[:prothits_precision] ) do |val, precision|
|
103
|
-
# final_output[:prothits_precision][Validator::Validator_to_string[val.class.to_s]] = precision
|
104
|
-
#end
|
105
|
-
end
|
106
|
-
final_output[:pephits_precision] = answer[:params][:validators].zip( answer[:pephits_precision] ).map do |val, precision|
|
107
|
-
{ 'validator' => Validator::Validator_to_string[val.class.to_s], 'value' => precision }
|
108
|
-
end
|
109
|
-
final_output[:pephits] = answer[:pephits].size
|
110
|
-
final_output_as_strings = SpecID::Precision::Output.symbol_keys_to_string(final_output)
|
111
|
-
cleanup_params_hash(final_output_as_strings['params'])
|
112
|
-
fh.print(final_output_as_strings.to_yaml )
|
113
|
-
end
|
114
|
-
|
115
|
-
|
116
|
-
# returns nil
|
117
|
-
def cleanup_params_hash(hash)
|
118
|
-
################################
|
119
|
-
# OUTPUT
|
120
|
-
################################
|
121
|
-
hash['output'] = hash['output'].map do |output|
|
122
|
-
if output[1] == nil
|
123
|
-
output[1] = 'STDOUT'
|
124
|
-
end
|
125
|
-
output.join(" => ")
|
126
|
-
end
|
127
|
-
%w(postfilter top_hit_by).each do |st|
|
128
|
-
hash[st] = hash[st].to_s
|
129
|
-
end
|
130
|
-
if hash['interactive']
|
131
|
-
if file = hash['interactive'].file
|
132
|
-
hash['interactive'] = file
|
133
|
-
else
|
134
|
-
hash['interactive'] = true
|
135
|
-
end
|
136
|
-
end
|
137
|
-
if hash['decoy']
|
138
|
-
if hash['decoy']['regexp']
|
139
|
-
hash['decoy']['regexp'] = hash['decoy']['regexp'].inspect
|
140
|
-
end
|
141
|
-
end
|
142
|
-
if x = hash['validators']
|
143
|
-
hash['validators'] = Validator.sensible_validator_hashes(x)
|
144
|
-
end
|
145
|
-
nil
|
146
|
-
end
|
147
|
-
|
148
|
-
end
|