Class: Bio::Fasta

Inherits:
Object show all
Defined in:
lib/bio/appl/fasta.rb,
lib/bio/appl/fasta/format10.rb

Defined Under Namespace

Classes: Report

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(program, db, opt = [], server = 'local') ⇒ Fasta

Returns a FASTA factory object (Bio::Fasta).



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/bio/appl/fasta.rb', line 23

def initialize(program, db, opt = [], server = 'local')
  @format	= 10

  @program	= program
  @db	= db
  @server	= server

  @ktup	= nil
  @matrix	= nil

  @output	= ''

  begin
    a = opt.to_ary
  rescue NameError #NoMethodError
    # backward compatibility
    a = Shellwords.shellwords(opt)
  end
  @options	= [ '-Q', '-H', '-m', @format.to_s, *a ] # need -a ?
end

Instance Attribute Details

#dbObject

Returns the value of attribute db.



43
44
45
# File 'lib/bio/appl/fasta.rb', line 43

def db
  @db
end

#formatObject

Returns the value of attribute format.



67
68
69
# File 'lib/bio/appl/fasta.rb', line 67

def format
  @format
end

#ktupObject

Returns the value of attribute ktup.



43
44
45
# File 'lib/bio/appl/fasta.rb', line 43

def ktup
  @ktup
end

#matrixObject

Returns the value of attribute matrix.



43
44
45
# File 'lib/bio/appl/fasta.rb', line 43

def matrix
  @matrix
end

#optionsObject

Returns the value of attribute options.



43
44
45
# File 'lib/bio/appl/fasta.rb', line 43

def options
  @options
end

#outputObject (readonly)

Returns a String containing fasta execution output in as is format.



46
47
48
# File 'lib/bio/appl/fasta.rb', line 46

def output
  @output
end

#programObject

Returns the value of attribute program.



43
44
45
# File 'lib/bio/appl/fasta.rb', line 43

def program
  @program
end

#serverObject

Returns the value of attribute server.



43
44
45
# File 'lib/bio/appl/fasta.rb', line 43

def server
  @server
end

Class Method Details

.local(program, db, option = '') ⇒ Object

Returns a FASTA factory object (Bio::Fasta) to run FASTA search on local computer.



80
81
82
# File 'lib/bio/appl/fasta.rb', line 80

def self.local(program, db, option = '')
  self.new(program, db, option, 'local')
end

.parser(parser) ⇒ Object

OBSOLETE. Does nothing and shows warning messages.

Historically, selecting parser to use (‘format6’ or ‘format10’ were expected, but only ‘format10’ was available as a working parser).



74
75
76
# File 'lib/bio/appl/fasta.rb', line 74

def self.parser(parser)
  warn 'Bio::Fasta.parser is obsoleted and will soon be removed.'
end

.remote(program, db, option = '', server = 'genomenet') ⇒ Object

Returns a FASTA factory object (Bio::Fasta) to execute FASTA search on remote server.

For the develpper, you can add server ‘hoge’ by adding exec_hoge(query) method.



90
91
92
# File 'lib/bio/appl/fasta.rb', line 90

def self.remote(program, db, option = '', server = 'genomenet')
  self.new(program, db, option, server)
end

Instance Method Details

#optionObject



48
49
50
51
# File 'lib/bio/appl/fasta.rb', line 48

def option
  # backward compatibility
  Bio::Command.make_command_line(@options)
end

#option=(str) ⇒ Object



53
54
55
56
# File 'lib/bio/appl/fasta.rb', line 53

def option=(str)
  # backward compatibility
  @options = Shellwords.shellwords(str)
end

#query(query) ⇒ Object

Execute FASTA search and returns Report object (Bio::Fasta::Report).



95
96
97
# File 'lib/bio/appl/fasta.rb', line 95

def query(query)
  return self.send("exec_#{@server}", query.to_s)
end