transrate 0.0.8 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/bin/transrate +11 -3
- data/lib/transrate.rb +4 -1
- data/lib/transrate/#assembly.rb# +130 -0
- data/lib/transrate/assembly.rb +28 -7
- data/lib/transrate/bowtie2.rb +4 -4
- data/lib/transrate/comparative_metrics.rb +8 -3
- data/lib/transrate/dimension_reduce.rb +18 -0
- data/lib/transrate/express.rb +37 -0
- data/lib/transrate/metric.rb +16 -0
- data/lib/transrate/read_metrics.rb +28 -6
- data/lib/transrate/reciprocal_annotation.rb +5 -3
- data/lib/transrate/transrater.rb +17 -2
- data/lib/transrate/usearch.rb +23 -17
- data/lib/transrate/version.rb +1 -1
- data/transrate.gemspec +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4a7687e1bc2071fe2f043245e1eff90742f4f1e
|
4
|
+
data.tar.gz: 61ef6386c15fe8d56485c8c5737d3283aefaede3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42ab6bc0454bd683798c5e9a1d93a7687fd3282bac182275901b89435dc3c90203dc3ffab12ad128fdf4ebab99702df816f3534917a061da6efdbd120e85cf9b
|
7
|
+
data.tar.gz: fed477db5ad8a33560bdf25a9bff9185638e49e418ccd5fcf9808235034abbc03ea1c7dded07520f4e4d0bff3f784146417a7e11c58cf938a4007bc71e7c15fc
|
data/.gitignore
CHANGED
data/bin/transrate
CHANGED
@@ -39,7 +39,7 @@ EOS
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def pretty_print_hash hash, width
|
42
|
-
hash.map{ |k, v| "#{k.to_s}#{" " * (width - (k.length + v.
|
42
|
+
hash.map{ |k, v| "#{k.to_s}#{" " * (width - (k.length + v.to_f.round(2).to_s.length))}#{v.to_f.round(2)}" }.join("\n")
|
43
43
|
end
|
44
44
|
|
45
45
|
include Transrate
|
@@ -59,7 +59,8 @@ if (opts.left && opts.right)
|
|
59
59
|
puts "\ncalculating read diagnostics..."
|
60
60
|
t0 = Time.now
|
61
61
|
read_metrics = ReadMetrics.new a
|
62
|
-
|
62
|
+
read_metrics.run(opts.left, opts.right)
|
63
|
+
read_results = read_metrics.read_stats
|
63
64
|
puts "...done in #{Time.now - t0} seconds"
|
64
65
|
else
|
65
66
|
puts "\nno reads provided, skipping read diagnostics"
|
@@ -68,7 +69,8 @@ end
|
|
68
69
|
puts "\ncalculating comparative metrics..."
|
69
70
|
t0 = Time.now
|
70
71
|
comparative_metrics = ComparativeMetrics.new(a, r)
|
71
|
-
|
72
|
+
comparative_metrics.run
|
73
|
+
comparative_results = comparative_metrics.comp_stats
|
72
74
|
puts "...done in #{Time.now - t0} seconds"
|
73
75
|
|
74
76
|
report_width = 30
|
@@ -93,3 +95,9 @@ if comparative_results
|
|
93
95
|
puts "-" * report_width
|
94
96
|
puts pretty_print_hash(comparative_results, report_width)
|
95
97
|
end
|
98
|
+
|
99
|
+
transrater = Transrater.new(a, r, opts.left, opts.right)
|
100
|
+
transrater.run(opts.left, opts.right)
|
101
|
+
puts "\n\n"
|
102
|
+
puts "Overall score #{transrater.assembly_score.to_f.round(2)}"
|
103
|
+
puts "\n" + "-" * report_width
|
data/lib/transrate.rb
CHANGED
@@ -6,4 +6,7 @@ require 'transrate/read_metrics'
|
|
6
6
|
require 'transrate/usearch'
|
7
7
|
require 'transrate/rb_hit'
|
8
8
|
require 'transrate/reciprocal_annotation'
|
9
|
-
require 'transrate/comparative_metrics'
|
9
|
+
require 'transrate/comparative_metrics'
|
10
|
+
require 'transrate/metric'
|
11
|
+
require 'transrate/dimension_reduce'
|
12
|
+
require 'transrate/express'
|
@@ -0,0 +1,130 @@
|
|
1
|
+
require 'bio'
|
2
|
+
require 'bettersam'
|
3
|
+
require 'csv'
|
4
|
+
require 'forwardable'
|
5
|
+
|
6
|
+
module Transrate
|
7
|
+
|
8
|
+
class Assembly
|
9
|
+
|
10
|
+
include Enumerable
|
11
|
+
extend Forwardable
|
12
|
+
def_delegators :@assembly, :each, :<<
|
13
|
+
|
14
|
+
attr_accessor :ublast_db
|
15
|
+
attr_accessor :orfs_ublast_db
|
16
|
+
attr_accessor :protein
|
17
|
+
attr_reader :assembly
|
18
|
+
|
19
|
+
# number of bases in the assembly
|
20
|
+
attr_writer :n_bases
|
21
|
+
|
22
|
+
# assembly filename
|
23
|
+
attr_accessor :file
|
24
|
+
|
25
|
+
# assembly n50
|
26
|
+
attr_reader :n50
|
27
|
+
|
28
|
+
# Reuturn a new Assembly.
|
29
|
+
#
|
30
|
+
# - +:file+ - path to the assembly FASTA file
|
31
|
+
def initialize file
|
32
|
+
@file = file
|
33
|
+
@assembly = []
|
34
|
+
@n_bases = 0
|
35
|
+
Bio::FastaFormat.open(file).each do |entry|
|
36
|
+
@n_bases += entry.length
|
37
|
+
@assembly << entry
|
38
|
+
end
|
39
|
+
@assembly.sort_by! { |x| x.length }
|
40
|
+
end
|
41
|
+
|
42
|
+
# Return a new Assembly object by loading sequences
|
43
|
+
# from the FASTA-format +:file+
|
44
|
+
def self.stats_from_fasta file
|
45
|
+
a = Assembly.new file
|
46
|
+
a.basic_stats
|
47
|
+
end
|
48
|
+
|
49
|
+
def run
|
50
|
+
stats = self.basic_stats
|
51
|
+
stats.each_pair do |key, value|
|
52
|
+
ivar = "@#{key.gsub(/ /, '_')}".to_sym
|
53
|
+
self.instance_variable_set(ivar, value)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Return a hash of statistics about this assembly
|
58
|
+
def basic_stats
|
59
|
+
cumulative_length = 0.0
|
60
|
+
# we'll calculate Nx for all these x
|
61
|
+
x = [90, 70, 50, 30, 10]
|
62
|
+
x2 = x.clone
|
63
|
+
cutoff = x2.pop / 100.0
|
64
|
+
res = []
|
65
|
+
n1k = 0
|
66
|
+
n10k = 0
|
67
|
+
orf_length_sum = 0
|
68
|
+
@assembly.each do |s|
|
69
|
+
n1k += 1 if s.length > 1_000
|
70
|
+
n10k += 1 if s.length > 10_000
|
71
|
+
orf_length_sum += orf_length(s.seq)
|
72
|
+
|
73
|
+
cumulative_length += s.length
|
74
|
+
if cumulative_length >= @n_bases * cutoff
|
75
|
+
res << s.length
|
76
|
+
if x2.empty?
|
77
|
+
cutoff=1
|
78
|
+
else
|
79
|
+
cutoff = x2.pop / 100.0
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
mean = cumulative_length / @assembly.size
|
85
|
+
ns = Hash[x.map { |n| "N#{n}" }.zip(res)]
|
86
|
+
{
|
87
|
+
"n_seqs" => @assembly.size,
|
88
|
+
"smallest" => @assembly.first.length,
|
89
|
+
"largest" => @assembly.last.length,
|
90
|
+
"n_bases" => @n_bases,
|
91
|
+
"mean_len" => mean,
|
92
|
+
"n_1k" => n1k,
|
93
|
+
"n_10k" => n10k,
|
94
|
+
"orf percent" => 300*orf_length_sum/(@assembly.size*mean)
|
95
|
+
}.merge ns
|
96
|
+
end
|
97
|
+
|
98
|
+
# finds longest orf in a sequence
|
99
|
+
def orf_length sequence
|
100
|
+
longest=0
|
101
|
+
(1..6).each do |frame|
|
102
|
+
translated = Bio::Sequence::NA.new(sequence).translate(frame)
|
103
|
+
translated.split(/\*/).each do |orf|
|
104
|
+
if orf.length > longest
|
105
|
+
longest=orf.length
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
return longest
|
110
|
+
end
|
111
|
+
|
112
|
+
# return the number of bases in the assembly, calculating
|
113
|
+
# from the assembly if it hasn't already been done.
|
114
|
+
def n_bases
|
115
|
+
unless @n_bases
|
116
|
+
@n_bases = 0
|
117
|
+
@assembly.each { |s| @n_bases += s.length }
|
118
|
+
end
|
119
|
+
@n_bases
|
120
|
+
end
|
121
|
+
|
122
|
+
def print_stats
|
123
|
+
self.basic_stats.map do |k, v|
|
124
|
+
"#{k}#{" " * (20 - (k.length + v.to_i.to_s.length))}#{v.to_i}"
|
125
|
+
end.join("\n")
|
126
|
+
end
|
127
|
+
|
128
|
+
end # Assembly
|
129
|
+
|
130
|
+
end # Transrate
|
data/lib/transrate/assembly.rb
CHANGED
@@ -14,6 +14,7 @@ module Transrate
|
|
14
14
|
attr_accessor :ublast_db
|
15
15
|
attr_accessor :orfs_ublast_db
|
16
16
|
attr_accessor :protein
|
17
|
+
attr_reader :assembly
|
17
18
|
|
18
19
|
# number of bases in the assembly
|
19
20
|
attr_writer :n_bases
|
@@ -63,18 +64,23 @@ module Transrate
|
|
63
64
|
res = []
|
64
65
|
n1k = 0
|
65
66
|
n10k = 0
|
67
|
+
orf_length_sum = 0
|
66
68
|
@assembly.each do |s|
|
67
|
-
new_cum_len = cumulative_length + s.length
|
68
|
-
prop = new_cum_len / self.n_bases
|
69
69
|
n1k += 1 if s.length > 1_000
|
70
70
|
n10k += 1 if s.length > 10_000
|
71
|
-
|
71
|
+
orf_length_sum += orf_length(s.seq)
|
72
|
+
|
73
|
+
cumulative_length += s.length
|
74
|
+
if cumulative_length >= @n_bases * cutoff
|
72
75
|
res << s.length
|
73
|
-
|
74
|
-
|
76
|
+
if x2.empty?
|
77
|
+
cutoff=1
|
78
|
+
else
|
79
|
+
cutoff = x2.pop / 100.0
|
80
|
+
end
|
75
81
|
end
|
76
|
-
cumulative_length = new_cum_len
|
77
82
|
end
|
83
|
+
|
78
84
|
mean = cumulative_length / @assembly.size
|
79
85
|
ns = Hash[x.map { |n| "N#{n}" }.zip(res)]
|
80
86
|
{
|
@@ -84,10 +90,25 @@ module Transrate
|
|
84
90
|
"n_bases" => @n_bases,
|
85
91
|
"mean_len" => mean,
|
86
92
|
"n_1k" => n1k,
|
87
|
-
"n_10k" => n10k
|
93
|
+
"n_10k" => n10k,
|
94
|
+
"orf percent" => 300*orf_length_sum/(@assembly.size*mean)
|
88
95
|
}.merge ns
|
89
96
|
end
|
90
97
|
|
98
|
+
# finds longest orf in a sequence
|
99
|
+
def orf_length sequence
|
100
|
+
longest=0
|
101
|
+
(1..6).each do |frame|
|
102
|
+
translated = Bio::Sequence::NA.new(sequence).translate(frame)
|
103
|
+
translated.split(/\*/).each do |orf|
|
104
|
+
if orf.length > longest
|
105
|
+
longest=orf.length
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
return longest
|
110
|
+
end
|
111
|
+
|
91
112
|
# return the number of bases in the assembly, calculating
|
92
113
|
# from the assembly if it hasn't already been done.
|
93
114
|
def n_bases
|
data/lib/transrate/bowtie2.rb
CHANGED
@@ -17,12 +17,12 @@ module Transrate
|
|
17
17
|
def map_reads file, left, right=nil, insertsize=200, insertsd=50, outputname=nil
|
18
18
|
lbase = File.basename(left)
|
19
19
|
rbase = File.basename(right)
|
20
|
-
outputname ||= "#{lbase}.#{rbase}.sam"
|
20
|
+
outputname ||= "#{lbase}.#{rbase}.#{File.basename(file)}.sam"
|
21
21
|
realistic_dist = insertsize + (3 * insertsd)
|
22
22
|
unless File.exists? outputname
|
23
23
|
# construct bowtie command
|
24
|
-
bowtiecmd = "#{@bowtie2} -
|
25
|
-
bowtiecmd += " --no-unal
|
24
|
+
bowtiecmd = "#{@bowtie2} --very-sensitive-local -p 8 -X #{realistic_dist}" # TODO number of cores should be variable '-p 8'
|
25
|
+
bowtiecmd += " --no-unal"
|
26
26
|
bowtiecmd += " #{File.basename(file)} -1 #{left}"
|
27
27
|
# paired end?
|
28
28
|
bowtiecmd += " -2 #{right}" if right
|
@@ -41,4 +41,4 @@ module Transrate
|
|
41
41
|
|
42
42
|
end # Bowtie2
|
43
43
|
|
44
|
-
end # Transrate
|
44
|
+
end # Transrate
|
@@ -4,7 +4,8 @@ module Transrate
|
|
4
4
|
|
5
5
|
class ComparativeMetrics
|
6
6
|
|
7
|
-
|
7
|
+
attr_reader :rbh_per_contig
|
8
|
+
attr_reader :reciprocal_hits
|
8
9
|
|
9
10
|
def initialize assembly, reference
|
10
11
|
@assembly = assembly
|
@@ -17,8 +18,13 @@ module Transrate
|
|
17
18
|
@ortholog_hit_ratio = self.ortholog_hit_ratio rbu
|
18
19
|
@collapse_factor = self.collapse_factor @ra.r2l_hits
|
19
20
|
@reciprocal_hits = rbu.size
|
21
|
+
@rbh_per_contig = @reciprocal_hits.to_f / @assembly.assembly.size.to_f
|
22
|
+
end
|
23
|
+
|
24
|
+
def comp_stats
|
20
25
|
{
|
21
26
|
:reciprocal_hits => @reciprocal_hits,
|
27
|
+
:rbh_per_contig => @rbh_per_contig,
|
22
28
|
:ortholog_hit_ratio => @ortholog_hit_ratio,
|
23
29
|
:collapse_factor => @collapse_factor
|
24
30
|
}
|
@@ -44,8 +50,7 @@ module Transrate
|
|
44
50
|
end
|
45
51
|
targets[target] << query
|
46
52
|
end
|
47
|
-
sum = targets.values.reduce(0.0){ |
|
48
|
-
puts "sum: #{sum}"
|
53
|
+
sum = targets.values.reduce(0.0){ |summer, val| summer += val.size }
|
49
54
|
sum / targets.size
|
50
55
|
end
|
51
56
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Transrate
|
2
|
+
|
3
|
+
class DimensionReduce
|
4
|
+
|
5
|
+
def self.dimension_reduce(metrics)
|
6
|
+
total = 0
|
7
|
+
metrics.each do |metric|
|
8
|
+
o = metric.origin
|
9
|
+
w = metric.weighting
|
10
|
+
a = metric.score
|
11
|
+
total += w * ((o - a) ** 2)
|
12
|
+
end
|
13
|
+
Math.sqrt(total) / metrics.length
|
14
|
+
end
|
15
|
+
|
16
|
+
end # DimensionReduce
|
17
|
+
|
18
|
+
end # Transrate
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Transrate
|
2
|
+
|
3
|
+
require 'which'
|
4
|
+
|
5
|
+
class Express
|
6
|
+
|
7
|
+
# return an Express object
|
8
|
+
def initialize
|
9
|
+
express_path = Which::which('express')
|
10
|
+
raise "could not find eXpress in the path" if express_path.empty?
|
11
|
+
@express = express_path.first
|
12
|
+
end
|
13
|
+
|
14
|
+
# return hash of expression for each sequenceID
|
15
|
+
# in the assembly fastafile
|
16
|
+
def quantify_expression assembly, samfile
|
17
|
+
assembly = assembly.file if assembly.is_a? Assembly
|
18
|
+
cmd = "#{@express} --no-bias-correct #{assembly} #{samfile}"
|
19
|
+
ex_output = 'results.xprs'
|
20
|
+
fin_output = "#{assembly}_#{ex_output}"
|
21
|
+
unless File.exists? fin_output
|
22
|
+
`#{cmd}`
|
23
|
+
File.rename(ex_output, fin_output)
|
24
|
+
end
|
25
|
+
expression = {}
|
26
|
+
File.open(fin_output).each do |line|
|
27
|
+
line = line.chomp.split("\t")
|
28
|
+
target = line[1]
|
29
|
+
effective_count = line[7]
|
30
|
+
expression[target] = effective_count
|
31
|
+
end
|
32
|
+
expression
|
33
|
+
end
|
34
|
+
|
35
|
+
end # Express
|
36
|
+
|
37
|
+
end # Transrate
|
@@ -5,7 +5,10 @@ module Transrate
|
|
5
5
|
attr_reader :total
|
6
6
|
attr_reader :bad
|
7
7
|
attr_reader :supported_bridges
|
8
|
-
|
8
|
+
attr_reader :pc_good_mapping
|
9
|
+
attr_reader :percent_mapping
|
10
|
+
attr_reader :expressed_contigs
|
11
|
+
|
9
12
|
def initialize assembly
|
10
13
|
@assembly = assembly
|
11
14
|
@mapper = Bowtie2.new
|
@@ -14,12 +17,14 @@ module Transrate
|
|
14
17
|
|
15
18
|
def run left, right, insertsize=200, insertsd=50
|
16
19
|
@mapper.build_index @assembly.file
|
17
|
-
samfile = @mapper.map_reads(@assembly.file,
|
18
|
-
left, right,
|
19
|
-
insertsize, insertsd)
|
20
|
+
samfile = @mapper.map_reads(@assembly.file, left, right, insertsize, insertsd)
|
20
21
|
self.analyse_read_mappings(samfile, insertsize, insertsd)
|
22
|
+
self.analyse_expression(samfile)
|
21
23
|
@percent_mapping = @total.to_f / @num_pairs.to_f * 100.0
|
22
24
|
@pc_good_mapping = @good.to_f / @num_pairs.to_f * 100.0
|
25
|
+
end
|
26
|
+
|
27
|
+
def read_stats
|
23
28
|
{
|
24
29
|
:num_pairs => @num_pairs,
|
25
30
|
:total_mappings => @total,
|
@@ -37,7 +42,9 @@ module Transrate
|
|
37
42
|
:unrealistic_overlap => @unrealistic_overlap,
|
38
43
|
:realistic_fragment => @realistic_fragment,
|
39
44
|
:unrealistic_fragment => @unrealistic_fragment,
|
40
|
-
:potential_bridges => @supported_bridges
|
45
|
+
:potential_bridges => @supported_bridges,
|
46
|
+
:expressed_contigs => @expressed_contigs,
|
47
|
+
:unexpressed_contigs => @unexpressed_contigs
|
41
48
|
}
|
42
49
|
end
|
43
50
|
|
@@ -74,6 +81,8 @@ module Transrate
|
|
74
81
|
@unrealistic_overlap = 0
|
75
82
|
@realistic_fragment = 0
|
76
83
|
@unrealistic_fragment = 0
|
84
|
+
@unexpressed_contigs = 0
|
85
|
+
@expressed_contigs = 0
|
77
86
|
end
|
78
87
|
|
79
88
|
def realistic_distance insertsize, insertsd
|
@@ -163,6 +172,19 @@ module Transrate
|
|
163
172
|
end
|
164
173
|
end
|
165
174
|
|
175
|
+
def analyse_expression samfile
|
176
|
+
express = Express.new
|
177
|
+
@expression = express.quantify_expression(@assembly.file, samfile)
|
178
|
+
@expression.each_pair do |target, count|
|
179
|
+
count = count.to_f
|
180
|
+
if count == 0
|
181
|
+
@unexpressed_contigs += 1
|
182
|
+
elsif count > 0
|
183
|
+
@expressed_contigs += 1
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
166
188
|
end # ReadMetrics
|
167
|
-
|
189
|
+
|
168
190
|
end # Transrate
|
@@ -22,10 +22,11 @@ module Transrate
|
|
22
22
|
|
23
23
|
def make_assembly_db
|
24
24
|
unless @assembly.orfs_ublast_db
|
25
|
+
assembly_dir = File.dirname(@assembly.file)
|
25
26
|
assembly_base = File.basename(@assembly.file, ".*")
|
26
27
|
assembly_orfs = assembly_base + ".orfs"
|
27
28
|
@usearch.findorfs @assembly.file, assembly_orfs
|
28
|
-
assembly_db = assembly_base + ".udb"
|
29
|
+
assembly_db = File.join(assembly_dir, assembly_base + ".udb")
|
29
30
|
@usearch.makeudb_ublast assembly_orfs, assembly_db
|
30
31
|
@assembly.orfs_ublast_db = assembly_db
|
31
32
|
end
|
@@ -33,8 +34,9 @@ module Transrate
|
|
33
34
|
|
34
35
|
def make_reference_db
|
35
36
|
unless @reference.ublast_db
|
37
|
+
reference_dir = File.dirname(@reference.file)
|
36
38
|
reference_base = File.basename(@reference.file, ".*")
|
37
|
-
reference_db = reference_base + ".udb"
|
39
|
+
reference_db = File.join(reference_dir, reference_base + ".udb")
|
38
40
|
@usearch.makeudb_ublast @reference.file, reference_db
|
39
41
|
@reference.ublast_db = reference_db
|
40
42
|
end
|
@@ -88,4 +90,4 @@ module Transrate
|
|
88
90
|
|
89
91
|
end # ReciprocalAnnotation
|
90
92
|
|
91
|
-
end # Transrate
|
93
|
+
end # Transrate
|
data/lib/transrate/transrater.rb
CHANGED
@@ -7,11 +7,10 @@ module Transrate
|
|
7
7
|
attr_reader :comparative_metrics
|
8
8
|
|
9
9
|
def initialize assembly, reference, left, right, insertsize=nil, insertsd=nil
|
10
|
-
@assembly
|
10
|
+
@assembly = assembly.is_a?(Assembly) ? assembly : Assembly.new(assembly)
|
11
11
|
@reference = reference.is_a?(Assembly) ? reference : Assembly.new(reference)
|
12
12
|
@read_metrics = ReadMetrics.new @assembly
|
13
13
|
@comparative_metrics = ComparativeMetrics.new(@assembly, @reference)
|
14
|
-
self.run(left, right, insertsize, insertsd)
|
15
14
|
end
|
16
15
|
|
17
16
|
def run left, right, insertsize=nil, insertsd=nil
|
@@ -20,6 +19,22 @@ module Transrate
|
|
20
19
|
@comparative_metrics.run
|
21
20
|
end
|
22
21
|
|
22
|
+
def assembly_score
|
23
|
+
pg = Metric.new('pg', @read_metrics.pc_good_mapping, 0.0)
|
24
|
+
rbhpc = Metric.new('rbhpc', @comparative_metrics.rbh_per_contig, 0.0)
|
25
|
+
ec = Metric.new('ec', @read_metrics.expressed_contigs, 0.0)
|
26
|
+
@score = DimensionReduce.dimension_reduce([pg, rbhpc, ec])
|
27
|
+
end
|
28
|
+
|
29
|
+
def all_metrics left, right, insertsize=nil, insertsd=nil
|
30
|
+
self.run(left, right, insertsize, insertsd)
|
31
|
+
all = @assembly.basic_stats
|
32
|
+
all.merge!(@read_metrics.read_stats)
|
33
|
+
all.merge!(@comparative_metrics.comp_stats)
|
34
|
+
all[:score] = @score
|
35
|
+
all
|
36
|
+
end
|
37
|
+
|
23
38
|
end # Transrater
|
24
39
|
|
25
40
|
end # Transrate
|
data/lib/transrate/usearch.rb
CHANGED
@@ -19,30 +19,36 @@ module Transrate
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def ublast query, target, evalue="1e-5"
|
22
|
-
subcmd = " -ublast #{query}"
|
23
|
-
subcmd += " -db #{target}"
|
24
|
-
subcmd += " -evalue #{evalue}"
|
25
22
|
blast6outfile = "#{File.basename(query)}_#{File.basename(target)}.b6"
|
26
|
-
|
27
|
-
subcmd
|
28
|
-
|
29
|
-
|
30
|
-
|
23
|
+
unless File.exists? blast6outfile
|
24
|
+
subcmd = " -ublast #{query}"
|
25
|
+
subcmd += " -db #{target}"
|
26
|
+
subcmd += " -evalue #{evalue}"
|
27
|
+
subcmd += " -userout #{blast6outfile}"
|
28
|
+
subcmd += self.custom_output_fields
|
29
|
+
subcmd += " -strand both"
|
30
|
+
subcmd += " -threads #{@threads}"
|
31
|
+
self.run subcmd
|
32
|
+
end
|
31
33
|
blast6outfile
|
32
34
|
end
|
33
35
|
|
34
36
|
def makeudb_ublast filepath, output
|
35
|
-
|
36
|
-
|
37
|
-
|
37
|
+
unless File.exists? output
|
38
|
+
subcmd = " -makeudb_ublast #{filepath}"
|
39
|
+
subcmd += " -output #{output}"
|
40
|
+
self.run subcmd
|
41
|
+
end
|
38
42
|
end
|
39
43
|
|
40
44
|
def findorfs filepath, output
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
45
|
+
unless File.exists? output
|
46
|
+
subcmd = " -findorfs #{filepath}"
|
47
|
+
subcmd += " -output #{output}"
|
48
|
+
subcmd += " -xlat"
|
49
|
+
subcmd += " -orfstyle 7"
|
50
|
+
self.run subcmd
|
51
|
+
end
|
46
52
|
end
|
47
53
|
|
48
54
|
def run subcmd
|
@@ -52,4 +58,4 @@ module Transrate
|
|
52
58
|
|
53
59
|
end # Usearch
|
54
60
|
|
55
|
-
end # Transrate
|
61
|
+
end # Transrate
|
data/lib/transrate/version.rb
CHANGED
data/transrate.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
|
|
7
7
|
gem.authors = [ "Richard Smith" ]
|
8
8
|
gem.email = "rds45@cam.ac.uk"
|
9
9
|
gem.licenses = ["MIT"]
|
10
|
-
gem.homepage = 'https://github.com/blahah/
|
10
|
+
gem.homepage = 'https://github.com/blahah/transrate'
|
11
11
|
gem.summary = %q{ quality assessment of de-novo transcriptome assemblies }
|
12
12
|
gem.description = %q{ a library and command-line tool for quality assessment of de-novo transcriptome assemblies }
|
13
13
|
gem.version = Transrate::VERSION::STRING.dup
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transrate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -150,9 +150,13 @@ files:
|
|
150
150
|
- README.md
|
151
151
|
- bin/transrate
|
152
152
|
- lib/transrate.rb
|
153
|
+
- lib/transrate/#assembly.rb#
|
153
154
|
- lib/transrate/assembly.rb
|
154
155
|
- lib/transrate/bowtie2.rb
|
155
156
|
- lib/transrate/comparative_metrics.rb
|
157
|
+
- lib/transrate/dimension_reduce.rb
|
158
|
+
- lib/transrate/express.rb
|
159
|
+
- lib/transrate/metric.rb
|
156
160
|
- lib/transrate/rb_hit.rb
|
157
161
|
- lib/transrate/read_metrics.rb
|
158
162
|
- lib/transrate/reciprocal_annotation.rb
|
@@ -160,7 +164,7 @@ files:
|
|
160
164
|
- lib/transrate/usearch.rb
|
161
165
|
- lib/transrate/version.rb
|
162
166
|
- transrate.gemspec
|
163
|
-
homepage: https://github.com/blahah/
|
167
|
+
homepage: https://github.com/blahah/transrate
|
164
168
|
licenses:
|
165
169
|
- MIT
|
166
170
|
metadata: {}
|