Class: SequenceServer::BLAST::Formatter

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/sequenceserver/blast/formatter.rb

Overview

Formats BLAST+ archive file format into other file formats.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(search_id, type) ⇒ Formatter

Returns a new instance of Formatter


15
16
17
18
19
20
21
# File 'lib/sequenceserver/blast/formatter.rb', line 15

def initialize(search_id, type)
  @archive_file = get_archive_file search_id
  @format, @mime, @specifiers = OUTFMT[type]
  @type = type

  validate && run
end

Instance Attribute Details

#archive_fileObject (readonly)

Returns the value of attribute archive_file


23
24
25
# File 'lib/sequenceserver/blast/formatter.rb', line 23

def archive_file
  @archive_file
end

#formatObject (readonly)

Returns the value of attribute format


25
26
27
# File 'lib/sequenceserver/blast/formatter.rb', line 25

def format
  @format
end

#mimeObject (readonly)

Returns the value of attribute mime


25
26
27
# File 'lib/sequenceserver/blast/formatter.rb', line 25

def mime
  @mime
end

#specifiersObject (readonly)

Returns the value of attribute specifiers


25
26
27
# File 'lib/sequenceserver/blast/formatter.rb', line 25

def specifiers
  @specifiers
end

#typeObject (readonly)

Returns the value of attribute type


23
24
25
# File 'lib/sequenceserver/blast/formatter.rb', line 23

def type
  @type
end

Instance Method Details

#fileObject


27
28
29
# File 'lib/sequenceserver/blast/formatter.rb', line 27

def file
  @file ||= Tempfile.new filename
end

#filenameObject


31
32
33
34
# File 'lib/sequenceserver/blast/formatter.rb', line 31

def filename
  @filename ||=
    "sequenceserver-#{type}_report.#{mime}"
end