ms-error_rate 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/mascot_pepxml_to_peptide_hit_qvalues.rb +10 -34
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.8
|
@@ -4,7 +4,7 @@ require 'trollop'
|
|
4
4
|
require 'nokogiri'
|
5
5
|
require 'set'
|
6
6
|
|
7
|
-
require 'ms/error_rate/qvalue'
|
7
|
+
require 'ms/error_rate/qvalue/pepxml'
|
8
8
|
|
9
9
|
opts = Trollop::Parser.new do
|
10
10
|
banner %Q{usage: #{File.basename(__FILE__)} <fwd>.xml <decoy>.xml ...
|
@@ -12,50 +12,26 @@ outputs: <fwd>.phq.csv
|
|
12
12
|
phq.tsv?: see schema/peptide_hit_qvalues.phq.tsv
|
13
13
|
}
|
14
14
|
opt :z_together, "do not group by charge state", :default => false
|
15
|
+
opt :verbose, "be verbose", :default => false
|
15
16
|
end
|
16
17
|
|
17
|
-
DELIMITER = "\t"
|
18
|
-
|
19
18
|
opt = opts.parse(ARGV)
|
20
19
|
if ARGV.size == 0 || (ARGV.size%2 != 0)
|
21
20
|
puts "\n\n!! only even numbers of files accepted (target decoy target decoy ...) !!\n\n" if (ARGV.size%2 != 0)
|
22
21
|
opts.educate
|
23
22
|
exit
|
24
23
|
end
|
24
|
+
$VERBOSE = opt.delete(:verbose)
|
25
25
|
|
26
26
|
files = ARGV.to_a
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
File.open(file) do |io|
|
33
|
-
doc = Nokogiri::XML.parse(io, nil, nil, Nokogiri::XML::ParseOptions::DEFAULT_XML | Nokogiri::XML::ParseOptions::NOBLANKS)
|
34
|
-
# we can work with namespaces, or just remove them ...
|
35
|
-
doc.remove_namespaces!
|
36
|
-
root = doc.root
|
37
|
-
search_hits = root.xpath('//search_hit')
|
38
|
-
search_hits.map do |search_hit|
|
39
|
-
aaseq = search_hit['peptide']
|
40
|
-
ionscore = search_hit.children.find {|node| node.name == 'search_score' && node['name'] == 'ionscore' }['value'].to_f
|
41
|
-
charge = search_hit.parent.parent['assumed_charge'].to_i
|
42
|
-
PeptideHit.new(aaseq, charge, ionscore)
|
43
|
-
end
|
27
|
+
files.each_slice(2).map do |target, decoy|
|
28
|
+
hit_qvalue_pairs = Ms::ErrorRate::Qvalue::Pepxml.target_decoy_qvalues(target, decoy, opt, &:ionscore)
|
29
|
+
hits = [] ; qvals = []
|
30
|
+
hit_qvalue_pairs.each do |hit, qval|
|
31
|
+
hits << hit ; qvals << qval
|
44
32
|
end
|
33
|
+
outfile = Ms::Ident::PeptideHit::Qvalue.to_phq(target.chomp(File.ext(target)), hits, qvals)
|
34
|
+
puts "created: #{outfile}" if $VERBOSE
|
45
35
|
end
|
46
36
|
|
47
|
-
hits_per_target = peptide_hits_per_file.each_slice(2).map do |target_hits, decoy_hits|
|
48
|
-
pairs = Ms::ErrorRate::Qvalue.target_decoy_qvalues(target_hits, decoy_hits, :z_together => opt[:z_together], &:ionscore)
|
49
|
-
target_peptide_hits = pairs.map {|peptide_hit, qvalue| peptide_hit.qvalue = qvalue ; peptide_hit }
|
50
|
-
end
|
51
|
-
|
52
|
-
files.each_slice(2).map(&:first).zip(hits_per_target) do |file, hits|
|
53
|
-
newfile = file.chomp(File.extname(file)) + ".phq.tsv"
|
54
|
-
File.open(newfile,'w') do |out|
|
55
|
-
out.puts %w(aaseq charge qvalue).join(DELIMITER)
|
56
|
-
hits.each do |hit|
|
57
|
-
out.puts hit.values_at(0,1,3).join(DELIMITER)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
37
|
|
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
|
+
- 8
|
9
|
+
version: 0.0.8
|
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-30 00:00:00 -06:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|