transrate 0.0.16 → 0.1.0
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.
- checksums.yaml +4 -4
- data/bin/transrate +9 -6
- data/lib/transrate/assembly.rb +18 -15
- data/lib/transrate/transrater.rb +3 -1
- data/lib/transrate/version.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfac9099c06f657ebaa995763f287339e1527a5d
|
4
|
+
data.tar.gz: 5281dc92d37cccc7f518622c223ffcbdeef86fff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56715785fb5dd0f8f50cae0092d35cb5ef38c80a84c4f9575cac936f520056fac3e5c626a56d07b83bcaf12d5827472d8ca6378b33bed4efd4fcebc12a122a4c
|
7
|
+
data.tar.gz: 032e000796a0df849f2650cf861c9a5756272c0cde7fb8ffd3ba0a31117e003c5806a717f10fcc021947048ba12578ae8016ad6944f0b5f22953a899c5d88198
|
data/bin/transrate
CHANGED
@@ -141,14 +141,17 @@ opts.assembly.split(',').each do |assembly|
|
|
141
141
|
end
|
142
142
|
|
143
143
|
log "Comparative metrics done in #{Time.now - t0} seconds"
|
144
|
-
end
|
145
144
|
|
146
|
-
|
147
|
-
|
148
|
-
score = transrater.assembly_score
|
149
|
-
unless score.nil?
|
150
|
-
log "OVERALL SCORE: #{score.to_f.round(2) * 100}%"
|
145
|
+
|
146
|
+
log "\n"
|
151
147
|
log "-" * report_width
|
148
|
+
score = transrater.assembly_score
|
149
|
+
unless score.nil?
|
150
|
+
log "OVERALL SCORE: #{score.to_f.round(2) * 100}%"
|
151
|
+
log "-" * report_width
|
152
|
+
end
|
153
|
+
else
|
154
|
+
log "\nNo reference provided, skipping comparative diagnostics"
|
152
155
|
end
|
153
156
|
|
154
157
|
all << contig_results.
|
data/lib/transrate/assembly.rb
CHANGED
@@ -87,6 +87,9 @@ module Transrate
|
|
87
87
|
# @return [Hash] basic statistics about the assembly
|
88
88
|
def basic_stats threads=8
|
89
89
|
|
90
|
+
# disable threading basic stats for now
|
91
|
+
threads = 1
|
92
|
+
|
90
93
|
# create a work queue to process contigs in parallel
|
91
94
|
queue = Queue.new
|
92
95
|
|
@@ -167,10 +170,10 @@ module Transrate
|
|
167
170
|
# the next value to set the next cutoff. we take a copy
|
168
171
|
# of the Array so we can use the intact original to collect
|
169
172
|
# the results later
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
173
|
+
x = [90, 70, 50, 30, 10]
|
174
|
+
x2 = x.clone
|
175
|
+
cutoff = x2.pop / 100.0
|
176
|
+
res = []
|
174
177
|
n1k = 0
|
175
178
|
n10k = 0
|
176
179
|
orf_length_sum = 0
|
@@ -193,19 +196,20 @@ module Transrate
|
|
193
196
|
# cutoff has been reached. if it has, store the Nx value and
|
194
197
|
# get the next cutoff
|
195
198
|
cumulative_length += contig.length
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
199
|
+
if cumulative_length >= @n_bases * cutoff
|
200
|
+
res << contig.length
|
201
|
+
if x2.empty?
|
202
|
+
cutoff=1
|
203
|
+
else
|
204
|
+
cutoff = x2.pop / 100.0
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
204
208
|
end
|
205
209
|
|
206
210
|
# calculate and return the statistics as a hash
|
207
211
|
mean = cumulative_length / @assembly.size
|
208
|
-
|
212
|
+
ns = Hash[x.map { |n| "N#{n}" }.zip(res)]
|
209
213
|
{
|
210
214
|
'n_seqs' => bin.size,
|
211
215
|
'smallest' => bin.first.length,
|
@@ -215,8 +219,7 @@ module Transrate
|
|
215
219
|
'n_1k' => n1k,
|
216
220
|
'n_10k' => n10k,
|
217
221
|
'orf_percent' => 300 * orf_length_sum / (@assembly.size * mean)
|
218
|
-
}
|
219
|
-
# }.merge ns
|
222
|
+
}.merge ns
|
220
223
|
|
221
224
|
end # basic_bin_stats
|
222
225
|
|
data/lib/transrate/transrater.rb
CHANGED
@@ -24,7 +24,9 @@ module Transrate
|
|
24
24
|
# @param insertsd [Integer] standard deviation of the read pair insert size
|
25
25
|
def initialize assembly, reference, left=nil, right=nil, insertsize=nil, insertsd=nil
|
26
26
|
@assembly = assembly.is_a?(Assembly) ? assembly : Assembly.new(assembly)
|
27
|
-
|
27
|
+
if reference
|
28
|
+
@reference = reference.is_a?(Assembly) ? reference : Assembly.new(reference)
|
29
|
+
end
|
28
30
|
@read_metrics = ReadMetrics.new @assembly
|
29
31
|
@comparative_metrics = ComparativeMetrics.new(@assembly, @reference)
|
30
32
|
end
|
data/lib/transrate/version.rb
CHANGED