transrate 1.0.0.beta1 → 1.0.0.beta2
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/.gitignore +1 -0
- data/.travis.yml +8 -0
- data/CITATION +3 -0
- data/README.md +1 -1
- data/Rakefile +71 -0
- data/bin/transrate +92 -41
- data/deps/blast.yaml +27 -0
- data/deps/deps.yaml +36 -62
- data/ext/transrate/transrate.c +9 -0
- data/lib/transrate/assembly.rb +21 -11
- data/lib/transrate/comparative_metrics.rb +2 -2
- data/lib/transrate/contig.rb +8 -3
- data/lib/transrate/read_metrics.rb +22 -62
- data/lib/transrate/salmon.rb +67 -0
- data/lib/transrate/snap.rb +4 -32
- data/lib/transrate/transrater.rb +1 -1
- data/lib/transrate/version.rb +1 -1
- data/lib/transrate.rb +18 -15
- data/test/data/sorghum_100.fa +200 -0
- data/test/data/test.sf +30 -0
- data/test/helper.rb +13 -0
- data/test/test_assembly.rb +54 -0
- data/test/test_bin.rb +30 -27
- data/test/test_cmd.rb +5 -0
- data/test/test_contig.rb +9 -14
- data/test/test_read_metrics.rb +66 -42
- data/test/test_salmon.rb +33 -0
- data/test/test_snap.rb +27 -0
- data/test/test_transrater.rb +10 -10
- data/transrate.gemspec +1 -1
- metadata +14 -12
- data/lib/transrate/express.rb +0 -102
- data/lib/transrate/sam_checker.rb +0 -74
- data/lib/transrate/samtools.rb +0 -146
- data/test/data/express_results.xprs +0 -5
- data/test/test_express.rb +0 -22
- data/test/test_samtools.rb +0 -22
data/test/test_bin.rb
CHANGED
@@ -10,27 +10,29 @@ class TestTransrateBin < Test::Unit::TestCase
|
|
10
10
|
end
|
11
11
|
|
12
12
|
teardown do
|
13
|
-
files = ["
|
14
|
-
"
|
15
|
-
"
|
13
|
+
files = ["sorghum_100.1.fastq.sorghum_100.2.fastq.sorghum_100.bam.bai",
|
14
|
+
"sorghum_100.1.fastq.sorghum_100.2.fastq.sorghum_100.bam",
|
15
|
+
"sorghum_100_into_Os.protein.2.1.blast",
|
16
16
|
"assembly.2_into_Os.protein.2.1.blast",
|
17
|
-
"
|
18
|
-
"Os.protein.
|
17
|
+
"sorghum_100.nhr", "sorghum_100.nin", "sorghum_100.nsq",
|
18
|
+
"Os.protein.2_into_sorghum_100.2.blast",
|
19
19
|
"Os.protein.2_into_assembly.2.2.blast",
|
20
20
|
"assembly.2.nhr", "assembly.2.nin", "assembly.2.nsq",
|
21
21
|
"Os.protein.2.phr", "Os.protein.2.pin", "Os.protein.2.psq",
|
22
|
-
"transrate_assemblies.csv",
|
23
|
-
"
|
24
|
-
"
|
25
|
-
"
|
26
|
-
"
|
27
|
-
"
|
28
|
-
"bad.
|
29
|
-
"fragmented.
|
22
|
+
"transrate_assemblies.csv",
|
23
|
+
"sorghum_100.fa_quant.sf",
|
24
|
+
"sorghum_100.fa_bam_info.csv",
|
25
|
+
"transrate_sorghum_100.fa_contigs.csv",
|
26
|
+
"sorghum_100.1.fastq-sorghum_100.2.fastq-read_count.txt",
|
27
|
+
"sorghum_100.1.fastq.sorghum_100.2.fastq.sorghum_100.assigned.bam",
|
28
|
+
"bad.sorghum_100.fa", "chimeric.sorghum_100.fa",
|
29
|
+
"fragmented.sorghum_100.fa", "good.sorghum_100.fa"]
|
30
30
|
files.each do |file|
|
31
31
|
File.delete(file) if File.exist?(file)
|
32
32
|
end
|
33
|
-
`rm -rf
|
33
|
+
`rm -rf sorghum_100`
|
34
|
+
`rm -rf logs`
|
35
|
+
`rm -rf libParams`
|
34
36
|
end
|
35
37
|
|
36
38
|
should "run help" do
|
@@ -53,10 +55,10 @@ class TestTransrateBin < Test::Unit::TestCase
|
|
53
55
|
end
|
54
56
|
|
55
57
|
should "run on test data" do
|
56
|
-
assembly = File.join(File.dirname(__FILE__), 'data', '
|
58
|
+
assembly = File.join(File.dirname(__FILE__), 'data', 'sorghum_100.fa')
|
57
59
|
reference = File.join(File.dirname(__FILE__), 'data', 'Os.protein.2.fa')
|
58
|
-
left = File.join(File.dirname(__FILE__), 'data', '
|
59
|
-
right = File.join(File.dirname(__FILE__), 'data', '
|
60
|
+
left = File.join(File.dirname(__FILE__), 'data', 'sorghum_100.1.fastq')
|
61
|
+
right = File.join(File.dirname(__FILE__), 'data', 'sorghum_100.2.fastq')
|
60
62
|
cmd = "bundle exec bin/transrate --assembly #{assembly}"
|
61
63
|
cmd << " --reference #{reference}"
|
62
64
|
cmd << " --left #{left}"
|
@@ -65,7 +67,7 @@ class TestTransrateBin < Test::Unit::TestCase
|
|
65
67
|
c.run
|
66
68
|
assert_equal true, c.status.success?, "exit status"
|
67
69
|
assert File.exist?("transrate_assemblies.csv"), "csv file doesn't exist"
|
68
|
-
assert File.exist?("
|
70
|
+
assert File.exist?("transrate_sorghum_100.fa_contigs.csv"),
|
69
71
|
"contig csv file doesn't exist"
|
70
72
|
hash = {}
|
71
73
|
CSV.foreach("transrate_assemblies.csv", :headers => true,
|
@@ -77,19 +79,20 @@ class TestTransrateBin < Test::Unit::TestCase
|
|
77
79
|
hash[header]=field
|
78
80
|
end
|
79
81
|
end
|
80
|
-
|
81
|
-
assert_equal
|
82
|
-
assert_equal
|
82
|
+
assert_in_delta 137748, hash[:n_bases], 1000, "number of bases"
|
83
|
+
assert_equal 1692, hash[:n50], "n50"
|
84
|
+
assert_equal 2, hash[:n_refs_with_crbb], "number of crb hits"
|
85
|
+
assert_equal 2, hash[:n_contigs_with_crbb], "number of contigs with hits"
|
83
86
|
end
|
84
87
|
|
85
88
|
should "run on test data with comma separated list of fastq files" do
|
86
|
-
assembly = File.join(File.dirname(__FILE__), 'data', '
|
89
|
+
assembly = File.join(File.dirname(__FILE__), 'data', 'sorghum_100.fa')
|
87
90
|
left = []
|
88
91
|
right = []
|
92
|
+
left << File.join(File.dirname(__FILE__), 'data', 'sorghum_100.1.fastq')
|
89
93
|
left << File.join(File.dirname(__FILE__), 'data', '150uncovered.l.fq')
|
90
|
-
|
94
|
+
right << File.join(File.dirname(__FILE__), 'data', 'sorghum_100.2.fastq')
|
91
95
|
right << File.join(File.dirname(__FILE__), 'data', '150uncovered.r.fq')
|
92
|
-
right << File.join(File.dirname(__FILE__), 'data', 'bridging_reads.r.fastq')
|
93
96
|
cmd = "bundle exec bin/transrate --assembly #{assembly}"
|
94
97
|
cmd << " --left #{left.join(",")}"
|
95
98
|
cmd << " --right #{right.join(",")}"
|
@@ -101,7 +104,7 @@ class TestTransrateBin < Test::Unit::TestCase
|
|
101
104
|
end
|
102
105
|
assert_equal true, c.status.success?, "exit status"
|
103
106
|
assert File.exist?("transrate_assemblies.csv")
|
104
|
-
assert File.exist?("
|
107
|
+
assert File.exist?("transrate_sorghum_100.fa_contigs.csv"),
|
105
108
|
"contig csv file doesn't exist"
|
106
109
|
hash = {}
|
107
110
|
CSV.foreach("transrate_assemblies.csv", :headers => true,
|
@@ -111,8 +114,8 @@ class TestTransrateBin < Test::Unit::TestCase
|
|
111
114
|
hash[header]=field
|
112
115
|
end
|
113
116
|
end
|
114
|
-
|
115
|
-
assert_equal
|
117
|
+
assert_in_delta 137748, hash[:n_bases], 1000, "number of bases"
|
118
|
+
assert_equal 1692, hash[:n50], "n50"
|
116
119
|
end
|
117
120
|
|
118
121
|
should "fail when one of multiple assemblies is missing" do
|
data/test/test_cmd.rb
CHANGED
@@ -10,6 +10,11 @@ class TestCmd < Test::Unit::TestCase
|
|
10
10
|
assert_equal "success", cmd.stdout.chomp, 'run echo command'
|
11
11
|
end
|
12
12
|
|
13
|
+
should "get the string of a command" do
|
14
|
+
cmd = Transrate::Cmd.new "echo success"
|
15
|
+
assert_equal "echo success", cmd.to_s, 'cmd to string'
|
16
|
+
end
|
17
|
+
|
13
18
|
end
|
14
19
|
|
15
20
|
end
|
data/test/test_contig.rb
CHANGED
@@ -7,7 +7,7 @@ class TestContig < Test::Unit::TestCase
|
|
7
7
|
context "Contig" do
|
8
8
|
|
9
9
|
setup do
|
10
|
-
seq = Bio::FastaFormat.new ">test
|
10
|
+
seq = Bio::FastaFormat.new ">test;\nATGCGTGTATATACGCGTAG" # cg=3, gc=2, c*g=20
|
11
11
|
@contig = Transrate::Contig.new seq
|
12
12
|
end
|
13
13
|
|
@@ -32,19 +32,6 @@ class TestContig < Test::Unit::TestCase
|
|
32
32
|
assert_equal 1, contig.dibase_composition[:gn]
|
33
33
|
end
|
34
34
|
|
35
|
-
should "benchmark composition" do
|
36
|
-
seq = "GCCGTGAGCTTCTTGATCGAGTTCTTCTCCCGCTTCGCGAACGCCTTGGACTCCTNGCACGGG"
|
37
|
-
seq << "GTCAGCCCCGCGATGTCGGCGGCCGCGGGCGGGGGG"
|
38
|
-
seq = seq * 100000
|
39
|
-
seq = Bio::FastaFormat.new ">test\n"+seq
|
40
|
-
contig = Transrate::Contig.new seq
|
41
|
-
ruby_time = 11 # time taken with the ruby version
|
42
|
-
c_time = Benchmark.realtime do |x|
|
43
|
-
contig.dibase_composition
|
44
|
-
end
|
45
|
-
assert c_time*100 < ruby_time, "c faster than ruby"
|
46
|
-
end
|
47
|
-
|
48
35
|
should "know how many of each two-base pair it contains" do
|
49
36
|
assert_equal 3, @contig.dibase_composition[:cg], "cg count"
|
50
37
|
assert_equal 3, @contig.dibase_composition[:at], "at count"
|
@@ -121,5 +108,13 @@ class TestContig < Test::Unit::TestCase
|
|
121
108
|
"linguistic complexity k=6"
|
122
109
|
end
|
123
110
|
|
111
|
+
should "classify contig" do
|
112
|
+
assert_equal :bad, @contig.classify, "contig is not bad"
|
113
|
+
end
|
114
|
+
|
115
|
+
should "strip trailing semicolons from FASTA entry IDs" do
|
116
|
+
assert_equal "test", @contig.name, "trailing semicolon was not stripped"
|
117
|
+
end
|
118
|
+
|
124
119
|
end
|
125
120
|
end
|
data/test/test_read_metrics.rb
CHANGED
@@ -6,15 +6,14 @@ class TestReadMetrics < Test::Unit::TestCase
|
|
6
6
|
context "ReadMetrics" do
|
7
7
|
|
8
8
|
setup do
|
9
|
-
query = File.join(File.dirname(__FILE__), 'data',
|
10
|
-
'sorghum_transcript.fa')
|
9
|
+
query = File.join(File.dirname(__FILE__), 'data', 'sorghum_100.fa')
|
11
10
|
@assembly = Transrate::Assembly.new(query)
|
12
11
|
@read_metrics = Transrate::ReadMetrics.new(@assembly)
|
13
12
|
end
|
14
13
|
|
15
14
|
teardown do
|
16
|
-
if File.exist?("test/data/
|
17
|
-
rm = "rm test/data/
|
15
|
+
if File.exist?("test/data/sorghum_100.fa.fai")
|
16
|
+
rm = "rm test/data/sorghum_100.fa.fai"
|
18
17
|
`#{rm}`
|
19
18
|
end
|
20
19
|
end
|
@@ -24,33 +23,33 @@ class TestReadMetrics < Test::Unit::TestCase
|
|
24
23
|
end
|
25
24
|
|
26
25
|
should "calculate read mapping statistics" do
|
27
|
-
left = File.join(File.dirname(__FILE__), 'data', '
|
28
|
-
right = File.join(File.dirname(__FILE__), 'data', '
|
26
|
+
left = File.join(File.dirname(__FILE__), 'data', 'sorghum_100.1.fastq')
|
27
|
+
right = File.join(File.dirname(__FILE__), 'data', 'sorghum_100.2.fastq')
|
29
28
|
Dir.mktmpdir do |tmpdir|
|
30
29
|
Dir.chdir tmpdir do
|
31
30
|
@read_metrics.run(left, right)
|
32
31
|
stats = @read_metrics.read_stats
|
33
32
|
assert @read_metrics.has_run, "has run"
|
34
|
-
assert_equal
|
35
|
-
assert_equal
|
36
|
-
|
33
|
+
assert_equal 25006, stats[:fragments], 'number of read pairs'
|
34
|
+
assert_equal 21000, stats[:fragments_mapped], 'number mapping'
|
35
|
+
assert_in_delta 0.84, stats[:p_fragments_mapped].round(4), 0.05
|
37
36
|
'proportion mapping'
|
38
|
-
|
39
|
-
|
37
|
+
assert_in_delta 17382, stats[:good_mappings], 50, 'good mapping'
|
38
|
+
assert_in_delta 0.6945,stats[:p_good_mapping].round(3), 0.005,
|
40
39
|
'percent good mapping'
|
41
|
-
|
42
|
-
assert_equal 1,
|
43
|
-
assert_equal
|
44
|
-
assert_equal
|
45
|
-
assert_equal
|
46
|
-
|
40
|
+
assert_in_delta 3637, stats[:bad_mappings], 50, 'bad mapping'
|
41
|
+
assert_equal 1, stats[:potential_bridges], 'bridges'
|
42
|
+
assert_equal 93, stats[:contigs_uncovbase], 'uncovered base contig'
|
43
|
+
assert_equal 28, stats[:contigs_uncovered], 'uncovered contig'
|
44
|
+
assert_equal 72, stats[:contigs_lowcovered], 'lowcovered contig'
|
45
|
+
assert_in_delta 50, stats[:contigs_good], 10, 'good contigs'
|
47
46
|
end
|
48
47
|
end
|
49
48
|
end
|
50
49
|
|
51
50
|
should "get metrics for individual contigs" do
|
52
|
-
left = File.join(File.dirname(__FILE__), 'data', '
|
53
|
-
right = File.join(File.dirname(__FILE__), 'data', '
|
51
|
+
left = File.join(File.dirname(__FILE__), 'data', 'sorghum_100.1.fastq')
|
52
|
+
right = File.join(File.dirname(__FILE__), 'data', 'sorghum_100.2.fastq')
|
54
53
|
Dir.mktmpdir do |tmpdir|
|
55
54
|
Dir.chdir tmpdir do
|
56
55
|
@read_metrics.run(left, right)
|
@@ -63,31 +62,49 @@ class TestReadMetrics < Test::Unit::TestCase
|
|
63
62
|
|
64
63
|
edit_a = a[:p_seq_true].round(5)
|
65
64
|
edit_b = b[:p_seq_true].round(5)
|
66
|
-
|
67
|
-
|
65
|
+
assert_in_delta 0.6597, edit_a.round(4), 0.01, "edit distance 1"
|
66
|
+
assert_in_delta 0.9364, edit_b.round(4), 0.01, "edit distance 2"
|
68
67
|
|
69
|
-
|
70
|
-
|
71
|
-
assert_equal 0.875, b[:p_good].round(5), "proportion of good mappings"
|
68
|
+
assert_in_delta 0.5714, a[:p_good].round(4), 0.01, "prop of good mappings"
|
69
|
+
assert_in_delta 0.8302, b[:p_good].round(4), 0.01, "prop of good mappings"
|
72
70
|
|
73
71
|
# uncovered bases
|
74
72
|
unc_a = contigs[0].uncovered_bases
|
75
73
|
unc_b = contigs[1].uncovered_bases
|
76
|
-
|
77
|
-
|
74
|
+
assert_in_delta 366, unc_a, 20, "uncovered bases"
|
75
|
+
assert_in_delta 64, unc_b, 20, "uncovered bases"
|
78
76
|
|
79
77
|
prop_unc_a = a[:p_bases_covered]
|
80
78
|
prop_unc_b = b[:p_bases_covered]
|
81
|
-
|
82
|
-
|
79
|
+
assert_in_delta 0.5622, prop_unc_a.round(4), 0.05, "proportion covered bases"
|
80
|
+
assert_in_delta 0.9964, prop_unc_b.round(4), 0.05, "proportion covered bases"
|
83
81
|
|
84
82
|
end
|
85
83
|
end
|
86
84
|
end
|
87
85
|
|
86
|
+
should "classify individual contigs" do
|
87
|
+
left = File.join(File.dirname(__FILE__), 'data', 'sorghum_100.1.fastq')
|
88
|
+
right = File.join(File.dirname(__FILE__), 'data', 'sorghum_100.2.fastq')
|
89
|
+
Dir.mktmpdir do |tmpdir|
|
90
|
+
Dir.chdir tmpdir do
|
91
|
+
@read_metrics.run(left, right)
|
92
|
+
contigs = []
|
93
|
+
@assembly.each do |name, contig|
|
94
|
+
contigs << contig
|
95
|
+
end
|
96
|
+
assert_equal :bad, contigs[0].classify
|
97
|
+
assert_equal :good, contigs[1].classify
|
98
|
+
assert_equal :bad, contigs[2].classify
|
99
|
+
assert_equal :good, contigs[3].classify
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
|
88
105
|
should "get segmentation probability for individual contigs" do
|
89
|
-
left = File.join(File.dirname(__FILE__), 'data', '
|
90
|
-
right = File.join(File.dirname(__FILE__), 'data', '
|
106
|
+
left = File.join(File.dirname(__FILE__), 'data', 'sorghum_100.1.fastq')
|
107
|
+
right = File.join(File.dirname(__FILE__), 'data', 'sorghum_100.2.fastq')
|
91
108
|
Dir.mktmpdir do |tmpdir|
|
92
109
|
Dir.chdir tmpdir do
|
93
110
|
@read_metrics.run(left, right)
|
@@ -100,23 +117,30 @@ class TestReadMetrics < Test::Unit::TestCase
|
|
100
117
|
|
101
118
|
edit_a = a[:p_not_segmented].round(5)
|
102
119
|
edit_b = b[:p_not_segmented].round(5)
|
103
|
-
|
104
|
-
|
120
|
+
assert_in_delta 0.9965, edit_a.round(4), 0.05, "probability not segmented 1"
|
121
|
+
assert_in_delta 0.9644, edit_b.round(4), 0.05, "probability not segmented 2"
|
105
122
|
|
106
123
|
end
|
107
124
|
end
|
108
125
|
end
|
109
126
|
|
110
127
|
should "find read pairs that support scaffolding" do
|
111
|
-
left = File.join(File.dirname(__FILE__),
|
112
|
-
|
113
|
-
right = File.join(File.dirname(__FILE__),
|
114
|
-
'data', 'bridging_reads.r.fastq')
|
128
|
+
left = File.join(File.dirname(__FILE__), 'data', 'sorghum_100.1.fastq')
|
129
|
+
right = File.join(File.dirname(__FILE__), 'data', 'sorghum_100.2.fastq')
|
115
130
|
Dir.mktmpdir do |tmpdir|
|
116
131
|
Dir.chdir tmpdir do
|
117
132
|
@read_metrics.run(left, right)
|
133
|
+
contigs = []
|
134
|
+
@assembly.each do |name, contig|
|
135
|
+
if contig.in_bridges > 0
|
136
|
+
contigs << contig
|
137
|
+
end
|
138
|
+
end
|
118
139
|
stats = @read_metrics.read_stats
|
119
|
-
|
140
|
+
assert @read_metrics.has_run, "has run"
|
141
|
+
assert_equal 1, stats[:potential_bridges], 'bridges'
|
142
|
+
assert_equal "Sb01g002430.1", contigs[0].name
|
143
|
+
assert_equal "Sb05g009350.1", contigs[1].name
|
120
144
|
end
|
121
145
|
end
|
122
146
|
end
|
@@ -126,15 +150,15 @@ class TestReadMetrics < Test::Unit::TestCase
|
|
126
150
|
right = []
|
127
151
|
left << File.join(File.dirname(__FILE__), 'data', '150uncovered.l.fq')
|
128
152
|
right << File.join(File.dirname(__FILE__), 'data', '150uncovered.r.fq')
|
129
|
-
|
130
|
-
|
131
|
-
right << File.join(File.dirname(__FILE__),
|
132
|
-
|
153
|
+
|
154
|
+
left << File.join(File.dirname(__FILE__), 'data', 'sorghum_100.1.fastq')
|
155
|
+
right << File.join(File.dirname(__FILE__), 'data', 'sorghum_100.2.fastq')
|
156
|
+
|
133
157
|
Dir.mktmpdir do |tmpdir|
|
134
158
|
Dir.chdir tmpdir do
|
135
159
|
@read_metrics.run(left.join(","), right.join(","))
|
136
160
|
stats = @read_metrics.read_stats
|
137
|
-
assert_equal
|
161
|
+
assert_equal 25229, stats[:fragments], 'number of read pairs'
|
138
162
|
end
|
139
163
|
end
|
140
164
|
|
data/test/test_salmon.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'tmpdir'
|
3
|
+
|
4
|
+
class TestSalmon < Test::Unit::TestCase
|
5
|
+
|
6
|
+
context "Salmon" do
|
7
|
+
|
8
|
+
setup do
|
9
|
+
@salmon = Transrate::Salmon.new
|
10
|
+
end
|
11
|
+
|
12
|
+
should "load an expression file" do
|
13
|
+
file = File.join(File.dirname(__FILE__), 'data', 'test.sf')
|
14
|
+
results = @salmon.load_expression file
|
15
|
+
assert_equal 18, results.size, "should be 18 results loaded"
|
16
|
+
assert_equal 1016, results['scaffold1'][:eff_len], "eff length is wrong"
|
17
|
+
assert_equal 20690, results['scaffold1'][:eff_count],
|
18
|
+
"eff count is wrong"
|
19
|
+
assert_equal 549.279, results['scaffold1'][:tpm], "tpm is wrong"
|
20
|
+
end
|
21
|
+
|
22
|
+
should "build a command to run salmon" do
|
23
|
+
cmd = @salmon.build_command "assembly.fa", "alignments.bam"
|
24
|
+
cmd = cmd.split(" ")[1..-1].join(" ") # remove command so test is portabl
|
25
|
+
test = "quant --libType IU --alignments alignments.bam "
|
26
|
+
test << "--targets assembly.fa --threads 4 --sampleOut "
|
27
|
+
test << "--sampleUnaligned --output ."
|
28
|
+
assert_equal test, cmd, "cmd is wrong"
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
data/test/test_snap.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'tmpdir'
|
3
|
+
|
4
|
+
class TestSnap < Test::Unit::TestCase
|
5
|
+
|
6
|
+
context "Snap" do
|
7
|
+
|
8
|
+
setup do
|
9
|
+
@reference = File.join(File.dirname(__FILE__), 'data', 'sorghum_100.fa')
|
10
|
+
@left = File.join(File.dirname(__FILE__), "data", "sorghum_100.1.fastq")
|
11
|
+
@right = File.join(File.dirname(__FILE__), "data", "sorghum_100.2.fastq")
|
12
|
+
end
|
13
|
+
|
14
|
+
should "map reads" do
|
15
|
+
Dir.mktmpdir do |tmpdir|
|
16
|
+
Dir.chdir(tmpdir) do
|
17
|
+
snap = Transrate::Snap.new
|
18
|
+
snap.build_index(@reference, 4)
|
19
|
+
snap.map_reads(@reference, @left, @right)
|
20
|
+
assert File.exist?(snap.bam), "bam file not found"
|
21
|
+
assert_equal 25006, snap.read_count, "read count"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
data/test/test_transrater.rb
CHANGED
@@ -8,11 +8,11 @@ class TestTransrater < Test::Unit::TestCase
|
|
8
8
|
context "transrater" do
|
9
9
|
|
10
10
|
setup do
|
11
|
-
@assembly = File.join(File.dirname(__FILE__), 'data', '
|
11
|
+
@assembly = File.join(File.dirname(__FILE__), 'data', 'sorghum_100.fa')
|
12
12
|
@reference = File.join(File.dirname(__FILE__), 'data', 'Os.protein.2.fa')
|
13
13
|
@rater = Transrate::Transrater.new(@assembly, @reference)
|
14
|
-
@left = File.join(File.dirname(__FILE__), 'data', '
|
15
|
-
@right = File.join(File.dirname(__FILE__), 'data', '
|
14
|
+
@left = File.join(File.dirname(__FILE__), 'data', 'sorghum_100.1.fastq')
|
15
|
+
@right = File.join(File.dirname(__FILE__), 'data', 'sorghum_100.2.fastq')
|
16
16
|
end
|
17
17
|
|
18
18
|
should "create transrater object" do
|
@@ -20,17 +20,17 @@ class TestTransrater < Test::Unit::TestCase
|
|
20
20
|
end
|
21
21
|
|
22
22
|
should "raise error when assembly input is nil" do
|
23
|
-
assert_raise
|
23
|
+
assert_raise Transrate::TransrateError do
|
24
24
|
rater = Transrate::Transrater.new(nil, @reference)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
should "handle assembly as an
|
28
|
+
should "handle assembly as an assembly object" do
|
29
29
|
assembly_object = Transrate::Assembly.new(@assembly)
|
30
30
|
rater = Transrate::Transrater.new(assembly_object, @reference)
|
31
31
|
end
|
32
32
|
|
33
|
-
should "handle reference as an
|
33
|
+
should "handle reference as an assembly object" do
|
34
34
|
reference_object = Transrate::Assembly.new(@reference)
|
35
35
|
rater = Transrate::Transrater.new(@assembly, reference_object)
|
36
36
|
end
|
@@ -39,8 +39,8 @@ class TestTransrater < Test::Unit::TestCase
|
|
39
39
|
Dir.mktmpdir do |tmpdir|
|
40
40
|
Dir.chdir tmpdir do
|
41
41
|
stats = @rater.assembly_metrics
|
42
|
-
assert_equal
|
43
|
-
assert_equal
|
42
|
+
assert_equal 1692, stats.n50
|
43
|
+
assert_equal 137748, stats.n_bases
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -49,7 +49,7 @@ class TestTransrater < Test::Unit::TestCase
|
|
49
49
|
Dir.mktmpdir do |tmpdir|
|
50
50
|
Dir.chdir tmpdir do
|
51
51
|
stats = @rater.read_metrics(@left, @right)
|
52
|
-
assert_equal
|
52
|
+
assert_equal 25006, stats.read_stats[:fragments]
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -59,7 +59,7 @@ class TestTransrater < Test::Unit::TestCase
|
|
59
59
|
Dir.chdir tmpdir do
|
60
60
|
all = @rater.all_metrics(@left, @right)
|
61
61
|
score = @rater.assembly_score
|
62
|
-
assert_equal 0.
|
62
|
+
assert_equal 0.14760, score.round(5) # regression test
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
data/transrate.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
|
|
19
19
|
|
20
20
|
gem.add_dependency 'yell', '~> 2.0', '>= 2.0.4'
|
21
21
|
gem.add_dependency 'trollop', '~> 2.0', '>= 2.0.0'
|
22
|
-
gem.add_dependency 'bindeps', '~> 1.
|
22
|
+
gem.add_dependency 'bindeps', '~> 1.1', '>= 1.1.2'
|
23
23
|
gem.add_dependency 'bio', '~> 1.4', '>= 1.4.3'
|
24
24
|
gem.add_dependency 'crb-blast', '~> 0.5', '>= 0.5.0'
|
25
25
|
gem.add_dependency 'ruby-prof', '~> 0.15', '>= 0.15.1'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transrate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Smith-Unna
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-02-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: yell
|
@@ -57,20 +57,20 @@ dependencies:
|
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '1.
|
60
|
+
version: '1.1'
|
61
61
|
- - ">="
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 1.
|
63
|
+
version: 1.1.2
|
64
64
|
type: :runtime
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - "~>"
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: '1.
|
70
|
+
version: '1.1'
|
71
71
|
- - ">="
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version: 1.
|
73
|
+
version: 1.1.2
|
74
74
|
- !ruby/object:Gem::Dependency
|
75
75
|
name: bio
|
76
76
|
requirement: !ruby/object:Gem::Requirement
|
@@ -302,11 +302,13 @@ extra_rdoc_files: []
|
|
302
302
|
files:
|
303
303
|
- ".gitignore"
|
304
304
|
- ".travis.yml"
|
305
|
+
- CITATION
|
305
306
|
- Gemfile
|
306
307
|
- LICENSE
|
307
308
|
- README.md
|
308
309
|
- Rakefile
|
309
310
|
- bin/transrate
|
311
|
+
- deps/blast.yaml
|
310
312
|
- deps/deps.yaml
|
311
313
|
- docs/transrate_logo_full.png
|
312
314
|
- ext/transrate/extconf.rb
|
@@ -317,10 +319,8 @@ files:
|
|
317
319
|
- lib/transrate/comparative_metrics.rb
|
318
320
|
- lib/transrate/contig.rb
|
319
321
|
- lib/transrate/contig_metrics.rb
|
320
|
-
- lib/transrate/express.rb
|
321
322
|
- lib/transrate/read_metrics.rb
|
322
|
-
- lib/transrate/
|
323
|
-
- lib/transrate/samtools.rb
|
323
|
+
- lib/transrate/salmon.rb
|
324
324
|
- lib/transrate/score_optimiser.rb
|
325
325
|
- lib/transrate/snap.rb
|
326
326
|
- lib/transrate/transrater.rb
|
@@ -334,19 +334,21 @@ files:
|
|
334
334
|
- test/data/assembly.fasta
|
335
335
|
- test/data/bridging_reads.l.fastq
|
336
336
|
- test/data/bridging_reads.r.fastq
|
337
|
-
- test/data/
|
337
|
+
- test/data/sorghum_100.fa
|
338
338
|
- test/data/sorghum_transcript.fa
|
339
|
+
- test/data/test.sf
|
339
340
|
- test/data/tiny.sam
|
340
341
|
- test/helper.rb
|
342
|
+
- test/test_assembly.rb
|
341
343
|
- test/test_bin.rb
|
342
344
|
- test/test_cmd.rb
|
343
345
|
- test/test_comp_metrics.rb
|
344
346
|
- test/test_contig.rb
|
345
347
|
- test/test_contig_metrics.rb
|
346
|
-
- test/test_express.rb
|
347
348
|
- test/test_inline.rb
|
348
349
|
- test/test_read_metrics.rb
|
349
|
-
- test/
|
350
|
+
- test/test_salmon.rb
|
351
|
+
- test/test_snap.rb
|
350
352
|
- test/test_transrate.rb
|
351
353
|
- test/test_transrater.rb
|
352
354
|
- test/vagrant/centos_6.5_64/Vagrantfile
|