ms-ident 0.0.21 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +6 -6
 - data/VERSION +1 -1
 - data/lib/ms/ident/pepxml.rb +7 -13
 - data/lib/ms/ident/pepxml/search_hit.rb +3 -0
 - metadata +3 -3
 
    
        data/Rakefile
    CHANGED
    
    | 
         @@ -29,12 +29,12 @@ Rake::TestTask.new(:spec) do |spec| 
     | 
|
| 
       29 
29 
     | 
    
         
             
              spec.verbose = true
         
     | 
| 
       30 
30 
     | 
    
         
             
            end
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
            require 'rcov/rcovtask'
         
     | 
| 
       33 
     | 
    
         
            -
            Rcov::RcovTask.new do |spec|
         
     | 
| 
       34 
     | 
    
         
            -
              spec.libs << 'spec'
         
     | 
| 
       35 
     | 
    
         
            -
              spec.pattern = 'spec/**/*_spec.rb'
         
     | 
| 
       36 
     | 
    
         
            -
              spec.verbose = true
         
     | 
| 
       37 
     | 
    
         
            -
            end
         
     | 
| 
      
 32 
     | 
    
         
            +
            #require 'rcov/rcovtask'
         
     | 
| 
      
 33 
     | 
    
         
            +
            #Rcov::RcovTask.new do |spec|
         
     | 
| 
      
 34 
     | 
    
         
            +
            #  spec.libs << 'spec'
         
     | 
| 
      
 35 
     | 
    
         
            +
            #  spec.pattern = 'spec/**/*_spec.rb'
         
     | 
| 
      
 36 
     | 
    
         
            +
            #  spec.verbose = true
         
     | 
| 
      
 37 
     | 
    
         
            +
            #end
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
39 
     | 
    
         
             
            task :default => :spec
         
     | 
| 
       40 
40 
     | 
    
         | 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            0.0. 
     | 
| 
      
 1 
     | 
    
         
            +
            0.0.22
         
     | 
    
        data/lib/ms/ident/pepxml.rb
    CHANGED
    
    | 
         @@ -2,6 +2,8 @@ require 'nokogiri' 
     | 
|
| 
       2 
2 
     | 
    
         
             
            require 'ms/ident'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'ms/ident/pepxml/msms_pipeline_analysis'
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
      
 5 
     | 
    
         
            +
            require 'ostruct'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
       5 
7 
     | 
    
         
             
            module Ms ; module Ident ; end ; end
         
     | 
| 
       6 
8 
     | 
    
         | 
| 
       7 
9 
     | 
    
         
             
            class Numeric
         
     | 
| 
         @@ -22,11 +24,8 @@ class Ms::Ident::Pepxml 
     | 
|
| 
       22 
24 
     | 
    
         | 
| 
       23 
25 
     | 
    
         
             
              attr_accessor :msms_pipeline_analysis
         
     | 
| 
       24 
26 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
               
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                ss_names = []
         
     | 
| 
       28 
     | 
    
         
            -
                have_ss_names = false
         
     | 
| 
       29 
     | 
    
         
            -
                # begin with aaseq, charge
         
     | 
| 
      
 27 
     | 
    
         
            +
              # returns an array of Ms::Ident::Pepxml::SearchHit::Simple structs
         
     | 
| 
      
 28 
     | 
    
         
            +
              def self.simple_search_hits(file)
         
     | 
| 
       30 
29 
     | 
    
         
             
                hit_values = File.open(file) do |io|
         
     | 
| 
       31 
30 
     | 
    
         
             
                  doc = Nokogiri::XML.parse(io, nil, nil, Nokogiri::XML::ParseOptions::DEFAULT_XML | Nokogiri::XML::ParseOptions::NOBLANKS)
         
     | 
| 
       32 
31 
     | 
    
         
             
                  # we can work with namespaces, or just remove them ...
         
     | 
| 
         @@ -37,18 +36,13 @@ class Ms::Ident::Pepxml 
     | 
|
| 
       37 
36 
     | 
    
         
             
                    aaseq = search_hit['peptide']
         
     | 
| 
       38 
37 
     | 
    
         
             
                    charge = search_hit.parent.parent['assumed_charge'].to_i
         
     | 
| 
       39 
