Class: Bio::Fasta::Report::Hit::Query
- Defined in:
- lib/bio/appl/fasta/format10.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns a Hash containing ‘sq_len’, ‘sq_offset’, ‘sq_type’, ‘al_start’, ‘al_stop’, and ‘al_display_start’ values.
-
#definition ⇒ Object
readonly
Returns the definition of the entry as a String.
-
#sequence ⇒ Object
readonly
Returns the sequence (with gaps) as a String.
Instance Method Summary collapse
-
#entry_id ⇒ Object
Returns the first word in the definition as a String.
-
#initialize(data) ⇒ Query
constructor
A new instance of Query.
-
#length ⇒ Object
Returns the sequence length.
-
#moltype ⇒ Object
Returns ‘p’ for protein sequence, ‘D’ for nucleotide sequence.
-
#start ⇒ Object
Returns alignment start position.
-
#stop ⇒ Object
Returns alignment end position.
Constructor Details
#initialize(data) ⇒ Query
Returns a new instance of Query.
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 |
# File 'lib/bio/appl/fasta/format10.rb', line 333 def initialize(data) @definition, *data = data.split(/\n/) @data = {} @sequence = '' pat = /;\s+([^:]+):\s+(.*)/ data.each do |x| if pat.match(x) @data[$1] = $2 else @sequence += x end end end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns a Hash containing ‘sq_len’, ‘sq_offset’, ‘sq_type’, ‘al_start’, ‘al_stop’, and ‘al_display_start’ values. You can access most of these values by Report::Hit#query_* methods.
356 357 358 |
# File 'lib/bio/appl/fasta/format10.rb', line 356 def data @data end |
#definition ⇒ Object (readonly)
Returns the definition of the entry as a String. You can access this value by Report::Hit#query_def method.
351 352 353 |
# File 'lib/bio/appl/fasta/format10.rb', line 351 def definition @definition end |
#sequence ⇒ Object (readonly)
Returns the sequence (with gaps) as a String. You can access this value by the Report::Hit#query_seq method.
360 361 362 |
# File 'lib/bio/appl/fasta/format10.rb', line 360 def sequence @sequence end |
Instance Method Details
#entry_id ⇒ Object
Returns the first word in the definition as a String. You can get this value by Report::Hit#query_id method.
364 365 366 |
# File 'lib/bio/appl/fasta/format10.rb', line 364 def entry_id @definition[/\S+/] end |
#length ⇒ Object
Returns the sequence length. You can access this value by the Report::Hit#query_len method.
370 371 372 |
# File 'lib/bio/appl/fasta/format10.rb', line 370 def length @data['sq_len'].to_i end |
#moltype ⇒ Object
Returns ‘p’ for protein sequence, ‘D’ for nucleotide sequence.
375 376 377 |
# File 'lib/bio/appl/fasta/format10.rb', line 375 def moltype @data['sq_type'] end |
#start ⇒ Object
Returns alignment start position. You can also access this value by Report::Hit#query_start method for shortcut.
381 382 383 |
# File 'lib/bio/appl/fasta/format10.rb', line 381 def start @data['al_start'].to_i end |
#stop ⇒ Object
Returns alignment end position. You can access this value by Report::Hit#query_end method for shortcut.
387 388 389 |
# File 'lib/bio/appl/fasta/format10.rb', line 387 def stop @data['al_stop'].to_i end |