Class: SequenceServer::BLAST::Query
- Inherits:
-
Struct
- Object
- Struct
- SequenceServer::BLAST::Query
- Defined in:
- lib/sequenceserver/blast/query.rb
Overview
Capture results per query of a BLAST search.
Instance Attribute Summary collapse
-
#def ⇒ Object
Returns the value of attribute def.
-
#hits ⇒ Object
Returns the value of attribute hits.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#length ⇒ Object
Returns the value of attribute length.
-
#number ⇒ Object
Returns the value of attribute number.
-
#report ⇒ Object
Returns the value of attribute report.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Query
constructor
A new instance of Query.
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Query
Returns a new instance of Query.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/sequenceserver/blast/query.rb', line 10 def initialize(*args) args[1] = args[1].to_i if args[2] == 'No definition line' || args[2] == 'unnamed protein product' args[2] = "Query_#{args[1]}" end args[3] = args[3].to_i @id, *rest = args[2].split @title = rest.join(' ') super end |
Instance Attribute Details
#def ⇒ Object
Returns the value of attribute def
9 10 11 |
# File 'lib/sequenceserver/blast/query.rb', line 9 def def @def end |
#hits ⇒ Object
Returns the value of attribute hits
9 10 11 |
# File 'lib/sequenceserver/blast/query.rb', line 9 def hits @hits end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
22 23 24 |
# File 'lib/sequenceserver/blast/query.rb', line 22 def id @id end |
#length ⇒ Object
Returns the value of attribute length
9 10 11 |
# File 'lib/sequenceserver/blast/query.rb', line 9 def length @length end |
#number ⇒ Object
Returns the value of attribute number
9 10 11 |
# File 'lib/sequenceserver/blast/query.rb', line 9 def number @number end |
#report ⇒ Object
Returns the value of attribute report
9 10 11 |
# File 'lib/sequenceserver/blast/query.rb', line 9 def report @report end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
22 23 24 |
# File 'lib/sequenceserver/blast/query.rb', line 22 def title @title end |
Instance Method Details
#to_json(*args) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/sequenceserver/blast/query.rb', line 24 def to_json(*args) %i[number id title length hits].inject({}) do |h, k| h[k] = send(k) h end.to_json(*args) end |