mspire 0.4.9 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (255) hide show
  1. data/README +27 -17
  2. data/changelog.txt +31 -62
  3. data/lib/ms/calc.rb +32 -0
  4. data/lib/ms/data/interleaved.rb +60 -0
  5. data/lib/ms/data/lazy_io.rb +73 -0
  6. data/lib/ms/data/lazy_string.rb +15 -0
  7. data/lib/ms/data/simple.rb +59 -0
  8. data/lib/ms/data/transposed.rb +41 -0
  9. data/lib/ms/data.rb +57 -0
  10. data/lib/ms/format/format_error.rb +12 -0
  11. data/lib/ms/spectrum.rb +25 -384
  12. data/lib/ms/support/binary_search.rb +126 -0
  13. data/lib/ms.rb +10 -10
  14. metadata +38 -350
  15. data/INSTALL +0 -58
  16. data/README.rdoc +0 -18
  17. data/Rakefile +0 -330
  18. data/bin/aafreqs.rb +0 -23
  19. data/bin/bioworks2excel.rb +0 -14
  20. data/bin/bioworks_to_pepxml.rb +0 -148
  21. data/bin/bioworks_to_pepxml_gui.rb +0 -225
  22. data/bin/fasta_shaker.rb +0 -5
  23. data/bin/filter_and_validate.rb +0 -5
  24. data/bin/gi2annot.rb +0 -14
  25. data/bin/id_class_anal.rb +0 -112
  26. data/bin/id_precision.rb +0 -172
  27. data/bin/ms_to_lmat.rb +0 -67
  28. data/bin/pepproph_filter.rb +0 -16
  29. data/bin/prob_validate.rb +0 -6
  30. data/bin/protein_summary.rb +0 -6
  31. data/bin/protxml2prots_peps.rb +0 -32
  32. data/bin/raw_to_mzXML.rb +0 -55
  33. data/bin/run_percolator.rb +0 -122
  34. data/bin/sqt_group.rb +0 -26
  35. data/bin/srf_group.rb +0 -27
  36. data/bin/srf_to_sqt.rb +0 -40
  37. data/lib/align/chams.rb +0 -78
  38. data/lib/align.rb +0 -154
  39. data/lib/archive/targz.rb +0 -94
  40. data/lib/bsearch.rb +0 -120
  41. data/lib/core_extensions.rb +0 -16
  42. data/lib/fasta.rb +0 -626
  43. data/lib/gi.rb +0 -124
  44. data/lib/group_by.rb +0 -10
  45. data/lib/index_by.rb +0 -11
  46. data/lib/merge_deep.rb +0 -21
  47. data/lib/ms/converter/mzxml.rb +0 -77
  48. data/lib/ms/gradient_program.rb +0 -170
  49. data/lib/ms/msrun.rb +0 -244
  50. data/lib/ms/msrun_index.rb +0 -108
  51. data/lib/ms/parser/mzdata/axml.rb +0 -67
  52. data/lib/ms/parser/mzdata/dom.rb +0 -175
  53. data/lib/ms/parser/mzdata/libxml.rb +0 -7
  54. data/lib/ms/parser/mzdata.rb +0 -31
  55. data/lib/ms/parser/mzxml/axml.rb +0 -70
  56. data/lib/ms/parser/mzxml/dom.rb +0 -182
  57. data/lib/ms/parser/mzxml/hpricot.rb +0 -253
  58. data/lib/ms/parser/mzxml/libxml.rb +0 -19
  59. data/lib/ms/parser/mzxml/regexp.rb +0 -122
  60. data/lib/ms/parser/mzxml/rexml.rb +0 -72
  61. data/lib/ms/parser/mzxml/xmlparser.rb +0 -248
  62. data/lib/ms/parser/mzxml.rb +0 -282
  63. data/lib/ms/parser.rb +0 -108
  64. data/lib/ms/precursor.rb +0 -25
  65. data/lib/ms/scan.rb +0 -81
  66. data/lib/mspire.rb +0 -4
  67. data/lib/pi_zero.rb +0 -244
  68. data/lib/qvalue.rb +0 -161
  69. data/lib/roc.rb +0 -187
  70. data/lib/sample_enzyme.rb +0 -160
  71. data/lib/scan_i.rb +0 -21
  72. data/lib/spec_id/aa_freqs.rb +0 -170
  73. data/lib/spec_id/bioworks.rb +0 -497
  74. data/lib/spec_id/digestor.rb +0 -138
  75. data/lib/spec_id/mass.rb +0 -179
  76. data/lib/spec_id/parser/proph.rb +0 -335
  77. data/lib/spec_id/precision/filter/cmdline.rb +0 -218
  78. data/lib/spec_id/precision/filter/interactive.rb +0 -134
  79. data/lib/spec_id/precision/filter/output.rb +0 -148
  80. data/lib/spec_id/precision/filter.rb +0 -637
  81. data/lib/spec_id/precision/output.rb +0 -60
  82. data/lib/spec_id/precision/prob/cmdline.rb +0 -160
  83. data/lib/spec_id/precision/prob/output.rb +0 -94
  84. data/lib/spec_id/precision/prob.rb +0 -249
  85. data/lib/spec_id/proph/pep_summary.rb +0 -104
  86. data/lib/spec_id/proph/prot_summary.rb +0 -484
  87. data/lib/spec_id/proph.rb +0 -4
  88. data/lib/spec_id/protein_summary.rb +0 -489
  89. data/lib/spec_id/sequest/params.rb +0 -316
  90. data/lib/spec_id/sequest/pepxml.rb +0 -1458
  91. data/lib/spec_id/sequest.rb +0 -33
  92. data/lib/spec_id/sqt.rb +0 -349
  93. data/lib/spec_id/srf.rb +0 -973
  94. data/lib/spec_id.rb +0 -778
  95. data/lib/spec_id_xml.rb +0 -99
  96. data/lib/transmem/phobius.rb +0 -147
  97. data/lib/transmem/toppred.rb +0 -368
  98. data/lib/transmem.rb +0 -157
  99. data/lib/validator/aa.rb +0 -48
  100. data/lib/validator/aa_est.rb +0 -112
  101. data/lib/validator/background.rb +0 -77
  102. data/lib/validator/bias.rb +0 -95
  103. data/lib/validator/cmdline.rb +0 -431
  104. data/lib/validator/decoy.rb +0 -107
  105. data/lib/validator/digestion_based.rb +0 -70
  106. data/lib/validator/probability.rb +0 -51
  107. data/lib/validator/prot_from_pep.rb +0 -234
  108. data/lib/validator/q_value.rb +0 -32
  109. data/lib/validator/transmem.rb +0 -272
  110. data/lib/validator/true_pos.rb +0 -46
  111. data/lib/validator.rb +0 -197
  112. data/lib/xml.rb +0 -38
  113. data/lib/xml_style_parser.rb +0 -119
  114. data/lib/xmlparser_wrapper.rb +0 -19
  115. data/release_notes.txt +0 -2
  116. data/script/compile_and_plot_smriti_final.rb +0 -97
  117. data/script/create_little_pepxml.rb +0 -61
  118. data/script/degenerate_peptides.rb +0 -47
  119. data/script/estimate_fpr_by_cysteine.rb +0 -226
  120. data/script/extract_gradient_programs.rb +0 -56
  121. data/script/find_cysteine_background.rb +0 -137
  122. data/script/genuine_tps_and_probs.rb +0 -136
  123. data/script/get_apex_values_rexml.rb +0 -44
  124. data/script/histogram_probs.rb +0 -61
  125. data/script/mascot_fix_pepxml.rb +0 -123
  126. data/script/msvis.rb +0 -42
  127. data/script/mzXML2timeIndex.rb +0 -25
  128. data/script/peps_per_bin.rb +0 -67
  129. data/script/prep_dir.rb +0 -121
  130. data/script/simple_protein_digestion.rb +0 -27
  131. data/script/smriti_final_analysis.rb +0 -103
  132. data/script/sqt_to_meta.rb +0 -24
  133. data/script/top_hit_per_scan.rb +0 -67
  134. data/script/toppred_to_yaml.rb +0 -47
  135. data/script/tpp_installer.rb +0 -249
  136. data/specs/align_spec.rb +0 -79
  137. data/specs/bin/bioworks_to_pepxml_spec.rb +0 -79
  138. data/specs/bin/fasta_shaker_spec.rb +0 -259
  139. data/specs/bin/filter_and_validate__multiple_vals_helper.yaml +0 -199
  140. data/specs/bin/filter_and_validate_spec.rb +0 -180
  141. data/specs/bin/ms_to_lmat_spec.rb +0 -34
  142. data/specs/bin/prob_validate_spec.rb +0 -86
  143. data/specs/bin/protein_summary_spec.rb +0 -14
  144. data/specs/fasta_spec.rb +0 -354
  145. data/specs/gi_spec.rb +0 -22
  146. data/specs/load_bin_path.rb +0 -7
  147. data/specs/merge_deep_spec.rb +0 -13
  148. data/specs/ms/gradient_program_spec.rb +0 -77
  149. data/specs/ms/msrun_spec.rb +0 -498
  150. data/specs/ms/parser_spec.rb +0 -92
  151. data/specs/ms/spectrum_spec.rb +0 -87
  152. data/specs/pi_zero_spec.rb +0 -115
  153. data/specs/qvalue_spec.rb +0 -39
  154. data/specs/roc_spec.rb +0 -251
  155. data/specs/rspec_autotest.rb +0 -149
  156. data/specs/sample_enzyme_spec.rb +0 -126
  157. data/specs/spec_helper.rb +0 -135
  158. data/specs/spec_id/aa_freqs_spec.rb +0 -52
  159. data/specs/spec_id/bioworks_spec.rb +0 -148
  160. data/specs/spec_id/digestor_spec.rb +0 -75
  161. data/specs/spec_id/precision/filter/cmdline_spec.rb +0 -20
  162. data/specs/spec_id/precision/filter/output_spec.rb +0 -31
  163. data/specs/spec_id/precision/filter_spec.rb +0 -246
  164. data/specs/spec_id/precision/prob_spec.rb +0 -44
  165. data/specs/spec_id/precision/prob_spec_helper.rb +0 -0
  166. data/specs/spec_id/proph/pep_summary_spec.rb +0 -98
  167. data/specs/spec_id/proph/prot_summary_spec.rb +0 -128
  168. data/specs/spec_id/protein_summary_spec.rb +0 -189
  169. data/specs/spec_id/sequest/params_spec.rb +0 -68
  170. data/specs/spec_id/sequest/pepxml_spec.rb +0 -374
  171. data/specs/spec_id/sequest_spec.rb +0 -38
  172. data/specs/spec_id/sqt_spec.rb +0 -246
  173. data/specs/spec_id/srf_spec.rb +0 -172
  174. data/specs/spec_id/srf_spec_helper.rb +0 -139
  175. data/specs/spec_id_helper.rb +0 -33
  176. data/specs/spec_id_spec.rb +0 -366
  177. data/specs/spec_id_xml_spec.rb +0 -33
  178. data/specs/transmem/phobius_spec.rb +0 -425
  179. data/specs/transmem/toppred_spec.rb +0 -298
  180. data/specs/transmem_spec.rb +0 -60
  181. data/specs/transmem_spec_shared.rb +0 -64
  182. data/specs/validator/aa_est_spec.rb +0 -66
  183. data/specs/validator/aa_spec.rb +0 -40
  184. data/specs/validator/background_spec.rb +0 -67
  185. data/specs/validator/bias_spec.rb +0 -122
  186. data/specs/validator/decoy_spec.rb +0 -51
  187. data/specs/validator/fasta_helper.rb +0 -26
  188. data/specs/validator/prot_from_pep_spec.rb +0 -141
  189. data/specs/validator/transmem_spec.rb +0 -146
  190. data/specs/validator/true_pos_spec.rb +0 -58
  191. data/specs/validator_helper.rb +0 -33
  192. data/specs/xml_spec.rb +0 -12
  193. data/test_files/000_pepxml18_small.xml +0 -206
  194. data/test_files/020a.mzXML.timeIndex +0 -4710
  195. data/test_files/4-03-03_mzXML/000.mzXML.timeIndex +0 -3973
  196. data/test_files/4-03-03_mzXML/020.mzXML.timeIndex +0 -3872
  197. data/test_files/4-03-03_small-prot.xml +0 -321
  198. data/test_files/4-03-03_small.xml +0 -3876
  199. data/test_files/7MIX_STD_110802_1.sequest_params_fragment.srf +0 -0
  200. data/test_files/bioworks-3.3_10prots.xml +0 -5999
  201. data/test_files/bioworks31.params +0 -77
  202. data/test_files/bioworks32.params +0 -62
  203. data/test_files/bioworks33.params +0 -63
  204. data/test_files/bioworks_single_run_small.xml +0 -7237
  205. data/test_files/bioworks_small.fasta +0 -212
  206. data/test_files/bioworks_small.params +0 -63
  207. data/test_files/bioworks_small.phobius +0 -109
  208. data/test_files/bioworks_small.toppred.out +0 -2847
  209. data/test_files/bioworks_small.xml +0 -5610
  210. data/test_files/bioworks_with_INV_small.xml +0 -3753
  211. data/test_files/bioworks_with_SHUFF_small.xml +0 -2503
  212. data/test_files/corrupted_900.srf +0 -0
  213. data/test_files/head_of_7MIX.srf +0 -0
  214. data/test_files/interact-opd1_mods_small-prot.xml +0 -304
  215. data/test_files/messups.fasta +0 -297
  216. data/test_files/opd1/000.my_answer.100lines.xml +0 -101
  217. data/test_files/opd1/000.tpp_1.2.3.first10.xml +0 -115
  218. data/test_files/opd1/000.tpp_2.9.2.first10.xml +0 -126
  219. data/test_files/opd1/000.v2.1.mzXML.timeIndex +0 -3748
  220. data/test_files/opd1/000_020-prot.png +0 -0
  221. data/test_files/opd1/000_020_3prots-prot.mod_initprob.xml +0 -62
  222. data/test_files/opd1/000_020_3prots-prot.xml +0 -62
  223. data/test_files/opd1/opd1_cat_inv_small-prot.xml +0 -139
  224. data/test_files/opd1/sequest.3.1.params +0 -77
  225. data/test_files/opd1/sequest.3.2.params +0 -62
  226. data/test_files/opd1/twenty_scans.mzXML +0 -418
  227. data/test_files/opd1/twenty_scans.v2.1.mzXML +0 -382
  228. data/test_files/opd1/twenty_scans_answ.lmat +0 -0
  229. data/test_files/opd1/twenty_scans_answ.lmata +0 -9
  230. data/test_files/opd1_020_beginning.RAW +0 -0
  231. data/test_files/opd1_2runs_2mods/data/020.mzData.xml +0 -683
  232. data/test_files/opd1_2runs_2mods/data/020.readw.mzXML +0 -382
  233. data/test_files/opd1_2runs_2mods/data/040.mzData.xml +0 -683
  234. data/test_files/opd1_2runs_2mods/data/040.readw.mzXML +0 -382
  235. data/test_files/opd1_2runs_2mods/data/README.txt +0 -6
  236. data/test_files/opd1_2runs_2mods/interact-opd1_mods__small.xml +0 -753
  237. data/test_files/orbitrap_mzData/000_cut.xml +0 -1920
  238. data/test_files/pepproph_small.xml +0 -4691
  239. data/test_files/phobius.small.noheader.txt +0 -50
  240. data/test_files/phobius.small.small.txt +0 -53
  241. data/test_files/s01_anC1_ld020mM.key.txt +0 -25
  242. data/test_files/s01_anC1_ld020mM.meth +0 -0
  243. data/test_files/small.fasta +0 -297
  244. data/test_files/small.sqt +0 -87
  245. data/test_files/smallraw.RAW +0 -0
  246. data/test_files/tf_bioworks2excel.bioXML +0 -14340
  247. data/test_files/tf_bioworks2excel.txt.actual +0 -1035
  248. data/test_files/toppred.small.out +0 -416
  249. data/test_files/toppred.xml.out +0 -318
  250. data/test_files/validator_hits_separate/bias_bioworks_small_HS.fasta +0 -7
  251. data/test_files/validator_hits_separate/bioworks_small_HS.xml +0 -5651
  252. data/test_files/yeast_gly_small-prot.xml +0 -265
  253. data/test_files/yeast_gly_small.1.0_1.0_1.0.parentTimes +0 -6
  254. data/test_files/yeast_gly_small.xml +0 -3807
  255. data/test_files/yeast_gly_small2.parentTimes +0 -6
