bio-rocker 1.4.1 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/ROCker +10 -1
- data/lib/rocker.rb +2 -2
- data/lib/rocker/step/filter.rb +13 -8
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b4564c29d3e69957f820b74d06c5203d20e3ee5bf204f869ff4cf33ac5d88b6
|
4
|
+
data.tar.gz: 6c2b445e7af8c2375947f15833cf96cc7543870cc9661b737b7b110c3d260da6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03000a1b229e95178c63ea726048eefaac48f7adacd47ee7d72aef8e09c0dc7899fc40a1c1b850c98c8fad2536616292aa9e65944a6dcfd95ad53db8c0f896ae
|
7
|
+
data.tar.gz: 2751ba9bda4f54adf351ee4998782c2bde98a775ad3726e997f84e78d22ae0ff2ce29dfe705df60ddff9c656636c584fb30ce8485fadc2abab316eea7f3b0785
|
data/bin/ROCker
CHANGED
@@ -241,7 +241,10 @@ opts = OptionParser.new do |opt|
|
|
241
241
|
opt.on('-M', '--max-length-correction FLOAT',
|
242
242
|
'Maximum length correction, as a read length fraction.',
|
243
243
|
'By default: 0.4.'){ |v| o[:lencorr_max] = v.to_f }
|
244
|
-
|
244
|
+
opt.on('-P', '--length-correction-penalty FLOAT',
|
245
|
+
'Penalty for length correction. By default uses the triangle method.',
|
246
|
+
'Recommended value: 0.5.'){ |v| o[:lencorr_pen] = v.to_f }
|
247
|
+
|
245
248
|
opt.separator ""
|
246
249
|
opt.separator "+ EXTERNAL SOFTWARE OPTIONS"
|
247
250
|
opt.on("--search STR",
|
@@ -266,6 +269,7 @@ opts = OptionParser.new do |opt|
|
|
266
269
|
["By default if --search #{k}:",
|
267
270
|
"'" + ROCker.default(:makedbcmd)[k] + "'" ]
|
268
271
|
end.flatten ){ |v| o[:makedbcmd]=v }
|
272
|
+
|
269
273
|
when "filter"
|
270
274
|
opt.separator "+ FILTERING ARGUMENTS"
|
271
275
|
opt.on("-k", "--rocker PATH",
|
@@ -282,6 +286,10 @@ opts = OptionParser.new do |opt|
|
|
282
286
|
opt.on('-M', '--max-length-correction FLOAT',
|
283
287
|
'Maximum length correction, as a read length fraction.',
|
284
288
|
'By default: 0.4.'){ |v| o[:lencorr_max] = v.to_f }
|
289
|
+
opt.on('-P', '--length-correction-penalty FLOAT',
|
290
|
+
'Penalty for length correction. By default uses the triangle method.',
|
291
|
+
'Recommended value: 0.5.'){ |v| o[:lencorr_pen] = v.to_f }
|
292
|
+
|
285
293
|
when "plot"
|
286
294
|
opt.separator "+ PLOTTING ARGUMENTS"
|
287
295
|
opt.on("-k", "--rocker PATH",
|
@@ -327,6 +335,7 @@ opts = OptionParser.new do |opt|
|
|
327
335
|
"Height of the plot in inches. By default: " +
|
328
336
|
ROCker.default(:height).to_s +
|
329
337
|
"."){ |v| o[:width]=v.to_f }
|
338
|
+
|
330
339
|
else
|
331
340
|
opt.banner = "Usage: ROCker.rb [task] [options]"
|
332
341
|
opt.separator ""
|
data/lib/rocker.rb
CHANGED
@@ -9,13 +9,13 @@ require 'rocker/rocdata'
|
|
9
9
|
|
10
10
|
class ROCker
|
11
11
|
#================================[ Class ]
|
12
|
-
@@VERSION = '1.
|
12
|
+
@@VERSION = '1.5.0'
|
13
13
|
@@CITATION = [
|
14
14
|
'Orellana, Rodriguez-R & Konstantinidis, 2016. DOI:10.1093/nar/gkw900.',
|
15
15
|
'ROCker: accurate detection and quantification of target genes in',
|
16
16
|
'short-read metagenomic data sets by modeling sliding-window bitscores.',
|
17
17
|
'Nucleic Acids Research 45(3):e14.']
|
18
|
-
@@DATE = '2019-
|
18
|
+
@@DATE = '2019-08-01'
|
19
19
|
@@DEFAULTS = {
|
20
20
|
# General
|
21
21
|
q: false, r: 'R', nucl: false, debug: false, thr: 2, search: :blast,
|
data/lib/rocker/step/filter.rb
CHANGED
@@ -48,7 +48,8 @@ class ROCker
|
|
48
48
|
bh = BlastHit.new(ln, data.aln)
|
49
49
|
next if bh.sbj.nil? # <- When the hit is not against a known target
|
50
50
|
bs = @o[:lencorr].nil? ? bh.bits :
|
51
|
-
correct_bs(bh, readlengths[bh.qry], exp_readlen,
|
51
|
+
correct_bs(bh, readlengths[bh.qry], exp_readlen,
|
52
|
+
@o[:lencorr_max], @o[:lencorr_pen])
|
52
53
|
oh.print ln if not(bh.sfrom.nil?) and
|
53
54
|
bs >= data.win_at_col(bh.midpoint).thr
|
54
55
|
end
|
@@ -56,16 +57,20 @@ class ROCker
|
|
56
57
|
oh.close
|
57
58
|
end # filter!
|
58
59
|
|
59
|
-
def correct_bs(bh, readlen, exp_readlen, max_corr)
|
60
|
+
def correct_bs(bh, readlen, exp_readlen, max_corr, penalty)
|
60
61
|
bs = bh.bits
|
61
62
|
return bs if @o[:lencorr].nil? or readlen.nil? or readlen >= exp_readlen
|
62
63
|
bits_per_aa = bs.to_f / readlen
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
64
|
+
if penalty.nil? or penalty > 1.0
|
65
|
+
miss = [exp_readlen - readlen, max_corr * readlen].min
|
66
|
+
return bs + (bits_per_aa * miss * penalty)
|
67
|
+
else
|
68
|
+
extra = [0.0, readlen * (max_corr + 1.0) - exp_readlen].max
|
69
|
+
max_tri = max_corr * readlen * bits_per_aa / 2
|
70
|
+
tanTheta = max_corr > 0.0 ? bits_per_aa / (max_corr * readlen) : 0.0
|
71
|
+
extra_tri = extra * extra * tanTheta / 2
|
72
|
+
return bs + (max_tri - extra_tri)
|
73
|
+
end
|
69
74
|
end
|
70
75
|
end # ROCker
|
71
76
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bio-rocker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luis (Coto) Orellana
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-08-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -81,7 +81,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
requirements: []
|
84
|
-
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 2.7.6
|
85
86
|
signing_key:
|
86
87
|
specification_version: 4
|
87
88
|
summary: ROCker
|