Class: ViennaRna::Package::TabuPath::Path

Inherits:
Object
  • Object
show all
Defined in:
lib/vienna_rna/package/tabu_path.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rna, output) ⇒ Path

Returns a new instance of Path.



30
31
32
33
34
# File 'lib/vienna_rna/package/tabu_path.rb', line 30

def initialize(rna, output)
  @rna                      = rna
  @path                     = output.split(?\n)[0..-2].unshift(rna.str_1)
  @barrier, _, @best_weight = output.split(?\n)[-1].gsub(/[^\d\.]/, " ").strip.split(/\s+/).map(&:to_f)
end

Instance Attribute Details

#barrierObject (readonly)

Returns the value of attribute barrier.



28
29
30
# File 'lib/vienna_rna/package/tabu_path.rb', line 28

def barrier
  @barrier
end

#best_weightObject (readonly)

Returns the value of attribute best_weight.



28
29
30
# File 'lib/vienna_rna/package/tabu_path.rb', line 28

def best_weight
  @best_weight
end

#pathObject (readonly)

Returns the value of attribute path.



28
29
30
# File 'lib/vienna_rna/package/tabu_path.rb', line 28

def path
  @path
end

#rnaObject (readonly)

Returns the value of attribute rna.



28
29
30
# File 'lib/vienna_rna/package/tabu_path.rb', line 28

def rna
  @rna
end

Instance Method Details

#full_path?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/vienna_rna/package/tabu_path.rb', line 40

def full_path?
  rna.str_1 == path.first && rna.str_2 == path.last
end

#inspectObject



44
45
46
# File 'lib/vienna_rna/package/tabu_path.rb', line 44

def inspect
  "#<#{self.class.name} with barrier %.2f and length %d on #{rna.inspect}>" % [barrier, best_weight]
end

#lengthObject



36
37
38
# File 'lib/vienna_rna/package/tabu_path.rb', line 36

def length
  path.length
end