mspire 0.5.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. data/README.rdoc +24 -0
  2. data/Rakefile +51 -0
  3. data/VERSION +1 -0
  4. data/lib/cv/description.rb +18 -0
  5. data/lib/cv/param.rb +33 -0
  6. data/lib/cv.rb +3 -0
  7. data/lib/io/bookmark.rb +13 -0
  8. data/lib/merge.rb +7 -0
  9. data/lib/ms/cvlist.rb +76 -0
  10. data/lib/ms/digester.rb +245 -0
  11. data/lib/ms/fasta.rb +86 -0
  12. data/lib/ms/ident/peptide/db.rb +243 -0
  13. data/lib/ms/ident/peptide.rb +72 -0
  14. data/lib/ms/ident/peptide_hit/qvalue.rb +56 -0
  15. data/lib/ms/ident/peptide_hit.rb +26 -0
  16. data/lib/ms/ident/pepxml/modifications.rb +83 -0
  17. data/lib/ms/ident/pepxml/msms_pipeline_analysis.rb +70 -0
  18. data/lib/ms/ident/pepxml/msms_run_summary.rb +82 -0
  19. data/lib/ms/ident/pepxml/parameters.rb +14 -0
  20. data/lib/ms/ident/pepxml/sample_enzyme.rb +165 -0
  21. data/lib/ms/ident/pepxml/search_database.rb +49 -0
  22. data/lib/ms/ident/pepxml/search_hit/modification_info.rb +79 -0
  23. data/lib/ms/ident/pepxml/search_hit.rb +144 -0
  24. data/lib/ms/ident/pepxml/search_result.rb +35 -0
  25. data/lib/ms/ident/pepxml/search_summary.rb +92 -0
  26. data/lib/ms/ident/pepxml/spectrum_query.rb +85 -0
  27. data/lib/ms/ident/pepxml.rb +112 -0
  28. data/lib/ms/ident/protein.rb +33 -0
  29. data/lib/ms/ident/protein_group.rb +80 -0
  30. data/lib/ms/ident/search.rb +114 -0
  31. data/lib/ms/ident.rb +37 -0
  32. data/lib/ms/isotope/aa.rb +59 -0
  33. data/lib/ms/mascot.rb +6 -0
  34. data/lib/ms/mass/aa.rb +79 -0
  35. data/lib/ms/mass.rb +55 -0
  36. data/lib/ms/mzml/index_list.rb +98 -0
  37. data/lib/ms/mzml/plms1.rb +34 -0
  38. data/lib/ms/mzml.rb +197 -0
  39. data/lib/ms/obo.rb +38 -0
  40. data/lib/ms/plms1.rb +156 -0
  41. data/lib/ms/quant/qspec/protein_group_comparison.rb +22 -0
  42. data/lib/ms/quant/qspec.rb +112 -0
  43. data/lib/ms/spectrum.rb +154 -8
  44. data/lib/ms.rb +3 -10
  45. data/lib/msplat.rb +2 -0
  46. data/lib/obo/ims.rb +5 -0
  47. data/lib/obo/ms.rb +7 -0
  48. data/lib/obo/ontology.rb +41 -0
  49. data/lib/obo/unit.rb +5 -0
  50. data/lib/openany.rb +23 -0
  51. data/lib/write_file_or_string.rb +18 -0
  52. data/obo/ims.obo +562 -0
  53. data/obo/ms.obo +11677 -0
  54. data/obo/unit.obo +2563 -0
  55. data/spec/ms/cvlist_spec.rb +60 -0
  56. data/spec/ms/digester_spec.rb +351 -0
  57. data/spec/ms/fasta_spec.rb +100 -0
  58. data/spec/ms/ident/peptide/db_spec.rb +108 -0
  59. data/spec/ms/ident/pepxml/sample_enzyme_spec.rb +181 -0
  60. data/spec/ms/ident/pepxml/search_hit/modification_info_spec.rb +37 -0
  61. data/spec/ms/ident/pepxml_spec.rb +442 -0
  62. data/spec/ms/ident/protein_group_spec.rb +68 -0
  63. data/spec/ms/mass_spec.rb +8 -0
  64. data/spec/ms/mzml/index_list_spec.rb +122 -0
  65. data/spec/ms/mzml/plms1_spec.rb +62 -0
  66. data/spec/ms/mzml_spec.rb +50 -0
  67. data/spec/ms/plms1_spec.rb +38 -0
  68. data/spec/ms/quant/qspec_spec.rb +25 -0
  69. data/spec/msplat_spec.rb +24 -0
  70. data/spec/obo_spec.rb +25 -0
  71. data/spec/spec_helper.rb +25 -0
  72. data/spec/testfiles/ms/ident/peptide/db/uni_11_sp_tr.fasta +69 -0
  73. data/spec/testfiles/ms/ident/peptide/db/uni_11_sp_tr.msd_clvg2.min_aaseq4.yml +728 -0
  74. data/spec/testfiles/ms/mzml/j24z.idx_comp.3.mzML +271 -0
  75. data/spec/testfiles/ms/mzml/openms.noidx_nocomp.12.mzML +330 -0
  76. data/spec/testfiles/ms/quant/kill_extra_tabs.rb +13 -0
  77. data/spec/testfiles/ms/quant/max_quant_output.provenance.txt +15 -0
  78. data/spec/testfiles/ms/quant/max_quant_output.txt +199 -0
  79. data/spec/testfiles/ms/quant/pdcd5_final.killedextratabs.tsv +199 -0
  80. data/spec/testfiles/ms/quant/pdcd5_final.killedextratabs.tsv_qspecgp +199 -0
  81. data/spec/testfiles/ms/quant/pdcd5_final.killedextratabs.tsv_qspecgp.csv +199 -0
  82. data/spec/testfiles/ms/quant/pdcd5_final.txt +199 -0
  83. data/spec/testfiles/ms/quant/pdcd5_final.txt_qspecgp +0 -0
  84. data/spec/testfiles/ms/quant/pdcd5_lfq_qspec.CSV.csv +199 -0
  85. data/spec/testfiles/ms/quant/pdcd5_lfq_qspec.csv +199 -0
  86. data/spec/testfiles/ms/quant/pdcd5_lfq_qspec.oneprot.csv +199 -0
  87. data/spec/testfiles/ms/quant/pdcd5_lfq_qspec.oneprot.tsv +199 -0
  88. data/spec/testfiles/ms/quant/pdcd5_lfq_qspec.oneprot.tsv_qspecgp +199 -0
  89. data/spec/testfiles/ms/quant/pdcd5_lfq_qspec.oneprot.tsv_qspecgp.csv +199 -0
  90. data/spec/testfiles/ms/quant/pdcd5_lfq_qspec.txt +199 -0
  91. data/spec/testfiles/ms/quant/pdcd5_lfq_tabdel.txt +134 -0
  92. data/spec/testfiles/ms/quant/pdcd5_lfq_tabdel.txt_qspecgp +134 -0
  93. data/spec/testfiles/ms/quant/remove_rest_of_proteins.rb +13 -0
  94. data/spec/testfiles/ms/quant/unlog_transform.rb +13 -0
  95. data/spec/testfiles/plms1/output.key +0 -0
  96. metadata +157 -40
  97. data/README +0 -77
  98. data/changelog.txt +0 -196
  99. data/lib/ms/calc.rb +0 -32
  100. data/lib/ms/data/interleaved.rb +0 -60
  101. data/lib/ms/data/lazy_io.rb +0 -73
  102. data/lib/ms/data/lazy_string.rb +0 -15
  103. data/lib/ms/data/simple.rb +0 -59
  104. data/lib/ms/data/transposed.rb +0 -41
  105. data/lib/ms/data.rb +0 -57
  106. data/lib/ms/format/format_error.rb +0 -12
  107. data/lib/ms/support/binary_search.rb +0 -126
