transrate 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +17 -0
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/bin/transrate +2 -375
- data/docs/transrate_logo_full.png +0 -0
- data/files.txt +78 -0
- data/lib/transrate.rb +1 -0
- data/lib/transrate/assembly.rb +4 -0
- data/lib/transrate/cmdline.rb +543 -0
- data/lib/transrate/comparative_metrics.rb +3 -0
- data/lib/transrate/snap.rb +10 -0
- data/lib/transrate/version.rb +1 -1
- data/packaging/build_deps_linux.sh +57 -0
- data/packaging/build_deps_macosx.sh +55 -0
- data/packaging/bundler-config +3 -0
- data/packaging/minify.sh +43 -0
- data/packaging/transrate +20 -0
- data/test/data/test_contig_nc1.fa +2 -0
- data/test/data/test_contig_nc2.fa +4 -0
- data/test/data/test_contig_nc3.fa +6 -0
- data/test/data/test_contig_nc4.fa +4 -0
- data/test/data/test_contig_nc5.fa +6 -0
- data/test/data/test_contig_nc6.fa +2 -0
- data/test/data/test_contig_nc7.fa +2 -0
- data/test/data/test_reference_aa1.fa +2 -0
- data/test/data/test_reference_nc1.fa +2 -0
- data/test/helper.rb +35 -6
- data/test/test_assembly.rb +5 -3
- data/test/test_cmd.rb +1 -1
- data/test/test_cmdline.rb +114 -0
- data/test/test_comp_metrics.rb +2 -2
- data/test/test_contig.rb +1 -1
- data/test/test_contig_metrics.rb +1 -1
- data/test/test_inline.rb +1 -1
- data/test/test_optimiser.rb +16 -16
- data/test/test_read_metrics.rb +1 -1
- data/test/test_salmon.rb +1 -1
- data/test/test_snap.rb +1 -1
- data/test/test_transrate.rb +1 -1
- data/test/test_transrater.rb +2 -2
- data/test/vagrant/centos_6.5_64/Vagrantfile +122 -0
- data/test/vagrant/debian_7.4_64/Vagrantfile +126 -0
- data/test/vagrant/debian_7.4_64/provision.sh +28 -0
- data/test/vagrant/fedora_20_64/Vagrantfile +122 -0
- data/test/vagrant/fedora_20_64/provision.sh +16 -0
- data/test/vagrant/linux-x86_64/Vagrantfile +10 -0
- data/test/vagrant/osx/Vagrantfile +18 -0
- data/test/vagrant/ubuntu_12.04_64/Vagrantfile +126 -0
- data/test/vagrant/ubuntu_12.04_64/provision.sh +24 -0
- data/transrate.gemspec +2 -2
- metadata +38 -17
- data/test/test_bin.rb +0 -139
data/lib/transrate/snap.rb
CHANGED
@@ -56,6 +56,7 @@ module Transrate
|
|
56
56
|
runner = Cmd.new snapcmd
|
57
57
|
runner.run
|
58
58
|
save_readcount runner.stdout
|
59
|
+
save_logs(runner.stdout, runner.stderr)
|
59
60
|
unless runner.status.success?
|
60
61
|
if runner.stderr=~/Unmatched\sread\sIDs/
|
61
62
|
logger.warn runner.stderr
|
@@ -71,6 +72,14 @@ module Transrate
|
|
71
72
|
@bam
|
72
73
|
end
|
73
74
|
|
75
|
+
def save_logs(stdout, stderr)
|
76
|
+
FileUtils.mkdir_p 'logs'
|
77
|
+
File.open('logs/snap.log', 'a') do |f|
|
78
|
+
f.write stdout
|
79
|
+
f.write stderr
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
74
83
|
def remap_reads(left, right, threads)
|
75
84
|
fixedleft = []
|
76
85
|
fixedright = []
|
@@ -90,6 +99,7 @@ module Transrate
|
|
90
99
|
runner = Cmd.new snapcmd
|
91
100
|
runner.run
|
92
101
|
save_readcount runner.stdout
|
102
|
+
save_logs(runner.stdout, runner.stderr)
|
93
103
|
unless runner.status.success?
|
94
104
|
raise SnapError.new("Snap failed\n#{runner.stderr}")
|
95
105
|
end
|
data/lib/transrate/version.rb
CHANGED
@@ -0,0 +1,57 @@
|
|
1
|
+
export PATH=~/gcc-4.8.4/bin:~/cmake-3.1.3-Linux-x86_64/bin:$PATH
|
2
|
+
|
3
|
+
cd ~
|
4
|
+
|
5
|
+
# transrate-tools
|
6
|
+
git clone --recursive https://github.com/Blahah/transrate-tools.git
|
7
|
+
cd transrate-tools/bamtools
|
8
|
+
mkdir build
|
9
|
+
cd build
|
10
|
+
cmake ..
|
11
|
+
make
|
12
|
+
cd ../..
|
13
|
+
cmake .
|
14
|
+
make
|
15
|
+
## package it up
|
16
|
+
cd src
|
17
|
+
tar zcvf bam-read_v1.0.0.beta4_linux.tar.gz bam-read
|
18
|
+
cp bam-read_v1.0.0.beta4_linux.tar.gz /vagrant/
|
19
|
+
|
20
|
+
# snap
|
21
|
+
git clone https://github.com/Blahah/snap.git
|
22
|
+
cd snap
|
23
|
+
git fetch
|
24
|
+
git checkout dev
|
25
|
+
make
|
26
|
+
# package it up
|
27
|
+
tar zcvf snap_v1.0dev.67.trfix1.tar.gz snap
|
28
|
+
cp snap_v1.0dev.67.trfix1.tar.gz /vagrant/
|
29
|
+
|
30
|
+
# salmon
|
31
|
+
git clone https://github.com/kingsfordgroup/sailfish.git
|
32
|
+
cd sailfish
|
33
|
+
git fetch
|
34
|
+
git checkout develop
|
35
|
+
mkdir build
|
36
|
+
cd build
|
37
|
+
cmake -DFETCH_BOOST=TRUE -DCMAKE_INSTALL_PREFIX=~/sailfish/ ..
|
38
|
+
make
|
39
|
+
make install
|
40
|
+
# collect libs for packaging
|
41
|
+
cd ..
|
42
|
+
scripts/cpld.bash bin/salmon lib
|
43
|
+
rm lib/libc.so.6
|
44
|
+
rm lib/ld-linux-x86-64l.so.2
|
45
|
+
rm lib/libdl.so.2
|
46
|
+
rm lib/libstdc++.so.6
|
47
|
+
rm lib/libgcc_s.so.1
|
48
|
+
rm lib/libpthread.so.0
|
49
|
+
|
50
|
+
# package it up
|
51
|
+
tar zcvf salmon_v0.3.0.tar.gz bin/salmon lib/
|
52
|
+
cp salmon_v0.3.0.tar.gz /vagrant/
|
53
|
+
|
54
|
+
# ruby 2.2 (for libruby)
|
55
|
+
|
56
|
+
|
57
|
+
# transrate (for the c extension)
|
@@ -0,0 +1,55 @@
|
|
1
|
+
brew tap homebrew/dupes
|
2
|
+
brew tap homebrew/versions
|
3
|
+
brew install cmake zlib gcc49 autoconf
|
4
|
+
|
5
|
+
cd ~
|
6
|
+
|
7
|
+
|
8
|
+
# transrate-tools
|
9
|
+
git clone --recursive https://github.com/Blahah/transrate-tools.git
|
10
|
+
## build bamtools
|
11
|
+
cd transrate-tools/bamtools
|
12
|
+
mkdir build
|
13
|
+
cd build
|
14
|
+
cmake ..
|
15
|
+
make
|
16
|
+
cd ../..
|
17
|
+
## build transrate-tools, directly specifying the static LIBZ location
|
18
|
+
cmake -DZLIB_LIBRARY=/usr/local/opt/zlib/lib/libz.a .
|
19
|
+
make
|
20
|
+
## package it up
|
21
|
+
cd src
|
22
|
+
tar zcvf bam-read_v1.0.0.beta4_osx.tar.gz bam-read
|
23
|
+
cp bam-read_v1.0.0.beta4_osx.tar.gz /vagrant/
|
24
|
+
|
25
|
+
|
26
|
+
# snap
|
27
|
+
cd ~
|
28
|
+
git clone https://github.com/Blahah/snap.git
|
29
|
+
cd snap
|
30
|
+
git fetch
|
31
|
+
git checkout dev
|
32
|
+
mv Makefile Makefile.old
|
33
|
+
# make sure snap uses gcc
|
34
|
+
sed 's/g\+\+/g\+\+-4\.9/g' Makefile.old > Makefile
|
35
|
+
make
|
36
|
+
# package it up
|
37
|
+
tar zcvf snap_v1.0dev.67.trfix1.tar.gz snap
|
38
|
+
cp snap_v1.0dev.67.trfix1.tar.gz /vagrant/
|
39
|
+
|
40
|
+
|
41
|
+
# salmon
|
42
|
+
git clone https://github.com/kingsfordgroup/sailfish.git
|
43
|
+
cd sailfish
|
44
|
+
git fetch
|
45
|
+
git checkout develop
|
46
|
+
mkdir build
|
47
|
+
cd build
|
48
|
+
cmake -DFETCH_BOOST=TRUE ..
|
49
|
+
make
|
50
|
+
make install
|
51
|
+
cd ..
|
52
|
+
# package it up
|
53
|
+
install_name_tool -add_rpath ../lib bin/salmon
|
54
|
+
tar zcvf salmon_v0.3.0.tar.gz bin/salmon lib/
|
55
|
+
cp salmon_v0.3.0.tar.gz /vagrant/
|
data/packaging/minify.sh
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
#! /bin/sh
|
2
|
+
|
3
|
+
# Remove tests
|
4
|
+
rm -rf lib/app/ruby/*/gems/*/test
|
5
|
+
rm -rf lib/app/ruby/*/gems/*/tests
|
6
|
+
rm -rf lib/app/ruby/*/gems/*/spec
|
7
|
+
rm -rf lib/app/ruby/*/gems/*/features
|
8
|
+
rm -rf lib/app/ruby/*/gems/*/benchmark
|
9
|
+
|
10
|
+
# Remove documentation
|
11
|
+
rm -f lib/app/ruby/*/gems/*/README*
|
12
|
+
rm -f lib/app/ruby/*/gems/*/CHANGE*
|
13
|
+
rm -f lib/app/ruby/*/gems/*/Change*
|
14
|
+
rm -f lib/app/ruby/*/gems/*/COPYING*
|
15
|
+
rm -f lib/app/ruby/*/gems/*/LICENSE*
|
16
|
+
rm -f lib/app/ruby/*/gems/*/MIT-LICENSE*
|
17
|
+
rm -f lib/app/ruby/*/gems/*/*.txt
|
18
|
+
rm -f lib/app/ruby/*/gems/*/*.md
|
19
|
+
rm -f lib/app/ruby/*/gems/*/*.rdoc
|
20
|
+
rm -rf lib/app/ruby/*/gems/*/doc
|
21
|
+
rm -rf lib/app/ruby/*/gems/*/docs
|
22
|
+
rm -rf lib/app/ruby/*/gems/*/example
|
23
|
+
rm -rf lib/app/ruby/*/gems/*/examples
|
24
|
+
rm -rf lib/app/ruby/*/gems/*/sample
|
25
|
+
rm -rf lib/app/ruby/*/gems/*/doc-api
|
26
|
+
find lib/app/ruby -name '*.md' | xargs rm -f
|
27
|
+
|
28
|
+
# Remove misc unnecessary files
|
29
|
+
rm -rf lib/app/ruby/*/gems/*/.gitignore
|
30
|
+
rm -rf lib/app/ruby/*/gems/*/.travis.yml
|
31
|
+
|
32
|
+
# Remove leftover native extension sources
|
33
|
+
rm -f lib/app/ruby/*/gems/*/ext/Makefile
|
34
|
+
rm -f lib/app/ruby/*/gems/*/ext/*/Makefile
|
35
|
+
find lib/app/ruby -name '*.c' | xargs rm -f
|
36
|
+
find lib/app/ruby -name '*.cpp' | xargs rm -f
|
37
|
+
find lib/app/ruby -name '*.h' | xargs rm -f
|
38
|
+
find lib/app/ruby -name '*.rl' | xargs rm -f
|
39
|
+
find lib/app/ruby -name 'extconf.rb' | xargs rm -f
|
40
|
+
|
41
|
+
# Remove Java files. They're only used for JRuby support
|
42
|
+
find lib/app/ruby -name '*.java' | xargs rm -f
|
43
|
+
find lib/app/ruby -name '*.class' | xargs rm -f
|
data/packaging/transrate
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
set -e
|
3
|
+
|
4
|
+
# Figure out where this script is located.
|
5
|
+
SELFDIR="`dirname \"$0\"`"
|
6
|
+
SELFDIR="`cd \"$SELFDIR\" && pwd`"
|
7
|
+
|
8
|
+
# Temporarily set PATH and LD_LIBRARY_PATH
|
9
|
+
export PATH=$SELFDIR/bin:$PATH
|
10
|
+
export LD_LIBRARY_PATH=$SELFDIR/lib:$LD_LIBRARY_PATH
|
11
|
+
export DYLD_FALLBACK_LIBRARY_PATH=$SELFDIR/lib:$DYLD_FALLBACK_LIBRARY_PATH
|
12
|
+
# Tell Bundler where the Gemfile and gems are.
|
13
|
+
export BUNDLE_GEMFILE="$SELFDIR/lib/app/Gemfile"
|
14
|
+
unset BUNDLE_IGNORE_CONFIG
|
15
|
+
|
16
|
+
# Tell transrate this is the packaged version
|
17
|
+
export TRANSRATE_PACKAGED_BINARY=true
|
18
|
+
|
19
|
+
# Run the actual app using the bundled Ruby interpreter, with Bundler activated.
|
20
|
+
exec "$SELFDIR/lib/app/ruby/bin/ruby" -rbundler/setup "$SELFDIR/lib/app/bin/transrate" $@
|
@@ -0,0 +1,4 @@
|
|
1
|
+
>contig1
|
2
|
+
GTTGATGAAGAAAAAACTAGAGTGTGTGGATTGCATGAAATGGGCTGGGGCTTGTTGGAATTTTGCTATTGAAACTAATGTTTACTTCAAATTGATAGGAATTCAGTTGGTTTTCTGGTGGTNTCTCTTTCTTCTTCACAATTGGATTTTGATTCCAAACACCATCTCTTGGGAATTCAGTTGGTTTTCTGGTGA
|
3
|
+
>contig2
|
4
|
+
TAGGAATTCAGTTGGTTTTCTGGTGGTNTCTCTTTCTTCTTCACAATTGGATTTTGATTCCAAACACCATCTCTTGGGAATTCAGTTGGTTTTCTGGTGATAAACACTTCAATTTGACTATGGACTCTGTGTATTGTAAAGAACATGATGACAGAATTGCTTCGAATCCGGTGGGTTTACAGTCATCCGGGTCGG
|
@@ -0,0 +1,6 @@
|
|
1
|
+
>contig1
|
2
|
+
TTTCAGTTGATGAAGAAAAAACTAGAGTGTGTGGATTGCATGAAATGGGCTGGGGCTTGTTGGAATTTTGCTATTGAAACTAATGTTTACTTCAAATTGA
|
3
|
+
>contig2
|
4
|
+
TAAACACTTCAATTTGACTATGGACTCTGTGTATTGTAAAGAACATGATGACAGAATTGCTTCGAATCCGGTGGGTTTACAGTCATCCGGGTCGGGTCCT
|
5
|
+
>contig3
|
6
|
+
TGGGGCTTGTTGGAATTTTGCTATTGAAACTAATGTTTACTTCAAATTGATAGGAATTCAGTTGGTTTTCTGGTGGTNTCTCTTTCTTCTTCACAATTGGATTTTGATTCCAAACACCATCTCTTGGGAATTCAGTTGGTTTTCTGGTGATAAACACTTCAATTTGACTATGGACTCTGTGTATTGTAAAGAACATGATG
|
@@ -0,0 +1,4 @@
|
|
1
|
+
>contig1
|
2
|
+
TGCATGAAATGGGCTGGGGCTTGTTGGAATTTTGCTATTGAAACTAATGTTTACTTCAAATTGATAGGAATTCAGTTGGTTTTCTGGTGGTNTCTCTTTCTTCTTCACAATTGGATTTTGATTCCAAACACCATCTCTTGGGAATTCAGT
|
3
|
+
>contig2
|
4
|
+
TGCATGAAATGGGCTGGGGCTTGTTGGAATTTTGCTATTGAAACTAATGTTTACTTCAAATTGATAGGAATTCAGTTGGTTTTCTGGTGGTNTCTCTTTCTTCTTCACAATTGGATTTTGATTCCAAACACCATCTCTTGGGAATTCAGT
|
@@ -0,0 +1,6 @@
|
|
1
|
+
>contig1
|
2
|
+
TGGGGCTTGTTGGAATTTTGCTATTGAAACTAATGTTTACTTCAAATTGATAGGAATTCAGTTGGTTTTCTGGTGGTNTCTCTTTCTTCTTCACAATTGGATTTTGATTCCAAACACCATCTCTTGGGAATTCAGTTGGTTTTCTGGTGATAAACACTTCAATTTGACTATGGACTCTGTGTATTGTAAAGAACATGATG
|
3
|
+
>contig2
|
4
|
+
TAGGAATTCAGTTGGTTTTCTGGTGGTNTCTCTTTCTTCTTCACAATTGGATTTTGATTCCAAACACCATCTCTTGGGAATTCAGTTGGTTTTCTGGTGA
|
5
|
+
>contig3
|
6
|
+
TTCAGTTGGTTTTCTGGTGGTNTCTCTTTCTTCTTCACAATTGGATTTTGATTCCAAACACCATCTCTTGGGAATTCAGTTGGTTTTCTGGTGATAAACA
|
@@ -0,0 +1,2 @@
|
|
1
|
+
>reference1
|
2
|
+
TTTCAGTTGATGAAGAAAAAACTAGAGTGTGTGGATTGCATGAAATGGGCTGGGGCTTGTTGGAATTTTGCTATTGAAACTAATGTTTACTTCAAATTGATAGGAATTCAGTTGGTTTTCTGGTGGTNTCTCTTTCTTCTTCACAATTGGATTTTGATTCCAAACACCATCTCTTGGGAATTCAGTTGGTTTTCTGGTGATAAACACTTCAATTTGACTATGGACTCTGTGTATTGTAAAGAACATGATGACAGAATTGCTTCGAATCCGGTGGGTTTACAGTCATCCGGGTCGGGTCCT
|
data/test/helper.rb
CHANGED
@@ -7,13 +7,12 @@ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
|
7
7
|
]
|
8
8
|
SimpleCov.start
|
9
9
|
|
10
|
+
require "stringio"
|
11
|
+
|
10
12
|
require 'minitest/autorun'
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
Turn.config.trace = 5
|
15
|
-
rescue LoadError
|
16
|
-
end
|
13
|
+
require "minitest/reporters"
|
14
|
+
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
|
15
|
+
|
17
16
|
require 'shoulda/context'
|
18
17
|
require 'transrate'
|
19
18
|
|
@@ -29,3 +28,33 @@ test_files.each do |file|
|
|
29
28
|
cmd.run
|
30
29
|
end
|
31
30
|
end
|
31
|
+
|
32
|
+
def capture_stderr
|
33
|
+
real_stderr, $stderr = $stderr, StringIO.new
|
34
|
+
yield
|
35
|
+
$stderr.string
|
36
|
+
ensure
|
37
|
+
$stderr = real_stderr
|
38
|
+
end
|
39
|
+
|
40
|
+
def capture_stdout
|
41
|
+
real_stdout, $stdout = $stdout, StringIO.new
|
42
|
+
yield
|
43
|
+
$stdout.string
|
44
|
+
ensure
|
45
|
+
$stdout = real_stdout
|
46
|
+
end
|
47
|
+
|
48
|
+
# use within an at_exit block, exploits the capture of last exception in
|
49
|
+
# the global var $!
|
50
|
+
def last_exit_successful?
|
51
|
+
$!.nil? || $!.is_a?(SystemExit) && $!.success?
|
52
|
+
end
|
53
|
+
|
54
|
+
def sorghum_data
|
55
|
+
assembly = File.join(File.dirname(__FILE__), 'data', 'sorghum_100.fa')
|
56
|
+
reference = File.join(File.dirname(__FILE__), 'data', 'Os.protein.2.fa')
|
57
|
+
left = File.join(File.dirname(__FILE__), 'data', 'sorghum_100.1.fastq')
|
58
|
+
right = File.join(File.dirname(__FILE__), 'data', 'sorghum_100.2.fastq')
|
59
|
+
[assembly, reference, left, right]
|
60
|
+
end
|
data/test/test_assembly.rb
CHANGED
@@ -2,7 +2,7 @@ require 'helper'
|
|
2
2
|
require 'bio'
|
3
3
|
require 'tmpdir'
|
4
4
|
|
5
|
-
class TestAssembly < Test
|
5
|
+
class TestAssembly < MiniTest::Test
|
6
6
|
|
7
7
|
context "Assembly" do
|
8
8
|
|
@@ -41,8 +41,10 @@ class TestAssembly < Test::Unit::TestCase
|
|
41
41
|
ref = File.join(File.dirname(__FILE__), 'data', 'sorghum_100.fa')
|
42
42
|
cmd = Transrate::Cmd.new("cat #{ref} #{ref} > tmp.fa")
|
43
43
|
cmd.run
|
44
|
-
|
45
|
-
|
44
|
+
capture_stderr do
|
45
|
+
assert_raises Transrate::AssemblyError do
|
46
|
+
assembly = Transrate::Assembly.new("tmp.fa")
|
47
|
+
end
|
46
48
|
end
|
47
49
|
end
|
48
50
|
end
|
data/test/test_cmd.rb
CHANGED
@@ -0,0 +1,114 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'csv'
|
3
|
+
|
4
|
+
class TestCmdline < MiniTest::Test
|
5
|
+
|
6
|
+
context "Transrate" do
|
7
|
+
|
8
|
+
teardown do
|
9
|
+
`rm -rf transrate_results`
|
10
|
+
end
|
11
|
+
|
12
|
+
should "fail nicely on non existent assembly files" do
|
13
|
+
assert_raises Transrate::TransrateIOError do
|
14
|
+
Transrate::Cmdline.new("--assembly foo.fasta".split)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
should "fail nicely when assembly is not provided" do
|
19
|
+
assert_raises Transrate::TransrateArgError do
|
20
|
+
Transrate::Cmdline.new("--left left.fq".split)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
should "fail on non existent reference files" do
|
25
|
+
Dir.mktmpdir do |tmpdir|
|
26
|
+
Dir.chdir tmpdir do
|
27
|
+
assembly, reference, left, right = sorghum_data
|
28
|
+
assert_raises Transrate::TransrateIOError do
|
29
|
+
Transrate::Cmdline.new("--assembly #{assembly} --reference foo.fasta".split)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
should "run on test data" do
|
36
|
+
Dir.mktmpdir do |tmpdir|
|
37
|
+
Dir.chdir tmpdir do
|
38
|
+
captured_stdout = capture_stdout do
|
39
|
+
assembly, reference, left, right = sorghum_data
|
40
|
+
cmd = "--assembly #{assembly}"
|
41
|
+
cmd << " --reference #{reference}"
|
42
|
+
cmd << " --left #{left}"
|
43
|
+
cmd << " --right #{right}"
|
44
|
+
c = Transrate::Cmdline.new(cmd.split)
|
45
|
+
c.run
|
46
|
+
end
|
47
|
+
assert File.exist?("transrate_results/assemblies.csv"), "csv file doesn't exist"
|
48
|
+
assert File.exist?("transrate_results/sorghum_100/contigs.csv"),
|
49
|
+
"contig csv file doesn't exist"
|
50
|
+
hash = {}
|
51
|
+
CSV.foreach("transrate_results/assemblies.csv", :headers => true,
|
52
|
+
:header_converters => :symbol,
|
53
|
+
:converters => :all) do |row|
|
54
|
+
row.headers
|
55
|
+
row.fields
|
56
|
+
row.headers.zip(row.fields).each do |header, field|
|
57
|
+
hash[header]=field
|
58
|
+
end
|
59
|
+
end
|
60
|
+
assert_in_delta 137748, hash[:n_bases], 1000, "number of bases"
|
61
|
+
assert_equal 1692, hash[:n50], "n50"
|
62
|
+
assert_equal 2, hash[:n_refs_with_crbb], "number of crb hits"
|
63
|
+
assert_equal 2, hash[:n_contigs_with_crbb], "number of contigs with hits"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
should "run on test data with comma separated list of fastq files" do
|
69
|
+
Dir.mktmpdir do |tmpdir|
|
70
|
+
Dir.chdir tmpdir do
|
71
|
+
captured_stdout = capture_stdout do
|
72
|
+
assembly, reference, left, right = sorghum_data
|
73
|
+
left = [left]
|
74
|
+
left << File.join(File.dirname(__FILE__), 'data', '150uncovered.l.fq')
|
75
|
+
right = [right]
|
76
|
+
right << File.join(File.dirname(__FILE__), 'data', '150uncovered.r.fq')
|
77
|
+
cmd = "--assembly #{assembly}"
|
78
|
+
cmd << " --left #{left.join(",")}"
|
79
|
+
cmd << " --right #{right.join(",")}"
|
80
|
+
c = Transrate::Cmdline.new(cmd.split)
|
81
|
+
c.run
|
82
|
+
end
|
83
|
+
assert File.exist?("transrate_results/assemblies.csv")
|
84
|
+
assert File.exist?("transrate_results/sorghum_100/contigs.csv"),
|
85
|
+
"contig csv file doesn't exist"
|
86
|
+
hash = {}
|
87
|
+
CSV.foreach("transrate_results/assemblies.csv", :headers => true,
|
88
|
+
:header_converters => :symbol,
|
89
|
+
:converters => :all) do |row|
|
90
|
+
row.headers.zip(row.fields).each do |header, field|
|
91
|
+
hash[header]=field
|
92
|
+
end
|
93
|
+
end
|
94
|
+
assert_in_delta 137748, hash[:n_bases], 1000, "number of bases"
|
95
|
+
assert_equal 1692, hash[:n50], "n50"
|
96
|
+
assert_equal 25006 + 223, hash[:fragments], "number of reads"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
should "fail when one of multiple assemblies is missing" do
|
102
|
+
assembly, reference, left, right = sorghum_data
|
103
|
+
assembly2 = "does_not_exist.fa"
|
104
|
+
cmd = " --assembly #{assembly},#{assembly2}"
|
105
|
+
cmd << " --reference #{reference}"
|
106
|
+
cmd << " --left #{left}"
|
107
|
+
cmd << " --right #{right}"
|
108
|
+
assert_raises Transrate::TransrateIOError do
|
109
|
+
Transrate::Cmdline.new(cmd.split)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
end
|