Class: Bio::Fasta::Report
Overview
Summarized results of the fasta execution results.
Defined Under Namespace
Instance Attribute Summary collapse
-
#hits ⇒ Object
readonly
Returns an Array of Bio::Fasta::Report::Hit objects.
-
#list ⇒ Object
readonly
Returns the ‘The best scores are’ lines as a String.
-
#log ⇒ Object
readonly
Returns the trailing lines including library size, execution date, fasta function used, and fasta versions as a String.
-
#program ⇒ Object
readonly
Returns a Bio::Fasta::Report::Program object.
Instance Method Summary collapse
-
#each ⇒ Object
Iterates on each Bio::Fasta::Report::Hit object.
-
#initialize(data) ⇒ Report
constructor
A new instance of Report.
-
#lap_over(length_min = 0) ⇒ Object
Returns an Array of Bio::Fasta::Report::Hit objects having longer overlap length than ‘length_min’.
-
#threshold(evalue_max = 0.1) ⇒ Object
Returns an Array of Bio::Fasta::Report::Hit objects having better evalue than ‘evalue_max’.
Constructor Details
#initialize(data) ⇒ Report
Returns a new instance of Report.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/bio/appl/fasta/format10.rb', line 18 def initialize(data) # header lines - brief list of the hits if data.sub!(/.*\nThe best scores are/m, '') data.sub!(/(.*)\n\n>>>/m, '') @list = "The best scores are" + $1 else data.sub!(/.*\n!!\s+/m, '') data.sub!(/.*/) { |x| @list = x; '' } end # body lines - fasta execution result program, *hits = data.split(/\n>>/) # trailing lines - log messages of the execution @log = hits.pop @log.sub!(/.*<\n/m, '') @log.strip! # parse results @program = Program.new(program) @hits = [] hits.each do |x| @hits.push(Hit.new(x)) end end |
Instance Attribute Details
#hits ⇒ Object (readonly)
Returns an Array of Bio::Fasta::Report::Hit objects.
56 57 58 |
# File 'lib/bio/appl/fasta/format10.rb', line 56 def hits @hits end |
#list ⇒ Object (readonly)
Returns the ‘The best scores are’ lines as a String.
46 47 48 |
# File 'lib/bio/appl/fasta/format10.rb', line 46 def list @list end |
#log ⇒ Object (readonly)
Returns the trailing lines including library size, execution date, fasta function used, and fasta versions as a String.
50 51 52 |
# File 'lib/bio/appl/fasta/format10.rb', line 50 def log @log end |
#program ⇒ Object (readonly)
Returns a Bio::Fasta::Report::Program object.
53 54 55 |
# File 'lib/bio/appl/fasta/format10.rb', line 53 def program @program end |
Instance Method Details
#each ⇒ Object
Iterates on each Bio::Fasta::Report::Hit object.
59 60 61 62 63 |
# File 'lib/bio/appl/fasta/format10.rb', line 59 def each @hits.each do |x| yield x end end |
#lap_over(length_min = 0) ⇒ Object
Returns an Array of Bio::Fasta::Report::Hit objects having longer overlap length than ‘length_min’.
77 78 79 80 81 82 83 |
# File 'lib/bio/appl/fasta/format10.rb', line 77 def lap_over(length_min = 0) list = [] @hits.each do |x| list.push(x) if x.overlap > length_min end return list end |
#threshold(evalue_max = 0.1) ⇒ Object
Returns an Array of Bio::Fasta::Report::Hit objects having better evalue than ‘evalue_max’.
67 68 69 70 71 72 73 |
# File 'lib/bio/appl/fasta/format10.rb', line 67 def threshold(evalue_max = 0.1) list = [] @hits.each do |x| list.push(x) if x.evalue < evalue_max end return list end |