class Bio::HMMER

Description

A wapper for HMMER programs (hmmsearch or hmmpfam).

Examples

require 'bio'
program = 'hmmsearch' # or 'hmmpfam'
hmmfile = 'test.hmm'
seqfile = 'test.faa'

factory = Bio::HMMER.new(program, hmmfile, seqfile)
report = factory.query
report.class # => Bio::HMMER::Report

References

Attributes

hmmfile[RW]

Name of hmmfile.

options[RW]

Command line options.

output[R]

Shows the raw output from the hmmer search.

program[RW]

Prgrams name. (hmmsearch or hmmpfam).

seqfile[RW]

Name of seqfile.

Public Class Methods

new(program, hmmfile, seqfile, options = []) click to toggle source

Sets a program name, a profile hmm file name, a query sequence file name and options in string.

Program names: hmmsearch, hmmpfam

# File lib/bio/appl/hmmer.rb, line 60
def initialize(program, hmmfile, seqfile, options = [])
  @program = program
  @hmmfile = hmmfile
  @seqfile = seqfile
  @output  = ''
  
  begin
    @options = options.to_ary
  rescue NameError #NoMethodError
    # backward compatibility
    @options = Shellwords.shellwords(options)
  end
end
reports(multiple_report_text) { |report| ... } click to toggle source

A reader interface for multiple reports text into a report (Bio::HMMER::Report).

Examples

# Iterator
Bio::HMMER.reports(reports_text) do |report|
  report
end

# Array
reports = Bio::HMMER.reports(reports_text)
# File lib/bio/appl/hmmer/report.rb, line 62
def self.reports(multiple_report_text)
  ary = []
  multiple_report_text.each_line("\n//\n") do |report|
    if block_given?
      yield Report.new(report)
    else
      ary << Report.new(report)
    end
  end
  return ary
end

Public Instance Methods

option() click to toggle source

Gets options by String. backward compatibility.

# File lib/bio/appl/hmmer.rb, line 77
def option
  Bio::Command.make_command_line(@options)
end
option=(str) click to toggle source

Sets options by String. backward compatibility.

# File lib/bio/appl/hmmer.rb, line 84
def option=(str)
  @options = Shellwords.shellwords(str)
end
query() click to toggle source

Executes the hmmer search and returns the report (Bio::HMMER::Report object).

# File lib/bio/appl/hmmer.rb, line 91
def query
  cmd = [ @program, *@options ]
  cmd.concat([ @hmmfile, @seqfile ])
    
  report = nil
  
  @output = Bio::Command.query_command(cmd, nil)
  report = parse_result(@output)
    
  return report
end