msf 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +24 -0
  4. data/Gemfile.lock +67 -0
  5. data/LICENSE.txt +20 -0
  6. data/README.md +45 -0
  7. data/Rakefile +43 -0
  8. data/VERSION +1 -0
  9. data/bin/ibspectra +43 -0
  10. data/erd/config.png +0 -0
  11. data/erd/empty.png +0 -0
  12. data/erd/erd.png +0 -0
  13. data/erd/msf.xcdatamodeld/.xccurrentversion +8 -0
  14. data/erd/msf.xcdatamodeld/msf.xcdatamodel/contents +330 -0
  15. data/erd/schema.txt +666 -0
  16. data/lib/msf.rb +2 -0
  17. data/lib/msf/models.rb +4 -0
  18. data/lib/msf/models/amino_acid.rb +50 -0
  19. data/lib/msf/models/amino_acid_modification.rb +55 -0
  20. data/lib/msf/models/amino_acid_modification_neutral_loss.rb +31 -0
  21. data/lib/msf/models/amino_acid_modifications_amino_acid_nls.rb +23 -0
  22. data/lib/msf/models/amino_acid_modifications_amino_acids.rb +27 -0
  23. data/lib/msf/models/annotation_data_version.rb +20 -0
  24. data/lib/msf/models/annotation_dataset.rb +29 -0
  25. data/lib/msf/models/annotation_group.rb +38 -0
  26. data/lib/msf/models/annotation_type.rb +23 -0
  27. data/lib/msf/models/chromatogram.rb +26 -0
  28. data/lib/msf/models/custom_data_field.rb +56 -0
  29. data/lib/msf/models/custom_data_peptide.rb +25 -0
  30. data/lib/msf/models/custom_data_processing_node.rb +25 -0
  31. data/lib/msf/models/custom_data_protein.rb +25 -0
  32. data/lib/msf/models/custom_data_spectrum.rb +25 -0
  33. data/lib/msf/models/enzyme.rb +32 -0
  34. data/lib/msf/models/fasta_file.rb +50 -0
  35. data/lib/msf/models/file_info.rb +41 -0
  36. data/lib/msf/models/mass_peak.rb +36 -0
  37. data/lib/msf/models/peptide.rb +118 -0
  38. data/lib/msf/models/peptide_score.rb +34 -0
  39. data/lib/msf/models/peptide_score_decoy.rb +34 -0
  40. data/lib/msf/models/peptide_terminal_modification.rb +29 -0
  41. data/lib/msf/models/peptides_amino_acid_modifications.rb +32 -0
  42. data/lib/msf/models/peptides_proteins.rb +27 -0
  43. data/lib/msf/models/processing_node.rb +65 -0
  44. data/lib/msf/models/processing_node_score.rb +45 -0
  45. data/lib/msf/models/protein.rb +38 -0
  46. data/lib/msf/models/protein_annotation.rb +35 -0
  47. data/lib/msf/models/protein_identification_group.rb +19 -0
  48. data/lib/msf/models/protein_score.rb +34 -0
  49. data/lib/msf/models/reporter_ion_quan_result.rb +31 -0
  50. data/lib/msf/models/reporter_ion_quan_result_search_spectrum.rb +29 -0
  51. data/lib/msf/models/scan_event.rb +37 -0
  52. data/lib/msf/models/schema_info.rb +29 -0
  53. data/lib/msf/models/spectrum.rb +34 -0
  54. data/lib/msf/models/spectrum_header.rb +63 -0
  55. data/lib/msf/models/spectrum_score.rb +24 -0
  56. data/lib/msf/models/taxonomy_name.rb +26 -0
  57. data/lib/msf/models/workflow_info.rb +46 -0
  58. data/lib/msf/models/workflow_message.rb +31 -0
  59. data/lib/msf/msf.rb +32 -0
  60. data/lib/msf/sql/enzyme_cleavage_specificity.rb +16 -0
  61. data/lib/msf/sql/false_discovery_rate.rb +24 -0
  62. data/lib/msf/sql/fasta_file_protein_annotation.rb +17 -0
  63. data/lib/msf/sql/mass_peak_relation.rb +17 -0
  64. data/lib/msf/sql/peptide_amino_acid_modification_decoy.rb +23 -0
  65. data/lib/msf/sql/peptide_decoy.rb +32 -0
  66. data/lib/msf/sql/peptide_terminal_modification_decoy.rb +20 -0
  67. data/lib/msf/sql/precursor_ion_quan_result.rb +29 -0
  68. data/lib/msf/sql/precursor_ion_quan_result_event_spectrum.rb +17 -0
  69. data/lib/msf/sql/precursor_ion_quan_result_search_spectrum.rb +20 -0
  70. data/lib/msf/sql/processing_node_filter_parameter.rb +29 -0
  71. data/lib/msf/sql/processing_node_interface.rb +19 -0
  72. data/lib/msf/sql/processing_node_parameter.rb +46 -0
  73. data/lib/msf/sql/processing_node_spectrum.rb +16 -0
  74. data/lib/msf/sql/quan_result.rb +40 -0
  75. data/lib/msf/sql/result_filter_set.rb +12 -0
  76. data/lib/msf/sql/taxonomy_node.rb +26 -0
  77. data/msf.gemspec +143 -0
  78. data/spec/msf_spec.rb +7 -0
  79. data/spec/spec_helper.rb +14 -0
  80. metadata +275 -0
