ms-error_rate 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.11
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!(&:reverse) if opt[:decoy_first]
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
- Ms::Ident::Pepxml.search_hits(file)
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).zip(files) do |target_hits_and_decoy_hits, file|
50
- to_run[file.chomp(File.extname(file)) + EXT] = target_hits_and_decoy_hits
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
- hit_qvalue_pairs = Ms::ErrorRate::Qvalue.target_decoy_qvalues(target_decoy_pair.first, target_decoy_pair.last, :z_together => opt[:z_together])
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
- puts "created: #{outfile}" if $VERBOSE
72
+ putsv "created: #{outfile}"
62
73
  end
63
74
 
64
75
 
@@ -2,7 +2,6 @@
2
2
  require 'set'
3
3
  require 'ms/error_rate/decoy'
4
4
 
5
-
6
5
  class Array
7
6
  def group_by(&block)
8
7
  hash = Hash.new {|h,k| h[k] = [] }
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 11
9
- version: 0.0.11
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-30 00:00:00 -06:00
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