MSAbundanceSim 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ms_abundance_sim.rb +10 -18
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 268fcffc387bab3d7171a689587d31608f310caa
4
- data.tar.gz: c96eec4ada2a66919d2cb169386dedd67b3ecaf6
3
+ metadata.gz: 15ce22fdc00a43ccd1de3e549b7686ce1163b640
4
+ data.tar.gz: 25bf60003d8eccaa9d02a7173528d7a58d58bddc
5
5
  SHA512:
6
- metadata.gz: f04254780acc303a1740e788e55f4e29293f46e38f4a1a1f65d9718019485602d47de1ed20e506c0db7f35c87a67ba216a3b8f1cea04a7f952f456b289f53b60
7
- data.tar.gz: edc6f893102eedcef87ba5e413dfd7dc1abc7ac3b99ee598b9d94dddab5cc67164c6ad351fed1fa26223d235ebb8e511124bce727612359f83f922a2834a96b8
6
+ metadata.gz: f0e0e2327e26353dd960bd3986d958e397ade85c7145ba556abe7109bae38d9f21b16ec51b04b4e701d3ed9e24c8a90b56358cb8e002dc81e8d21737806de54d
7
+ data.tar.gz: 9ad8473d36030038fb20b2f94c1c39d0167fbb11ffbebc7e4e9f61bb4eb3d9cdc10ff863074e18e3448afb30128e78cc9c3e865fd745e60a85fc855ee2242f03
@@ -9,7 +9,7 @@ require 'set'
9
9
  require 'yaml'
10
10
 
11
11
  class MSAbundanceSim
12
- VERSION = "0.2.0"
12
+ VERSION = "0.3.0"
13
13
  end
14
14
 
15
15
  ProteinEntry = Struct.new(:entry_line_wo_abundance, :abundances, :additional_lines) do
@@ -34,9 +34,8 @@ class MSAbundanceSim
34
34
  control_variance: 1,
35
35
  case_variance: 2,
36
36
  output_abundance_separator: " #",
37
- downshift_min_threshold: 0,
37
+ downshift_min_threshold: 1.0,
38
38
  downshift_probability_threshold: 0.75,
39
- downshift_amount: 1,
40
39
  }
41
40
 
42
41
  class << self
@@ -77,12 +76,13 @@ class MSAbundanceSim
77
76
  return pert_fc * sign
78
77
  end
79
78
 
80
- # takes 'value' and subtracts 'amount' from it if 'value' is greater than
81
- # min_threshold AND a random number is less than the probability_threshold
82
- # (i.e., a probability of 1 means downshifting will happen to all values).
83
- def downshift(value, min_threshold, probability_threshold, amount, random=rand())
84
- if (value > min_threshold) && (random < probability_threshold)
85
- value - amount
79
+ # takes 'value' and subtracts rand(min_threshold..value) from it if
80
+ # 'value' is >= min_threshold AND a random number is less than the
81
+ # probability_threshold (i.e., a probability of 1 means downshifting will
82
+ # happen to all values).
83
+ def downshift(value, min_threshold, probability_threshold, random=rand())
84
+ if (value >= min_threshold) && (random < probability_threshold)
85
+ value - rand(min_threshold..value)
86
86
  else
87
87
  value
88
88
  end
@@ -136,7 +136,7 @@ class MSAbundanceSim
136
136
 
137
137
  fold_change = MSAbundanceSim.get_fold_change(protein_entry.abundances, variance, max_abundance)
138
138
 
139
- downshift_params = %w(min_threshold probability_threshold amount)
139
+ downshift_params = %w(min_threshold probability_threshold)
140
140
  .map {|key| 'downshift_' + key }
141
141
  .map(&:to_sym)
142
142
  .map {|key| opts[key] }
@@ -279,14 +279,6 @@ class MSAbundanceSim
279
279
  "some fold changes."
280
280
  ) {|v| opts[:downshift_probability_threshold] = v }
281
281
 
282
- op.on(
283
- "--downshift-amount<#{defaults[:downshift_amount]}>",
284
- Float,
285
- "Amount the fold change will be altered",
286
- "if meeting the threshold and probability-",
287
- "threshold."
288
- ) {|v| opts[:downshift_amount] = v }
289
-
290
282
  op.on("--verbose", "talk about it") {|v| $VERBOSE = 3 }
291
283
  end
292
284
  [parser, opts]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: MSAbundanceSim
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Smith, John T. Prince
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-18 00:00:00.000000000 Z
11
+ date: 2017-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler