class Bio::HMMER::Report

A parser class for a search report by hmmsearch or hmmpfam program in the HMMER package.

Examples

Examples
 #for multiple reports in a single output file (example.hmmpfam)
 Bio::HMMER.reports(File.read("example.hmmpfam")) do |report|
   report.program['name']
   report.parameter['HMM file']
   report.query_info['Query sequence']
   report.hits.each do |hit|
     hit.accession
     hit.description
     hit.score
     hit.evalue
     hit.hsps.each do |hsp|
       hsp.accession
       hsp.domain
       hsp.evalue
       hsp.midline
   end
 end

References

Constants

DELIMITER

Delimiter of each entry for Bio::FlatFile support.

Attributes

domain_top_hits[R]

statistics by hmmsearch. Keys are 'Total memory', 'Satisfying E cutoff' and 'Total hits'.

histogram[R]

statistics by hmmsearch.

hits[R]
hsps[R]

Returns an Array of Bio::HMMER::Report::Hsp objects. Under special circumstances, some HSPs do not have parent Hit objects. If you want to access such HSPs, use this method.

parameter[R]

A hash contains parameters used. Valid keys are 'HMM file' and 'Sequence file'.

program[R]

A Hash contains program information used. Valid keys are 'name', 'version', 'copyright' and 'license'.

query_info[R]

A hash contains the query information. Valid keys are 'query sequence', 'Accession' and 'Description'.

statistical_detail[R]

statistics by hmmsearch. Keys are 'mu', 'lambda', 'chi-sq statistic' and 'P(chi-square)'.

total_seq_searched[R]

statistics by hmmsearch.

whole_seq_top_hits[R]

statistics by hmmsearch. Keys are 'Total memory', 'Satisfying E cutoff' and 'Total hits'.

Public Class Methods

new(data) click to toggle source

Parses a HMMER search report (by hmmpfam or hmmsearch program) and reutrns a Bio::HMMER::Report object.

Examples

hmmpfam_report = Bio::HMMER::Report.new(File.read("hmmpfam.out"))

hmmsearch_report = Bio::HMMER::Report.new(File.read("hmmsearch.out"))
# File lib/bio/appl/hmmer/report.rb, line 156
def initialize(data)

  # The input data is divided into six data fields, i.e. header,
  # query infomation, hits, HSPs, alignments and search statistics.
  # However, header and statistics data don't necessarily exist.
  subdata, is_hmmsearch = get_subdata(data)

  # if header exists, parse it
  if subdata["header"]
    @program, @parameter = parse_header_data(subdata["header"])
  else
    @program, @parameter = [{}, {}]
  end

  @query_info = parse_query_info(subdata["query"])
  @hits       = parse_hit_data(subdata["hit"])
  @hsps       = parse_hsp_data(subdata["hsp"], is_hmmsearch)

  if @hsps != []
    # split alignment subdata into an array of alignments
    aln_ary = subdata["alignment"].split(/^\S+.*?\n/).slice(1..-1)

    # append alignment information to corresponding Hsp
    aln_ary.each_with_index do |aln, i|
      @hsps[i].set_alignment(aln)
    end
  end

  # assign each Hsp object to its parent Hit
  hits_hash = {}
  @hits.each do |hit|
    hits_hash[hit.accession] = hit
  end
  @hsps.each do |hsp|
    if hits_hash.has_key?(hsp.accession)
      hits_hash[hsp.accession].append_hsp(hsp)
    end
  end

  # parse statistics (for hmmsearch)
  if is_hmmsearch
    @histogram, @statistical_detail, @total_seq_searched,          @whole_seq_top_hits, @domain_top_hits =          parse_stat_data(subdata["statistics"])
  end

end

Public Instance Methods

each() { |hit| ... } click to toggle source

Iterates each hit (Bio::HMMER::Report::Hit).

# File lib/bio/appl/hmmer/report.rb, line 206
def each
  @hits.each do |hit|
    yield hit
  end
end
Also aliased as: each_hit
each_hit()
Alias for: each