Class: Bioinform::YAMLCollectionParser

Inherits:
Parser show all
Includes:
MultipleMotifsParser
Defined in:
lib/bioinform/parsers/yaml_parser.rb

Instance Attribute Summary

Attributes inherited from Parser

#input

Instance Method Summary collapse

Methods inherited from Parser

array_from_acgt_hash, choose, need_tranpose?, normalize_hash_keys, parse, #parse, parse!, transform_input, try_convert_to_array, valid_matrix?

Methods included from Parser::SingleMotifParser

#each, included

Constructor Details

#initialize(input) ⇒ YAMLCollectionParser

Returns a new instance of YAMLCollectionParser.



23
24
25
# File 'lib/bioinform/parsers/yaml_parser.rb', line 23

def initialize(input)
  @input = input
end

Instance Method Details

#collectionObject



26
27
28
# File 'lib/bioinform/parsers/yaml_parser.rb', line 26

def collection
  @collection ||= YAML.load(input)
end

#parse!Object



29
30
31
32
33
# File 'lib/bioinform/parsers/yaml_parser.rb', line 29

def parse!
  collection.container.shift.pm
rescue Psych::SyntaxError
  raise 'parsing error'
end