mspire 0.8.6.2 → 0.8.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b2a81f049d60fc8583b6983a65bba777cb099859
4
+ data.tar.gz: 801edda8a819a0555966b7039dea2dcedf75f22c
5
+ SHA512:
6
+ metadata.gz: 078df42a60519c0a9431be10957c4bab2f8a2060c7a53e6d6d1e58962654149eaff385328d5f19c79b4885938d488e0db25c68a7259a2d75702d96868bf991ec
7
+ data.tar.gz: cc584e4bb9df969d60d497db14e9af86dd5332254a5fc9fefbf9186cc040891a8e9ae40b09dd5caa3a7685df8cf08ae635d33a1aa4cf663c0a6e6c267a08602b
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ pkg
2
+ test_files_large
3
+ doc/output/*
4
+ .*.swp
5
+ *.gemspec
6
+ playing_around_with
7
+ coverage
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 1.9.3
5
+ # - jruby-19mode # JRuby in 1.9 mode
6
+ # - rbx-19mode
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in mspire.gemspec
4
+ gemspec
5
+
6
+ gem 'coveralls', require: false
data/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # mspire
2
2
 
3
+ [![Gem Version][GV img]][Gem Version]
4
+ [![Build Status][BS img]][Build Status]
5
+ [![Dependency Status][DS img]][Dependency Status]
6
+ [![Code Climate][CC img]][Code Climate]
7
+
3
8
  Mspire is a full featured library for working with mass spectrometry data,
4
9
  particularly proteomic, metabolomic and lipidomic data sets. It aims to be
5
10
  fast, robust, and beautiful.
@@ -159,3 +164,14 @@ trypsin.digest("AACCKDDEERFFKPGG") # => ["AACCK", "DDEER", "FFKPGG"]
159
164
  ## Copyright
160
165
 
161
166
  MIT license. See LICENSE for details.
167
+
168
+ [Gem Version]: https://rubygems.org/gems/mspire
169
+ [Build Status]: https://travis-ci.org/princelab/mspire
170
+ [travis pull requests]: https://travis-ci.org/princelab/mspire/pull_requests
171
+ [Dependency Status]: https://gemnasium.com/princelab/mspire
172
+ [Code Climate]: https://codeclimate.com/github/princelab/mspire
173
+
174
+ [GV img]: https://badge.fury.io/rb/mspire.png
175
+ [BS img]: https://travis-ci.org/princelab/mspire.png
176
+ [DS img]: https://gemnasium.com/princelab/mspire.png
177
+ [CC img]: https://codeclimate.com/github/princelab/mspire.png
data/Rakefile CHANGED
@@ -1,33 +1,4 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'rspec/core/rake_task'
4
- require 'yard'
5
-
6
- require 'jeweler'
7
- Jeweler::Tasks.new do |gem|
8
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
9
- gem.name = "mspire"
10
- gem.homepage = "http://github.com/princelab/mspire"
11
- gem.license = "MIT"
12
- gem.summary = %Q{mass spectrometry proteomics, lipidomics, and tools}
13
- gem.description = %Q{mass spectrometry proteomics, lipidomics, and tools, a rewrite of mspire, merging of ms-* gems}
14
- gem.email = "jtprince@gmail.com"
15
- gem.authors = ["John T. Prince", "Simon Chiang"]
16
- gem.add_dependency "nokogiri", "~> 1.5.9"
17
- gem.add_dependency "bsearch", ">= 1.5.0"
18
- gem.add_dependency "andand", ">= 1.3.3"
19
- gem.add_dependency "obo", ">= 0.1.3"
20
- gem.add_dependency "builder", "~> 3.2.0"
21
- gem.add_dependency "bio", "~> 1.4.3"
22
- gem.add_dependency "trollop", "~> 2.0.0"
23
- # this should be a real dependency, but need to document getting this
24
- # working on windows first!
25
- gem.add_development_dependency "fftw3", "~> 0.3"
26
- gem.add_development_dependency "rspec", "~> 2.13"
27
- gem.add_development_dependency "jeweler", "~> 1.8.4"
28
- #gem.add_development_dependency "rcov", ">= 0"
29
- end
30
- Jeweler::RubygemsDotOrgTasks.new
1
+ require "bundler/gem_tasks"
31
2
 
32
3
  require 'rspec/core'
33
4
  require 'rspec/core/rake_task'
@@ -35,23 +6,6 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
35
6
  spec.pattern = FileList['spec/**/*_spec.rb']
36
7
  end
37
8
 
38
- YARD::Rake::YardocTask.new do |t|
39
- t.files = ['lib/**/*.rb', 'obo/**/*', 'README.md', 'script/**/*'] # optional
40
- #t.options = ['--any', '--extra', '--opts'] # optional
41
- end
42
-
43
- RSpec::Core::RakeTask.new(:rcov) do |spec|
44
- spec.pattern = 'spec/**/*_spec.rb'
45
- spec.rcov = true
46
- end
47
-
48
- #require 'rcov/rcovtask'
49
- #Rcov::RcovTask.new do |spec|
50
- # spec.libs << 'spec'
51
- # spec.pattern = 'spec/**/*_spec.rb'
52
- # spec.verbose = true
53
- #end
54
-
55
9
  task :default => :spec
56
10
 
57
11
  require 'rdoc/task'
@@ -59,7 +13,7 @@ Rake::RDocTask.new do |rdoc|
59
13
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
60
14
 
61
15
  rdoc.rdoc_dir = 'rdoc'
62
- rdoc.title = "mspire #{version}"
16
+ rdoc.title = "rubabel #{version}"
63
17
  rdoc.rdoc_files.include('README*')
64
18
  rdoc.rdoc_files.include('lib/**/*.rb')
65
19
  end
