bio-velvet 0.4.2 → 0.5.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/Gemfile +1 -0
- data/VERSION +1 -1
- data/lib/bio-velvet/graph.rb +1 -1
- data/lib/bio-velvet/runner.rb +39 -7
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9aabe701dacbf7cda8d1d87ed8fc183c655f808c
|
4
|
+
data.tar.gz: 84bcad61582984031f5e34471a84a964c8564485
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1958b34c29aa4c69e3f8282af61f630e809c19b42a95ada248fda72e85e4e0ca49fd8976e65bf168dc96775afe10ddb1006f99ec5af34f1aa82f2d9bf3d4f997
|
7
|
+
data.tar.gz: e30e66ded35e8d22a663c942420caa5dd7a87c0adce6c076d18a8b66295b732b439675de976a72b87b6c0582d454d20b0c91f5de0dd2f7176d8c745c2a6e0862
|
data/Gemfile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
data/lib/bio-velvet/graph.rb
CHANGED
@@ -447,7 +447,7 @@ module Bio
|
|
447
447
|
fwd = @ends_of_kmers_of_node[0...10]+'..'
|
448
448
|
rev = @ends_of_kmers_of_twin_node[0...10]+'..'
|
449
449
|
end
|
450
|
-
"Node #{@node_id}: #{fwd} / #{rev}"
|
450
|
+
"Node from #{@parent_graph.class}: #{@node_id}: #{fwd} / #{rev}"
|
451
451
|
end
|
452
452
|
|
453
453
|
def inspect
|
data/lib/bio-velvet/runner.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
require 'files'
|
2
2
|
require 'systemu'
|
3
|
+
require 'parallel'
|
3
4
|
|
4
5
|
module Bio
|
5
6
|
module Velvet
|
6
7
|
class Runner
|
7
8
|
include Bio::Velvet::Logging
|
9
|
+
include Parallel::ProcessorCount
|
8
10
|
|
9
11
|
# Run velveth and then velvetg, with the given kmer size. Returned
|
10
12
|
# is a Bio::Velvet::Result class, stored in a temporary directory.
|
@@ -14,13 +16,21 @@ module Bio
|
|
14
16
|
# to velveth and velvetg, respectively.
|
15
17
|
#
|
16
18
|
# The final options argument is used to specify bio-velvet wrapper options. Currently:
|
17
|
-
# :output_assembly_path: a directory where the assembly takes place
|
19
|
+
# :output_assembly_path: a directory where the assembly takes place [default: a temporary directory]
|
20
|
+
# :velveth_path: path to the velveth binary [default: 'velveth']
|
21
|
+
# :velvetg_path: path to the velvetg binary [default: 'velvetg']
|
22
|
+
# :threads: number of threads to use [default: all threads on the machine]
|
18
23
|
def velvet(kmer_length, velveth_options_string, velvetg_options_string='', options={})
|
19
24
|
res = velveth kmer_length, velveth_options_string, options
|
20
|
-
velvetg res, velvetg_options_string
|
25
|
+
velvetg res, velvetg_options_string, options
|
21
26
|
end
|
22
27
|
|
28
|
+
# Run velveth with the given kmer and return a Bio::Velvet::Result object
|
29
|
+
#
|
30
|
+
# Options:
|
31
|
+
# :velveth_path: path to the velveth binary [default: 'velveth']
|
23
32
|
def velveth(kmer_length, velveth_arguments, options={})
|
33
|
+
set_num_cpus(options[:threads])
|
24
34
|
result = Result.new
|
25
35
|
outdir = nil
|
26
36
|
if options[:output_assembly_path]
|
@@ -31,8 +41,11 @@ module Bio
|
|
31
41
|
end
|
32
42
|
result.result_directory = outdir
|
33
43
|
|
44
|
+
binary = options[:velveth_path]
|
45
|
+
binary ||= 'velveth'
|
46
|
+
|
34
47
|
# Run velveth
|
35
|
-
cmd = "
|
48
|
+
cmd = "#{binary} #{result.result_directory} #{kmer_length} #{velveth_arguments}"
|
36
49
|
log.info "Running velveth: #{cmd}" if log.info?
|
37
50
|
status, stdout, stderr = systemu cmd
|
38
51
|
if status.exitstatus != 0
|
@@ -47,8 +60,15 @@ module Bio
|
|
47
60
|
# Run velvetg, with a Bio::Velvet::Result object
|
48
61
|
# generated with velveth, and velvetg arguments as a String (no need to specify the velvet directory, just the extra
|
49
62
|
# arguments).
|
50
|
-
|
51
|
-
|
63
|
+
#
|
64
|
+
# Further options (the third argument):
|
65
|
+
# :velvetg_path: path to the velvetg binary [default: 'velvetg']
|
66
|
+
def velvetg(velveth_result_object, velvetg_arguments, options={})
|
67
|
+
binary = options[:velvetg_path]
|
68
|
+
binary ||= 'velvetg'
|
69
|
+
|
70
|
+
cmd = "#{binary} #{velveth_result_object.result_directory} #{velvetg_arguments}"
|
71
|
+
|
52
72
|
log.info "Running velvetg: #{cmd}" if log.info?
|
53
73
|
status, stdout, stderr = systemu cmd
|
54
74
|
if status.exitstatus != 0
|
@@ -62,8 +82,8 @@ module Bio
|
|
62
82
|
|
63
83
|
# Detect the binary version currently in use and return
|
64
84
|
# as a String
|
65
|
-
def binary_version
|
66
|
-
cmd =
|
85
|
+
def binary_version(velveth_path='velveth')
|
86
|
+
cmd = velveth_path
|
67
87
|
log.info "Running velveth: #{cmd}" if log.info?
|
68
88
|
status, stdout, stderr = systemu cmd
|
69
89
|
if status.exitstatus != 0
|
@@ -76,6 +96,18 @@ module Bio
|
|
76
96
|
raise "Unable to parse the version number from running `#{cmd}', the output was: #{stdout}"
|
77
97
|
end
|
78
98
|
end
|
99
|
+
|
100
|
+
# According to the manual,
|
101
|
+
#"Velvet will the use up to OMP_NUM_THREADS+1 or OMP_THREAD_LIMIT threads."
|
102
|
+
#
|
103
|
+
# Argument is the number of CPUs, or nil if all CPUs on the machine are
|
104
|
+
# to be used
|
105
|
+
def set_num_cpus(num_cpus=nil)
|
106
|
+
num_cpus ||= processor_count #from the parallel gem
|
107
|
+
log.debug "Setting number of CPUs to run velvet with to #{num_cpus}."
|
108
|
+
ENV['OMP_NUM_THREADS'] = (num_cpus - 1).to_s
|
109
|
+
ENV['OMP_THREAD_LIMIT'] = num_cpus.to_s
|
110
|
+
end
|
79
111
|
end
|
80
112
|
|
81
113
|
class VelvetRunnerException < Exception; end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bio-velvet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben J Woodcroft
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bio-logger
|
@@ -80,6 +80,26 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0.1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: parallel
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.3.3
|
90
|
+
- - "~>"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '1.3'
|
93
|
+
type: :runtime
|
94
|
+
prerelease: false
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 1.3.3
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '1.3'
|
83
103
|
- !ruby/object:Gem::Dependency
|
84
104
|
name: rspec
|
85
105
|
requirement: !ruby/object:Gem::Requirement
|