@@ -0,0 +1,25 @@
1
+ # ActiveRecord model of MSF CustomDataProtein
2
+ #
3
+ # Example:
4
+ #
5
+ # CustomDataProtein.find(1)
6
+ # CustomDataProtein.first.field_value
7
+ class CustomDataProtein < ActiveRecord::Base
8
+ def self.table_name
9
+ :CustomDataProteins
10
+ end
11
+ def self.primary_key
12
+ [:FieldID, :ProteinID]
13
+ end
14
+ def field_id
15
+ self.FieldID
16
+ end
17
+ def protein_id
18
+ self.ProteinID
19
+ end
20
+ def field_value
21
+ self.FieldValue
22
+ end
23
+ belongs_to :custom_data_field,
24
+ :foreign_key => "FieldID"
25
+ end
@@ -0,0 +1,25 @@
1
+ # ActiveRecord model of MSF CustomDataSpectrum
2
+ #
3
+ # Example:
4
+ #
5
+ # CustomDataSpectrum.find(1)
6
+ # CustomDataSpectrum.first.field_value
7
+ class CustomDataSpectrum < ActiveRecord::Base
8
+ def self.table_name
9
+ :CustomDataSpectra
10
+ end
11
+ def self.primary_key
12
+ [:FieldID, :SpectrumID]
13
+ end
14
+ def field_id
15
+ self.FieldID
16
+ end
17
+ def spectrum_id
18
+ self.SpectrumID
19
+ end
20
+ def field_value
21
+ self.FieldValue
22
+ end
23
+ belongs_to :custom_data_field,
24
+ :foreign_key => "FieldID"
25
+ end
@@ -0,0 +1,32 @@
1
+ # ActiveRecord model of MSF Enzyme
2
+ #
3
+ # Example:
4
+ #
5
+ # Enzyme.find(1)
6
+ # Enzyme.all.first.name
7
+ class Enzyme < ActiveRecord::Base
8
+ def self.table_name
9
+ :Enzymes
10
+ end
11
+ def self.primary_key
12
+ :EnzymeID
13
+ end
14
+ def enzyme_id
15
+ self.EnzymeID
16
+ end
17
+ def name
18
+ self.Name
19
+ end
20
+ def abbreviation
21
+ self.Abbreviation
22
+ end
23
+ def seperator
24
+ self.Seperator
25
+ end
26
+ def non_seperator
27
+ self.NonSeperator
28
+ end
29
+ def offset
30
+ self.Offset
31
+ end
32
+ end
@@ -0,0 +1,50 @@
1
+ # ActiveRecord model of MSF FastaFile
2
+ #
3
+ # Example:
4
+ #
5
+ # FastaFile.find(1)
6
+ # FastaFile.first.file_name
7
+ class FastaFile < ActiveRecord::Base
8
+ def self.table_name
9
+ :FastaFiles
10
+ end
11
+ def self.primary_key
12
+ :FastaFileID
13
+ end
14
+ def fasta_file_id
15
+ self.FastaFileID
16
+ end
17
+ def file_name
18
+ self.FileName
19
+ end
20
+ def state
21
+ self.State
22
+ end
23
+ def virtual_file_name
24
+ self.VirtualFileName
25
+ end
26
+ def file_size
27
+ self.FileSize
28
+ end
29
+ def file_time
30
+ self.FileTime
31
+ end
32
+ def number_of_proteins
33
+ self.NumberOfProteins
34
+ end
35
+ def number_of_amino_acids
36
+ self.NumberOfAminoAcids
37
+ end
38
+ def file_hash_code
39
+ self.FileHashCode
40
+ end
41
+ def hidden
42
+ self.Hidden
43
+ end
44
+ def is_srf_import
45
+ self.IsSrfImport
46
+ end
47
+ def is_scheduled_for_deletion
48
+ self.IsScheduledForDeletion
49
+ end
50
+ end
@@ -0,0 +1,41 @@
1
+ # ActiveRecord model of MSF FileInfo
2
+ #
3
+ # Example:
4
+ #
5
+ # FileInfo.find(1)
6
+ # FileInfo.first.file_name
7
+ # FileInfo.first.chromatograms.first.trace_type
8
+ class FileInfo < ActiveRecord::Base
9
+ def self.table_name
10
+ :FileInfos
11
+ end
12
+ def self.primary_key
13
+ :FileID
14
+ end
15
+ def file_id
16
+ self.FileID
17
+ end
18
+ def file_name
19
+ self.FileName
20
+ end
21
+ def file_basename
22
+ path = self.FileName.gsub("\\","/")
23
+ File.basename(path,File.extname(path))
24
+ end
25
+ def file_time
26
+ self.FileTime
27
+ end
28
+ def file_size
29
+ self.FileSize
30
+ end
31
+ def physical_file_name
32
+ self.PhysicalFileName
33
+ end
34
+ def file_type
35
+ self.FileType
36
+ end
37
+ has_many :chromatograms,
38
+ :foreign_key => "FileID"
39
+ has_many :mass_peaks,
40
+ :foreign_key => "FileID"
41
+ end
@@ -0,0 +1,36 @@
1
+ # ActiveRecord model of MSF MassPeak
2
+ #
3
+ # Example:
4
+ #
5
+ # MassPeak.find(1)
6
+ # MassPeak.first.charge
7
+ class MassPeak < ActiveRecord::Base
8
+ def self.table_name
9
+ :MassPeaks
10
+ end
11
+ def self.primary_key
12
+ :MassPeakID
13
+ end
14
+ def mass_peak_id
15
+ self.MassPeakID
16
+ end
17
+ def charge
18
+ self.Charge
19
+ end
20
+ def intensity
21
+ self.Intensity
22
+ end
23
+ def mass
24
+ self.Mass
25
+ end
26
+ def scan_numbers
27
+ self.ScanNumbers
28
+ end
29
+ def file_id
30
+ self.FileID
31
+ end
32
+ belongs_to :file_info,
33
+ :foreign_key => "FileID"
34
+ has_one :spectrum_header,
35
+ :foreign_key => "MassPeakID"
36
+ end
@@ -0,0 +1,118 @@
1
+ # ActiveRecord model of MSF Peptide
2
+ #
3
+ # Example:
4
+ #
5
+ # Peptide.find(1)
6
+ # Peptide.first.sequence
7
+ # Peptide.first.internal_modifications
8
+ # Peptide.first.terminal_modification
9
+ class Peptide < ActiveRecord::Base
10
+ def self.table_name
11
+ :Peptides
12
+ end
13
+ def self.primary_key
14
+ :PeptideID
15
+ end
16
+ def processing_node_number
17
+ self.ProcessingNodeNumber
18
+ end
19
+ def peptide_id
20
+ self.PeptideID
21
+ end
22
+ def spectrum_id
23
+ self.SpectrumID
24
+ end
25
+ def total_ions_count
26
+ self.TotalIonsCount
27
+ end
28
+ def matched_ions_count
29
+ self.MatchedIonsCount
30
+ end
31
+ def confidence_level
32
+ self.ConfidenceLevel
33
+ end
34
+ def search_engine_rank
35
+ self.SearchEngineRank
36
+ end
37
+ def hidden
38
+ self.Hidden
39
+ end
40
+ def sequence
41
+ self.Sequence
42
+ end
43
+ def annotation
44
+ self.Annotation
45
+ end
46
+ def unique_peptide_sequence_id
47
+ self.UniquePeptideSequenceID
48
+ end
49
+ def missed_cleavages
50
+ self.MissedCleavages
51
+ end
52
+ def theoretical_mass
53
+ mass = 0
54
+ charge = self.spectrum.spectrum_header.charge
55
+ self.sequence.split(//).each do |aa|
56
+ mass += AminoAcid.mass_for_one_letter_code(aa)
57
+ end
58
+ self.peptides_amino_acid_modifications.each do |modification|
59
+ mass += modification.internal_modification.delta_mass
60
+ end
61
+ unless self.terminal_modification.nil?
62
+ mass += self.terminal_modification.delta_mass
63
+ end
64
+ mass += 1.007825 + 15.994910 + 1.007825
65
+ mass = (mass + (charge * 1.007825)) / charge
66
+ end
67
+ def modified_sequence
68
+ nterm = ''
69
+ cterm = '-COOH'
70
+ if self.terminal_modification.nil?
71
+ nterm = "NH2-"
72
+ else
73
+ nterm = "#{self.terminal_modification.modification_name}-"
74
+ end
75
+ sequence_amino_acids = self.sequence.split(//)
76
+ self.peptides_amino_acid_modifications.each do |modification|
77
+ sequence_amino_acids[modification.position] = "#{sequence_amino_acids[modification.position]}<#{modification.internal_modification.modification_name}>"
78
+ end
79
+ nterm + sequence_amino_acids.join("") + cterm
80
+ end
81
+ def isobar_sequence
82
+ nterm = ''
83
+ unless self.terminal_modification.nil?
84
+ nterm = "#{self.terminal_modification.modification_name}:"
85
+ end
86
+ sequence_amino_acids = self.sequence.split(//)
87
+ isobar_amino_acids = []
88
+ sequence_amino_acids.count.times { isobar_amino_acids << ":"}
89
+ self.peptides_amino_acid_modifications.each do |modification|
90
+ isobar_amino_acids[modification.position] = "#{modification.internal_modification.modification_name}_#{sequence_amino_acids[modification.position]}:"
91
+ end
92
+ nterm + isobar_amino_acids.join("")
93
+ end
94
+ belongs_to :spectrum,
95
+ :foreign_key => "SpectrumID"
96
+ has_one :peptide_score,
97
+ :foreign_key => "PeptideID"
98
+ # HABTM join table for proteins
99
+ has_many :peptides_proteins,
100
+ :class_name => 'PeptidesProteins',
101
+ :foreign_key => "PeptideID"
102
+ has_many :proteins, :through => :peptides_proteins
103
+ # HABTM join table for internal_modifications
104
+ has_many :peptides_amino_acid_modifications,
105
+ :class_name => 'PeptidesAminoAcidModifications',
106
+ :foreign_key => "PeptideID"
107
+ has_many :internal_modifications, :through => :peptides_amino_acid_modifications,
108
+ :class_name => 'AminoAcidModification',
109
+ :foreign_key => 'PeptideID'
110
+ # join table for terminal_modifications
111
+ has_one :peptide_terminal_modification,
112
+ :class_name => 'PeptideTerminalModification',
113
+ :foreign_key => "PeptideID"
114
+ has_one :terminal_modification, :through => :peptide_terminal_modification,
115
+ :class_name => 'AminoAcidModification',
116
+ :foreign_key => 'PeptideID'
117
+
118
+ end
@@ -0,0 +1,34 @@
1
+ # ActiveRecord model of MSF PeptideScore
2
+ #
3
+ # Example:
4
+ #
5
+ # PeptideScore.first.score
6
+ class PeptideScore < ActiveRecord::Base
7
+ def self.table_name
8
+ :PeptideScores
9
+ end
10
+ def self.primary_key
11
+ [:ProcessingNodeNumber, :PeptideID, :ScoreID]
12
+ end
13
+ def processing_node_number
14
+ self.ProcessingNodeNumber
15
+ end
16
+ def peptide_id
17
+ self.PeptideID
18
+ end
19
+ def score_id
20
+ self.ScoreID
21
+ end
22
+ def processing_node_id
23
+ self.ProcessingNodeID
24
+ end
25
+ def score_value
26
+ self.ScoreValue
27
+ end
28
+ belongs_to :peptide,
29
+ :foreign_key => "PeptideID"
30
+ belongs_to :processing_node,
31
+ :foreign_key => "ProcessingNodeNumber"
32
+ belongs_to :processing_node_score,
33
+ :foreign_key => "ScoreID"
34
+ end
@@ -0,0 +1,34 @@
1
+ # ActiveRecord model of MSF PeptideScoreDecoy
2
+ #
3
+ # Example:
4
+ #
5
+ # PeptideScoreDecoy.first.score
6
+ class PeptideScoreDecoy < ActiveRecord::Base
7
+ def self.table_name
8
+ :PeptideScores_decoy
9
+ end
10
+ def self.primary_key
11
+ [:ProcessingNodeNumber, :PeptideID, :ScoreID]
12
+ end
13
+ def processing_node_number
14
+ self.ProcessingNodeNumber
15
+ end
16
+ def peptide_id
17
+ self.PeptideID
18
+ end
19
+ def score_id
20
+ self.ScoreID
21
+ end
22
+ def processing_node_id
23
+ self.ProcessingNodeID
24
+ end
25
+ def score_value
26
+ self.ScoreValue
27
+ end
28
+ belongs_to :peptide,
29
+ :foreign_key => "PeptideID"
30
+ belongs_to :processing_node,
31
+ :foreign_key => "ProcessingNodeNumber"
32
+ belongs_to :processing_node_score,
33
+ :foreign_key => "ScoreID"
34
+ end
@@ -0,0 +1,29 @@
1
+ # ActiveRecord model of MSF PeptideTerminalModification
2
+ #
3
+ # Example:
4
+ #
5
+ # PeptideTerminalModification.first
6
+ class PeptideTerminalModification < ActiveRecord::Base
7
+ def self.table_name
8
+ :PeptidesTerminalModifications
9
+ end
10
+ def self.primary_key
11
+ [:ProcessingNodeNumber, :PeptideID, :TerminalModificationID]
12
+ end
13
+ def processing_node_number
14
+ self.ProcessingNodeNumber
15
+ end
16
+ def peptide_id
17
+ self.PeptideID
18
+ end
19
+ def terminal_modification_id
20
+ self.TerminalModificationID
21
+ end
22
+ belongs_to :peptide,
23
+ :foreign_key => "PeptideID"
24
+ belongs_to :terminal_modification,
25
+ :class_name => 'AminoAcidModification',
26
+ :foreign_key => 'TerminalModificationID'
27
+ belongs_to :processing_node,
28
+ :foreign_key => 'ProcessingNodeNumber'
29
+ end
@@ -0,0 +1,32 @@
1
+ # ActiveRecord model of MSF PeptidesAminoAcidModifications
2
+ # Join table for Peptides and AminoAcidModifications HABTM
3
+ #
4
+ # Example:
5
+ #
6
+ # PeptidesAminoAcidModifications.first.position
7
+ class PeptidesAminoAcidModifications < ActiveRecord::Base
8
+ def self.table_name
9
+ :PeptidesAminoAcidModifications
10
+ end
11
+ def self.primary_key
12
+ # [:AminoAcidModificationID, :PeptideID]
13
+ [:ProcessingNodeNumber, :PeptideID, :AminoAcidModificationID, :Position]
14
+ end
15
+ def processing_node_number
16
+ self.ProcessingNodeNumber
17
+ end
18
+ def peptide_id
19
+ self.PeptideID
20
+ end
21
+ def amino_acid_modification_id
22
+ self.AminoAcidModificationID
23
+ end
24
+ def position
25
+ self.Position
26
+ end
27
+ belongs_to :peptide,
28
+ :foreign_key => 'PeptideID'
29
+ belongs_to :internal_modification,
30
+ :class_name => 'AminoAcidModification',
31
+ :foreign_key => 'AminoAcidModificationID'
32
+ end