Class: Bio::Spidey::Report
Overview
Spidey report parser class. Please see bio/appl/spidey/report.rb for details.
Its object may contain some Bio::Spidey::Report::Hit objects.
Defined Under Namespace
Classes: Hit, Segment, SegmentPair, SeqDesc
Constant Summary collapse
- DELIMITER =
Delimiter of each entry. Bio::FlatFile uses it.
RS = "\n--SPIDEY "
- DELIMITER_OVERRUN =
(Integer) excess read size included in DELIMITER.
9
Instance Attribute Summary collapse
-
#all_hits ⇒ Object
readonly
Returns an Array of Bio::Spidey::Report::Hit objects.
-
#entry_overrun ⇒ Object
readonly
piece of next entry.
-
#hits ⇒ Object
readonly
Returns an Array of Bio::Spidey::Report::Hit objects.
Instance Method Summary collapse
-
#each_hit(&x) ⇒ Object
(also: #each)
Iterates over each hits.
-
#initialize(str) ⇒ Report
constructor
Creates a new Bio::Spidey::Report object from String.
-
#mrna ⇒ Object
Returns sequence informationsof the mRNA.
-
#num_hits ⇒ Object
Returns number of hits.
-
#query_def ⇒ Object
Returns definition of the mRNA (query) sequence.
-
#query_id ⇒ Object
Returns identifier of the mRNA (query) sequence.
-
#query_len ⇒ Object
Returns the length of the mRNA (query) sequence.
Constructor Details
#initialize(str) ⇒ Report
Creates a new Bio::Spidey::Report object from String. You can use Bio::FlatFile to read a file.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/bio/appl/spidey/report.rb', line 47 def initialize(str) str = str.sub(/\A\s+/, '') str.sub!(/\n(^\-\-SPIDEY .*)/m, '') # remove trailing entries for sure @entry_overrun = $1 data = str.split(/\r?\n(?:\r?\n)+/) d0 = data.shift.to_s.split(/\r?\n/) @hit = Hit.new(data, d0) @all_hits = [ @hit ] if d0.empty? or /\ANo alignment found\.\s*\z/ =~ d0[-1] then @hits = [] else @hits = [ @hit ] end end |
Instance Attribute Details
#all_hits ⇒ Object (readonly)
Returns an Array of Bio::Spidey::Report::Hit objects. Unlike Bio::Spidey::Report#hits, the method returns results of all trials of pairwise alignment. This would be a Bio::Spidey specific method.
73 74 75 |
# File 'lib/bio/appl/spidey/report.rb', line 73 def all_hits @all_hits end |
#entry_overrun ⇒ Object (readonly)
piece of next entry. Bio::FlatFile uses it.
62 63 64 |
# File 'lib/bio/appl/spidey/report.rb', line 62 def entry_overrun @entry_overrun end |
#hits ⇒ Object (readonly)
Returns an Array of Bio::Spidey::Report::Hit objects. Because current version of SPIDEY supports only 1 genomic sequences, the number of hits is 1 or 0.
67 68 69 |
# File 'lib/bio/appl/spidey/report.rb', line 67 def hits @hits end |
Instance Method Details
#each_hit(&x) ⇒ Object Also known as: each
Iterates over each hits. Same as hits.each. Yields a Bio::Spidey::Report::Hit object.
576 577 578 |
# File 'lib/bio/appl/spidey/report.rb', line 576 def each_hit(&x) #:yields: hit @hits.each(&x) end |
#mrna ⇒ Object
Returns sequence informationsof the mRNA. Returns a Bio::Spidey::Report::SeqDesc object. This would be a Bio::Spidey specific method.
563 |
# File 'lib/bio/appl/spidey/report.rb', line 563 def mrna; @hit.mrna; end |
#num_hits ⇒ Object
Returns number of hits. Same as hits.size.
571 |
# File 'lib/bio/appl/spidey/report.rb', line 571 def num_hits; @hits.size; end |
#query_def ⇒ Object
Returns definition of the mRNA (query) sequence.
582 |
# File 'lib/bio/appl/spidey/report.rb', line 582 def query_def; @hit.mrna.definition; end |
#query_id ⇒ Object
Returns identifier of the mRNA (query) sequence.
585 |
# File 'lib/bio/appl/spidey/report.rb', line 585 def query_id; @hit.mrna.entry_id; end |
#query_len ⇒ Object
Returns the length of the mRNA (query) sequence.
588 |
# File 'lib/bio/appl/spidey/report.rb', line 588 def query_len; @hit.mrna.len; end |