ms-msrun 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/History CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.3.1 / 2011-01-26
2
+ * (since 0.1.1): added support for mzML and parsing zlib compressed spectra
3
+ * added read/write for the .plms1 filetype, an ad hoc binary filetype for ms1 data
4
+
1
5
  == 0.1.1 / 2009-11-19
2
6
  * using unified mspire template
3
7
  * using spec-more (bacon) rather than minitest-spec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require "ms/msrun/plms1"
4
+
5
+ ext = "plms1"
6
+
7
+ if ARGV.size == 0
8
+ puts "usage: #{File.basename(__FILE__)} <file>.mz[X]ML ..."
9
+ puts "output: <file>.#{ext} ..."
10
+ puts ""
11
+ puts " plms1 is the Prince Lab MS 1 binary file format"
12
+ puts " [matlab readers and writers also exist]"
13
+ puts ""
14
+ puts "options:"
15
+ puts " --spec print file spec and exit"
16
+ end
17
+
18
+ if ARGV.include?("--spec")
19
+ puts Ms::Msrun::Plms1::SPECIFICATION
20
+ exit
21
+ end
22
+
23
+ ARGV.each do |file|
24
+ outfile = file.sub(/\.mzX?ML$/,".#{ext}")
25
+ Ms::Msrun.open(file) do |ms|
26
+ # see docs for lots more options here
27
+ ms.to_plms1.write(outfile)
28
+ end
29
+ end
@@ -5,12 +5,25 @@ require 'stringio'
5
5
  module Ms
6
6
  class Msrun
7
7
 
8
- def to_plms1
8
+ # if given scans, will use those, or optionally takes a block where an
9
+ # array of ms1 scans are yielded and it expects Enumerable scans back.
10
+ def to_plms1(scans=nil)
9
11
  times = []
10
12
  scan_numbers = []
11
13
  spectra = []
12
14
 
13
- ms.each(:ms_level => 1, :precursor => false) do |scan|
15
+ unless scans
16
+ scans = []
17
+ ms.each(:ms_level => 1, :precursor => false) do |scan|
18
+ scans << scan
19
+ end
20
+ end
21
+
22
+ if block_given?
23
+ scans = yield(scans)
24
+ end
25
+
26
+ scans.each do |scan|
14
27
  times << scan.time
15
28
  scan_numbers << scan.num
16
29
  spec = scan.spectrum
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 1
9
- version: 0.3.1
8
+ - 2
9
+ version: 0.3.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - John T. Prince
@@ -61,6 +61,7 @@ dependencies:
61
61
  description: A library for working with LC/MS runs. Part of mspire. Has parsers for mzXML v1, 2, and 3, mzData (currently broken) and mzML (planned). Can convert to commonly desired search output (such as mgf). Fast random access of scans, and fast reading of the entire file.
62
62
  email: jtprince@gmail.com
63
63
  executables:
64
+ - ms_to_plms1.rb
64
65
  - base64_to_array.rb
65
66
  - ms_to_obiwarp.rb
66
67
  - ms_to_search.rb
@@ -79,6 +80,7 @@ files:
79
80
  - VERSION
80
81
  - bin/base64_to_array.rb
81
82
  - bin/ms_to_obiwarp.rb
83
+ - bin/ms_to_plms1.rb
82
84
  - bin/ms_to_search.rb
83
85
  - lib/ms/msrun.rb
84
86
  - lib/ms/msrun/axml/mzxml.rb