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,27 @@
1
+ # ActiveRecord model of MSF PeptidesProteins
2
+ # Join table for Peptides and Proteins HABTM
3
+ #
4
+ # Example:
5
+ #
6
+ # PeptidesProteins.first
7
+ class PeptidesProteins < ActiveRecord::Base
8
+ def self.table_name
9
+ :PeptidesProteins
10
+ end
11
+ def self.primary_keys
12
+ [:ProcessingNodeNumber, :PeptideID, :ProteinID]
13
+ end
14
+ def processing_node_number
15
+ self.ProcessingNodeNumber
16
+ end
17
+ def peptide_id
18
+ self.PeptideID
19
+ end
20
+ def protein_id
21
+ self.ProteinID
22
+ end
23
+ belongs_to :protein,
24
+ :foreign_key => 'ProteinID'
25
+ belongs_to :peptide,
26
+ :foreign_key => 'PeptideID'
27
+ end
@@ -0,0 +1,65 @@
1
+ # ActiveRecord model of MSF ProcessingNode
2
+ #
3
+ # Example:
4
+ #
5
+ # ProcessingNode.find(1)
6
+ # ProcessingNode.first.node_name
7
+ # ProcessingNode.find_by_NodeName('Mascot').peptides
8
+ # ProcessingNode.find_by_NodeName('Mascot').protein_scores
9
+ # ProcessingNode.find_by_NodeName('Mascot').spectrum_scores
10
+ class ProcessingNode < ActiveRecord::Base
11
+ def self.table_name
12
+ :ProcessingNodes
13
+ end
14
+ def self.primary_key
15
+ :ProcessingNodeNumber
16
+ end
17
+ def processing_node_number
18
+ self.ProcessingNodeNumber
19
+ end
20
+ def processing_node_id
21
+ self.ProcessingNodeID
22
+ end
23
+ def processing_node_parent_number
24
+ self.ProcessingNodeParentNumber
25
+ end
26
+ def node_name
27
+ self.NodeName
28
+ end
29
+ def friendly_name
30
+ self.FriendlyName
31
+ end
32
+ def major_version
33
+ self.MajorVersion
34
+ end
35
+ def minor_version
36
+ self.MinorVersion
37
+ end
38
+ def node_comment
39
+ self.NodeComment
40
+ end
41
+ def node_guid
42
+ self.NodeGUID
43
+ end
44
+ def processing_node_state
45
+ self.ProcessingNodeState
46
+ end
47
+ def self.isobaric_tags
48
+ @isobaric_tags ||= {
49
+ '113' => {'channel_id' => 1, 'mono_mass' => 113.107873, 'average_mass' => 113.1808},
50
+ '114' => {'channel_id' => 2, 'mono_mass' => 114.111228, 'average_mass' => 114.1735},
51
+ '115' => {'channel_id' => 3, 'mono_mass' => 115.108263, 'average_mass' => 115.1669},
52
+ '116' => {'channel_id' => 4, 'mono_mass' => 116.111618, 'average_mass' => 116.1595},
53
+ '117' => {'channel_id' => 5, 'mono_mass' => 117.114973, 'average_mass' => 117.1522},
54
+ '118' => {'channel_id' => 6, 'mono_mass' => 118.112008, 'average_mass' => 118.1456},
55
+ '119' => {'channel_id' => 7, 'mono_mass' => 119.115363, 'average_mass' => 119.1383},
56
+ '121' => {'channel_id' => 8, 'mono_mass' => 121.122072, 'average_mass' => 121.1236},
57
+ }
58
+ end
59
+ has_many :peptides,
60
+ :foreign_key => 'ProcessingNodeNumber'
61
+ has_many :protein_scores,
62
+ :foreign_key => 'ProcessingNodeNumber'
63
+ has_many :spectrum_scores,
64
+ :foreign_key => 'ProcessingNodeNumber'
65
+ end
@@ -0,0 +1,45 @@
1
+ # ActiveRecord model of MSF ProcessingNodeScore
2
+ #
3
+ # Example:
4
+ #
5
+ # ProcessingNodeScore.first.score_name
6
+ class ProcessingNodeScore < ActiveRecord::Base
7
+ def self.table_name
8
+ :ProcessingNodeScores
9
+ end
10
+ def self.primary_key
11
+ :ScoreID
12
+ end
13
+ def processing_node_id
14
+ self.ProcessingNodeID
15
+ end
16
+ def score_id
17
+ self.ScoreID
18
+ end
19
+ def score_name
20
+ self.ScoreName
21
+ end
22
+ def friendly_name
23
+ self.FriendlyName
24
+ end
25
+ def description
26
+ self.Description
27
+ end
28
+ def format_string
29
+ self.FormatString
30
+ end
31
+ def score_category
32
+ self.ScoreCategory
33
+ end
34
+ def hidden
35
+ self.Hidden
36
+ end
37
+ def is_main_score
38
+ self.IsMainScore
39
+ end
40
+ def score_guid
41
+ self.ScoreGUID
42
+ end
43
+ has_many :processing_nodes,
44
+ :foreign_key => "ProcessingNodeID"
45
+ end
@@ -0,0 +1,38 @@
1
+ # ActiveRecord model of MSF Protein
2
+ #
3
+ # Example:
4
+ #
5
+ # Protein.find(1)
6
+ # Protein.first.sequence
7
+ # Protein.first.protein_score
8
+ # Protein.first.protein_annotation
9
+ # Protein.first.peptides
10
+ class Protein < ActiveRecord::Base
11
+ def self.table_name
12
+ :Proteins
13
+ end
14
+ def self.primary_key
15
+ :ProteinID
16
+ end
17
+ def protein_id
18
+ self.ProteinID
19
+ end
20
+ def sequence
21
+ self.Sequence
22
+ end
23
+ def sequence_hash_code
24
+ self.SequenceHashCode
25
+ end
26
+ def is_master_protein
27
+ self.IsMasterProtein
28
+ end
29
+ has_one :protein_score,
30
+ :foreign_key => "ProteinID"
31
+ has_one :protein_annotation,
32
+ :foreign_key => "ProteinID"
33
+ # HABTM join table for peptides
34
+ has_many :peptides_proteins,
35
+ :class_name => 'PeptidesProteins',
36
+ :foreign_key => "ProteinID"
37
+ has_many :peptides, :through => :peptides_proteins
38
+ end
@@ -0,0 +1,35 @@
1
+ # ActiveRecord model of MSF ProteinAnnotation
2
+ #
3
+ # Example:
4
+ #
5
+ # ProteinAnnotation.first.description
6
+ class ProteinAnnotation < ActiveRecord::Base
7
+ def self.table_name
8
+ :ProteinAnnotations
9
+ end
10
+ def self.primary_key
11
+ :ProteinAnnotationID
12
+ end
13
+ def protein_annotation_id
14
+ self.ProteinAnnotationID
15
+ end
16
+ def protein_id
17
+ self.ProteinID
18
+ end
19
+ def description_hash_code
20
+ self.DescriptionHashCode
21
+ end
22
+ def description
23
+ self.Description
24
+ end
25
+ def taxonomy_id
26
+ self.TaxonomyID
27
+ end
28
+ def accession
29
+ self.description.split('|')[1]
30
+ end
31
+ belongs_to :protein,
32
+ :foreign_key => "ProteinID"
33
+ belongs_to :taxonomy,
34
+ :foreign_key => "TaxonomyID"
35
+ end
@@ -0,0 +1,19 @@
1
+ # ActiveRecord model of MSF ProteinIdentificationGroup
2
+ #
3
+ # Example:
4
+ #
5
+ # ProteinIdentificationGroup.first
6
+ class ProteinIdentificationGroup < ActiveRecord::Base
7
+ def self.table_name
8
+ :ProteinIdentificationGroups
9
+ end
10
+ def self.primary_key
11
+ [:ProteinIdentificationGroupId, :ProcessingNodeNumber]
12
+ end
13
+ def protein_identification_group_id
14
+ self.ProteinIdentificationGroupId
15
+ end
16
+ def processing_node_number
17
+ self.ProcessingNodeNumber
18
+ end
19
+ end
@@ -0,0 +1,34 @@
1
+ # ActiveRecord model of MSF ProteinScore
2
+ #
3
+ # Example:
4
+ #
5
+ # ProteinScore.first.protein_score
6
+ class ProteinScore < ActiveRecord::Base
7
+ def self.table_name
8
+ :ProteinScores
9
+ end
10
+ def self.primary_key
11
+ [:ProcessingNodeNumber, :ProteinID]
12
+ end
13
+ def processing_node_number
14
+ self.ProcessingNodeNumber
15
+ end
16
+ def protein_id
17
+ self.ProteinID
18
+ end
19
+ def protein_identification_group_id
20
+ self.ProteinIdentificationGroupID
21
+ end
22
+ def protein_score
23
+ self.ProteinScore
24
+ end
25
+ def coverage
26
+ self.Coverage
27
+ end
28
+ belongs_to :protein,
29
+ :foreign_key => "ProteinID"
30
+ belongs_to :protein_identification_group,
31
+ :foreign_key => "ProteinIdentificationGroupID"
32
+ belongs_to :processing_node,
33
+ :foreign_key => "ProcessingNodeNumber"
34
+ end
@@ -0,0 +1,31 @@
1
+ # ActiveRecord model of MSF ReporterIonQuanResult
2
+ #
3
+ # Example:
4
+ #
5
+ # ReporterIonQuanResult.find(1)
6
+ # ReporterIonQuanResult.first.reporter_ion_quan_results_search_spectra
7
+ class ReporterIonQuanResult < ActiveRecord::Base
8
+ def self.table_name
9
+ :ReporterIonQuanResults
10
+ end
11
+ def self.primary_key
12
+ [:ProcessingNodeNumber, :QuanChannelID, :SpectrumID]
13
+ end
14
+ def processing_node_number
15
+ self.ProcessingNodeNumber
16
+ end
17
+ def quan_channel_id
18
+ self.QuanChannelID
19
+ end
20
+ def spectrum_id
21
+ self.SpectrumID
22
+ end
23
+ def mass
24
+ self.Mass
25
+ end
26
+ def height
27
+ self.Height
28
+ end
29
+ belongs_to :reporter_ion_quan_results_search_spectra,
30
+ :foreign_key => 'SpectrumID'
31
+ end
@@ -0,0 +1,29 @@
1
+ # ActiveRecord model of MSF ReporterIonQuanResultsSearchSpectra
2
+ # Join table for ReporterIonQuanResult and Spectrum HABTM
3
+ #
4
+ # Example:
5
+ #
6
+ # ReporterIonQuanResultsSearchSpectra.first
7
+ class ReporterIonQuanResultsSearchSpectra < ActiveRecord::Base
8
+ def self.table_name
9
+ :ReporterIonQuanResultsSearchSpectra
10
+ end
11
+ def self.primary_key
12
+ :SearchSpectrumID
13
+ # [:ProcessingNodeNumber, :SpectrumID, :SearchSpectrumID]
14
+ end
15
+ def processing_node_number
16
+ self.ProcessingNodeNumber
17
+ end
18
+ def spectrum_id
19
+ self.SpectrumID
20
+ end
21
+ def search_spectrum_id
22
+ self.SearchSpectrumID
23
+ end
24
+ has_many :reporter_ion_quan_results,
25
+ :foreign_key => "SpectrumID",
26
+ :primary_key => "SpectrumID"
27
+ belongs_to :spectrum,
28
+ :foreign_key => 'UniqueSpectrumID'
29
+ end
@@ -0,0 +1,37 @@
1
+ # ActiveRecord model of MSF ScanEvent
2
+ #
3
+ # Example:
4
+ #
5
+ # ScanEvent.find(1)
6
+ # ScanEvent.first.scan_type
7
+ class ScanEvent < ActiveRecord::Base
8
+ def self.table_name
9
+ :ScanEvents
10
+ end
11
+ def self.primary_key
12
+ :ScanEventID
13
+ end
14
+ def scan_event_id
15
+ self.ScanEventID
16
+ end
17
+ def ms_level
18
+ self.MSLevel
19
+ end
20
+ def polarity
21
+ self.Polarity
22
+ end
23
+ def scan_type
24
+ self.ScanType
25
+ end
26
+ def ionization
27
+ self.Ionization
28
+ end
29
+ def mass_analyzer
30
+ self.MassAnalyzer
31
+ end
32
+ def activation_type
33
+ self.ActivationType
34
+ end
35
+ has_many :spectrum_headers,
36
+ :foreign_key => "ScanEventID"
37
+ end
@@ -0,0 +1,29 @@
1
+ # ActiveRecord model of MSF SchemaInfo
2
+ #
3
+ # Example:
4
+ #
5
+ # SchemaInfo.find(1)
6
+ # SchemaInfo.first.software_version
7
+ class SchemaInfo < ActiveRecord::Base
8
+ def self.table_name
9
+ :SchemaInfo
10
+ end
11
+ def self.primary_key
12
+ :Version
13
+ end
14
+ def version
15
+ self.Version
16
+ end
17
+ def kind
18
+ self.Kind
19
+ end
20
+ def date
21
+ self.Date
22
+ end
23
+ def software_version
24
+ self.SoftwareVersion
25
+ end
26
+ def comment
27
+ self.Comment
28
+ end
29
+ end
@@ -0,0 +1,34 @@
1
+ # ActiveRecord model of MSF Spectrum
2
+ #
3
+ # Example:
4
+ #
5
+ # Spectrum.find(1)
6
+ # Spectrum.first.spectrum
7
+ class Spectrum < ActiveRecord::Base
8
+ def self.table_name
9
+ :Spectra
10
+ end
11
+ def self.primary_key
12
+ :UniqueSpectrumID
13
+ end
14
+ def unique_spectrum_id
15
+ self.UniqueSpectrumID
16
+ end
17
+ def spectrum
18
+ self.Spectrum
19
+ end
20
+ def spectrum_hash_code
21
+ self.SpectrumHashCode
22
+ end
23
+ has_many :peptides,
24
+ :foreign_key => "SpectrumID",
25
+ :primary_key => "UniqueSpectrumID"
26
+ has_one :spectrum_header,
27
+ :foreign_key => "SpectrumID"
28
+ has_one :spectrum_score,
29
+ :foreign_key => "SpectrumID"
30
+ has_one :search_spectrum,
31
+ :class_name => 'ReporterIonQuanResultsSearchSpectra',
32
+ :foreign_key => "SearchSpectrumID",
33
+ :primary_key => "UniqueSpectrumID"
34
+ end
@@ -0,0 +1,63 @@
1
+ # ActiveRecord model of MSF SpectrumHeader
2
+ #
3
+ # Example:
4
+ #
5
+ # SpectrumHeader.find(1)
6
+ # SpectrumHeader.first.mass
7
+ class SpectrumHeader < ActiveRecord::Base
8
+ def self.table_name
9
+ :SpectrumHeaders
10
+ end
11
+ def self.primary_key
12
+ :SpectrumID
13
+ end
14
+ def spectrum_id
15
+ self.SpectrumID
16
+ end
17
+ def mass_peak_id
18
+ self.MassPeakID
19
+ end
20
+ def scan_event_id
21
+ self.ScanEventID
22
+ end
23
+ def last_scan
24
+ self.LastScan
25
+ end
26
+ def first_scan
27
+ self.FirstScan
28
+ end
29
+ def retention_time
30
+ self.RetentionTime
31
+ end
32
+ def hidden
33
+ self.Hidden
34
+ end
35
+ def scan_numbers
36
+ self.ScanNumbers
37
+ end
38
+ def charge
39
+ self.Charge
40
+ end
41
+ def mass
42
+ self.Mass
43
+ end
44
+ def creating_processing_node_number
45
+ self.CreatingProcessingNodeNumber
46
+ end
47
+ def unique_spectrum_id
48
+ self.UniqueSpectrumID
49
+ end
50
+ def title
51
+ self.mass_peak.file_info.file_basename + "_" + self.SpectrumID.to_s + "_" + self.FirstScan.to_s + "_" + self.Charge.to_s
52
+ end
53
+ # associations
54
+ belongs_to :spectrum,
55
+ :foreign_key => "SpectrumID"
56
+ belongs_to :mass_peak,
57
+ :foreign_key => "MassPeakID"
58
+ belongs_to :scan_event,
59
+ :foreign_key => "ScanEventID"
60
+ belongs_to :unique_spectrum,
61
+ :class_name => "Spectrum",
62
+ :foreign_key => "UniqueSpectrumID"
63
+ end