data/bin/mspire CHANGED
File without changes
@@ -72,7 +72,7 @@ class Mspire::Ident::Pepxml::TerminalModification
72
72
  def to_xml(builder=nil)
73
73
  xmlb = builder || Nokogiri::XML::Builder.new
74
74
  #short_element_xml_from_instance_vars("terminal_modification")
75
- attrs = [:terminus, :massdiff, :mass, :variable, :protein_terminus, :description].map {|at| v=send(at) ; [at,v] if v }
75
+ attrs = [:terminus, :massdiff, :mass, :variable, :protein_terminus, :description].map {|at| v=send(at) ; [at,v] if v }.compact
76
76
  hash = Hash[attrs]
77
77
  hash[:massdiff] = hash[:massdiff].to_plus_minus_string
78
78
  xmlb.terminal_modification(hash)
@@ -44,7 +44,8 @@ Mspire::Ident::Pepxml::SearchHit::ModificationInfo = Struct.new(:modified_peptid
44
44
  ## Collect the modifications:
45
45
  ## Create the attribute string:
46
46
  atts = [:mod_nterm_mass, :mod_cterm_mass, :modified_peptide]
47
- atts.map! {|at| (v=send(at)) && [at, v] }.compact
47
+ atts.map! {|at| (v=send(at)) && [at, v] }
48
+ atts.compact!
48
49
  xmlb.modification_info(Hash[atts]) do |xmlb|
49
50
  mod_aminoacid_masses.andand.each do |mod_aa_mass|
50
51
  mod_aa_mass.to_xml(xmlb)
@@ -137,7 +137,7 @@ class Mspire::Ident::Pepxml
137
137
  self
138
138
  end
139
139
 
140
- Simple = Struct.new(:id, :search, :aaseq, :charge, :search_scores)
140
+ Simple = Struct.new(:id, :search, :aaseq, :charge, :search_scores, :analysis_results)
141
141
  end
142
142
 
143
143
  end
@@ -49,7 +49,7 @@ class Mspire::Ident::Pepxml::SpectrumQuery
49
49
  def to_xml(builder=nil)
50
50
  xmlb = builder || Nokogiri::XML::Builder.new
51
51
  # all through search_specification
52
- attrs = members[0, 8].map {|at| v=send(at) ; [at, v] if v }
52
+ attrs = members[0, 8].map {|at| v=send(at) ; [at, v] if v }.compact
53
53
  attrs_hash = Hash[attrs]
54
54
  case pepxml_version
55
55
  when 18
@@ -24,8 +24,11 @@ class Mspire::Ident::Pepxml
24
24
 
25
25
  attr_accessor :msms_pipeline_analysis
26
26
 
27
- # returns an array of Mspire::Ident::Pepxml::SearchHit::Simple structs
28
- def self.simple_search_hits(file)
27
+ # returns an array of Mspire::Ident::Pepxml::SearchHit::Simple structs will
28
+ # only process last result if duplicate search scores are included. Score
29
+ # keys returned as symbols and values cast as Floats while analysis results
30
+ # are all returned as strings.
31
+ def self.simple_search_hits(file, &block)
29
32
  hit_values = File.open(file) do |io|
30
33
  doc = Nokogiri::XML.parse(io, nil, nil, Nokogiri::XML::ParseOptions::DEFAULT_XML | Nokogiri::XML::ParseOptions::NOBLANKS | Nokogiri::XML::ParseOptions::STRICT)
31
34
  # we can work with namespaces, or just remove them ...
@@ -35,12 +38,24 @@ class Mspire::Ident::Pepxml
35
38
  search_hits.each_with_index.map do |search_hit,i|
36
39
  aaseq = search_hit['peptide']
37
40
  charge = search_hit.parent.parent['assumed_charge'].to_i
38
- search_score_nodes = search_hit.children.select {|node| node.name == 'search_score' }
41
+ nodes_by_name = search_hit.children.group_by(&:name)
39
42
  search_scores = {}
40
- search_score_nodes.each do |node|
43
+ nodes_by_name['search_score'].each do |node|
41
44
  search_scores[node['name'].to_sym] = node['value'].to_f
42
45
  end
43
- Mspire::Ident::Pepxml::SearchHit::Simple.new("hit_#{i}", Mspire::Ident::Search.new(file.chomp(File.extname(file))), aaseq, charge, search_scores)
46
+ analysis_results = {}
47
+ nodes_by_name['analysis_result'].each do |node|
48
+ analysis_results[node['analysis']] = node.children.map do |atnode|
49
+ atnode.attribute_nodes.each_with_object({}) do |attribute, hash|
50
+ hash[attribute.name] = attribute.value
51
+ end
52
+ end
53
+ end
54
+ hit = Mspire::Ident::Pepxml::SearchHit::Simple.new("hit_#{i}", Mspire::Ident::Search.new(file.chomp(File.extname(file))), aaseq, charge, search_scores, analysis_results)
55
+ if block
56
+ block.call(search_hit_n.parent.parent)
57
+ end
58
+ hit
44
59
  end
45
60
  end
46
61
  end
@@ -0,0 +1,3 @@
1
+ module Mspire
2
+ VERSION = "0.8.7"
3
+ end
data/lib/mspire.rb CHANGED
@@ -1,7 +1,5 @@
1
-
2
- require 'mspire/mass/aa' # requires mspire/mass & therefore mspire/molecular_formula
1
+ require 'mspire/version'
3
2
 
4
3
  module Mspire
5
- VERSION = IO.read(File.join(File.dirname(__FILE__), '..', 'VERSION')).chomp
6
4
  CITE = "Prince JT, Marcotte EM. mspire: mass spectrometry proteomics in Ruby. Bioinformatics. 2008. 24(23):2796-7."
7
5
  end