Class: SequenceServer::BLAST::Formatter

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

Overview

Formatter is invoked during report generation or for results download to convert BLAST+ archive file to other formats. Formatter generates output in Job#dir. Output files persist till the job itself is deleted. Calling Formatter a second time (for the same input job and output format) will return saved ouput.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job, type) ⇒ Formatter

Returns a new instance of Formatter.



18
19
20
21
22
23
24
# File 'lib/sequenceserver/blast/formatter.rb', line 18

def initialize(job, type)
  @job = job
  @type = type

  @format, @mime, @specifiers = OUTFMT[type]
  run
end

Instance Attribute Details

#formatObject (readonly)

Returns the value of attribute format.



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

def format
  @format
end

#mimeObject (readonly)

Returns the value of attribute mime.



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

def mime
  @mime
end

#specifiersObject (readonly)

Returns the value of attribute specifiers.



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

def specifiers
  @specifiers
end

Instance Method Details

#filenameObject



36
37
38
# File 'lib/sequenceserver/blast/formatter.rb', line 36

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

#filepathObject



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

def filepath
  @filepath ||= File.join(job.dir, filename)
end

#read_fileObject



40
41
42
# File 'lib/sequenceserver/blast/formatter.rb', line 40

def read_file
  File.read(filepath)
end

#sizeObject



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

def size
  File.size(filepath)
end