@@ -1,249 +0,0 @@
1
- #!/usr/bin/ruby -w
2
-
3
- ###########################################################
4
- # GLOBAL CONFIG:
5
-
6
- ## SYSTEM SPECIFIC VARIABLES:
7
- BIN_DIR = '/usr/bin/'
8
- NICE_PATH = '/usr/bin/nice' # path to nice program on your system
9
-
10
- ## APACHE VARIABLES:
11
- MODS_AVAILABLE = '/etc/apache2/mods-available/include.load'
12
- MODS_ENABLED = '/etc/apache2/mods-enabled/include.load'
13
- # A File that will be included by the webserver to add specific directives:
14
- TPP_CONF = '/etc/apache2/conf.d/tpp.conf'
15
- # The system call to restart your apache
16
- RESTART_APACHE = '/etc/init.d/apache2 restart'
17
-
18
- ## SETUP YOUR TPP INSTALL:
19
- TPP_INSTALL = "/work/tpp" # directory to hold TPP executables, etc.
20
- # (where TPP_ROOT will actually go)
21
- TPP_DATA_PATH = "/work/tpp-data" # directory to hold your tpp data files
22
-
23
- TPP_WEB = '/tpp/'
24
- TPP_ISB_DEF_DIR = '/tools/bin/TPP/'
25
- TPP_ISB_DIR = 'tpp' # DON'T change this
26
-
27
- WEBSERVER_ROOT = '/var/www'
28
- TPP_WEB_PATH_STUB = WEBSERVER_ROOT # real directory to make soft link inside
29
- # For security reasons, TPP_VIS_PATH should NOT be the same as TPP_DATA_PATH
30
- TPP_VIS_PATH = WEBSERVER_ROOT + '/tpp-vis/'
31
- TPP_DATA_PATH_SOFT_LINK = WEBSERVER_ROOT + '/tpp'
32
- #TPP_WEB_PATH = WEBSERVER_ROOT + TPP_DATA_PATH_SOFT_LINK
33
-
34
- ## VARIABLES YOU PROBABLY DON'T WANT TO CHANGE:
35
- XINTERACT_WRAPPER = 'xinteract'
36
- XINTERACT_ISB = 'xinteract-isb'
37
- makefile_incl = 'src/Makefile.incl'
38
- sequest2xml = 'src/Parsers/Algorithm2XML/Sequest2XML/Sequest2XML.cxx'
39
-
40
- ### VARIABLES YOU PROBABLY SHOULDN'T CHANGE UNLESS YOU MODIFY the config
41
- ### scripts
42
- HARD_CODED_TPP_INSTALL = '/tools/bin/TPP/tpp/'
43
- TPP_ROOT = HARD_CODED_TPP_INSTALL
44
- HARD_CODED_TPP_INSTALL_STUB = '/tools/bin/TPP' # real dir to hold soft link
45
- ###########################################################
46
-
47
- require 'fileutils'
48
-
49
- #######################################################
50
- # SUBROUTINES:
51
- #######################################################
52
-
53
-
54
- # creates the file with the given contents unless the file already exists AND already contains the contents
55
- def make_file(file, string)
56
- puts "Trying to make file: #{file}"
57
- if File.exist?(file) && string == IO.read(file)
58
- puts "File already exists with the given string"
59
- else
60
- puts "Made file with given string"
61
- File.open(file, "w") { |out| out.print string }
62
- end
63
- end
64
-
65
- def mkpath(mpath)
66
- path = mpath.chomp('/')
67
- if File.exist? path; puts "Dir #{path} exists"
68
- else
69
- FileUtils.mkpath path
70
- puts "CREATING #{path}"
71
- end
72
- end
73
-
74
- def chmod(code, path)
75
- printf("Changing mode of #{path} to %o", code)
76
- FileUtils.chmod code, path
77
- end
78
-
79
- # creates wrapper around xinteract that runs #{XINTERACT_ISB} and moves files
80
- # to #{TPP_VIS_PATH}
81
- def xinteract_wrapper
82
- tpp_data_path_wts = TPP_DATA_PATH.chomp('/')+'/'
83
- "# Runs xinteract with whatever command lines given
84
- # And then moves shtml files to #{TPP_VIS_PATH}
85
- #{XINTERACT_ISB} $@
86
- ruby -e 'if Dir[\"#{tpp_data_path_wts}*.shtml\"].size > 0 ; system \"mv #{tpp_data_path_wts}*.shtml #{TPP_VIS_PATH}\"; puts \"moving #{tpp_data_path_wts}*.shtml to #{TPP_VIS_PATH} for webserver security.\" end'
87
- ".gsub(/^\s+/,'')
88
- end
89
-
90
- def swap_line(file, regex, newval)
91
- puts "EDITING: #{file}"
92
- tmpfile = "tmp.tmp"
93
- File.open(tmpfile, "w") do |out|
94
- out.puts IO.readlines(file).collect{|line| line.sub(regex, newval) }
95
- end
96
- File.rename(tmpfile, file)
97
- end
98
- #{tpp_data_path_wts}*.shtml
99
- def soft_link(mtarget, mlink)
100
- (link,target) = [mlink,mtarget].collect {|t| t.chomp('/')}
101
- if File.exist? link ;#{tpp_data_path_wts}*.shtml puts "Link #{link} exists!"
102
- else
103
- FileUtils.ln_sf target, link
104
- puts "CREATING soft link: #{link} -> #{target}"
105
- end
106
- end
107
-
108
- def sys(string)
109
- puts "PERFORMING: #{string}"
110
- puts `#{string}`
111
- end
112
-
113
- def modify_and_restart_apache(tpp_root, webserver_root, tpp_vis_path, mods_avail, mods_enab)
114
- # APACHE:
115
- soft_link(mods_avail, mods_enab)
116
-
117
- conf_string = <<END_DOC
118
- #
119
- # ISB-Tools Trans Proteomic Pipeline directive
120
- #
121
-
122
- Alias /tpp/html \"#{tpp_root}html\"
123
- <Directory \"#{tpp_root}html\">
124
- AllowOverride None
125
- Options Includes Indexes FollowSymLinks MultiViews
126
- Order allow,deny
127
- Allow from all
128
- </Directory>
129
-
130
- <Directory \"#{tpp_root}schema\">
131
- AllowOverride None
132
- Options Includes Indexes FollowSymLinks MultiViews
133
- Order allow,deny
134
- Allow from all
135
- </Directory>
136
-
137
- ScriptAlias /tpp/cgi-bin/ \"#{tpp_root}cgi-bin/\"
138
- <Directory \"#{tpp_root}cgi-bin\">
139
- AllowOverride AuthConfig Limit
140
- Options ExecCGI
141
- Order allow,deny
142
- Allow from all
143
- SetEnv WEBSERVER_ROOT #{webserver_root}
144
- </Directory>
145
-
146
- <Directory \"#{tpp_vis_path}\">
147
- Options Includes
148
- </Directory>
149
-
150
- END_DOC
151
-
152
- make_file(TPP_CONF, conf_string)
153
- sys "#{RESTART_APACHE}"
154
- end
155
-
156
-
157
-
158
- ###############################################################
159
- # MAIN
160
- ###############################################################
161
-
162
- if ARGV.size < 1
163
- puts "
164
- usage: #{File.basename(__FILE__)} trans_proteomic_pipeline_dir
165
-
166
- Will install tpp on a ubuntu system (perhaps a debian system, too?). With
167
- slight modifications, you may get this to install on other machines.
168
- Requires apache2 (sudo apt-get apache2). The installation uses all the
169
- default TPP locations because a lot of these are quite hard-coded in the tpp
170
- despite the config files they use. Instead, soft-links are made so that you
171
- can configure your system however you desire. Will probably not clobber
172
- existing files, but it might ;)
173
-
174
- PLEASE SET GLOBAL VARIABLES in this script (#{File.basename(__FILE__)})!
175
-
176
- PREREQS:
177
- sudo apt-get install <prereq>
178
- make, g++, ruby, apache2, libzzip-dev, libgd2-dev, libpng3-dev libexpat-dev
179
- --> or all on one line:
180
- sudo apt-get install make g++ ruby apache2 libzzip-dev libgd2-dev libpng3-dev libexpat-dev
181
-
182
- In all likelihood, this will need to be run as root.
183
- "
184
- exit
185
- end
186
-
187
- #########################
188
- # MAKE INSTALLATION DIR:
189
- #########################
190
- mkpath HARD_CODED_TPP_INSTALL_STUB # dir to hold soft link
191
- mkpath TPP_INSTALL
192
- soft_link(TPP_INSTALL, HARD_CODED_TPP_INSTALL.sub(/\/$/,''))
193
-
194
- ############################
195
- # MAKE WEB DIRS:
196
- ############################
197
- mkpath TPP_WEB_PATH_STUB
198
- soft_link(TPP_DATA_PATH, TPP_DATA_PATH_SOFT_LINK)
199
-
200
- mkpath TPP_DATA_PATH.chomp('/')
201
- chmod(0777, TPP_DATA_PATH.chomp('/'))
202
- mkpath TPP_VIS_PATH.chomp('/')
203
-
204
- ## VERY SPECIFIC to OUR SYSTEM
205
- soft_link('/project/marcotte/marcotte/ms', TPP_DATA_PATH.chomp('/') + '/ms')
206
- system "sudo chown john:marcotte #{TPP_DATA_PATH.chomp('/')}"
207
- system "sudo chown john:marcotte #{TPP_VIS_PATH.chomp('/')}"
208
-
209
- ############################
210
- # FIX UP APACHE
211
- ############################
212
- modify_and_restart_apache(TPP_ROOT, WEBSERVER_ROOT, TPP_VIS_PATH, MODS_AVAILABLE, MODS_ENABLED)
213
-
214
- ############################
215
- # MAKE and INSTALL
216
- ############################
217
- Dir.chdir ARGV[0] do
218
- ############################
219
- # SWAP OUT BAD LINES
220
- ############################
221
- swap_line(makefile_incl, /TPP_ROOT=.*/, 'TPP_ROOT='+TPP_ROOT)
222
- swap_line(makefile_incl, /TPP_WEB=.*/, 'TPP_WEB='+TPP_WEB)
223
- swap_line(sequest2xml, /if\(k < 12\) \{/, 'if(k < 6) {' )
224
- swap_line(sequest2xml, /cerr << " error: length of " << result->spectrum_ << " less than 13" << endl;/, 'cerr << " error: length of " << result->spectrum_ << " less than 6" << endl;')
225
- # CLEAN, MAKE, MAKE INSTALL:
226
- Dir.chdir('src') do
227
- sys "make clean"
228
- sys "make all"
229
- sys "make install"
230
- end
231
- end
232
-
233
- ############################
234
- # CREATE ADDITIONAL LINKS:
235
- ############################
236
- soft_link(NICE_PATH, '/bin/nice')
237
- soft_link(TPP_ROOT + 'bin/xinteract', BIN_DIR + XINTERACT_ISB)
238
- puts "LINKING batchcoverage to #{BIN_DIR}batchcoverage"
239
- soft_link(TPP_ROOT + 'bin/batchcoverage', BIN_DIR + 'batchcoverage')
240
- soft_link(TPP_ROOT + 'bin/Sequest2XML', BIN_DIR + 'Sequest2XML')
241
-
242
- ############################
243
- # CREATE xinteract wrapper:
244
- ############################
245
- puts "CREATING xinteract wrapper script '#{BIN_DIR}#{XINTERACT_WRAPPER}'"
246
- File.open("#{BIN_DIR}#{XINTERACT_WRAPPER}", "w") do |fh| fh.print(xinteract_wrapper) end
247
- puts `chmod +x #{BIN_DIR}#{XINTERACT_WRAPPER}`
248
-
249
-
data/specs/align_spec.rb DELETED
@@ -1,79 +0,0 @@
1
- require File.expand_path( File.dirname(__FILE__) + '/spec_helper' )
2
-
3
- require 'align'
4
-
5
- describe Align do
6
-
7
- before(:each) do
8
- @mz1 = Tfiles + '4-03-03_mzXML/000.mzXML.timeIndex'
9
- @mz2 = Tfiles + '4-03-03_mzXML/020.mzXML.timeIndex'
10
- @prt = Tfiles + '4-03-03_small-prot.xml'
11
- @pep = Tfiles + '4-03-03_small.xml'
12
- end
13
-
14
- it_should 'finds overlapping peptides of same seq+charge' do
15
- s1 = 'DETTIVEGAGDAEAIQGR'
16
- c1 = '2'
17
- s2 = 'TDDVAGDGTTTATVLAQALVR'
18
- c2 = '2'
19
-
20
- al = Align.new
21
- pep1 = al.peps_with_scans([@mz1], @prt, @pep, 0.05 ,0.05 ,0.05 )
22
- pep2 = al.peps_with_scans(@mz2, @prt, @pep, 0.98,0.98,0.98 )
23
- olap = al.overlapping_peps_by_seqcharge([pep1, pep2])
24
- olap.each do |peps|
25
- has_seqcharges = []
26
- peps.each do |pep|
27
- if pep.sequence == s1 && pep.charge == c1
28
- has_seqcharges << true
29
- elsif pep.sequence == s2 && pep.charge == c2
30
- has_seqcharges << true
31
- else
32
- has_seqcharges << false
33
- end
34
- end
35
- has_seqcharges.each { |c| c.should be_true }
36
- end
37
- end
38
-
39
- ### !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
40
- # @TODO: CURRENT WORK!
41
- it_should 'should find overlapping peptides at a seqcharge with a filter' do
42
- al = Align.new
43
- pep1 = al.peps_with_scans([@mz1], @prt, @pep, 0.0 ,0.0 ,0.0 )
44
- pep2 = al.peps_with_scans(@mz2, @prt, @pep, 0.0, 0.0, 0.0 )
45
- max_dups = nil
46
- outlier_cutoff = 0.0
47
- olap = al.overlapping_peps_by_seqcharge_with_filter([pep1, pep2], max_dups, outlier_cutoff)
48
- olap.each do |peps|
49
- p peps
50
- end
51
- end
52
-
53
- it_should 'should toss outliers' do
54
-
55
- # Consistency/sanity checks right now (not accuracy)
56
- x = [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,10,0 ,1,2,3,4,5,6,7,8,9]
57
- y = [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0 ,10,1,2,3,4,5,6,7,8,9]
58
- expx2 = [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,1,2,3,4,5,6,7,8,9]
59
- expy2 = [-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,1,2,3,4,5,6,7,8,9]
60
-
61
- pcls = Proph::Pep
62
- scls = MS::Scan
63
-
64
- pep_groups = [x,y].collect do |arr|
65
- arr.collect do |val|
66
- pep = pcls.new
67
- pep.arithmetic_avg_scan_by_parent_time = scls.new(nil,nil,val.to_f)
68
- pep
69
- end
70
- end
71
-
72
- al = Align.new
73
- deviations = 3.2
74
- size_before = pep_groups.first.size
75
- al.toss_outliers(pep_groups, deviations)
76
- (size_before - pep_groups.first.size).should == 2
77
- end
78
-
79
- end
@@ -1,79 +0,0 @@
1
- require File.expand_path( File.dirname(__FILE__) + '/../spec_helper' )
2
- require 'fileutils'
3
-
4
-
5
- $XML_SANITY_LINES = ['<sample_enzyme name="Trypsin">', '<specificity cut="KR" no_cut="P" sense="C"/>', '<parameter name="diff_search_options" value="0.000000 S 0.000000 C 0.000000 M 0.000000 X 0.000000 T 0.000000 Y"/>']
6
-
7
- $XML_SANITY_MATCHES = [/<spectrum_query spectrum="0\d0.\d+.\d+.[123]" start_scan="\d+" end_scan="\d+" precursor_neutral_mass="[\d\.]+" assumed_charge="[123]" index="\d+">/,
8
- / <search_hit hit_rank="\d" peptide="[\w\-\.]+" peptide_prev_aa="." peptide_next_aa="." protein=".*" num_tot_proteins="\d+" num_matched_ions="\d+" tot_num_ions="\d+" calc_neutral_pep_mass="[\d\.]+" massdiff="[\+\-][\d\.]+" num_tol_term="\d" num_missed_cleavages="\d" is_rejected="[01]">/,
9
- /<search_score name="xcorr" value="[\d\.]+"\/>/,
10
- /<search_score name="deltacn" value="[\d\.]+"\/>/,
11
- /<search_score name="deltacnstar" value="[01]"\/>/,
12
- /<search_score name="spscore" value="[\d\.]+"\/>/,
13
- /<search_score name="sprank" value="\d+"\/>/,
14
- ]
15
-
16
-
17
- describe 'bioworks_to_pepxml.rb' do
18
- before(:all) do
19
- @tf_mzxml_path = Tfiles_l + "/yeast_gly_mzXML"
20
- @tf_bioworks_xml = Tfiles + "/bioworks_small.xml"
21
- @tf_params = Tfiles + '/bioworks32.params'
22
- @out_path = Tfiles + '/pepxml/'
23
- @progname = 'bioworks_to_pepxml.rb'
24
- @no_delete = false
25
- end
26
-
27
- it_should_behave_like "a cmdline program"
28
-
29
- def _basic(cmd, prc)
30
- puts "Performing: #{cmd}" if $DEBUG
31
- reply = `#{cmd}`
32
- puts reply if $DEBUG
33
- %w(000 020).each do |file|
34
- ffile = @out_path + file + ".xml"
35
- prc.call(ffile)
36
- end
37
- end
38
-
39
- spec_large do
40
- it 'works on a real bioworks.xml file' do
41
- cmd = "#{@cmd} -p #{@tf_params} -o #{@out_path} #{@tf_bioworks_xml} -m #{@tf_mzxml_path} -d /work/special/path --copy_mzxml"
42
- ## FILES EXIST:
43
- prc = proc {|file|
44
- file.exist_as_a_file?.should be_true
45
- beginning = IO.readlines(file)[0,50].join("\n")
46
- $XML_SANITY_LINES.each do |line|
47
- beginning.should include(line)
48
- #beginning.include?(line).should be_true
49
- end
50
- $XML_SANITY_MATCHES.each do |match|
51
- beginning.should =~ match
52
- end
53
- }
54
- _basic(cmd, prc)
55
- ## COPY MZXML:
56
- %w(000 020).each do |file|
57
- mzxml_file = File.join(@out_path, "#{file}.mzXML")
58
- mzxml_file.exist_as_a_file?.should be_true
59
- end
60
- ## CLEANUP:
61
- unless @no_delete then FileUtils.rm_rf(@out_path) end
62
- end
63
- end
64
-
65
- spec_large do
66
- it 'transforms database name when its proper to do so' do
67
- cmd = "#{@cmd} -p #{@tf_params} -o #{@out_path} #{@tf_bioworks_xml} -m #{@tf_mzxml_path}"
68
- db_re = /C:\\Xcalibur\\database\\ecoli_K12_ncbi_20060321.fasta/
69
- IO.read(@tf_params).should =~ db_re
70
- prc = proc {|file|
71
- file.exist_as_a_file?.should be_true
72
- IO.read(file).should_not =~ db_re
73
- }
74
- _basic(cmd, prc)
75
- unless @no_delete then FileUtils.rm_rf(@out_path) end
76
- end
77
- end
78
- end
79
-
@@ -1,259 +0,0 @@
1
- require File.expand_path( File.dirname(__FILE__) + '/../spec_helper' )
2
-
3
- require 'fasta'
4
-
5
-
6
- class Fasta
7
- def same_sized_proteins?(other_fasta_obj_or_file)
8
- other = Fasta.to_fasta(other_fasta_obj_or_file)
9
- @prots.zip(other.prots).all? do |a,b|
10
- a.aaseq.size == b.aaseq.size
11
- end
12
- end
13
-
14
- # This is tough to say 'for sure' Right now, we consider the proteins
15
- # shuffled if they are all the same size and 2/3 or more of the peptides are
16
- # different than the other (this is designed for small sets of proteins
17
- # where it is possible one of the peptides is equal to the other).
18
- def shuffled?(other_fasta_obj_or_file)
19
- other = Fasta.to_fasta(other_fasta_obj_or_file)
20
- if !same_sized_proteins?(other)
21
- false
22
- else
23
- (same, different) = @prots.zip(other.prots).partition do |prota, protb|
24
- prota == protb
25
- end
26
- fraction_different = different.size.to_f / (same.size + different.size)
27
- fraction_different >= 2.0/3
28
- end
29
- end
30
- end
31
-
32
- describe "a manipulator of a fasta file", :shared => true do
33
- before(:all) do
34
- @filestring = ">gi|P1
35
- AMKRGAN
36
- >gi|P2
37
- CRGATKKTAGRPMEK
38
- >gi|P3
39
- PEPTIDE
40
- "
41
-
42
- @rev_filestring = ">gi|P1
43
- NAGRKMA
44
- >gi|P2
45
- KEMPRGATKKTAGRC
46
- >gi|P3
47
- EDITPEP
48
- "
49
-
50
- @rev_pref_filestring = ">REV_gi|P1
51
- NAGRKMA
52
- >REV_gi|P2
53
- KEMPRGATKKTAGRC
54
- >REV_gi|P3
55
- EDITPEP
56
- "
57
-
58
- @rev_tryptic_filestring = ">gi|P1
59
- MAKRNAG
60
- >gi|P2
61
- CRTAGKKEMPRGATK
62
- >gi|P3
63
- EDITPEP
64
- "
65
- end
66
-
67
-
68
- before(:each) do
69
- testdir = File.dirname(__FILE__)
70
- @tmpfile = Tfiles + "/littlefasta.trash.fasta"
71
- @f = Tfiles + "/trash.fasta"
72
- File.open(@tmpfile, "w") {|fh| fh.print @filestring }
73
- end
74
-
75
- after(:each) do
76
- File.unlink @tmpfile if File.exist? @tmpfile
77
- File.unlink @f if File.exist? @f
78
- end
79
-
80
- it 'reverses protein sequences' do
81
- reverse_the_file
82
- fastap(@f).to_s.should == @rev_filestring
83
- end
84
-
85
- def reverse_the_file
86
- do_it(:reverse)
87
- end
88
-
89
- it 'shuffles protein sequences' do
90
- shuffle_the_file
91
- Fasta.new(@f).shuffled?(Fasta.from_string(@filestring)).should be_true
92
- end
93
-
94
- def shuffle_the_file
95
- do_it(:shuffle)
96
- end
97
-
98
- it 'concatenates sequences' do
99
- concatenate_sequences
100
- lns = fastalns(@f)
101
- strlns(@filestring).should == lns[0..5] # first part equal
102
- strlns(@rev_pref_filestring).should == lns[6..-1] # "second part equal")
103
- end
104
-
105
- def concatenate_sequences
106
- do_it(:reverse, :cat => true, :prefix => 'REV_')
107
- end
108
-
109
- it 'makes prefixes' do
110
- make_prefixes
111
- #@shaker.reverse(@tmpfile, :out => @f, :prefix => 'SILLY_')
112
- fp = fastap(@f)
113
- fp.each do |prt|
114
- prt.header.should match(/^>SILLY_.+/)
115
- end
116
- end
117
-
118
- def make_prefixes
119
- do_it(:reverse, :prefix => 'SILLY_')
120
- end
121
-
122
- it 'makes fractions of proteins' do
123
- make_fractions_of_proteins(1.0/3)
124
- fastap(@f).size.should == 1
125
- fastap(@f).first.header.should =~ /^>[^M]/
126
-
127
- # this guy gets rounded up on the command line so that it fails there
128
- #make_fractions_of_proteins(2.0/3)
129
- #fastap(@f).size.should == 2
130
- #fastap(@f).each do |prt|
131
- # prt.header.should =~ /^>[^M]/
132
- #end
133
-
134
- make_fractions_of_proteins(1.0)
135
- fastap(@f).size.should == 3
136
- fastap(@f).each do |prt|
137
- prt.header.should =~ /^>[^M]/
138
- end
139
- end
140
-
141
- def make_fractions_of_proteins(fraction)
142
- do_it(:shuffle, :fraction => fraction)
143
- end
144
-
145
-
146
- it 'makes fractions with labels (for > 1)' do
147
- make_fractions_of_proteins(1.1)
148
- fastap(@f).size.should == 4
149
- fastap(@f).any? do |prt|
150
- prt.header =~ /^>[^M]/
151
- end.should be_true
152
-
153
-
154
- make_fractions_of_proteins(2.6)
155
- fastap(@f).size.should == 8
156
-
157
- make_reverse_cat_fractions(2.0)
158
- fastap(@f).size.should == 9
159
-
160
- fp = Fasta.new(@f)
161
- fp[0..2].each do |prt|
162
- prt.header.should =~ /^>/
163
- end
164
- fp[3..5].each do |prt|
165
- prt.header.should =~ /^>MINE_f0_/
166
- end
167
- fp[6..8].each do |prt|
168
- prt.header.should =~ /^>MINE_f1_/
169
- end
170
- end
171
-
172
- def make_reverse_cat_fractions(fraction, prefix='MINE_')
173
- do_it(:reverse, :fraction => fraction, :cat => true, :prefix => prefix)
174
- end
175
-
176
- def reverse_tryptic_peptides
177
- do_it(:reverse, :tryptic_peptides => true)
178
- end
179
-
180
- it 'reverses tryptic peptides' do
181
- reverse_tryptic_peptides
182
- Fasta.from_string(@rev_tryptic_filestring).should == Fasta.new(@f)
183
- end
184
-
185
- def shuffle_tryptic_peptides
186
- do_it(:shuffle, :tryptic_peptides => true)
187
- end
188
-
189
- it 'shuffles tryptic peptides (rerun on failure to recheck)' do
190
- shuffle_tryptic_peptides
191
- lns = fastap(@f).to_s.split("\n")
192
- lns[1][2..3].should == 'KR'
193
- lns[3][1..1].should == 'R'
194
- lns[3].size.should == 'CRGATKKTAGRPMEK'.size
195
- lns[3].should_not == 'CRGATKKTAGRPMEK' #sequence is randomised from original [remote chance of failure] rerun to make sure
196
- end
197
-
198
- def strlns(str)
199
- str.split("\n")
200
- end
201
-
202
- def fastalns(fn)
203
- fn.exist_as_a_file?.should be_true
204
- IO.read(fn).split("\n")
205
- end
206
-
207
- # returns the fasta object proteins
208
- def fastap(fn)
209
- @f.exist_as_a_file?.should be_true
210
- Fasta.new(fn).prots
211
- end
212
-
213
- end
214
-
215
- describe FastaShaker, "by method call" do
216
-
217
- before(:all) do
218
- @shaker = FastaShaker.new
219
- end
220
-
221
- it_should_behave_like "a manipulator of a fasta file"
222
-
223
- def do_it(method, additional_opts={})
224
- opts = {:out => @f}
225
- @shaker.send(method, @tmpfile, opts.merge(additional_opts))
226
- end
227
-
228
- end
229
-
230
-
231
- describe FastaShaker, "by command line long args" do
232
- before(:all) do
233
- @progname = 'fasta_shaker.rb'
234
- end
235
-
236
- it_should_behave_like "a cmdline program"
237
- it_should_behave_like "a manipulator of a fasta file"
238
-
239
- # returns an array of the args
240
- def opts_to_cmd_args(hash)
241
- opts = []
242
- hash.each do |k,v|
243
- opts.push('--' + k.to_s)
244
- unless (v == true) or (v == false)
245
- opts.push(v)
246
- end
247
- end
248
- opts
249
- end
250
-
251
- def do_it(method, additional_opts={})
252
- opts = {:out => @f}
253
- opts.merge!(additional_opts)
254
- cmd = [@cmd, method, @tmpfile, *(opts_to_cmd_args(opts))].join(" ")
255
- #puts cmd
256
- system cmd
257
- end
258
-
259
- end