Class Bio::HMMER
In: lib/bio/appl/hmmer.rb
lib/bio/appl/hmmer/report.rb
Parent: Object

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

Methods

new   option   option=   query   reports  

Classes and Modules

Class Bio::HMMER::Report

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

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

Program names: hmmsearch, hmmpfam

[Source]

    # File lib/bio/appl/hmmer.rb, line 60
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

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)

[Source]

    # File lib/bio/appl/hmmer/report.rb, line 62
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

Gets options by String. backward compatibility.

[Source]

    # File lib/bio/appl/hmmer.rb, line 77
77:   def option
78:     Bio::Command.make_command_line(@options)
79:   end

Sets options by String. backward compatibility.

[Source]

    # File lib/bio/appl/hmmer.rb, line 84
84:   def option=(str)
85:     @options = Shellwords.shellwords(str)
86:   end

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

[Source]

     # File lib/bio/appl/hmmer.rb, line 91
 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

[Validate]