mspire-simulator 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +46 -3
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/bin/mspire-simulator +8 -0
- data/bin/sim_mail +2 -2
- data/lib/cv_parser.rb +7 -0
- data/lib/ms/curvefit/curve_fit_helper.rb +26 -20
- data/lib/ms/curvefit/mzml_reader.rb +1 -1
- data/lib/ms/curvefit.rb +25 -8
- data/lib/ms/isoelectric_calc.rb +162 -103
- data/lib/ms/merger.rb +46 -33
- data/lib/ms/mzml_wrapper.rb +74 -29
- data/lib/ms/noise.rb +28 -28
- data/lib/ms/rt/rt_helper.rb +3 -3
- data/lib/ms/rt/rtgenerator.rb +63 -51
- data/lib/ms/rt/weka.rb +17 -17
- data/lib/ms/sim_digester.rb +45 -26
- data/lib/ms/sim_feature.rb +180 -122
- data/lib/ms/sim_peptide.rb +58 -55
- data/lib/ms/sim_spectra.rb +22 -23
- data/lib/ms/sim_trollop.rb +36 -32
- data/lib/ms/tr_file_writer.rb +111 -98
- data/lib/progress.rb +21 -20
- data/mspire-simulator.gemspec +5 -5
- data/spec/file_writer_spec.rb +2 -1
- data/spec/merger_spec.rb +2 -1
- data/spec/ms-simulate_spec.rb +1 -1
- data/spec/peptide_spec.rb +2 -1
- data/spec/spec_helper.rb +8 -3
- data/spec/spectra_spec.rb +4 -3
- metadata +5 -5
- data/spec/progress_spec.rb +0 -22
data/lib/progress.rb
CHANGED
@@ -1,24 +1,25 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
2
|
+
class Progress
|
3
|
+
# ANSI escape code to clear line from cursor to end of line
|
4
|
+
# "\e" is an alternative to "\033"
|
5
|
+
# cf. http://en.wikipedia.org/wiki/ANSI_escape_code
|
6
|
+
def initialize(message, time = nil)
|
7
|
+
@message = message
|
8
|
+
@time = time ? time : Time.now
|
9
|
+
@reset = "\r\e[0K"
|
10
|
+
end
|
11
|
+
def progress(num, message_addition = "")
|
12
|
+
message = @message+message_addition
|
13
13
|
# reset lines
|
14
|
-
reset
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
14
|
+
print "#{@reset} #{message}" + "#{num}%".rjust(60-message.length)
|
15
|
+
$stdout.flush
|
16
|
+
end
|
17
|
+
def finish!(message_addition = "")
|
18
|
+
time = Time.now - @time
|
19
|
+
message = @message + message_addition
|
20
|
+
str = "#{@reset} #{message}" + "100%".rjust(60-message.length)
|
21
|
+
print str + "Took: #{"%.2f" % time} sec.\n".rjust(100-str.length)
|
22
|
+
$stdout.flush
|
23
23
|
end
|
24
|
+
alias :update :progress
|
24
25
|
end
|
data/mspire-simulator.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "mspire-simulator"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["anoyce"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-12-13"
|
13
13
|
s.description = "Simulates MS1 runs given amino acid FASTA files. Outputs an MZML file.\n\t\t\tCan simulate specific data if given an MZML file containing a single isolated peptide peak."
|
14
14
|
s.email = "andrewbnoyce@gmail.com"
|
15
15
|
s.executables = ["mspire-simulator", "sim_mail"]
|
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
"VERSION",
|
25
25
|
"bin/mspire-simulator",
|
26
26
|
"bin/sim_mail",
|
27
|
+
"lib/cv_parser.rb",
|
27
28
|
"lib/ms/curvefit.rb",
|
28
29
|
"lib/ms/curvefit/curve_fit_helper.rb",
|
29
30
|
"lib/ms/curvefit/fit_graph.rb",
|
@@ -49,14 +50,13 @@ Gem::Specification.new do |s|
|
|
49
50
|
"spec/merger_spec.rb",
|
50
51
|
"spec/ms-simulate_spec.rb",
|
51
52
|
"spec/peptide_spec.rb",
|
52
|
-
"spec/progress_spec.rb",
|
53
53
|
"spec/spec_helper.rb",
|
54
54
|
"spec/spectra_spec.rb"
|
55
55
|
]
|
56
|
-
s.homepage = "
|
56
|
+
s.homepage = "https://github.com/princelab/mspire-simulator"
|
57
57
|
s.licenses = ["MIT"]
|
58
58
|
s.require_paths = ["lib"]
|
59
|
-
s.rubygems_version = "1.8.
|
59
|
+
s.rubygems_version = "1.8.24"
|
60
60
|
s.summary = "Simulates MS1 runs given amino acid FASTA files. Outputs an MZML file."
|
61
61
|
|
62
62
|
if s.respond_to? :specification_version then
|
data/spec/file_writer_spec.rb
CHANGED
data/spec/merger_spec.rb
CHANGED
data/spec/ms-simulate_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
3
3
|
|
4
4
|
describe "MSsimulate" do
|
5
5
|
it "Gathers parameters from the cmd line and runs the simulator; If no params are given or --help a help message is displayed" do
|
6
|
-
output = `ruby bin/
|
6
|
+
output = `ruby bin/mspire-simulator --help`
|
7
7
|
output.should =~ /where/
|
8
8
|
end
|
9
9
|
end
|
data/spec/peptide_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -2,10 +2,15 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
2
2
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
3
|
require 'rspec'
|
4
4
|
|
5
|
-
#
|
6
|
-
# in ./support/ and its subdirectories.
|
7
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
5
|
+
Dir["#{File.dirname(__FILE__)}/lib/**/*.rb"].each {|f| require f}
|
8
6
|
|
9
7
|
RSpec.configure do |config|
|
8
|
+
|
9
|
+
config.before(:all) do
|
10
|
+
system("mkdir .m .i")
|
11
|
+
system("mkdir .m/A .m/R .m/N .m/D .m/C .m/E .m/Q .m/G .m/H .m/I .m/L .m/K .m/M .m/F .m/P .m/S .m/T .m/W .m/Y .m/V .m/U .m/O")
|
12
|
+
system("mkdir .i/A .i/R .i/N .i/D .i/C .i/E .i/Q .i/G .i/H .i/I .i/L .i/K .i/M .i/F .i/P .i/S .i/T .i/W .i/Y .i/V .i/U .i/O")
|
13
|
+
end
|
10
14
|
|
15
|
+
config.after(:all) {system("rm -r -f .m .i")}
|
11
16
|
end
|
data/spec/spectra_spec.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#spectra_spec.rb
|
2
|
-
|
2
|
+
$LOAD_PATH << './lib'
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
3
4
|
require 'mspire'
|
4
5
|
require 'ms/sim_spectra'
|
5
6
|
require 'ms/sim_peptide'
|
@@ -91,8 +92,8 @@ describe MS::Sim_Spectra do
|
|
91
92
|
end
|
92
93
|
|
93
94
|
it "Each feature should have a predicted retention time and intensity" do
|
94
|
-
p_rts = [(
|
95
|
-
p_ints = [2.
|
95
|
+
p_rts = [(823..826),(769..772),(1485..1490)]
|
96
|
+
p_ints = [2.058,2.095,2.219]
|
96
97
|
@spectra.features.each_with_index do |fe,i|
|
97
98
|
p_rts[i].should cover(fe.p_rt)
|
98
99
|
fe.p_int.should == p_ints[i]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mspire-simulator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mspire
|
@@ -189,6 +189,7 @@ files:
|
|
189
189
|
- VERSION
|
190
190
|
- bin/mspire-simulator
|
191
191
|
- bin/sim_mail
|
192
|
+
- lib/cv_parser.rb
|
192
193
|
- lib/ms/curvefit.rb
|
193
194
|
- lib/ms/curvefit/curve_fit_helper.rb
|
194
195
|
- lib/ms/curvefit/fit_graph.rb
|
@@ -214,10 +215,9 @@ files:
|
|
214
215
|
- spec/merger_spec.rb
|
215
216
|
- spec/ms-simulate_spec.rb
|
216
217
|
- spec/peptide_spec.rb
|
217
|
-
- spec/progress_spec.rb
|
218
218
|
- spec/spec_helper.rb
|
219
219
|
- spec/spectra_spec.rb
|
220
|
-
homepage:
|
220
|
+
homepage: https://github.com/princelab/mspire-simulator
|
221
221
|
licenses:
|
222
222
|
- MIT
|
223
223
|
post_install_message:
|
@@ -238,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
238
238
|
version: '0'
|
239
239
|
requirements: []
|
240
240
|
rubyforge_project:
|
241
|
-
rubygems_version: 1.8.
|
241
|
+
rubygems_version: 1.8.24
|
242
242
|
signing_key:
|
243
243
|
specification_version: 3
|
244
244
|
summary: Simulates MS1 runs given amino acid FASTA files. Outputs an MZML file.
|
data/spec/progress_spec.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
#progress_spec.rb
|
2
|
-
|
3
|
-
require 'progress'
|
4
|
-
require 'time'
|
5
|
-
|
6
|
-
describe Progress, "#progress" do
|
7
|
-
it "Prints out a given message and percentage, refreshing the current line with each call." do
|
8
|
-
101.times do |i|
|
9
|
-
Progress.progress("Message:",i)
|
10
|
-
sleep 0.01
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
it "Also can take a final time to show how long a process took." do
|
15
|
-
start = Time.now
|
16
|
-
101.times do |i|
|
17
|
-
Progress.progress("Message:",i)
|
18
|
-
sleep 0.01
|
19
|
-
end
|
20
|
-
Progress.progress("Message:",100,Time.now - start)
|
21
|
-
end
|
22
|
-
end
|