ms-quant 0.0.3 → 0.0.4

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 CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -165,8 +165,6 @@ protein_groups.each do |protein_group|
165
165
  protein_group.peptide_hits.each {|hit| pephit_to_protein_groups[hit] << protein_group }
166
166
  end
167
167
 
168
- # partition them all out by filename
169
-
170
168
  counts_parallel_to_names_with_counts_per_group = samplenames.map do |name|
171
169
  pep_hit_to_prot_groups = Hash.new {|h,k| h[k] = [] }
172
170
  groups_of_pephits = protein_groups.map do |prot_group|
@@ -175,9 +173,9 @@ counts_parallel_to_names_with_counts_per_group = samplenames.map do |name|
175
173
  pep_hit_to_prot_groups[pep_hit] << prot_group
176
174
  end # returns the group of pep_hits
177
175
  end
178
- counts = Ms::Quant::SpectralCounts.counts(groups_of_pephits) # do |pephit|
179
- # pephit_to_protein_groups[pephit].size
180
- #end
176
+ counts = Ms::Quant::SpectralCounts.counts(groups_of_pephits) do |pephit|
177
+ pephit_to_protein_groups[pephit].size
178
+ end
181
179
  end
182
180
 
183
181
  if opt[:qspec] || opt[:descriptions]
@@ -222,10 +220,17 @@ end
222
220
  header_cats.push( *%w(BestID AllIDs) )
223
221
  header_cats.push( 'Description' ) if opt[:descriptions]
224
222
 
223
+ sort_protein_id =
224
+ if id_to_length
225
+ lambda {|prot_id| [prot_id, -id_to_length[prot_id]] }
226
+ else
227
+ lambda {|prot_id| prot_id }
228
+ end
229
+
225
230
  protein_groups.zip(ar_of_rows) do |zipped|
226
231
  (pg, row) = zipped
227
232
  # swiss-prot and then the shortest
228
- best_protid = pg.sort_by {|prot_id| [prot_id, -id_to_length[prot_id]] }.first
233
+ best_protid = pg.sort_by(&sort_protein_id).first
229
234
  (gene_id, desc) =
230
235
  if opt[:descriptions]
231
236
  desc = id_to_desc[best_protid]
@@ -238,8 +243,6 @@ protein_groups.zip(ar_of_rows) do |zipped|
238
243
  row.push(desc) if desc
239
244
  end
240
245
 
241
- ### SORT???
242
-
243
246
  File.open(opt[:outfile],'w') do |out|
244
247
  out.puts header_cats.join(delimiter)
245
248
  ar_of_rows.each {|row| out.puts row.join(delimiter) }
@@ -28,11 +28,11 @@ class Ms::Quant::Qspec
28
28
  def self.results_array(resultsfile)
29
29
  rows = IO.readlines(resultsfile).map {|line| line.chomp.split("\t") }
30
30
  headers = rows.shift
31
+ start_bayes = headers.index {|v| v =~ /BayesFactor/i }
31
32
  rows.map do |row|
32
33
  data = [row[0]]
33
- data.push( *row[1,2].map(&:to_i) )
34
- data.push( *row[3,4].map(&:to_f) )
35
- data.push( row[7] )
34
+ data.push( *row[start_bayes,4].map(&:to_f) )
35
+ data.push( row[start_bayes+4] )
36
36
  Results.new(*data)
37
37
  end
38
38
  end
@@ -74,18 +74,19 @@ class Ms::Quant::Qspec
74
74
  write(tfile.path)
75
75
  qspec_exe = self.class.executable(conditions)
76
76
  cmd = [qspec_exe, tfile.path, NBURNIN, NITER, (normalize ? 1 : 0)].join(' ')
77
- puts "running #{cmd}" if $VERBOSE
77
+ if $VERBOSE
78
+ puts "running #{cmd}" if $VERBOSE
79
+ else
80
+ cmd << " 2>&1"
81
+ end
78
82
  reply = `#{cmd}`
79
83
  puts reply if $VERBOSE
80
- results = self.class.results_array(tfile.path + Results::EXT)
84
+ results = self.class.results_array(tfile.path + '_' + qspec_exe)
81
85
  tfile.unlink
82
86
  results
83
87
  end
84
88
 
85
89
  # for version 2 of QSpec
86
- Results = Struct.new(:protid, :set0, :set1, :bayes_factor, :fold_change, :rb_stat, :fdr, :flag)
87
- class Results
88
- EXT = '_qspec'
89
- end
90
+ Results = Struct.new(:protid, :bayes_factor, :fold_change, :rb_stat, :fdr, :flag)
90
91
  end
91
92
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
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-31 00:00:00 -06:00
17
+ date: 2011-04-04 00:00:00 -06:00
18
18
  default_executable: peptide_hit_qvalues_to_spectral_counts_table.rb
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency