MSAbundanceSim 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ms_abundance_sim.rb +10 -18
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15ce22fdc00a43ccd1de3e549b7686ce1163b640
|
4
|
+
data.tar.gz: 25bf60003d8eccaa9d02a7173528d7a58d58bddc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0e0e2327e26353dd960bd3986d958e397ade85c7145ba556abe7109bae38d9f21b16ec51b04b4e701d3ed9e24c8a90b56358cb8e002dc81e8d21737806de54d
|
7
|
+
data.tar.gz: 9ad8473d36030038fb20b2f94c1c39d0167fbb11ffbebc7e4e9f61bb4eb3d9cdc10ff863074e18e3448afb30128e78cc9c3e865fd745e60a85fc855ee2242f03
|
data/lib/ms_abundance_sim.rb
CHANGED
@@ -9,7 +9,7 @@ require 'set'
|
|
9
9
|
require 'yaml'
|
10
10
|
|
11
11
|
class MSAbundanceSim
|
12
|
-
VERSION = "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
|
81
|
-
# min_threshold AND a random number is less than the
|
82
|
-
# (i.e., a probability of 1 means downshifting will
|
83
|
-
|
84
|
-
|
85
|
-
|
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
|
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.
|
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-
|
11
|
+
date: 2017-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|