transrate 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/transrate +129 -77
- data/lib/transrate/version.rb +1 -1
- 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: 11e11ad4e926162c2f5abf2a77c77be603dee85a
|
4
|
+
data.tar.gz: cd9d544e1ab00d43314bba1b3fcebf2fb9cac2f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39385d5c1e6badec90cfc732cd50daa78a38fb7756ccd97223dfcc512de2445c04cdb03c79910e367c2f141653d33a298325d67565e13d4ee5b0fde0a424ae66
|
7
|
+
data.tar.gz: 75b91afe62981e0b71e16fb9e80325ba7950f44d2b81716565d123bef591085f3b273d44d1ed75882b25533724ae2e6a86efa3c500a0c3f3ee96bf3efa9ef13e
|
data/bin/transrate
CHANGED
@@ -2,37 +2,53 @@
|
|
2
2
|
|
3
3
|
require 'trollop'
|
4
4
|
require 'transrate'
|
5
|
+
require 'csv'
|
5
6
|
|
6
7
|
opts = Trollop::options do
|
7
8
|
version Transrate::VERSION::STRING.dup
|
8
9
|
banner <<-EOS
|
9
10
|
|
10
|
-
Transrate v#{Transrate::VERSION::STRING.dup} by Richard Smith <rds45@cam.ac.uk>
|
11
|
-
|
12
|
-
DESCRIPTION:
|
13
|
-
Analyse a de-novo transcriptome
|
14
|
-
assembly using three kinds of metrics:
|
15
|
-
|
16
|
-
1. contig-based
|
17
|
-
2. read-mapping (if --left and --right are provided)
|
18
|
-
3. reference-based (if --reference is provided)
|
19
|
-
|
20
|
-
Bug reports and feature requests at:
|
21
|
-
http://github.com/blahah/transrate
|
22
|
-
|
23
|
-
USAGE:
|
24
|
-
transrate <options>
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
opt :
|
33
|
-
|
34
|
-
|
35
|
-
opt :
|
11
|
+
Transrate v#{Transrate::VERSION::STRING.dup} by Richard Smith <rds45@cam.ac.uk>
|
12
|
+
|
13
|
+
DESCRIPTION:
|
14
|
+
Analyse a de-novo transcriptome
|
15
|
+
assembly using three kinds of metrics:
|
16
|
+
|
17
|
+
1. contig-based
|
18
|
+
2. read-mapping (if --left and --right are provided)
|
19
|
+
3. reference-based (if --reference is provided)
|
20
|
+
|
21
|
+
Bug reports and feature requests at:
|
22
|
+
http://github.com/blahah/transrate
|
23
|
+
|
24
|
+
USAGE:
|
25
|
+
transrate <options>
|
26
|
+
|
27
|
+
EXAMPLES:
|
28
|
+
transrate --assembly contigs.fa --reference Athaliana_protein.fa --threads 8
|
29
|
+
|
30
|
+
OPTIONS:
|
31
|
+
|
32
|
+
EOS
|
33
|
+
opt :assembly, "assembly file(s) in FASTA format, comma-separated",
|
34
|
+
:required => true,
|
35
|
+
:type => String
|
36
|
+
opt :reference, "reference proteome file in FASTA format",
|
37
|
+
:type => String
|
38
|
+
opt :left, "left reads file in FASTQ format",
|
39
|
+
:type => String
|
40
|
+
opt :right, "right reads file in FASTQ format",
|
41
|
+
:type => String
|
42
|
+
opt :insertsize, "mean insert size",
|
43
|
+
:default => 200,
|
44
|
+
:type => Integer
|
45
|
+
opt :insertsd, "insert size standard deviation",
|
46
|
+
:default => 50,
|
47
|
+
:type => Integer
|
48
|
+
opt :threads, "number of threads to use",
|
49
|
+
:default => 8,
|
50
|
+
:type => Integer
|
51
|
+
opt :quiet, "don't print results - only save to file"
|
36
52
|
end
|
37
53
|
|
38
54
|
def pretty_print_hash hash, width
|
@@ -48,72 +64,108 @@ def pretty_print_hash hash, width
|
|
48
64
|
end.join("\n")
|
49
65
|
end
|
50
66
|
|
67
|
+
# don't log if --quiet is set
|
68
|
+
$quiet = opts.quiet
|
69
|
+
def log msg
|
70
|
+
unless $quiet
|
71
|
+
puts msg
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
51
75
|
include Transrate
|
52
76
|
|
53
|
-
a = Assembly.new opts.assembly
|
54
77
|
r = opts.reference ? Assembly.new(opts.reference) : nil
|
78
|
+
report_width = 30
|
55
79
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
opts.insertsize,
|
60
|
-
opts.insertsd)
|
80
|
+
# loop through the assemblies, storing their outputs in an array of hashes
|
81
|
+
all = []
|
82
|
+
opts.assembly.split(',').each do |assembly|
|
61
83
|
|
62
|
-
|
84
|
+
a = Assembly.new assembly
|
63
85
|
|
64
|
-
|
86
|
+
transrater = Transrater.new(a, r,
|
87
|
+
opts.left,
|
88
|
+
opts.right,
|
89
|
+
opts.insertsize,
|
90
|
+
opts.insertsd)
|
65
91
|
|
66
|
-
|
67
|
-
t0 = Time.now
|
68
|
-
contig_results = transrater.assembly_metrics.basic_stats
|
92
|
+
log "\nAnalysing assembly: #{assembly}\n\n"
|
69
93
|
|
70
|
-
|
71
|
-
puts "\n"
|
72
|
-
puts "Contig metrics:"
|
73
|
-
puts "-" * report_width
|
74
|
-
puts pretty_print_hash(contig_results, report_width)
|
75
|
-
end
|
94
|
+
contig_results = {}
|
76
95
|
|
77
|
-
|
78
|
-
|
79
|
-
read_results = nil
|
80
|
-
if (opts.left && opts.right)
|
81
|
-
puts "\ncalculating read diagnostics..."
|
96
|
+
log "Calculating contig metrics..."
|
82
97
|
t0 = Time.now
|
83
|
-
|
98
|
+
contig_results = transrater.assembly_metrics.basic_stats
|
84
99
|
|
85
|
-
if
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
100
|
+
if contig_results
|
101
|
+
log "\n"
|
102
|
+
log "Contig metrics:"
|
103
|
+
log "-" * report_width
|
104
|
+
log pretty_print_hash(contig_results, report_width)
|
90
105
|
end
|
91
106
|
|
92
|
-
|
93
|
-
else
|
94
|
-
puts "\nNo reads provided, skipping read diagnostics"
|
95
|
-
end
|
107
|
+
log "Contig metrics done in #{Time.now - t0} seconds"
|
96
108
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
109
|
+
read_results = {}
|
110
|
+
|
111
|
+
if (opts.left && opts.right)
|
112
|
+
log "\ncalculating read diagnostics..."
|
113
|
+
t0 = Time.now
|
114
|
+
read_results = transrater.read_metrics(opts.left, opts.right).read_stats
|
115
|
+
|
116
|
+
if read_results
|
117
|
+
log "\n"
|
118
|
+
log "Read mapping metrics:"
|
119
|
+
log "-" * report_width
|
120
|
+
log pretty_print_hash(read_results, report_width)
|
121
|
+
end
|
122
|
+
|
123
|
+
log "Read metrics done in #{Time.now - t0} seconds"
|
124
|
+
else
|
125
|
+
log "\nNo reads provided, skipping read diagnostics"
|
108
126
|
end
|
109
127
|
|
110
|
-
|
111
|
-
|
128
|
+
comparative_results={}
|
129
|
+
|
130
|
+
if opts.reference
|
131
|
+
log "\nCalculating comparative metrics..."
|
132
|
+
t0 = Time.now
|
133
|
+
comparative_metrics = transrater.comparative_metrics
|
134
|
+
comparative_results = comparative_metrics.comp_stats
|
135
|
+
|
136
|
+
if comparative_results
|
137
|
+
log "\n"
|
138
|
+
log "Comparative metrics:"
|
139
|
+
log "-" * report_width
|
140
|
+
log pretty_print_hash(comparative_results, report_width)
|
141
|
+
end
|
142
|
+
|
143
|
+
log "Comparative metrics done in #{Time.now - t0} seconds"
|
144
|
+
end
|
145
|
+
|
146
|
+
log "\n"
|
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
|
+
|
154
|
+
all << contig_results.
|
155
|
+
merge(read_results).
|
156
|
+
merge(comparative_results).
|
157
|
+
merge({ :assembly => assembly })
|
112
158
|
|
113
|
-
puts "\n"
|
114
|
-
puts "-" * report_width
|
115
|
-
score = transrater.assembly_score
|
116
|
-
unless score.nil?
|
117
|
-
puts "OVERALL SCORE: #{score.to_f.round(2) * 100}%"
|
118
|
-
puts "-" * report_width
|
119
159
|
end
|
160
|
+
|
161
|
+
# write out all resuls to .csv
|
162
|
+
outfile = opts.out || 'transrate.csv'
|
163
|
+
CSV.open(outfile, 'wb') do |file|
|
164
|
+
keys = all[0].keys
|
165
|
+
keys.delete(:assembly)
|
166
|
+
head = [:assembly] + keys
|
167
|
+
file << head
|
168
|
+
all.each do |row|
|
169
|
+
file << head.map { |x| row[x] }
|
170
|
+
end
|
171
|
+
end
|
data/lib/transrate/version.rb
CHANGED
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.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|