Class: Bio::Velvet::Underground
- Inherits:
-
Object
- Object
- Bio::Velvet::Underground
- Extended by:
- FFI::Library
- Includes:
- UndergroundLogging
- Defined in:
- lib/bio-velvet_underground.rb,
lib/bio-velvet_underground/graph.rb,
lib/bio-velvet_underground/runner.rb,
lib/bio-velvet_underground/constants.rb,
lib/bio-velvet_underground/binary_sequence_store.rb
Defined Under Namespace
Classes: ArcStruct, BinarySequenceStore, Graph, GraphStruct, NodeStruct, ReadSet, Runner, ShortReadMarker
Constant Summary collapse
- DEFAULT_MAXKMERLENGTH =
31
Class Method Summary collapse
- .attach_runner_functions ⇒ Object
-
.attach_shared_library(velvet_compilation_options = {}) ⇒ Object
Attach the correct shared velvet library with ffi.
-
.compilation_max_kmer(graph_hash_length) ⇒ Object
Return the minimum kmer length greater than or equal to the given graph hash length e.g.
-
.library_location_of(max_kmer_length = nil) ⇒ Object
Where is the library given the max_kmer_length.
- .log ⇒ Object
-
.max_kmers ⇒ Object
Different versions of velvet are compiled on installation of bio-velvet_underground.
Methods included from UndergroundLogging
Class Method Details
.attach_runner_functions ⇒ Object
55 56 57 58 |
# File 'lib/bio-velvet_underground/runner.rb', line 55 def self.attach_runner_functions attach_function :velveth, [:int32, :pointer], :int32 attach_function :velvetg, [:int32, :pointer], :int32 end |
.attach_shared_library(velvet_compilation_options = {}) ⇒ Object
Attach the correct shared velvet library with ffi. Options: :kmer: attach library with at least this much kmer length
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/bio-velvet_underground.rb', line 30 def self.attach_shared_library(={}) max_kmer_length = nil given_kmer = [:kmer] if !given_kmer.nil? max_kmer_length = compilation_max_kmer(given_kmer) raise "No installed velvet library available for max kmer #{given_kmer}" if max_kmer_length.nil? end log.debug "Found max kmer length #{max_kmer_length} to load with the velvet library" # Set the ffi library path to the correct velvet one lib_location = self.library_location_of(max_kmer_length) log.debug "Loading velvet underground FFI library #{lib_location}.." ffi_lib lib_location log.debug "Velvet library loaded." attach_graph_functions attach_binary_sequence_functions attach_runner_functions end |
.compilation_max_kmer(graph_hash_length) ⇒ Object
Return the minimum kmer length greater than or equal to the given graph hash length e.g. 29 => 31, 31 => 31, 33 => 63.
24 25 26 |
# File 'lib/bio-velvet_underground.rb', line 24 def self.compilation_max_kmer(graph_hash_length) max_kmers.select{|k| graph_hash_length<=k}.min end |
.library_location_of(max_kmer_length = nil) ⇒ Object
Where is the library given the max_kmer_length
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/bio-velvet_underground/constants.rb', line 16 def self.library_location_of(max_kmer_length=nil) if !Bio::Velvet::Underground.max_kmers.include?(max_kmer_length) and !max_kmer_length.nil? raise "bad max kmer length #{max_kmer_length}" end extras = [] if !max_kmer_length.nil? and max_kmer_length != DEFAULT_MAXKMERLENGTH extras.push "-maxkmer#{max_kmer_length}" end return File.join( File.dirname(__FILE__), 'external', "libvelvet#{extras.join('') }.so.1.0") end |
.log ⇒ Object
18 19 20 |
# File 'lib/bio-velvet_underground.rb', line 18 def self.log Bio::Log::LoggerPlus['bio-velvet_underground'] end |
.max_kmers ⇒ Object
Different versions of velvet are compiled on installation of bio-velvet_underground. These are the different MAXKMERLENGTH parameters that are given to the velvet Makefile. See the velvet manual for more information on this.
11 12 13 |
# File 'lib/bio-velvet_underground/constants.rb', line 11 def self.max_kmers [31,63,127,255] end |