@@ -1,59 +0,0 @@
1
- module Ms
2
- module Data
3
- module_function
4
-
5
- # Initializes a new simple data array.
6
- def new_simple(unresolved_data)
7
- Simple.new(unresolved_data)
8
- end
9
-
10
- # A Simple data array that lazily evaluates unresolved_data, and
11
- # each member of unresolved_data using to_a:
12
- #
13
- # class LazyObject
14
- # attr_reader :to_a
15
- # def initialize(array)
16
- # @to_a = array
17
- # end
18
- # end
19
- #
20
- # a = LazyObject.new([1,2,3])
21
- # b = LazyObject.new([4,5,6])
22
- # s = Ms::Data::Simple.new([a, b])
23
- #
24
- # s.unresolved_data # => [a, b]
25
- # s.data # => []
26
- # s[0] # => [1,2,3]
27
- # s[1] # => [4,5,6]
28
- # s.data # => [[1,2,3], [4,5,6]]
29
- #
30
- class Simple
31
- # The underlying resolved data store.
32
- attr_reader :data
33
-
34
- # The underlying unresolved data store.
35
- attr_reader :unresolved_data
36
-
37
- def initialize(unresolved_data)
38
- @data = []
39
- @unresolved_data = unresolved_data
40
- end
41
-
42
- def [](index)
43
- @data[index] ||= @unresolved_data.to_a[index].to_a
44
- end
45
-
46
- def resolve
47
- 0.upto(@unresolved_data.length - 1) do |index|
48
- self[index]
49
- end unless resolved?
50
-
51
- self
52
- end
53
-
54
- def resolved?
55
- @data.compact.length == @unresolved_data.length
56
- end
57
- end
58
- end
59
- end
@@ -1,41 +0,0 @@
1
- require 'ms/data/simple'
2
-
3
- module Ms
4
- module Data
5
- module_function
6
-
7
- # Initializes a new transposed data array.
8
- def new_transposed(unresolved_data)
9
- Transposed.new(unresolved_data)
10
- end
11
-
12
- # A Transposed data array lazily evaluates it's unresolved data as
13
- # a transposed array. The unresolved data is evaluated
14
- # into an array using to_a.
15
- #
16
- # t = Ms::Data::Transposed.new([[1,4],[2,5],[3,6]])
17
- #
18
- # t.unresolved_data # => [[1,4],[2,5],[3,6]]
19
- # t.data # => []
20
- # t[0] # => [1,2,3]
21
- # t[1] # => [4,5,6]
22
- # t.data # => [[1,2,3], [4,5,6]]
23
- #
24
- class Transposed < Simple
25
-
26
- def [](index)
27
- resolve.data[index]
28
- end
29
-
30
- def resolved?
31
- !@data.empty?
32
- end
33
-
34
- def resolve
35
- @data = @unresolved_data.to_a.transpose unless resolved?
36
- self
37
- end
38
-
39
- end
40
- end
41
- end
data/lib/ms/data.rb DELETED
@@ -1,57 +0,0 @@
1
- require 'ms/data/interleaved'
2
- require 'ms/data/transposed'
3
-
4
- module Ms
5
-
6
- # The Data module contains a number of classes providing a standard way to
7
- # resolve various data storage formats into a 'simple' data array.
8
- #
9
- # type format
10
- # simple [[mzs,...], [intensities...]]
11
- # transposed [[mz,intensity], [mz,intensity], ...]
12
- # interleaved [mz,intensity,mz,intensity,...]
13
- #
14
- # For instance:
15
- #
16
- # s = Data.new([[1,2,3], [4,5,6]], :simple)
17
- # s.resolve.data # => [[1,2,3], [4,5,6]]
18
- #
19
- # t = Data.new([[1,4],[2,5],[3,6]], :transposed)
20
- # t.resolve.data # => [[1,2,3], [4,5,6]]
21
- #
22
- # i = Data.new([1,4,2,5,3,6], :interleaved)
23
- # i.resolve.data # => [[1,2,3], [4,5,6]]
24
- #
25
- # Data is always resolved by calling to_a on the unresolved data object
26
- # and then rearranging as needed (in the case of simple data, to_a is
27
- # also called on each member of the unresolved data array). This lazy
28
- # resolution allows the use of non-array unresolved_data objects such
29
- # as Data::LazyString:
30
- #
31
- # str = [[1,4,2,5,3,6].pack("g*")].pack("m")
32
- # unresolved_data = Data::LazyString.new(str)
33
- #
34
- # i = Data.new(unresolved_data, :interleaved)
35
- # i.resolve.data # => [[1,2,3], [4,5,6]]
36
- #
37
- # Obviously the big advantage of lazy data resolution is that Data objects
38
- # may be instantiated cheaply while expensive operations like unpacking and
39
- # rearrangement may be put off or not executed at all.
40
- #
41
- module Data
42
- module_function
43
-
44
- # Initializes a new data array of the specified type by forwarding
45
- # data to the "new_<type>" method.
46
- #
47
- # simple = Ms::Data.new([[1,2,3], [4,5,6]], :simple)
48
- # simple.class # => Ms::Data::Simple
49
- #
50
- # interleaved = Ms::Data.new([1,4,2,5,3,6], :interleaved)
51
- # interleaved.class # => Ms::Data::Interleaved
52
- #
53
- def new(data, type=:simple)
54
- send("new_#{type}", data)
55
- end
56
- end
57
- end
@@ -1,12 +0,0 @@
1
- module Ms
2
- module Format
3
- class FormatError < Exception
4
- attr_accessor :str
5
-
6
- def initialize(msg, str)
7
- super(msg)
8
- @str = str
9
- end
10
- end
11
- end
12
- end
@@ -1,126 +0,0 @@
1
- module Ms
2
- module Support
3
-
4
- # A binary search library adapted from: http://0xcc.net/ruby-bsearch/
5
- # ---
6
- #
7
- # Ruby/Bsearch - a binary search library for Ruby.
8
- #
9
- # Copyright (C) 2001 Satoru Takabayashi <satoru@namazu.org>
10
- # All rights reserved.
11
- # This is free software with ABSOLUTELY NO WARRANTY.
12
- #
13
- # You can redistribute it and/or modify it under the terms of
14
- # the Ruby's licence.
15
- #
16
- # Example:
17
- #
18
- # % irb -r ./bsearch.rb
19
- # >> %w(a b c c c d e f).bsearch_first {|x| x <=> "c"}
20
- # => 2
21
- # >> %w(a b c c c d e f).bsearch_last {|x| x <=> "c"}
22
- # => 4
23
- # >> %w(a b c e f).bsearch_first {|x| x <=> "c"}
24
- # => 2
25
- # >> %w(a b e f).bsearch_first {|x| x <=> "c"}
26
- # => nil
27
- # >> %w(a b e f).bsearch_last {|x| x <=> "c"}
28
- # => nil
29
- # >> %w(a b e f).bsearch_lower_boundary {|x| x <=> "c"}
30
- # => 2
31
- # >> %w(a b e f).bsearch_upper_boundary {|x| x <=> "c"}
32
- # => 2
33
- # >> %w(a b c c c d e f).bsearch_range {|x| x <=> "c"}
34
- # => 2...5
35
- # >> %w(a b c d e f).bsearch_range {|x| x <=> "c"}
36
- # => 2...3
37
- # >> %w(a b d e f).bsearch_range {|x| x <=> "c"}
38
- # => 2...2
39
- #
40
- # The binary search algorithm is extracted from Jon Bentley's
41
- # Programming Pearls 2nd ed. p.93
42
- #
43
- module BinarySearch
44
- VERSION = '1.5'
45
-
46
- module_function
47
-
48
- #
49
- # Return the lower boundary. (inside)
50
- #
51
- def search_lower_boundary(array, range=nil, &block)
52
- range = 0 ... array.length if range == nil
53
-
54
- lower = range.first() -1
55
- upper = if range.exclude_end? then range.last else range.last + 1 end
56
- while lower + 1 != upper
57
- mid = ((lower + upper) / 2).to_i # for working with mathn.rb (Rational)
58
- if yield(array[mid]) < 0
59
- lower = mid
60
- else
61
- upper = mid
62
- end
63
- end
64
- return upper
65
- end
66
-
67
- #
68
- # This method searches the FIRST occurrence which satisfies a
69
- # condition given by a block in binary fashion and return the
70
- # index of the first occurrence. Return nil if not found.
71
- #
72
- def search_first(array, range=nil, &block)
73
- boundary = search_lower_boundary(array, range, &block)
74
- if boundary >= array.length || yield(array[boundary]) != 0
75
- return nil
76
- else
77
- return boundary
78
- end
79
- end
80
-
81
- #
82
- # Return the upper boundary. (outside)
83
- #
84
- def search_upper_boundary(array, range=nil, &block)
85
- range = 0 ... array.length if range == nil
86
-
87
- lower = range.first() -1
88
- upper = if range.exclude_end? then range.last else range.last + 1 end
89
- while lower + 1 != upper
90
- mid = ((lower + upper) / 2).to_i # for working with mathn.rb (Rational)
91
- if yield(array[mid]) <= 0
92
- lower = mid
93
- else
94
- upper = mid
95
- end
96
- end
97
- return lower + 1 # outside of the matching range.
98
- end
99
-
100
- #
101
- # This method searches the LAST occurrence which satisfies a
102
- # condition given by a block in binary fashion and return the
103
- # index of the last occurrence. Return nil if not found.
104
- #
105
- def search_last(array, range=nil, &block)
106
- # `- 1' for canceling `lower + 1' in bsearch_upper_boundary.
107
- boundary = search_upper_boundary(array, range, &block) - 1
108
-
109
- if (boundary <= -1 || yield(array[boundary]) != 0)
110
- return nil
111
- else
112
- return boundary
113
- end
114
- end
115
-
116
- #
117
- # Return the search result as a Range object.
118
- #
119
- def search_range(array, range=nil, &block)
120
- lower = search_lower_boundary(array, range, &block)
121
- upper = search_upper_boundary(array, range, &block)
122
- return lower ... upper
123
- end
124
- end
125
- end
126
- end