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
60 def initialize(program, hmmfile, seqfile, options = [])
61   @program = program
62   @hmmfile = hmmfile
63   @seqfile = seqfile
64   @output  = ''
65   
66   begin
67     @options = options.to_ary
68   rescue NameError #NoMethodError
69     # backward compatibility
70     @options = Shellwords.shellwords(options)
71   end
72 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
62 def self.reports(multiple_report_text)
63   ary = []
64   multiple_report_text.each_line("\n//\n") do |report|
65     if block_given?
66       yield Report.new(report)
67     else
68       ary << Report.new(report)
69     end
70   end
71   return ary
72 end

Public Instance Methods

option() click to toggle source

Gets options by String. backward compatibility.

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

Sets options by String. backward compatibility.

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

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

    # File lib/bio/appl/hmmer.rb
 91 def query
 92   cmd = [ @program, *@options ]
 93   cmd.concat([ @hmmfile, @seqfile ])
 94     
 95   report = nil
 96   
 97   @output = Bio::Command.query_command(cmd, nil)
 98   report = parse_result(@output)
 99     
100   return report
101 end