Class: Unipept::BlastFormatter

Inherits:
Formatter show all
Defined in:
lib/formatters.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Formatter

available, default, #format, formatters, #group_by_first_key, #integrate_fasta_headers, new_for_format, register

Class Method Details

.hidden?Boolean

Returns:

  • (Boolean)


319
320
321
# File 'lib/formatters.rb', line 319

def self.hidden?
  true
end

Instance Method Details

#convert(data, _first) ⇒ String

Converts the given input data to the Blast format.

Parameters:

  • data (Array)

    The data we wish to convert

  • Is (Boolean)

    this the first output batch?

Returns:

  • (String)

    The converted input data in the Blast format



338
339
340
341
342
343
344
345
# File 'lib/formatters.rb', line 338

def convert(data, _first)
  data
    .reject { |o| o['refseq_protein_ids'].empty? }
    .map do |o|
      "#{o['peptide']}\tref|#{o['refseq_protein_ids']}|\t100\t10\t0\t0\t0\t10\t0\t10\t1e-100\t100\n"
    end
    .join
end


327
328
329
# File 'lib/formatters.rb', line 327

def footer
  ''
end

#header(_data, _fasta_mapper = nil) ⇒ Object



323
324
325
# File 'lib/formatters.rb', line 323

def header(_data, _fasta_mapper = nil)
  ''
end

#typeString

Returns The type of the current formatter: blast.

Returns:

  • (String)

    The type of the current formatter: blast



315
316
317
# File 'lib/formatters.rb', line 315

def type
  'blast'
end