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.
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
# File 'lib/bio/appl/fasta/format10.rb', line 243 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.
266 267 268 |
# File 'lib/bio/appl/fasta/format10.rb', line 266 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.
261 262 263 |
# File 'lib/bio/appl/fasta/format10.rb', line 261 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.
270 271 272 |
# File 'lib/bio/appl/fasta/format10.rb', line 270 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.
274 275 276 |
# File 'lib/bio/appl/fasta/format10.rb', line 274 def entry_id @definition[/\S+/] end |
#length ⇒ Object
Returns the sequence length. You can access this value by the Report::Hit#query_len method.
280 281 282 |
# File 'lib/bio/appl/fasta/format10.rb', line 280 def length @data['sq_len'].to_i end |
#moltype ⇒ Object
Returns ‘p’ for protein sequence, ‘D’ for nucleotide sequence.
285 286 287 |
# File 'lib/bio/appl/fasta/format10.rb', line 285 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.
291 292 293 |
# File 'lib/bio/appl/fasta/format10.rb', line 291 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.
297 298 299 |
# File 'lib/bio/appl/fasta/format10.rb', line 297 def stop @data['al_stop'].to_i end |