38 
     | 
    
         
             
                    search_score_nodes = search_hit.children.select {|node| node.name == 'search_score' }
         
     | 
| 
       40 
     | 
    
         
            -
                     
     | 
| 
      
 39 
     | 
    
         
            +
                    search_scores = {}
         
     | 
| 
       41 
40 
     | 
    
         
             
                    search_score_nodes.each do |node|
         
     | 
| 
       42 
     | 
    
         
            -
                       
     | 
| 
       43 
     | 
    
         
            -
                      ss_values << node['value'].to_f
         
     | 
| 
      
 41 
     | 
    
         
            +
                      search_scores[node['name'].to_sym] = node['value'].to_f
         
     | 
| 
       44 
42 
     | 
    
         
             
                    end
         
     | 
| 
       45 
     | 
    
         
            -
                     
     | 
| 
       46 
     | 
    
         
            -
                    [aaseq, charge, *ss_values]
         
     | 
| 
      
 43 
     | 
    
         
            +
                    Ms::Ident::Pepxml::SearchHit::Simple.new(aaseq, charge, search_scores)
         
     | 
| 
       47 
44 
     | 
    
         
             
                  end
         
     | 
| 
       48 
45 
     | 
    
         
             
                end
         
     | 
| 
       49 
     | 
    
         
            -
                fields.push(*ss_names)
         
     | 
| 
       50 
     | 
    
         
            -
                peptide_hit_class = Struct.new(*fields)
         
     | 
| 
       51 
     | 
    
         
            -
                hit_values.map {|ar| peptide_hit_class.new(*ar) }
         
     | 
| 
       52 
46 
     | 
    
         
             
              end
         
     | 
| 
       53 
47 
     | 
    
         | 
| 
       54 
48 
     | 
    
         
             
              def pepxml_version
         
     | 
| 
         @@ -120,6 +120,7 @@ class Ms::Ident::Pepxml 
     | 
|
| 
       120 
120 
     | 
    
         
             
                end
         
     | 
| 
       121 
121 
     | 
    
         | 
| 
       122 
122 
     | 
    
         
             
                def from_pepxml_node(node)
         
     | 
| 
      
 123 
     | 
    
         
            +
                  node.attributes
         
     | 
| 
       123 
124 
     | 
    
         
             
                  self[0] = node['hit_rank'].to_i
         
     | 
| 
       124 
125 
     | 
    
         
             
                  self[1] = node['peptide']
         
     | 
| 
       125 
126 
     | 
    
         
             
                  self[2] = node['peptide_prev_aa']
         
     | 
| 
         @@ -135,6 +136,8 @@ class Ms::Ident::Pepxml 
     | 
|
| 
       135 
136 
     | 
    
         
             
                  self[12] = node['is_rejected'].to_i
         
     | 
| 
       136 
137 
     | 
    
         
             
                  self
         
     | 
| 
       137 
138 
     | 
    
         
             
                end
         
     | 
| 
      
 139 
     | 
    
         
            +
             
     | 
| 
      
 140 
     | 
    
         
            +
                Simple = Struct.new(:aaseq, :charge, :search_scores)
         
     | 
| 
       138 
141 
     | 
    
         
             
              end
         
     | 
| 
       139 
142 
     | 
    
         | 
| 
       140 
143 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version 
     | 
|
| 
       5 
5 
     | 
    
         
             
              segments: 
         
     | 
| 
       6 
6 
     | 
    
         
             
              - 0
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 0
         
     | 
| 
       8 
     | 
    
         
            -
              -  
     | 
| 
       9 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 8 
     | 
    
         
            +
              - 22
         
     | 
| 
      
 9 
     | 
    
         
            +
              version: 0.0.22
         
     | 
| 
       10 
10 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       11 
11 
     | 
    
         
             
            authors: 
         
     | 
| 
       12 
12 
     | 
    
         
             
            - John T. Prince
         
     | 
| 
         @@ -14,7 +14,7 @@ autorequire: 
     | 
|
| 
       14 
14 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       15 
15 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
            date: 2011-03- 
     | 
| 
      
 17 
     | 
    
         
            +
            date: 2011-03-31 00:00:00 -06:00
         
     | 
| 
       18 
18 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       19 
19 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       20 
20 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     |