Class: RGFA

Inherits:
Object
  • Object
show all
Defined in:
lib/bfa.rb

Defined Under Namespace

Classes: ByteArray, Line

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_bfa(filename) ⇒ Object



37
38
39
# File 'lib/bfa.rb', line 37

def from_bfa(filename)
  BFA::Reader.parse(filename)
end

.from_file(filename) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/bfa.rb', line 20

def from_file(filename)
  f = File.open(filename)
  is_gzip = (f.read(2).bytes == [31,139])
  if is_gzip
    # currently only gzipped bfa are supported
    f.close
    from_bfa(filename)
  end
  is_bfa = (f.read(4) == BFA::Constants::MAGIC_STRING)
  f.close
  if is_bfa
    from_bfa(filename)
  else
    from_gfa(filename)
  end
end

.from_gfaObject



18
# File 'lib/bfa.rb', line 18

alias_method :from_gfa, :from_file

Instance Method Details

#to_bfa(filename, compressed = true) ⇒ Object



11
12
13
14
# File 'lib/bfa.rb', line 11

def to_bfa(filename, compressed=true)
  BFA::Writer.encode(filename, self, compressed)
  return nil
end