Class: Bio::Fasta::Report::Hit::Query
- Inherits:
-
Object
- Object
- 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.
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
# File 'lib/bio/appl/fasta/format10.rb', line 334 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.
357 358 359 |
# File 'lib/bio/appl/fasta/format10.rb', line 357 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.
352 353 354 |
# File 'lib/bio/appl/fasta/format10.rb', line 352 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.
361 362 363 |
# File 'lib/bio/appl/fasta/format10.rb', line 361 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.
365 366 367 |
# File 'lib/bio/appl/fasta/format10.rb', line 365 def entry_id @definition[/\S+/] end |
#length ⇒ Object
Returns the sequence length. You can access this value by the Report::Hit#query_len method.
371 372 373 |
# File 'lib/bio/appl/fasta/format10.rb', line 371 def length @data['sq_len'].to_i end |
#moltype ⇒ Object
Returns ‘p’ for protein sequence, ‘D’ for nucleotide sequence.
376 377 378 |
# File 'lib/bio/appl/fasta/format10.rb', line 376 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.
382 383 384 |
# File 'lib/bio/appl/fasta/format10.rb', line 382 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.
388 389 390 |
# File 'lib/bio/appl/fasta/format10.rb', line 388 def stop @data['al_stop'].to_i end |