ms-error_rate 0.0.11 → 0.0.12
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/VERSION +1 -1
- data/bin/mascot_pepxml_to_peptide_hit_qvalues.rb +18 -7
- data/lib/ms/error_rate/qvalue.rb +0 -1
- metadata +3 -5
- data/bin/fasta_to_protein_length.rb +0 -20
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0.0. | 
| 1 | 
            +
            0.0.12
         | 
| @@ -6,6 +6,12 @@ require 'set' | |
| 6 6 |  | 
| 7 7 | 
             
            require 'ms/ident/pepxml'
         | 
| 8 8 | 
             
            require 'ms/ident/peptide_hit/qvalue'
         | 
| 9 | 
            +
            require 'ms/error_rate/qvalue'
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            def putsv(*args)
         | 
| 12 | 
            +
              puts(*args) if $VERBOSE
         | 
| 13 | 
            +
              $stdout.flush
         | 
| 14 | 
            +
            end
         | 
| 9 15 |  | 
| 10 16 | 
             
            EXT = Ms::Ident::PeptideHit::Qvalue::FILE_EXTENSION
         | 
| 11 17 | 
             
            combine_base  = "combined"
         | 
| @@ -32,33 +38,38 @@ $VERBOSE = opt.delete(:verbose) | |
| 32 38 |  | 
| 33 39 | 
             
            files = ARGV.to_a
         | 
| 34 40 |  | 
| 35 | 
            -
            files.each_slice(2).map | 
| 41 | 
            +
            (files=files.each_slice(2).map(&:reverse).flatten) if opt[:decoy_first]
         | 
| 36 42 |  | 
| 37 43 | 
             
            groups_of_search_hits = files.map do |file|
         | 
| 38 | 
            -
               | 
| 44 | 
            +
              putsv "reading search hits: #{file}"
         | 
| 45 | 
            +
              Ms::Ident::Pepxml.simple_search_hits(file)
         | 
| 39 46 | 
             
            end
         | 
| 40 47 |  | 
| 41 48 | 
             
            to_run = {}
         | 
| 42 49 | 
             
            if opt[:combine]
         | 
| 50 | 
            +
              putsv "combining all target hits together and all decoy hits together"
         | 
| 43 51 | 
             
              all_target = [] ; all_decoy = []
         | 
| 44 52 | 
             
              groups_of_search_hits.each_slice(2) do |target_hits,decoy_hits| 
         | 
| 45 53 | 
             
                all_target.push(*target_hits) ; all_decoy.push(*decoy_hits)
         | 
| 46 54 | 
             
              end
         | 
| 47 | 
            -
              to_run[combine_base] = [all_target, all_decoy]
         | 
| 55 | 
            +
              to_run[combine_base + EXT] = [all_target, all_decoy]
         | 
| 48 56 | 
             
            else
         | 
| 49 | 
            -
              groups_of_search_hits.each_slice(2) | 
| 50 | 
            -
                 | 
| 57 | 
            +
              files.zip(groups_of_search_hits).each_slice(2) do |pair_of_file_and_hit_pairs|
         | 
| 58 | 
            +
                (tfile_hits, dfile_hits) = pair_of_file_and_hit_pairs
         | 
| 59 | 
            +
                file = tfile_hits.first
         | 
| 60 | 
            +
                to_run[file.chomp(File.extname(file)) + EXT] = [tfile_hits.last, dfile_hits.last]
         | 
| 51 61 | 
             
              end
         | 
| 52 62 | 
             
            end
         | 
| 53 63 |  | 
| 54 64 | 
             
            to_run.each do |file, target_decoy_pair|
         | 
| 55 | 
            -
               | 
| 65 | 
            +
              putsv "calculating qvalues for #{file}"
         | 
| 66 | 
            +
              hit_qvalue_pairs = Ms::ErrorRate::Qvalue.target_decoy_qvalues(target_decoy_pair.first, target_decoy_pair.last, :z_together => opt[:z_together]) {|hit| hit.search_scores[:ionscore] }
         | 
| 56 67 | 
             
              hits = [] ; qvals = []
         | 
| 57 68 | 
             
              hit_qvalue_pairs.each do |hit, qval|
         | 
| 58 69 | 
             
                hits << hit ; qvals << qval
         | 
| 59 70 | 
             
              end
         | 
| 60 71 | 
             
              outfile = Ms::Ident::PeptideHit::Qvalue.to_file(file, hits, qvals)
         | 
| 61 | 
            -
               | 
| 72 | 
            +
              putsv "created: #{outfile}"
         | 
| 62 73 | 
             
            end
         | 
| 63 74 |  | 
| 64 75 |  | 
    
        data/lib/ms/error_rate/qvalue.rb
    CHANGED
    
    
    
        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 | 
            +
              - 12
         | 
| 9 | 
            +
              version: 0.0.12
         | 
| 10 10 | 
             
            platform: ruby
         | 
| 11 11 | 
             
            authors: 
         | 
| 12 12 | 
             
            - John 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 
         | 
| @@ -95,7 +95,6 @@ executables: | |
| 95 95 | 
             
            - fasta_to_nuclear.rb
         | 
| 96 96 | 
             
            - fasta_to_peptide_centric_db.rb
         | 
| 97 97 | 
             
            - fasta_to_phobius.rb
         | 
| 98 | 
            -
            - fasta_to_protein_length.rb
         | 
| 99 98 | 
             
            - generate_sbv_input_hashes.rb
         | 
| 100 99 | 
             
            - mascot_pepxml_to_peptide_hit_qvalues.rb
         | 
| 101 100 | 
             
            - phobius_to_nontransmembrane.rb
         | 
| @@ -117,7 +116,6 @@ files: | |
| 117 116 | 
             
            - bin/fasta_to_nuclear.rb
         | 
| 118 117 | 
             
            - bin/fasta_to_peptide_centric_db.rb
         | 
| 119 118 | 
             
            - bin/fasta_to_phobius.rb
         | 
| 120 | 
            -
            - bin/fasta_to_protein_length.rb
         | 
| 121 119 | 
             
            - bin/generate_sbv_input_hashes.rb
         | 
| 122 120 | 
             
            - bin/mascot_pepxml_to_peptide_hit_qvalues.rb
         | 
| 123 121 | 
             
            - bin/phobius_to_nontransmembrane.rb
         | 
| @@ -1,20 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/env ruby
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            if ARGV.size == 0
         | 
| 4 | 
            -
              puts "usage: #{File.basename(__FILE__)} <file>.fasta ..."
         | 
| 5 | 
            -
              puts "output: <file>.protid_to_size.yml"
         | 
| 6 | 
            -
              exit
         | 
| 7 | 
            -
            end
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            ARGV.each do |file|
         | 
| 10 | 
            -
              base = file.chomp(File.extname(file))
         | 
| 11 | 
            -
              outfile = base + ".protid_to_size.yml"
         | 
| 12 | 
            -
              cnt = 0
         | 
| 13 | 
            -
              File.open(outfile,'w') do |out|
         | 
| 14 | 
            -
                Ms::Fasta.foreach(file) do |entry|
         | 
| 15 | 
            -
                  out.puts "#{entry.entry_id}: #{entry.sequence.size}"
         | 
| 16 | 
            -
                  cnt += 1
         | 
| 17 | 
            -
                end
         | 
| 18 | 
            -
              end
         | 
| 19 | 
            -
              puts "wrote #{cnt} protein lengths to: #{outfile}"
         | 
| 20 | 
            -
            end
         |