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,12 +1,12 @@
|
|
1
1
|
require 'merge'
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'mspire/ident/pepxml/msms_run_summary'
|
4
4
|
|
5
|
-
module
|
6
|
-
module
|
7
|
-
class
|
5
|
+
module Mspire ; end
|
6
|
+
module Mspire::Ident ; end
|
7
|
+
class Mspire::Ident::Pepxml; end
|
8
8
|
|
9
|
-
class
|
9
|
+
class Mspire::Ident::Pepxml::MsmsPipelineAnalysis
|
10
10
|
include Merge
|
11
11
|
XMLNS = "http://regis-web.systemsbiology.net/pepXML"
|
12
12
|
XMLNS_XSI = "http://www.w3.org/2001/XMLSchema-instance"
|
@@ -32,7 +32,7 @@ class MS::Ident::Pepxml::MsmsPipelineAnalysis
|
|
32
32
|
attr_writer :date
|
33
33
|
|
34
34
|
def block_arg
|
35
|
-
@msms_run_summary =
|
35
|
+
@msms_run_summary = Mspire::Ident::Pepxml::MsmsRunSummary.new
|
36
36
|
end
|
37
37
|
|
38
38
|
# if block given, yields a new msms_run_summary to return value of block
|
@@ -1,15 +1,15 @@
|
|
1
1
|
require 'merge'
|
2
2
|
require 'nokogiri'
|
3
3
|
|
4
|
-
require '
|
5
|
-
require '
|
6
|
-
require '
|
4
|
+
require 'mspire/ident/pepxml/sample_enzyme'
|
5
|
+
require 'mspire/ident/pepxml/search_summary'
|
6
|
+
require 'mspire/ident/pepxml/spectrum_query'
|
7
7
|
|
8
|
-
module
|
9
|
-
module
|
10
|
-
class
|
8
|
+
module Mspire ; end
|
9
|
+
module Mspire::Ident ; end
|
10
|
+
class Mspire::Ident::Pepxml; end
|
11
11
|
|
12
|
-
class
|
12
|
+
class Mspire::Ident::Pepxml::MsmsRunSummary
|
13
13
|
include Merge
|
14
14
|
# The name of the pep xml file without any extension
|
15
15
|
attr_accessor :base_name
|
@@ -31,8 +31,8 @@ class MS::Ident::Pepxml::MsmsRunSummary
|
|
31
31
|
attr_accessor :spectrum_queries
|
32
32
|
|
33
33
|
def block_arg
|
34
|
-
[@sample_enzyme =
|
35
|
-
@search_summary =
|
34
|
+
[@sample_enzyme = Mspire::Ident::Pepxml::SampleEnzyme.new,
|
35
|
+
@search_summary = Mspire::Ident::Pepxml::SearchSummary.new,
|
36
36
|
@spectrum_queries ]
|
37
37
|
end
|
38
38
|
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'merge'
|
2
2
|
require 'strscan'
|
3
3
|
|
4
|
-
module
|
5
|
-
module
|
6
|
-
class
|
4
|
+
module Mspire ; end
|
5
|
+
module Mspire::Ident ; end
|
6
|
+
class Mspire::Ident::Pepxml ; end
|
7
7
|
|
8
|
-
class
|
8
|
+
class Mspire::Ident::Pepxml::SampleEnzyme
|
9
9
|
include Merge
|
10
10
|
# an identifier
|
11
11
|
attr_accessor :name
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require '
|
1
|
+
require 'mspire/fasta'
|
2
2
|
require 'merge'
|
3
|
-
module
|
4
|
-
module
|
3
|
+
module Mspire ; end
|
4
|
+
module Mspire::Ident ; end
|
5
5
|
|
6
|
-
class
|
6
|
+
class Mspire::Ident::Pepxml
|
7
7
|
class SearchDatabase
|
8
8
|
include Merge
|
9
9
|
# required! the local, full path to the protein sequence database
|
@@ -33,7 +33,7 @@ class MS::Ident::Pepxml
|
|
33
33
|
# returns self for chaining
|
34
34
|
def set_size_of_residues!
|
35
35
|
@size_of_residues = 0
|
36
|
-
|
36
|
+
Mspire::Fasta.foreach(@local_path) do |entry|
|
37
37
|
@size_of_residues += entry.sequence.size
|
38
38
|
end
|
39
39
|
self
|
@@ -2,13 +2,13 @@ require 'set'
|
|
2
2
|
require 'merge'
|
3
3
|
require 'nokogiri'
|
4
4
|
|
5
|
-
module
|
6
|
-
module
|
5
|
+
module Mspire ; end
|
6
|
+
module Mspire::Ident ; end
|
7
7
|
|
8
8
|
|
9
|
-
class
|
9
|
+
class Mspire::Ident::Pepxml
|
10
10
|
|
11
|
-
class
|
11
|
+
class Mspire::Ident::Pepxml::SearchHit
|
12
12
|
include Merge
|
13
13
|
|
14
14
|
DEFAULT_MEMBERS = [:hit_rank, :peptide, :peptide_prev_aa, :peptide_next_aa, :num_matched_ions, :tot_num_ions, :calc_neutral_pep_mass, :massdiff, :num_tol_term, :num_missed_cleavages, :is_rejected, :protein, :num_tot_proteins, :protein_desc, :calc_pI, :protein_mw, :modification_info, :search_scores, :spectrum_query]
|
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'andand'
|
2
2
|
require 'nokogiri'
|
3
3
|
|
4
|
-
module
|
5
|
-
module
|
6
|
-
class
|
7
|
-
class
|
4
|
+
module Mspire ; end
|
5
|
+
module Mspire::Ident ; end
|
6
|
+
class Mspire::Ident::Pepxml ; end
|
7
|
+
class Mspire::Ident::Pepxml::SearchHit ; end
|
8
8
|
|
9
9
|
|
10
10
|
# Positions and masses of modifications
|
11
|
-
|
11
|
+
Mspire::Ident::Pepxml::SearchHit::ModificationInfo = Struct.new(:modified_peptide, :mod_aminoacid_masses, :mod_nterm_mass, :mod_cterm_mass) do
|
12
12
|
## Should be something like this:
|
13
13
|
# <modification_info mod_nterm_mass=" " mod_nterm_mass=" " modified_peptide=" ">
|
14
14
|
# <mod_aminoacid_mass position=" " mass=" "/>
|
@@ -64,14 +64,14 @@ MS::Ident::Pepxml::SearchHit::ModificationInfo = Struct.new(:modified_peptide, :
|
|
64
64
|
self[3] = node['mod_cterm_mass']
|
65
65
|
_masses = []
|
66
66
|
node.children do |mass_n|
|
67
|
-
_masses <<
|
67
|
+
_masses << Mspire::Ident::Pepxml::SearchHit::ModificationInfo::ModAminoacidMass.new([mass_n['position'].to_i, mass_n['mass'].to_f])
|
68
68
|
end
|
69
69
|
self.mod_aminoacid_masses = _masses
|
70
70
|
self
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
-
|
74
|
+
Mspire::Ident::Pepxml::SearchHit::ModificationInfo::ModAminoacidMass = Struct.new(:position, :mass) do
|
75
75
|
def to_xml(builder)
|
76
76
|
builder.mod_aminoacid_mass(:position => position, :mass => mass)
|
77
77
|
builder
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'nokogiri'
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'mspire/ident/pepxml/search_hit'
|
4
4
|
|
5
|
-
module
|
6
|
-
module
|
7
|
-
class
|
5
|
+
module Mspire ; end
|
6
|
+
module Mspire::Ident ; end
|
7
|
+
class Mspire::Ident::Pepxml ; end
|
8
8
|
|
9
|
-
class
|
9
|
+
class Mspire::Ident::Pepxml::SearchResult
|
10
10
|
# an array of search_hits
|
11
11
|
attr_accessor :search_hits
|
12
12
|
|
@@ -1,13 +1,13 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
require '
|
1
|
+
require 'mspire/ident/pepxml/search_database'
|
2
|
+
require 'mspire/ident/pepxml/modifications'
|
3
|
+
require 'mspire/ident/pepxml/parameters'
|
4
4
|
|
5
5
|
require 'nokogiri'
|
6
6
|
require 'merge'
|
7
7
|
|
8
|
-
module
|
9
|
-
module
|
10
|
-
class
|
8
|
+
module Mspire ; end
|
9
|
+
module Mspire::Ident ; end
|
10
|
+
class Mspire::Ident::Pepxml ; end
|
11
11
|
|
12
12
|
|
13
13
|
# requires these keys:
|
@@ -15,10 +15,10 @@ class MS::Ident::Pepxml ; end
|
|
15
15
|
# :enzyme => a valid enzyme name
|
16
16
|
# :max_num_internal_cleavages => max number of internal cleavages allowed
|
17
17
|
# :min_number_termini => minimum number of termini??
|
18
|
-
class
|
18
|
+
class Mspire::Ident::Pepxml::EnzymaticSearchConstraint < Hash
|
19
19
|
end
|
20
20
|
|
21
|
-
class
|
21
|
+
class Mspire::Ident::Pepxml::SearchSummary
|
22
22
|
include Merge
|
23
23
|
|
24
24
|
DEFAULT_SEARCH_ID = '1'
|
@@ -30,7 +30,7 @@ class MS::Ident::Pepxml::SearchSummary
|
|
30
30
|
attr_accessor :out_data
|
31
31
|
# by default, "1"
|
32
32
|
attr_accessor :search_id
|
33
|
-
# an array of
|
33
|
+
# an array of Mspire::Ident::Pepxml::Modification objects
|
34
34
|
attr_accessor :modifications
|
35
35
|
# A SearchDatabase object (responds to :local_path and :type)
|
36
36
|
attr_accessor :search_database
|
@@ -47,10 +47,10 @@ class MS::Ident::Pepxml::SearchSummary
|
|
47
47
|
attr_accessor :enzymatic_search_constraint
|
48
48
|
|
49
49
|
def block_arg
|
50
|
-
[@search_database =
|
51
|
-
@enzymatic_search_constraint =
|
50
|
+
[@search_database = Mspire::Ident::Pepxml::SearchDatabase.new,
|
51
|
+
@enzymatic_search_constraint = Mspire::Ident::Pepxml::EnzymaticSearchConstraint.new,
|
52
52
|
@modifications,
|
53
|
-
@parameters =
|
53
|
+
@parameters = Mspire::Ident::Pepxml::Parameters.new,
|
54
54
|
]
|
55
55
|
end
|
56
56
|
|
@@ -1,15 +1,15 @@
|
|
1
1
|
require 'nokogiri'
|
2
|
-
require '
|
2
|
+
require 'mspire/mass'
|
3
3
|
require 'merge'
|
4
4
|
|
5
|
-
require '
|
5
|
+
require 'mspire/ident/pepxml/search_result'
|
6
6
|
|
7
|
-
module
|
8
|
-
module
|
9
|
-
class
|
7
|
+
module Mspire ; end
|
8
|
+
module Mspire::Ident ; end
|
9
|
+
class Mspire::Ident::Pepxml ; end
|
10
10
|
|
11
11
|
# search_specification is a search constraint applied specifically to this query (a String)
|
12
|
-
class
|
12
|
+
class Mspire::Ident::Pepxml::SpectrumQuery
|
13
13
|
include Merge
|
14
14
|
DEFAULT_MEMBERS = [:spectrum, :start_scan, :end_scan, :precursor_neutral_mass, :index, :assumed_charge, :retention_time_sec, :search_specification, :search_results, :pepxml_version]
|
15
15
|
|
@@ -77,7 +77,7 @@ class MS::Ident::Pepxml::SpectrumQuery
|
|
77
77
|
self
|
78
78
|
end
|
79
79
|
|
80
|
-
def self.calc_precursor_neutral_mass(m_plus_h, deltamass, h_plus=
|
80
|
+
def self.calc_precursor_neutral_mass(m_plus_h, deltamass, h_plus=Mspire::Mass::H_PLUS)
|
81
81
|
m_plus_h - h_plus + deltamass
|
82
82
|
end
|
83
83
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'set'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Mspire
|
4
4
|
module Ident
|
5
5
|
# represents a group of proteins, typically indistinguishable in the
|
6
6
|
# experiment.
|
@@ -47,7 +47,7 @@ module MS
|
|
47
47
|
peptides_to_protein_group[peptide_set] << protein
|
48
48
|
end
|
49
49
|
peptides_to_protein_group.each do |pephits,ar_of_prots|
|
50
|
-
pg =
|
50
|
+
pg = Mspire::Ident::ProteinGroup.new(ar_of_prots)
|
51
51
|
pg.peptide_hits = pephits
|
52
52
|
peptides_to_protein_group[pephits] = pg
|
53
53
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Mspire
|
4
4
|
class Isotope
|
5
5
|
MEMBERS = [:atomic_number, :element, :mass_number, :atomic_mass, :relative_abundance, :average_mass, :mono]
|
6
6
|
MEMBERS.each {|key| attr_accessor key }
|
@@ -30,7 +30,7 @@ module MS
|
|
30
30
|
|
31
31
|
if File.exist?(INFO_FILE_FULL_PATH)
|
32
32
|
|
33
|
-
ISOTOPES = YAML.load_file(INFO_FILE_FULL_PATH).map {|ar|
|
33
|
+
ISOTOPES = YAML.load_file(INFO_FILE_FULL_PATH).map {|ar| Mspire::Isotope.new *ar }
|
34
34
|
BY_ELEMENT = ISOTOPES.group_by(&:element)
|
35
35
|
|
36
36
|
else
|
@@ -89,5 +89,5 @@ module MS
|
|
89
89
|
end
|
90
90
|
|
91
91
|
if __FILE__ == $0
|
92
|
-
|
92
|
+
Mspire::Isotope::Updater.write_nist_info(Mspire::Isotope::INFO_FILE_FULL_PATH)
|
93
93
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
|
2
|
-
require '
|
3
|
-
require '
|
4
|
-
require '
|
5
|
-
require '
|
2
|
+
require 'mspire/mass'
|
3
|
+
require 'mspire/isotope'
|
4
|
+
require 'mspire/molecular_formula'
|
5
|
+
require 'mspire/spectrum'
|
6
6
|
|
7
7
|
require 'fftw3'
|
8
8
|
|
9
|
-
module
|
9
|
+
module Mspire
|
10
10
|
class Isotope
|
11
11
|
module Distribution
|
12
12
|
NORMALIZE = :total
|
@@ -15,7 +15,7 @@ module MS
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
module
|
18
|
+
module Mspire
|
19
19
|
class MolecularFormula < Hash
|
20
20
|
|
21
21
|
# takes any element composition (see any_to_num_elements).
|
@@ -30,7 +30,7 @@ module MS
|
|
30
30
|
# :max normalize to the highest peak intensity
|
31
31
|
# :low normalize to the intensity of the lowest m/z peak
|
32
32
|
# (this is typically the monoisotopic peak)
|
33
|
-
def isotope_distribution(normalize=
|
33
|
+
def isotope_distribution(normalize=Mspire::Isotope::Distribution::NORMALIZE, percent_cutoff=Mspire::Isotope::Distribution::PERCENT_CUTOFF)
|
34
34
|
mono_dist = raw_isotope_distribution
|
35
35
|
# percent_cutoff:
|
36
36
|
final_output = []
|
@@ -58,12 +58,12 @@ module MS
|
|
58
58
|
# Arguments are passed directly to isotope_distribution.
|
59
59
|
def isotope_distribution_spectrum(*args)
|
60
60
|
intensities = isotope_distribution(*args)
|
61
|
-
mono = self.map {|el,cnt|
|
61
|
+
mono = self.map {|el,cnt| Mspire::Mass::MONO[el]*cnt }.reduce(:+)
|
62
62
|
masses = Array.new(intensities.size)
|
63
|
-
neutron =
|
63
|
+
neutron = Mspire::Mass::NEUTRON
|
64
64
|
masses[0] = mono
|
65
65
|
(1...masses.size).each {|i| masses[i] = masses[i-1] + neutron }
|
66
|
-
|
66
|
+
Mspire::Spectrum.new [masses, intensities]
|
67
67
|
end
|
68
68
|
|
69
69
|
# returns relative ratios from low nominal mass to high nominal mass.
|
@@ -72,14 +72,14 @@ module MS
|
|
72
72
|
low_nominal = 0
|
73
73
|
high_nominal = 0
|
74
74
|
self.each do |el,cnt|
|
75
|
-
isotopes =
|
75
|
+
isotopes = Mspire::Isotope::BY_ELEMENT[el]
|
76
76
|
low_nominal += (isotopes.first.mass_number * cnt)
|
77
77
|
high_nominal += (isotopes.last.mass_number * cnt)
|
78
78
|
end
|
79
79
|
|
80
80
|
ffts = self.map do |el, cnt|
|
81
|
-
isotope_el_ar = NArray.float(high_nominal)
|
82
|
-
|
81
|
+
isotope_el_ar = NArray.float(high_nominal+1)
|
82
|
+
Mspire::Isotope::BY_ELEMENT[el].each do |isotope|
|
83
83
|
isotope_el_ar[isotope.mass_number] = isotope.relative_abundance
|
84
84
|
end
|
85
85
|
FFTW3.fft(isotope_el_ar)**cnt
|
@@ -92,12 +92,12 @@ module MS
|
|
92
92
|
|
93
93
|
class Isotope
|
94
94
|
module Distribution
|
95
|
-
def self.calculate(molecular_formula_like, normalize=
|
96
|
-
|
95
|
+
def self.calculate(molecular_formula_like, normalize=Mspire::Isotope::Distribution::NORMALIZE, percent_cutoff=Mspire::Isotope::Distribution::PERCENT_CUTOFF)
|
96
|
+
Mspire::MolecularFormula.new(molecular_formula_like).isotope_distribution(normalize, percent_cutoff)
|
97
97
|
end
|
98
98
|
|
99
|
-
def self.spectrum(molecular_formula_like, normalize=
|
100
|
-
|
99
|
+
def self.spectrum(molecular_formula_like, normalize=Mspire::Isotope::Distribution::NORMALIZE, percent_cutoff=Mspire::Isotope::Distribution::PERCENT_CUTOFF)
|
100
|
+
Mspire::MolecularFormula.new(molecular_formula_like).isotope_distribution_spectrum(normalize, percent_cutoff)
|
101
101
|
end
|
102
102
|
end
|
103
103
|
end
|
File without changes
|
data/lib/{ms → mspire}/mascot.rb
RENAMED
data/lib/{ms → mspire}/mass.rb
RENAMED
@@ -1,12 +1,12 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
1
|
+
require 'mspire/isotope'
|
2
|
+
require 'mspire/molecular_formula'
|
3
3
|
|
4
|
-
module
|
4
|
+
module Mspire
|
5
5
|
module Mass
|
6
6
|
|
7
7
|
# takes a molecular formula in this format: C2BrH12O
|
8
8
|
def self.formula_to_exact_mass(formula)
|
9
|
-
|
9
|
+
Mspire::MolecularFormula.new(formula).map do |el,cnt|
|
10
10
|
MONO[el] * cnt
|
11
11
|
end.reduce(:+)
|
12
12
|
end
|
@@ -16,20 +16,20 @@ module MS
|
|
16
16
|
'e' => 0.0005486, # www.mikeblaber.org/oldwine/chm1045/notes/Atoms/.../Atoms03.htm
|
17
17
|
'neutron' => 1.0086649156,
|
18
18
|
}
|
19
|
-
|
19
|
+
Mspire::Isotope::BY_ELEMENT.each do |el, isotopes|
|
20
20
|
MONO_STR[el.to_s] = isotopes.find {|iso| iso.mono }.atomic_mass
|
21
21
|
end
|
22
22
|
MONO_STR['h2o'] = %w(h h o).map {|el| MONO_STR[el] }.reduce(:+)
|
23
23
|
MONO_STR['oh'] = %w(o h).map {|el| MONO_STR[el] }.reduce(:+)
|
24
24
|
# add on deuterium
|
25
|
-
MONO_STR['d'] =
|
25
|
+
MONO_STR['d'] = Mspire::Isotope::BY_ELEMENT[:h].find {|iso| iso.element == :h && iso.mass_number == 2 }.atomic_mass
|
26
26
|
|
27
27
|
AVG_STR = {
|
28
28
|
'h+' => 1.007276, # using Mascot_H_plus mass (is this right for AVG??)
|
29
29
|
'e' => 0.0005486,
|
30
30
|
'neutron' => 1.0086649156,
|
31
31
|
}
|
32
|
-
|
32
|
+
Mspire::Isotope::BY_ELEMENT.each do |el, isotopes|
|
33
33
|
AVG_STR[el.to_s] = isotopes.first.average_mass
|
34
34
|
end
|
35
35
|
AVG_STR['h2o'] = %w(h h o).map {|el| AVG_STR[el] }.reduce(:+)
|