Class: Rbfam::Alignment
- Inherits:
-
Object
- Object
- Rbfam::Alignment
- Includes:
- CommonHelpers
- Defined in:
- lib/rbfam/modules/alignment.rb
Constant Summary collapse
- LINE_REGEXP =
/^([\w\.]+)\/(\d+)\-(\d+)\s+([AUGC\.]+)$/
Instance Attribute Summary collapse
-
#family ⇒ Object
readonly
Returns the value of attribute family.
-
#seed ⇒ Object
readonly
Returns the value of attribute seed.
Instance Method Summary collapse
- #entries(options = {}) ⇒ Object
-
#initialize(family) ⇒ Alignment
constructor
A new instance of Alignment.
- #load_entries!(options = {}) ⇒ Object
- #save_entries! ⇒ Object
Methods included from CommonHelpers
Constructor Details
#initialize(family) ⇒ Alignment
Returns a new instance of Alignment.
9 10 11 |
# File 'lib/rbfam/modules/alignment.rb', line 9 def initialize(family) @family = family end |
Instance Attribute Details
#family ⇒ Object (readonly)
Returns the value of attribute family.
7 8 9 |
# File 'lib/rbfam/modules/alignment.rb', line 7 def family @family end |
#seed ⇒ Object (readonly)
Returns the value of attribute seed.
7 8 9 |
# File 'lib/rbfam/modules/alignment.rb', line 7 def seed @seed end |
Instance Method Details
#entries(options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rbfam/modules/alignment.rb', line 13 def entries( = {}) = { alignment: :seed, limit: false }.merge() @parsed_entries ||= (pull_from_server([:alignment]) || "").split(/\n/).reject do |line| line =~ /^#/ end.select do |line| line =~ LINE_REGEXP end[[:limit] ? 0...[:limit] : 0..-1].map(&method(:parse_line)).tap do @seed = [:alignment] == :seed end end |
#load_entries!(options = {}) ⇒ Object
29 30 31 |
# File 'lib/rbfam/modules/alignment.rb', line 29 def load_entries!( = {}) @parsed_entries = family.load_entries!() end |
#save_entries! ⇒ Object
25 26 27 |
# File 'lib/rbfam/modules/alignment.rb', line 25 def save_entries! entries.each { |sequence| sequence.save!(seed: seed) } end |