mspire 0.6.26 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/mspire.rb +1 -1
- data/lib/{ms → mspire}/cv.rb +1 -1
- data/lib/{ms → mspire}/cv/param.rb +5 -5
- data/lib/{ms → mspire}/cv/paramable.rb +5 -5
- data/lib/{ms → mspire}/digester.rb +2 -2
- data/lib/{ms → mspire}/error_rate/decoy.rb +1 -1
- data/lib/{ms → mspire}/error_rate/qvalue.rb +4 -4
- data/lib/{ms → mspire}/fasta.rb +5 -5
- data/lib/{ms → mspire}/ident.rb +10 -10
- data/lib/{ms → mspire}/ident/peptide.rb +3 -3
- data/lib/{ms → mspire}/ident/peptide/db.rb +12 -12
- data/lib/{ms → mspire}/ident/peptide_hit.rb +6 -6
- data/lib/{ms → mspire}/ident/peptide_hit/qvalue.rb +7 -7
- data/lib/{ms → mspire}/ident/pepxml.rb +7 -7
- data/lib/{ms → mspire}/ident/pepxml/modifications.rb +7 -7
- data/lib/{ms → mspire}/ident/pepxml/msms_pipeline_analysis.rb +6 -6
- data/lib/{ms → mspire}/ident/pepxml/msms_run_summary.rb +9 -9
- data/lib/{ms → mspire}/ident/pepxml/parameters.rb +1 -1
- data/lib/{ms → mspire}/ident/pepxml/sample_enzyme.rb +4 -4
- data/lib/{ms → mspire}/ident/pepxml/search_database.rb +5 -5
- data/lib/{ms → mspire}/ident/pepxml/search_hit.rb +4 -4
- data/lib/{ms → mspire}/ident/pepxml/search_hit/modification_info.rb +7 -7
- data/lib/{ms → mspire}/ident/pepxml/search_result.rb +5 -5
- data/lib/{ms → mspire}/ident/pepxml/search_summary.rb +12 -12
- data/lib/{ms → mspire}/ident/pepxml/spectrum_query.rb +7 -7
- data/lib/{ms → mspire}/ident/protein.rb +2 -2
- data/lib/{ms → mspire}/ident/protein_group.rb +2 -2
- data/lib/{ms → mspire}/ident/search.rb +1 -1
- data/lib/{ms → mspire}/isotope.rb +3 -3
- data/lib/{ms → mspire}/isotope/aa.rb +1 -1
- data/lib/{ms → mspire}/isotope/distribution.rb +17 -17
- data/lib/{ms → mspire}/isotope/nist_isotope_info.yml +0 -0
- data/lib/{ms → mspire}/mascot.rb +1 -1
- data/lib/{ms → mspire}/mass.rb +7 -7
- data/lib/{ms → mspire}/mass/aa.rb +6 -6
- data/lib/{ms → mspire}/molecular_formula.rb +7 -7
- data/lib/{ms → mspire}/mzml.rb +55 -55
- data/lib/{ms → mspire}/mzml/activation.rb +3 -3
- data/lib/{ms → mspire}/mzml/chromatogram.rb +3 -3
- data/lib/{ms → mspire}/mzml/chromatogram_list.rb +1 -1
- data/lib/{ms → mspire}/mzml/component.rb +5 -5
- data/lib/{ms → mspire}/mzml/contact.rb +3 -3
- data/lib/{ms → mspire}/mzml/cv.rb +1 -1
- data/lib/{ms → mspire}/mzml/data_array.rb +12 -12
- data/lib/{ms → mspire}/mzml/data_array_container_like.rb +7 -7
- data/lib/{ms → mspire}/mzml/data_processing.rb +3 -3
- data/lib/{ms → mspire}/mzml/file_content.rb +3 -3
- data/lib/{ms → mspire}/mzml/file_description.rb +4 -4
- data/lib/{ms → mspire}/mzml/index_list.rb +2 -2
- data/lib/{ms → mspire}/mzml/instrument_configuration.rb +7 -7
- data/lib/{ms → mspire}/mzml/isolation_window.rb +3 -3
- data/lib/{ms → mspire}/mzml/list.rb +1 -1
- data/lib/{ms → mspire}/mzml/plms1.rb +3 -3
- data/lib/{ms → mspire}/mzml/precursor.rb +6 -6
- data/lib/{ms → mspire}/mzml/processing_method.rb +3 -3
- data/lib/{ms → mspire}/mzml/product.rb +3 -3
- data/lib/{ms → mspire}/mzml/referenceable_param_group.rb +4 -4
- data/lib/{ms → mspire}/mzml/run.rb +3 -3
- data/lib/{ms → mspire}/mzml/sample.rb +5 -5
- data/lib/{ms → mspire}/mzml/scan.rb +4 -4
- data/lib/{ms → mspire}/mzml/scan_list.rb +3 -3
- data/lib/{ms → mspire}/mzml/scan_settings.rb +5 -5
- data/lib/{ms → mspire}/mzml/selected_ion.rb +5 -5
- data/lib/{ms → mspire}/mzml/software.rb +5 -5
- data/lib/{ms → mspire}/mzml/source_file.rb +5 -5
- data/lib/{ms → mspire}/mzml/spectrum.rb +33 -20
- data/lib/{ms → mspire}/mzml/spectrum_list.rb +4 -4
- data/lib/{ms → mspire}/obo.rb +1 -1
- data/lib/{ms → mspire}/peak.rb +3 -3
- data/lib/{ms → mspire}/peak/point.rb +1 -1
- data/lib/{ms → mspire}/plms1.rb +4 -4
- data/lib/{ms → mspire}/quant/qspec.rb +4 -4
- data/lib/{ms → mspire}/quant/qspec/protein_group_comparison.rb +4 -4
- data/lib/{ms → mspire}/spectrum.rb +6 -6
- data/lib/{ms → mspire}/spectrum/centroid.rb +1 -1
- data/lib/{ms → mspire}/spectrum_like.rb +5 -5
- data/lib/{ms → mspire}/user_param.rb +2 -2
- data/script/mzml_read_binary.rb +1 -1
- data/spec/{ms → mspire}/cv/param_spec.rb +6 -6
- data/spec/{ms → mspire}/digester_spec.rb +10 -10
- data/spec/{ms → mspire}/error_rate/qvalue_spec.rb +3 -3
- data/spec/{ms → mspire}/fasta_spec.rb +10 -10
- data/spec/{ms → mspire}/ident/peptide/db_spec.rb +9 -9
- data/spec/{ms → mspire}/ident/pepxml/sample_enzyme_spec.rb +10 -10
- data/spec/{ms → mspire}/ident/pepxml/search_hit/modification_info_spec.rb +4 -4
- data/spec/{ms → mspire}/ident/pepxml_spec.rb +22 -22
- data/spec/{ms → mspire}/ident/protein_group_spec.rb +4 -4
- data/spec/{ms → mspire}/isotope/aa_spec.rb +3 -3
- data/spec/{ms → mspire}/isotope/distribution_spec.rb +4 -4
- data/spec/{ms → mspire}/isotope_spec.rb +9 -9
- data/spec/{ms → mspire}/mass_spec.rb +8 -8
- data/spec/{ms → mspire}/molecular_formula_spec.rb +4 -4
- data/spec/{ms → mspire}/mzml/cv_spec.rb +4 -4
- data/spec/{ms → mspire}/mzml/data_array_spec.rb +7 -7
- data/spec/{ms → mspire}/mzml/file_content_spec.rb +4 -4
- data/spec/{ms → mspire}/mzml/file_description_spec.rb +4 -4
- data/spec/{ms → mspire}/mzml/index_list_spec.rb +13 -13
- data/spec/{ms → mspire}/mzml/plms1_spec.rb +8 -8
- data/spec/{ms → mspire}/mzml/referenceable_param_group_spec.rb +6 -6
- data/spec/{ms → mspire}/mzml_spec.rb +30 -30
- data/spec/{ms → mspire}/peak_spec.rb +10 -10
- data/spec/{ms → mspire}/plms1_spec.rb +7 -7
- data/spec/{ms → mspire}/quant/qspec_spec.rb +2 -2
- data/spec/{ms → mspire}/spectrum_spec.rb +8 -8
- data/spec/{ms → mspire}/user_param_spec.rb +8 -8
- data/spec/testfiles/{ms → mspire}/ident/peptide/db/uni_11_sp_tr.fasta +0 -0
- data/spec/testfiles/{ms → mspire}/ident/peptide/db/uni_11_sp_tr.msd_clvg2.min_aaseq4.yml +0 -0
- data/spec/testfiles/{ms → mspire}/mzml/j24z.idx_comp.3.mzML +0 -0
- data/spec/testfiles/{ms → mspire}/mzml/mspire_simulated.MSn.check.mzML +0 -0
- data/spec/testfiles/{ms → mspire}/mzml/openms.noidx_nocomp.12.mzML +0 -0
- data/spec/testfiles/{ms → mspire}/quant/kill_extra_tabs.rb +0 -0
- data/spec/testfiles/{ms → mspire}/quant/max_quant_output.provenance.txt +0 -0
- data/spec/testfiles/{ms → mspire}/quant/max_quant_output.txt +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_final.killedextratabs.tsv +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_final.killedextratabs.tsv_qspecgp +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_final.killedextratabs.tsv_qspecgp.csv +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_final.txt +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_final.txt_qspecgp +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_qspec.CSV.csv +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_qspec.csv +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_qspec.oneprot.csv +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_qspec.oneprot.tsv +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_qspec.oneprot.tsv_qspecgp +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_qspec.oneprot.tsv_qspecgp.csv +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_qspec.txt +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_tabdel.txt +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_tabdel.txt_qspecgp +0 -0
- data/spec/testfiles/{ms → mspire}/quant/remove_rest_of_proteins.rb +0 -0
- data/spec/testfiles/{ms → mspire}/quant/unlog_transform.rb +0 -0
- metadata +148 -194
- data/lib/ms.rb +0 -3
@@ -1,6 +1,6 @@
|
|
1
|
-
require '
|
1
|
+
require 'mspire/mzml/spectrum'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Mspire
|
4
4
|
class Mzml
|
5
5
|
class SpectrumList < Array
|
6
6
|
|
@@ -13,10 +13,10 @@ module MS
|
|
13
13
|
end
|
14
14
|
|
15
15
|
# This method takes an object responding to :data, creates a new
|
16
|
-
#
|
16
|
+
# Mspire::Mzml::Spectrum object with that data and puts it in the internal
|
17
17
|
# list
|
18
18
|
def add_ms_spectrum!(spectrum, id)
|
19
|
-
mzml_spec =
|
19
|
+
mzml_spec = Mspire::Mzml::Spectrum.new(id)
|
20
20
|
mzml_spec.data = spectrum.data
|
21
21
|
self << mzml_spec
|
22
22
|
end
|
data/lib/{ms → mspire}/obo.rb
RENAMED
data/lib/{ms → mspire}/peak.rb
RENAMED
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
|
-
module
|
3
|
-
# an
|
2
|
+
module Mspire ; end
|
3
|
+
# an Mspire::Peak instance is an array of contiguous points (where each point is
|
4
4
|
# a doublet: an x coordinate and a y coordinate)
|
5
|
-
class
|
5
|
+
class Mspire::Peak < Array
|
6
6
|
|
7
7
|
# returns an Array of peaks. Splits peak with 1 or more local minima into
|
8
8
|
# multiple peaks. When a point is 'shared' between two adjacent peak-ish
|
data/lib/{ms → mspire}/plms1.rb
RENAMED
@@ -1,10 +1,10 @@
|
|
1
1
|
|
2
2
|
require 'write_file_or_string'
|
3
|
-
require '
|
3
|
+
require 'mspire/spectrum'
|
4
4
|
require 'stringio'
|
5
5
|
require 'openany'
|
6
6
|
|
7
|
-
module
|
7
|
+
module Mspire
|
8
8
|
|
9
9
|
=begin
|
10
10
|
# if given scans, will use those, or optionally takes a block where an
|
@@ -42,7 +42,7 @@ module MS
|
|
42
42
|
# Prince Lab MS 1: a simple format for reading and writing
|
43
43
|
# MS1 level mass spec data
|
44
44
|
#
|
45
|
-
# see
|
45
|
+
# see Mspire::Plms1::SPECIFICATION for the file specification
|
46
46
|
class Plms1
|
47
47
|
SPECIFICATION =<<-HERE
|
48
48
|
# The file format contains no newlines but is shown here broken into lines for
|
@@ -92,7 +92,7 @@ module MS
|
|
92
92
|
data = read_uint32(io)[0].times.map do
|
93
93
|
read_float64(io, read_uint32(io)[0])
|
94
94
|
end
|
95
|
-
|
95
|
+
Mspire::Spectrum.new(data)
|
96
96
|
end
|
97
97
|
end
|
98
98
|
self
|
@@ -1,7 +1,7 @@
|
|
1
|
-
module
|
2
|
-
module
|
1
|
+
module Mspire ; end
|
2
|
+
module Mspire::Quant ; end
|
3
3
|
|
4
|
-
class
|
4
|
+
class Mspire::Quant::Qspec
|
5
5
|
|
6
6
|
# personal communication with Hyungwon Choi: "We typically use nburn=2000,
|
7
7
|
# niter=10000, which is quite sufficient to guarantee the reproducibility of
|
@@ -62,7 +62,7 @@ class MS::Quant::Qspec
|
|
62
62
|
|
63
63
|
# writes a qspec formatted file to filename
|
64
64
|
def write(filename)
|
65
|
-
ints =
|
65
|
+
ints = Mspire::Quant::Qspec.conditions_to_ints(conditions)
|
66
66
|
header_cats = INIT_HEADER + ints
|
67
67
|
rows = @protname_length_pairs.map {|pair| pair.map.to_a }
|
68
68
|
@condition_to_count_array.each do |cond,counts|
|
@@ -1,14 +1,14 @@
|
|
1
|
-
require '
|
1
|
+
require 'mspire/quant/protein_group_comparison'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Mspire
|
4
4
|
module Quant
|
5
5
|
module ProteinGroupComparison
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
-
class
|
11
|
-
include
|
10
|
+
class Mspire::Quant::ProteinGroupComparison::Qspec
|
11
|
+
include Mspire::Quant::ProteinGroupComparison
|
12
12
|
|
13
13
|
attr_accessor :qspec_results_struct
|
14
14
|
|
@@ -1,13 +1,13 @@
|
|
1
|
-
require '
|
1
|
+
require 'mspire/spectrum_like'
|
2
2
|
require 'bsearch'
|
3
3
|
require 'bin'
|
4
|
-
require '
|
4
|
+
require 'mspire/peak'
|
5
5
|
|
6
|
-
module
|
6
|
+
module Mspire
|
7
7
|
# note that a point is an [m/z, intensity] doublet.
|
8
8
|
# A peak is considered a related string of points
|
9
9
|
class Spectrum
|
10
|
-
include
|
10
|
+
include Mspire::SpectrumLike
|
11
11
|
|
12
12
|
DEFAULT_MERGE = {
|
13
13
|
:bin_width => 5,
|
@@ -45,7 +45,7 @@ module MS
|
|
45
45
|
# number of spectra
|
46
46
|
# :return_data => false returns a parallel array containing
|
47
47
|
# the peaks associated with each returned point
|
48
|
-
# :split => false | :share | :greedy_y see
|
48
|
+
# :split => false | :share | :greedy_y see Mspire::Peak#split
|
49
49
|
#
|
50
50
|
# The binning algorithm is the fastest possible algorithm that would allow
|
51
51
|
# for arbitrary, non-constant bin widths (a ratcheting algorithm O(n + m))
|
@@ -109,7 +109,7 @@ module MS
|
|
109
109
|
#abort 'here'
|
110
110
|
|
111
111
|
|
112
|
-
peaks =
|
112
|
+
peaks = Mspire::Peak.new(pseudo_points).split(opt[:split])
|
113
113
|
|
114
114
|
return_data = []
|
115
115
|
_mzs = [] ; _ints = []
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Mspire
|
2
2
|
module SpectrumLike
|
3
3
|
include Enumerable
|
4
4
|
|
@@ -17,7 +17,7 @@ module MS
|
|
17
17
|
|
18
18
|
def centroided?() centroided end
|
19
19
|
|
20
|
-
# @return [
|
20
|
+
# @return [Mspire::Spectrum]
|
21
21
|
# @param [Array] data two element array of mzs and intensities
|
22
22
|
# @param [Boolean] centroided is the spectrum centroided or not
|
23
23
|
def initialize(data_arrays, centroided=true)
|
@@ -80,7 +80,7 @@ module MS
|
|
80
80
|
# of another given value
|
81
81
|
def normalize(norm_by=:tic)
|
82
82
|
norm_by = tic if norm_by == :tic
|
83
|
-
|
83
|
+
Mspire::Spectrum.new([self.mzs, self.intensities.map {|v| v / norm_by }])
|
84
84
|
end
|
85
85
|
|
86
86
|
def tic
|
@@ -134,9 +134,9 @@ module MS
|
|
134
134
|
find_all_nearest_index(val).map {|i| mzs[i] }
|
135
135
|
end
|
136
136
|
|
137
|
-
# uses
|
137
|
+
# uses Mspire::Spectrum.merge
|
138
138
|
def merge(other_spectra, opts={})
|
139
|
-
|
139
|
+
Mspire::Spectrum.merge([self, *other_spectra], opts)
|
140
140
|
end
|
141
141
|
end
|
142
142
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
module
|
2
|
+
module Mspire
|
3
3
|
|
4
4
|
class UserParam
|
5
5
|
|
@@ -24,7 +24,7 @@ module MS
|
|
24
24
|
@unit =
|
25
25
|
if args.size > 1 && ((args.last.is_a?(::CV::Param) || args.last =~ /^[A-Za-z]+:\d+$/))
|
26
26
|
unit_arg = args.pop
|
27
|
-
unit_arg.is_a?(::CV::Param) ? unit_arg :
|
27
|
+
unit_arg.is_a?(::CV::Param) ? unit_arg : Mspire::CV::Param[unit_arg]
|
28
28
|
end
|
29
29
|
@name, @value, @type = args
|
30
30
|
end
|
data/script/mzml_read_binary.rb
CHANGED
@@ -1,28 +1,28 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'mspire/cv/param'
|
4
4
|
require 'cv/param'
|
5
5
|
|
6
|
-
describe
|
6
|
+
describe Mspire::CV::Param do
|
7
7
|
describe 'object creation from class methods' do
|
8
8
|
|
9
9
|
it '::new allows full description' do
|
10
|
-
param1 =
|
10
|
+
param1 = Mspire::CV::Param.new('MS', 'MS:1000052', 'suspension')
|
11
11
|
param1.value.should be_nil
|
12
12
|
# just nonsense: 32 ng suspensions
|
13
|
-
param2 =
|
13
|
+
param2 = Mspire::CV::Param.new('MS', 'MS:1000052', 'suspension', 32, ::CV::Param.new('UO', 'UO:0000024', 'nanogram'))
|
14
14
|
param2.cv_ref.should == 'MS'
|
15
15
|
param2.value.should == 32
|
16
16
|
param2.unit.accession.should == 'UO:0000024'
|
17
17
|
end
|
18
18
|
|
19
19
|
it '::[] requires shortcut accession strings' do
|
20
|
-
param1 =
|
20
|
+
param1 = Mspire::CV::Param['MS:1000052']
|
21
21
|
param1.cv_ref.should == 'MS'
|
22
22
|
param1.value.should be_nil
|
23
23
|
|
24
24
|
# just nonsense: 32 ng suspensions
|
25
|
-
param2 =
|
25
|
+
param2 = Mspire::CV::Param['MS:1000052', 32, 'UO:0000024']
|
26
26
|
param2.cv_ref.should == 'MS'
|
27
27
|
param2.name.should == 'suspension'
|
28
28
|
param2.value.should == 32
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'spec_helper.rb'
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'mspire/digester'
|
4
4
|
require 'pp'
|
5
5
|
|
6
6
|
describe 'a digester' do
|
7
7
|
before do
|
8
|
-
@digester =
|
8
|
+
@digester = Mspire::Digester.new('arg', 'R')
|
9
9
|
end
|
10
10
|
|
11
11
|
def spp(input, str="")
|
@@ -50,7 +50,7 @@ describe 'a digester' do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
it 'finds cleavage sites with exception' do
|
53
|
-
@digester =
|
53
|
+
@digester = Mspire::Digester.new('argp', 'R', 'P')
|
54
54
|
{
|
55
55
|
"" => [0,0],
|
56
56
|
"A" => [0,1],
|
@@ -232,7 +232,7 @@ end
|
|
232
232
|
|
233
233
|
describe 'performs as documented in readme' do
|
234
234
|
it 'runs cleavage sites documentation' do
|
235
|
-
d =
|
235
|
+
d = Mspire::Digester.new('Trypsin', 'KR', 'P')
|
236
236
|
seq = "AARGGR"
|
237
237
|
sites = d.cleavage_sites(seq)
|
238
238
|
sites.should == [0, 3, 6]
|
@@ -251,7 +251,7 @@ end
|
|
251
251
|
|
252
252
|
describe 'basic trypsin digestion' do
|
253
253
|
it 'performs digestion and can specify sites of digestion' do
|
254
|
-
trypsin =
|
254
|
+
trypsin = Mspire::Digester['Trypsin']
|
255
255
|
|
256
256
|
expected = [
|
257
257
|
'MIVIGR',
|
@@ -281,11 +281,11 @@ describe 'basic trypsin digestion' do
|
|
281
281
|
"\tMIVIGR",
|
282
282
|
"SIVHP\nYITNEYEPFAAE K",
|
283
283
|
"QQILSI\rMAG"]
|
284
|
-
|
284
|
+
Mspire::Digester['Trypsin'].digest("\tMIVIGRSIVHP\nYITNEYEPFAAE KQQILSI\rMAG").should == expected
|
285
285
|
end
|
286
286
|
|
287
287
|
it 'does a trypsin digest' do
|
288
|
-
trypsin =
|
288
|
+
trypsin = Mspire::Digester[:trypsin]
|
289
289
|
{
|
290
290
|
"" => [''],
|
291
291
|
"A" => ["A"],
|
@@ -315,7 +315,7 @@ end
|
|
315
315
|
describe 'digestion with other enzymes' do
|
316
316
|
|
317
317
|
# This is how to access the already created enzyme:
|
318
|
-
#
|
318
|
+
# Mspire::Digester['Arg-C'] (or :arg_c, 'ARG-C', :ARG_C')
|
319
319
|
{
|
320
320
|
['Arg-C', :arg_c] => {
|
321
321
|
"AARC" => ["AAR", "C"],
|
@@ -337,8 +337,8 @@ describe 'digestion with other enzymes' do
|
|
337
337
|
}
|
338
338
|
}.each do |enzyme_names, test_hash|
|
339
339
|
it "digests with '#{enzyme_names.first}'" do
|
340
|
-
digester =
|
341
|
-
digester.should ==
|
340
|
+
digester = Mspire::Digester[enzyme_names.first]
|
341
|
+
digester.should == Mspire::Digester[enzyme_names.last]
|
342
342
|
digester.name.should == enzyme_names.first
|
343
343
|
test_hash.each do |sequence, expected|
|
344
344
|
digester.digest(sequence).should == expected
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'mspire/error_rate/qvalue'
|
4
4
|
|
5
5
|
Hit = Struct.new(:score, :charge)
|
6
6
|
HitWeird = Struct.new(:some_obscure_score, :charge)
|
@@ -20,14 +20,14 @@ describe 'calculating q-values' do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'can calculate qvalues on target/decoy sets (:score is default)' do
|
23
|
-
pairs =
|
23
|
+
pairs = Mspire::ErrorRate::Qvalue.target_decoy_qvalues(@target_hits, @decoy_hits)
|
24
24
|
pairs.each do |hit, qval|
|
25
25
|
@qval_by_hit[hit].should be_within(0.00000001).of(qval)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'can calculate qvalues on target/decoy sets with custom sorting' do
|
30
|
-
pairs =
|
30
|
+
pairs = Mspire::ErrorRate::Qvalue.target_decoy_qvalues(@target_hits_weird, @decoy_hits_weird) {|hit| hit.some_obscure_score }
|
31
31
|
pairs.each do |hit, qval|
|
32
32
|
@qval_by_hit[hit].should be_within(0.00000001).of(qval)
|
33
33
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'mspire/fasta'
|
4
4
|
|
5
5
|
describe 'basic fasta operations' do
|
6
6
|
before do
|
@@ -47,7 +47,7 @@ describe 'basic fasta operations' do
|
|
47
47
|
|
48
48
|
it 'can read a file' do
|
49
49
|
%w(newlines_file carriage_returns_and_newlines_file).each do |file|
|
50
|
-
|
50
|
+
Mspire::Fasta.open(@data[file]) do |fasta|
|
51
51
|
fasta_correct? fasta
|
52
52
|
end
|
53
53
|
end
|
@@ -56,7 +56,7 @@ describe 'basic fasta operations' do
|
|
56
56
|
it 'can read an IO object' do
|
57
57
|
%w(newlines_file carriage_returns_and_newlines_file).each do |file|
|
58
58
|
File.open(@data[file]) do |io|
|
59
|
-
fasta =
|
59
|
+
fasta = Mspire::Fasta.new(io)
|
60
60
|
fasta_correct? fasta
|
61
61
|
end
|
62
62
|
end
|
@@ -64,28 +64,28 @@ describe 'basic fasta operations' do
|
|
64
64
|
|
65
65
|
it 'can read a string' do
|
66
66
|
%w(newlines carriage_returns_and_newlines).each do |key|
|
67
|
-
fasta =
|
67
|
+
fasta = Mspire::Fasta.new @data[key]
|
68
68
|
fasta_correct? fasta
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
72
|
it 'iterates entries with foreach' do
|
73
73
|
%w(newlines_file carriage_returns_and_newlines_file).each do |file|
|
74
|
-
|
74
|
+
Mspire::Fasta.foreach(@data[file]) do |entry|
|
75
75
|
entry.should be_an_instance_of Bio::FastaFormat
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
-
it 'gives an iterator called with
|
81
|
-
seqs =
|
80
|
+
it 'gives an iterator called with Mspire::Fasta.foreach and no block' do
|
81
|
+
seqs = Mspire::Fasta.foreach(@data['newlines_file']).select {|e| e.header =~ /^gi/ }.map(&:sequence)
|
82
82
|
seqs.size.should == 1
|
83
83
|
seqs.first[0,4].should == 'LCLY'
|
84
84
|
end
|
85
85
|
|
86
86
|
it 'runs the documentation' do
|
87
87
|
fasta_file = @data['newlines_file']
|
88
|
-
ids =
|
88
|
+
ids = Mspire::Fasta.open(fasta_file) do |fasta|
|
89
89
|
fasta.map(&:entry_id)
|
90
90
|
end
|
91
91
|
ids.is_a?(Array)
|
@@ -93,12 +93,12 @@ describe 'basic fasta operations' do
|
|
93
93
|
|
94
94
|
# this code is already tested above
|
95
95
|
# File.open(fasta_file) do |io|
|
96
|
-
# fasta =
|
96
|
+
# fasta = Mspire::Fasta.new(io)
|
97
97
|
# end
|
98
98
|
|
99
99
|
# taking a string
|
100
100
|
string = ">id1 a simple header\nAAASDDEEEDDD\n>id2 header again\nPPPPPPWWWWWWTTTTYY\n"
|
101
|
-
fasta =
|
101
|
+
fasta = Mspire::Fasta.new(string)
|
102
102
|
(simple, not_simple) = fasta.partition {|entry| entry.header =~ /simple/ }
|
103
103
|
simple.first.header.include?("simple").should == true
|
104
104
|
not_simple.first.header.include?("simple").should == false
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
require 'yaml'
|
4
|
-
path = '
|
4
|
+
path = 'mspire/ident/peptide/db'
|
5
5
|
require path
|
6
6
|
|
7
7
|
module Kernel
|
@@ -28,18 +28,18 @@ describe 'a uniprot fasta file' do
|
|
28
28
|
describe 'amino acid expansion' do
|
29
29
|
|
30
30
|
it 'can expand out wildcard amino acid combinations' do
|
31
|
-
array =
|
31
|
+
array = Mspire::Ident::Peptide::Db.expand_peptides('ALXX', 'X' => %w(* % &), 'L' => %w(P Q) )
|
32
32
|
array.sort.should == %w(AP** AP*% AP*& AP%* AP%% AP%& AP&* AP&% AP&& AQ** AQ*% AQ*& AQ%* AQ%% AQ%& AQ&* AQ&% AQ&&).sort
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'will not expand explosive combinations (>MAX_NUM_AA_EXPANSION)' do
|
36
36
|
# this is from real data
|
37
37
|
worst_case = 'LTLLRPEKHEAATGVDTICTHRVDPIGPGLXXEXLYWELSXLTXXIXELGPYTLDR'
|
38
|
-
|
38
|
+
Mspire::Ident::Peptide::Db.expand_peptides(worst_case, 'X' => %w(* % &)).nil?.should == true
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'returns the peptide in the array if no expansion' do
|
42
|
-
array =
|
42
|
+
array = Mspire::Ident::Peptide::Db.expand_peptides('ZZZZZ', 'X' => %w(* % &), 'L' => %w(P Q) )
|
43
43
|
array.should == ['ZZZZZ']
|
44
44
|
end
|
45
45
|
|
@@ -53,7 +53,7 @@ describe 'a uniprot fasta file' do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'converts a fasta file into peptide centric db' do
|
56
|
-
output_files =
|
56
|
+
output_files = Mspire::Ident::Peptide::Db.cmdline([@fasta_file])
|
57
57
|
output_files.first.should == File.expand_path(@output_file)
|
58
58
|
File.exist?(@output_file).should == true
|
59
59
|
hash = {}
|
@@ -71,7 +71,7 @@ describe 'a uniprot fasta file' do
|
|
71
71
|
it 'lists approved enzymes and exits' do
|
72
72
|
output = capture_stdout do
|
73
73
|
begin
|
74
|
-
|
74
|
+
Mspire::Ident::Peptide::Db.cmdline(['--list-enzymes'])
|
75
75
|
rescue SystemExit
|
76
76
|
1.should == 1 # we exited
|
77
77
|
end
|
@@ -84,18 +84,18 @@ describe 'a uniprot fasta file' do
|
|
84
84
|
|
85
85
|
describe 'reading a peptide centric database' do
|
86
86
|
before do
|
87
|
-
outfiles =
|
87
|
+
outfiles = Mspire::Ident::Peptide::Db.cmdline([@fasta_file])
|
88
88
|
@outfile = outfiles.first
|
89
89
|
end
|
90
90
|
|
91
91
|
it 'creates a hash that can retrieve peptides as an array' do
|
92
|
-
hash =
|
92
|
+
hash = Mspire::Ident::Peptide::Db.new(@outfile)
|
93
93
|
hash["AVTEQGHELSNEER"].should == %w(sp|P31946|1433B_HUMAN sp|P31946-2|1433B_HUMAN)
|
94
94
|
hash["VRAAR"].should == ["tr|D3DX18|D3DX18_HUMAN"]
|
95
95
|
end
|
96
96
|
|
97
97
|
it 'reads the file on disk with random access or is enumerable' do
|
98
|
-
|
98
|
+
Mspire::Ident::Peptide::Db::IO.open(@outfile) do |io|
|
99
99
|
io["AVTEQGHELSNEER"].should == %w(sp|P31946|1433B_HUMAN sp|P31946-2|1433B_HUMAN)
|
100
100
|
io["VRAAR"].should == ["tr|D3DX18|D3DX18_HUMAN"]
|
101
101
|
io.each_with_index do |key_prots, i|
|