mzml 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +17 -16
- data/README.rdoc +22 -3
- data/lib/mzml/doc.rb +29 -2
- data/lib/mzml/version.rb +1 -1
- metadata +10 -10
data/LICENSE
CHANGED
@@ -1,20 +1,21 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
1
3
|
Copyright (c) 2009 Angel Pizarro
|
2
4
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
the following conditions:
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
10
11
|
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
13
14
|
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
OF
|
20
|
-
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.rdoc
CHANGED
@@ -1,12 +1,31 @@
|
|
1
|
-
=
|
1
|
+
= mzML
|
2
2
|
|
3
3
|
MzML is a standard data format for encoding mass spectrometry data. For more information see mzML the specification at http://psidev.info/index.php?q=node/257
|
4
4
|
|
5
|
-
This library is a non-validating mzML version 1.1
|
5
|
+
This library is a non-validating, read-only mzML parser for mzML version 1.1.x
|
6
6
|
|
7
|
+
It is built on top of the nokogiri gem for XML parsing, which itself relies on
|
8
|
+
the libxml2 C library. The library It is relatively fast
|
9
|
+
|
10
|
+
==USAGE:
|
11
|
+
|
12
|
+
require 'mzml'
|
13
|
+
mzml = MzML::Doc.open("test.mzXML")
|
14
|
+
# to iterate through spectra
|
15
|
+
mzml.each do |spectrum|
|
16
|
+
# ... do something interesting
|
17
|
+
end
|
18
|
+
# to get an Array of spectrum IDs
|
19
|
+
mzml.spectrum_list
|
20
|
+
# to fetch a specific spectrum, whose ID you already know
|
21
|
+
mzml.spectrum("controllerType=0 controllerNumber=1 scan=1")
|
22
|
+
|
23
|
+
You can also get chromatograms
|
24
|
+
mzml.each_chromatogram
|
25
|
+
mzml.chromatogram("TIC")
|
7
26
|
|
8
27
|
== Note on Patches/Pull Requests
|
9
|
-
|
28
|
+
|
10
29
|
* Fork the project. It is hosted @ http://github.com/delagoya/mzml
|
11
30
|
* Make your feature addition or bug fix.
|
12
31
|
* Add tests for it. This is important so I don't break it in a
|
data/lib/mzml/doc.rb
CHANGED
@@ -18,7 +18,15 @@
|
|
18
18
|
# ===USAGE:
|
19
19
|
#
|
20
20
|
# require 'mzml'
|
21
|
-
# mzml = MzML::Doc.
|
21
|
+
# mzml = MzML::Doc.open("test.mzXML")
|
22
|
+
# # to iterate through spectra
|
23
|
+
# mzml.each do |spectrum|
|
24
|
+
# # ... do something interesting
|
25
|
+
# end
|
26
|
+
# # to get an Array of spectrum IDs
|
27
|
+
# mzml.spectrum_list
|
28
|
+
# # to fetch a specific spectrum, whose ID you already know
|
29
|
+
# mzml.spectrum("controllerType=0 controllerNumber=1 scan=1")
|
22
30
|
module MzML
|
23
31
|
|
24
32
|
# An internal module containing useful regular expressions
|
@@ -61,6 +69,7 @@ module MzML
|
|
61
69
|
@spectrum_count = @spectrum_list.length
|
62
70
|
@chromatogram_count = @chromatogram_list.length
|
63
71
|
@current_spectrum_index = 0
|
72
|
+
@current_chromatogram_index = 0
|
64
73
|
end
|
65
74
|
attr_reader :index, :fname, :spectrum_list, :spectrum_count, :chromatogram_list, :chromatogram_count
|
66
75
|
|
@@ -93,7 +102,14 @@ module MzML
|
|
93
102
|
end
|
94
103
|
alias_method :each_spectrum, :each
|
95
104
|
|
96
|
-
def
|
105
|
+
def each_chromatogram &block
|
106
|
+
@chromatogram_list.each do |chromatogram_id|
|
107
|
+
block.call(self.chromatogram(chromatogram_id))
|
108
|
+
@current_chromatogram_index += 1
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def next
|
97
113
|
if @current_spectrum_index < @spectrum_list.length
|
98
114
|
@current_spectrum_index += 1
|
99
115
|
self.spectrum(@spectrum_list[@current_spectrum_index - 1])
|
@@ -103,9 +119,20 @@ module MzML
|
|
103
119
|
end
|
104
120
|
alias_method :next_spectrum, :next
|
105
121
|
|
122
|
+
def next_chromatogram
|
123
|
+
if @current_chromatogram_index < @chromatogram_list.length
|
124
|
+
@current_chromatogram_index += 1
|
125
|
+
self.chromatogram(@chromatogram_list[@current_chromatogram_index - 1])
|
126
|
+
else
|
127
|
+
nil
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
106
131
|
def rewind
|
107
132
|
super
|
108
133
|
@current_spectrum_index = 0
|
134
|
+
@current_chromatogram_index = 0
|
135
|
+
self.pos
|
109
136
|
end
|
110
137
|
|
111
138
|
private
|
data/lib/mzml/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mzml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
16
|
-
requirement: &
|
16
|
+
requirement: &70118841419920 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '1.5'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70118841419920
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70118841419360 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70118841419360
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: yard
|
38
|
-
requirement: &
|
38
|
+
requirement: &70118841418840 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70118841418840
|
47
47
|
description: A non-validating mzML parser. MzML is a standard data format for representing
|
48
48
|
mass spectrometry data.
|
49
49
|
email:
|
@@ -90,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
90
|
version: '0'
|
91
91
|
segments:
|
92
92
|
- 0
|
93
|
-
hash:
|
93
|
+
hash: 1368085886114290395
|
94
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
version: '0'
|
100
100
|
segments:
|
101
101
|
- 0
|
102
|
-
hash:
|
102
|
+
hash: 1368085886114290395
|
103
103
|
requirements: []
|
104
104
|
rubyforge_project:
|
105
105
|
rubygems_version: 1.8.11
|